]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AnonymousFave/actions/anonfavor.php
Cosmetic changes to common_redirect, clientError, serverError
[quix0rs-gnu-social.git] / plugins / AnonymousFave / actions / anonfavor.php
index 401b6a855b1a07eb0a912d96ff1e3866fe7657bf..2d35964c700cee95d1dec826b8dddcbb0388f162 100644 (file)
@@ -27,9 +27,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Anonymous favor class
@@ -57,33 +55,22 @@ class AnonFavorAction extends RedirectingAction
 
         if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
             // TRANS: Client error.
-            $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.')
-            );
-            return;
+            $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.'));
         }
 
         $id     = $this->trimmed('notice');
         $notice = Notice::getKV($id);
-        $token  = $this->trimmed('token-' . $notice->id);
-
-        if (empty($token) || $token != common_session_token()) {
-            // TRANS: Client error.
-            $this->clientError(_m('There was a problem with your session token. Try again, please.'));
-            return;
-        }
-
+        $token  = $this->checkSessionToken();
 
         if ($profile->hasFave($notice)) {
             // TRANS: Client error.
             $this->clientError(_m('This notice is already a favorite!'));
-            return;
         }
         $fave = Fave::addNew($profile, $notice);
 
         if (!$fave) {
             // TRANS: Server error.
             $this->serverError(_m('Could not create favorite.'));
-            return;
         }
 
         $profile->blowFavesCache();
@@ -98,7 +85,7 @@ class AnonFavorAction extends RedirectingAction
             $disfavor = new AnonDisFavorForm($this, $notice);
             $disfavor->show();
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
             $this->returnToPrevious();
         }