From bf0e40683ce769a325e2a6ad6ab97e1dc92c9980 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 18 Nov 2013 15:41:16 +0100 Subject: [PATCH] Removed TextHelper hacks --- src/Controllers/UserController.php | 15 ++++++--------- src/Views/post-view.phtml | 10 +++++----- src/Views/tag-list.phtml | 4 ++-- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index fa01617a..a2227bea 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -20,7 +20,7 @@ class UserController $senderName, $senderEmail, $recipientEmail, - $tokens) + $linkActionName) { //prepare unique user token do @@ -36,8 +36,11 @@ class UserController R::store($token); \Chibi\Registry::getContext()->mailSent = true; + $tokens = []; $tokens['host'] = $_SERVER['HTTP_HOST']; $tokens['token'] = $tokenText; + if ($linkActionName !== null) + $tokens['link'] = \Chibi\UrlHelper::route('user', $linkActionName, ['token' => $tokenText]); $body = wordwrap(TextHelper::replaceTokens($body, $tokens), 70); $subject = TextHelper::replaceTokens($subject, $tokens); @@ -75,9 +78,6 @@ class UserController return; } - $tokens = []; - $tokens['link'] = \Chibi\UrlHelper::route('user', 'activation', ['token' => '{token}']); - return self::sendTokenizedEmail( $user, $regConfig->confirmationEmailBody, @@ -85,16 +85,13 @@ class UserController $regConfig->confirmationEmailSenderName, $regConfig->confirmationEmailSenderEmail, $user->email_unconfirmed, - $tokens); + 'activation'); } private static function sendPasswordResetConfirmation($user) { $regConfig = \Chibi\Registry::getConfig()->registration; - $tokens = []; - $tokens['link'] = \Chibi\UrlHelper::route('user', 'password-reset', ['token' => '{token}']); - return self::sendTokenizedEmail( $user, $regConfig->passwordResetEmailBody, @@ -102,7 +99,7 @@ class UserController $regConfig->passwordResetEmailSenderName, $regConfig->passwordResetEmailSenderEmail, $user->email_confirmed, - $tokens); + 'password-reset'); } diff --git a/src/Views/post-view.phtml b/src/Views/post-view.phtml index dd571b71..c8fa1998 100644 --- a/src/Views/post-view.phtml +++ b/src/Views/post-view.phtml @@ -77,12 +77,12 @@  [ - $this->context->transport->post->id, 'score' => '{score}']) ?> + $this->context->transport->post->id, 'score' => $score]); } ?> context->score === 1): ?> - + - + vote up @@ -90,9 +90,9 @@ ,  context->score === -1): ?> - + - + down ] diff --git a/src/Views/tag-list.phtml b/src/Views/tag-list.phtml index cf3338f3..689bb2c7 100644 --- a/src/Views/tag-list.phtml +++ b/src/Views/tag-list.phtml @@ -1,14 +1,14 @@ context->transport->tags)); ?> - '{query}']) ?> + '_query_']) ?>