* Copyright (C) 2010, StatusNet, Inc.
*
* Show a single favorite in Atom Activity Streams format
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class AtompubshowfavoriteAction extends ApiAuthAction
{
private $_profile = null;
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$this->_profile = Profile::staticGet('id', $profileId);
if (empty($this->_profile)) {
+ // TRANS: Client exception.
throw new ClientException(_('No such profile.'), 404);
}
$this->_notice = Notice::staticGet('id', $noticeId);
if (empty($this->_notice)) {
+ // TRANS: Client exception thrown when referencing a non-existing notice.
throw new ClientException(_('No such notice.'), 404);
}
'notice_id' => $noticeId));
if (empty($this->_fave)) {
+ // TRANS: Client exception thrown when referencing a non-existing favorite.
throw new ClientException(_('No such favorite.'), 404);
}
*
* @return void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
$this->deleteFave();
break;
default:
+ // TRANS: Client exception thrown using an unsupported HTTP method.
throw new ClientException(_('HTTP method not supported.'),
405);
}
/**
* Show a single favorite, in ActivityStreams format
- *
+ *
* @return void
*/
-
function showFave()
{
$activity = $this->_fave->asActivity();
/**
* Delete the favorite
- *
+ *
* @return void
*/
-
function deleteFave()
{
if (empty($this->auth_user) ||
$this->auth_user->id != $this->_profile->id) {
- throw new ClientException(_("Can't delete someone else's".
+ // TRANS: Client exception thrown when trying to remove a favorite notice of another user.
+ throw new ClientException(_("Cannot delete someone else's".
" favorite"), 403);
}
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
*
* @return string last modified http header
*/
-
function lastModified()
{
return max(strtotime($this->_profile->modified),
*
* @return string etag http header
*/
-
function etag()
{
$mtime = strtotime($this->_fave->modified);
*
* @return boolean true if delete, else false
*/
-
function requiresAuth()
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||