X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fdisfavor.php;h=39598d60bfd6aa08e551a4af056aa6c5ea37bd24;hb=9d0ccbff01c1d861d152e30feeb2094f5a2742b4;hp=09b3bf18d3d03ad8348afe465511d125f2962293;hpb=a1cb64679b06e7962c2ffffc1fc5f115494cc005;p=quix0rs-gnu-social.git diff --git a/actions/disfavor.php b/actions/disfavor.php index 09b3bf18d3..39598d60bf 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -1,19 +1,18 @@ - * @author Robin Millette + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette * @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, Controlez-Vous, 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 . */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,17 +38,17 @@ require_once INSTALLDIR.'/lib/favorform.php'; * Disfavor class. * * @category Action - * @package Laconica - * @author Evan Prodromou - * @author Robin Millette + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class DisfavorAction extends Action { /** * Class handler. - * + * * @param array $args query arguments * * @return void @@ -58,6 +57,7 @@ class DisfavorAction extends Action { parent::handle($args); if (!common_logged_in()) { + // TRANS: Client error displayed when trying to remove a favorite while not logged in. $this->clientError(_('Not logged in.')); return; } @@ -71,26 +71,30 @@ class DisfavorAction extends Action $notice = Notice::staticGet($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 = $this->id; + $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; } $user->blowFavesCache(); if ($this->boolean('ajax')) { - $this->startHTML('text/xml;charset=utf-8', true); + $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'); @@ -100,8 +104,8 @@ class DisfavorAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('showfavorites', - array('nickname' => $user->nickname))); + array('nickname' => $user->nickname)), + 303); } } } -