]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/disfavor.php
The overloaded DB_DataObject function staticGet is now called getKV
[quix0rs-gnu-social.git] / actions / disfavor.php
index 02e01d6e006bd3747beca0bfdfb694fd530309d0..aa4f59857d792282fb76b300e5c9ea1e17f22a2a 100644 (file)
@@ -1,19 +1,18 @@
 <?php
-
 /**
  * Disfavor action.
  *
  * PHP version 5
  *
  * @category Action
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @author   Robin Millette <millette@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Robin Millette <millette@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  *
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -29,7 +28,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -39,11 +38,11 @@ require_once INSTALLDIR.'/lib/favorform.php';
  * Disfavor class.
  *
  * @category Action
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @author   Robin Millette <millette@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Robin Millette <millette@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 class DisfavorAction extends Action
 {
@@ -58,6 +57,7 @@ class DisfavorAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
+            // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
             return;
         }
@@ -68,22 +68,25 @@ class DisfavorAction extends Action
             return;
         }
         $id     = $this->trimmed('notice');
-        $notice = Notice::staticGet($id);
+        $notice = Notice::getKV($id);
         $token  = $this->trimmed('token-'.$notice->id);
         if (!$token || $token != common_session_token()) {
-            $this->clientError(_("There was a problem with your session token. Try again, please."));
+            // TRANS: Client error displayed when the session token does not match or is not given.
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
         $fave            = new Fave();
         $fave->user_id   = $user->id;
         $fave->notice_id = $notice->id;
         if (!$fave->find(true)) {
+            // TRANS: Client error displayed when trying to remove favorite status for a notice that is not a favorite.
             $this->clientError(_('This notice is not a favorite!'));
             return;
         }
         $result = $fave->delete();
         if (!$result) {
             common_log_db_error($fave, 'DELETE', __FILE__);
+            // TRANS: Server error displayed when removing a favorite from the database fails.
             $this->serverError(_('Could not delete favorite.'));
             return;
         }
@@ -91,6 +94,7 @@ class DisfavorAction extends Action
         if ($this->boolean('ajax')) {
             $this->startHTML('text/xml;charset=utf-8');
             $this->elementStart('head');
+            // TRANS: Title for page on which favorites can be added.
             $this->element('title', null, _('Add to favorites'));
             $this->elementEnd('head');
             $this->elementStart('body');
@@ -105,4 +109,3 @@ class DisfavorAction extends Action
         }
     }
 }
-