diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php index ddcf2adf..20217418 100644 --- a/src/Controllers/AuthController.php +++ b/src/Controllers/AuthController.php @@ -111,7 +111,7 @@ class AuthController else { $dummy = R::dispense('user'); - $dummy->name = 'Anonymous'; + $dummy->name = Model_User::getAnonymousName(); $dummy->access_rank = AccessRank::Anonymous; $dummy->anonymous = true; $_SESSION['user'] = serialize($dummy); diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 9fde9c38..5ddc924f 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -211,7 +211,7 @@ class PostController //log LogHelper::bufferChanges(); $fmt = ($anonymous and !$this->config->misc->logAnonymousUploads) - ? 'someone' + ? '{anon}' : '{user}'; $fmt .= ' added {post}'; LogHelper::logEvent('post-new', $fmt, ['post' => TextHelper::reprPost($post)]); diff --git a/src/Helpers/LogHelper.php b/src/Helpers/LogHelper.php index 24701314..814724fd 100644 --- a/src/Helpers/LogHelper.php +++ b/src/Helpers/LogHelper.php @@ -45,8 +45,11 @@ class LogHelper public static function log($text, array $tokens = []) { - if (isset(self::$context->user)) + $tokens['anon'] = Model_User::getAnonymousName(); + if (self::$context->loggedIn and isset(self::$context->user)) $tokens['user'] = TextHelper::reprUser(self::$context->user->name); + else + $tokens['user'] = $tokens['anon']; $text = TextHelper::replaceTokens($text, $tokens); diff --git a/src/Views/comment-small.phtml b/src/Views/comment-small.phtml index bd10f1c8..84f50a24 100644 --- a/src/Views/comment-small.phtml +++ b/src/Views/comment-small.phtml @@ -2,10 +2,10 @@
context->comment->commenter): ?> - <?php echo $this->context->comment->commenter->name ?: '[unknown user]' ?> + <?php echo $this->context->comment->commenter->name ?> - [unknown user] + <?php echo Model_User::getAnonymousName() ?>
@@ -17,7 +17,7 @@ context->comment->commenter->name ?> - [unknown user] + diff --git a/src/Views/post-view.phtml b/src/Views/post-view.phtml index a748b81a..26c5e538 100644 --- a/src/Views/post-view.phtml +++ b/src/Views/post-view.phtml @@ -56,9 +56,9 @@ - - [unknown user] - [unknown user] + + <?php echo Model_User::getAnonymousName() ?> +