* i18n/L10n fixes.

* translator documentation updated.
* superfluous whitespace removed.
This commit is contained in:
Siebrand Mazeland 2010-10-28 01:19:04 +02:00
parent a12474a99d
commit 04ae500749
30 changed files with 79 additions and 232 deletions

View File

@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiMediaUploadAction extends ApiAuthAction
{
/**
@ -57,7 +56,6 @@ class ApiMediaUploadAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -99,6 +97,7 @@ class ApiMediaUploadAction extends ApiAuthAction
if (isset($upload)) {
$this->showResponse($upload);
} else {
// TRANS: Client error displayed when uploading a media file has failed.
$this->clientError(_('Upload failed.'));
return;
}
@ -126,7 +125,6 @@ class ApiMediaUploadAction extends ApiAuthAction
* Overrided clientError to show a more Twitpic-like error
*
* @param String $msg an error message
*
*/
function clientError($msg)
{
@ -140,5 +138,4 @@ class ApiMediaUploadAction extends ApiAuthAction
$this->elementEnd('rsp');
$this->endDocument();
}
}

View File

@ -79,7 +79,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
$app = $datastore->getAppByRequestToken($this->reqToken);
$atok = $server->fetch_access_token($req);
} catch (Exception $e) {
common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
common_debug(var_export($req, true));
@ -88,7 +87,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
}
if (empty($atok)) {
// Token exchange failed -- log it
$msg = sprintf(
@ -101,7 +99,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
common_log(LOG_WARNING, $msg);
// TRANS: Client error given from the OAuth API when the request token or verifier is invalid.
$this->clientError(_("Invalid request token or verifier.", 400, 'text'));
} else {
common_log(
LOG_INFO,
@ -121,7 +118,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
*
* @param OAuthToken token the access token
*/
function showAccessToken($token)
{
header('Content-Type: application/x-www-form-urlencoded');

View File

@ -144,6 +144,7 @@ class ApiOauthAuthorizeAction extends Action
if (!$token || $token != common_session_token()) {
$this->showForm(
// TRANS: Form validation error in API OAuth authorisation because of an invalid session token.
_('There was a problem with your session token. Try again, please.'));
return;
}
@ -177,7 +178,6 @@ class ApiOauthAuthorizeAction extends Action
assert(!empty($this->reqToken));
if ($this->arg('allow')) {
// mark the req token as authorized
try {
$this->store->authorize_token($this->oauthTokenParam);
@ -250,9 +250,7 @@ class ApiOauthAuthorizeAction extends Action
// Otherwise, inform the user that the rt was authorized
$this->showAuthorized();
} else if ($this->arg('cancel')) {
common_log(
LOG_INFO,
sprintf(
@ -652,7 +650,6 @@ class ApiOauthAuthorizeAction extends Action
);
$pin->showPage();
} else {
// NOTE: This would only happen if an application registered as
// a web application but sent in 'oob' for the oauth_callback
// parameter. Usually web apps will send in a callback and
@ -693,7 +690,6 @@ class ApiOauthAuthorizeAction extends Action
$callback = $this->app->callback_url;
}
}
return $callback;

View File

@ -42,7 +42,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiOauthPinAction extends InfoAction
{
function __construct($title, $message, $verifier, $desktopMode = false)

View File

@ -42,7 +42,6 @@ require_once INSTALLDIR . '/lib/apioauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiOauthRequestTokenAction extends ApiOauthAction
{
/**
@ -51,9 +50,7 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -74,7 +71,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -127,7 +123,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
/*
* Display temporary OAuth credentials
*/
function showRequestToken($token)
{
header('Content-Type: application/x-www-form-urlencoded');
@ -142,7 +137,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
*
* @return boolean true or false
*/
function verifyCallback($callback)
{
if ($callback == "oob") {
@ -157,5 +151,4 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
return Validate::uri($callback);
}
}
}

View File

@ -48,10 +48,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php';
*
* @see ApiPrivateAuthAction
*/
class ApiSearchAtomAction extends ApiPrivateAuthAction
{
var $cnt;
var $query;
var $lang;
@ -70,7 +68,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @see Action::__construct
*/
function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
@ -81,7 +78,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadonly()
{
return true;
@ -93,16 +89,13 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
* @param array $args Arguments from $_REQUEST
*
* @return boolean success
*
*/
function prepare($args)
{
common_debug("in apisearchatom prepare()");
parent::prepare($args);
$this->query = $this->trimmed('q');
$this->lang = $this->trimmed('lang');
$this->rpp = $this->trimmed('rpp');
@ -139,7 +132,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -154,7 +146,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return array an array of Notice objects sorted in reverse chron
*/
function getNotices()
{
// TODO: Support search operators like from: and to:, boolean, etc.
@ -180,7 +171,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
if ($this->cnt > 0) {
while ($notice->fetch()) {
++$cnt;
if (!$this->max_id) {
@ -203,7 +193,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function showAtom()
{
$notices = $this->getNotices();
@ -212,7 +201,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
$this->showFeed();
foreach ($notices as $n) {
$profile = $n->getProfile();
// Don't show notices from deleted users
@ -230,7 +218,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function showFeed()
{
// TODO: A9 OpenSearch stuff like search.twitter.com?
@ -278,6 +265,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
'rel' => 'self',
'href' => $self_uri));
// @todo Needs i18n?
$this->element('title', null, "$this->query - $sitename Search");
$this->element('updated', null, common_date_iso8601('now'));
@ -313,7 +301,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
'rel' => 'previous',
'href' => $previous_uri));
}
}
/**
@ -324,7 +311,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function showEntry($notice)
{
$server = common_config('site', 'server');
@ -356,10 +342,10 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
if ($ns) {
if (!empty($ns->name) && !empty($ns->url)) {
$source = '<a href="'
. htmlspecialchars($ns->url)
. '" rel="nofollow">'
. htmlspecialchars($ns->name)
. '</a>';
. htmlspecialchars($ns->url)
. '" rel="nofollow">'
. htmlspecialchars($ns->name)
. '</a>';
} else {
$source = $ns->code;
}
@ -372,6 +358,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
$name = $profile->nickname;
if ($profile->fullname) {
// @todo Needs proper i18n?
$name .= ' (' . $profile->fullname . ')';
}
@ -387,7 +374,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function initAtom()
{
header('Content-Type: application/atom+xml; charset=utf-8');
@ -399,10 +385,8 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
function endAtom()
{
$this->elementEnd('feed');
}
}

View File

@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
* @link http://status.net/
* @see ApiAction
*/
class ApiSearchJSONAction extends ApiPrivateAuthAction
{
var $query;
@ -62,7 +61,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return boolean true if nothing goes wrong
*/
function prepare($args)
{
common_debug("apisearchjson prepare()");
@ -100,7 +98,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -112,10 +109,8 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return void
*/
function showResults()
{
// TODO: Support search operators like from: and to:, boolean, etc.
$notice = new Notice();
@ -146,7 +141,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;

View File

@ -55,7 +55,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusesDestroyAction extends ApiAuthAction
{
var $status = null;
@ -66,9 +65,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -94,13 +91,13 @@ class ApiStatusesDestroyAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method deleting a status.
_('API method not found.'),
404
);
@ -109,6 +106,8 @@ class ApiStatusesDestroyAction extends ApiAuthAction
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->clientError(
// TRANS: Client error displayed trying to delete a status not using POST or DELETE.
// TRANS: POST and DELETE should not be translated.
_('This method requires a POST or DELETE.'),
400,
$this->format
@ -118,6 +117,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
if (empty($this->notice)) {
$this->clientError(
// TRANS: Client error displayed trying to delete a status with an invalid ID.
_('No status found with that ID.'),
404, $this->format
);
@ -132,6 +132,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
$this->showNotice();
} else {
$this->clientError(
// TRANS: Client error displayed trying to delete a status of another user.
_('You may not delete another user\'s status.'),
403,
$this->format
@ -144,7 +145,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction
*
* @return void
*/
function showNotice()
{
if (!empty($this->notice)) {
@ -155,5 +155,4 @@ class ApiStatusesDestroyAction extends ApiAuthAction
}
}
}
}

View File

@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusesRetweetAction extends ApiAuthAction
{
var $original = null;
@ -54,9 +53,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -73,6 +70,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
$this->original = Notice::staticGet('id', $id);
if (empty($this->original)) {
// TRANS: Client error displayed trying to repeat a non-existing notice through the API.
$this->clientError(_('No such notice.'),
400, $this->format);
return false;
@ -81,6 +79,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
$this->user = $this->auth_user;
if ($this->user->id == $this->original->profile_id) {
// TRANS: Client error displayed trying to repeat an own notice through the API.
$this->clientError(_('Cannot repeat your own notice.'),
400, $this->format);
return false;
@ -89,6 +88,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
$profile = $this->user->getProfile();
if ($profile->hasRepeated($id)) {
// TRANS: Client error displayed trying to re-repeat a notice through the API.
$this->clientError(_('Already repeated that notice.'),
400, $this->format);
return false;
@ -106,15 +106,12 @@ class ApiStatusesRetweetAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$repeat = $this->original->repeat($this->user->id, $this->source);
$this->showNotice($repeat);
}
@ -123,7 +120,6 @@ class ApiStatusesRetweetAction extends ApiAuthAction
*
* @return void
*/
function showNotice($notice)
{
if (!empty($notice)) {

View File

@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusesRetweetsAction extends ApiAuthAction
{
const MAXCOUNT = 100;
@ -57,9 +56,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -69,6 +66,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
$this->original = Notice::staticGet('id', $id);
if (empty($this->original)) {
// TRANS: Client error displayed trying to display redents of a non-exiting notice.
$this->clientError(_('No such notice.'),
400, $this->format);
return false;
@ -94,7 +92,6 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -109,6 +106,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
$this->showJsonTimeline($strm);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}

View File

@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusesShowAction extends ApiPrivateAuthAction
{
var $notice_id = null;
var $notice = null;
@ -68,9 +66,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -100,12 +96,12 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
@ -118,7 +114,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
*
* @return void
*/
function showNotice()
{
if (!empty($this->notice)) {
@ -128,7 +123,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
$this->show_single_json_status($this->notice);
}
} else {
// XXX: Twitter just sets a 404 header and doens't bother
// to return an err msg
@ -136,12 +130,14 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
if (!empty($deleted)) {
$this->clientError(
// TRANS: Client error displayed requesting a deleted status.
_('Status deleted.'),
410,
$this->format
);
} else {
$this->clientError(
// TRANS: Client error displayed requesting a status with an invalid ID.
_('No status with that ID found.'),
404,
$this->format
@ -157,7 +153,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -168,7 +163,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notice)) {
@ -186,7 +180,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notice)) {
@ -204,5 +197,4 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
return null;
}
}

View File

@ -160,7 +160,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
@ -227,6 +226,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
}
if (empty($this->auth_user)) {
// TRANS: Client error displayed when updating a status for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -234,7 +234,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$status_shortened = common_shorten_links($this->status);
if (Notice::contentTooLong($status_shortened)) {
// Note: Twitter truncates anything over 140, flags the status
// as "truncated."
@ -304,6 +303,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
if (Notice::contentTooLong($status_shortened)) {
$upload->delete();
// TRANS: Client error displayed exceeding the maximum notice length.
// TRANS: %d is the maximum lenth for a notice.
$msg = _m('Maximum notice size is %d character, including attachment URL.',
'Maximum notice size is %d characters, including attachment URL.',
Notice::maxContent());

View File

@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusnetConfigAction extends ApiAction
{
var $keys = array(
@ -69,9 +68,7 @@ class ApiStatusnetConfigAction extends ApiAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -85,7 +82,6 @@ class ApiStatusnetConfigAction extends ApiAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -138,6 +134,7 @@ class ApiStatusnetConfigAction extends ApiAction
break;
default:
$this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
@ -155,11 +152,8 @@ class ApiStatusnetConfigAction extends ApiAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -47,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusnetVersionAction extends ApiPrivateAuthAction
{
/**
@ -58,7 +57,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -72,7 +70,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -90,6 +87,7 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
break;
default:
$this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
@ -107,11 +105,8 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiSubscriptionsAction extends ApiBareAuthAction
{
var $profiles = null;
@ -62,9 +61,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -84,6 +81,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed when requesting a list of followers for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return false;
}
@ -102,12 +100,12 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
@ -128,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return array Profiles
*/
function getProfiles()
{
}
@ -140,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -151,7 +147,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return string datestamp of the latest profile in the stream
*/
function lastModified()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
@ -171,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
@ -184,6 +178,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
// Caching tags.
isset($this->ids_only) ? 'IDs' : 'Profiles',
strtotime($this->profiles[0]->created),
strtotime($this->profiles[$last]->created))
@ -202,7 +197,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return void
*/
function showProfiles($include_statuses = true)
{
switch ($this->format) {
@ -230,6 +224,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
print json_encode($arrays);
break;
default:
// TRANS: Client error displayed when requesting profiles of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
@ -241,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return void
*/
function showIds()
{
switch ($this->format) {
@ -260,9 +254,9 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
print json_encode($ids);
break;
default:
// TRANS: Client error displayed when requesting IDs of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
}
}

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineFavoritesAction extends ApiBareAuthAction
{
var $notices = null;
@ -59,9 +58,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -69,6 +66,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed when requesting most recent favourite notices by a user for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -87,7 +85,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -99,7 +96,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
@ -107,6 +103,8 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$sitename = common_config('site', 'name');
$title = sprintf(
// TRANS: Title for timeline of most recent favourite notices by a user.
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
_('%1$s / Favorites from %2$s'),
$sitename,
$this->user->nickname
@ -116,7 +114,10 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$id = "tag:$taguribase:Favorites:" . $this->user->id;
$subtitle = sprintf(
_('%1$s updates favorited by %2$s / %2$s.'),
// TRANS: Subtitle for timeline of most recent favourite notices by a user.
// TRANS: %1$s is the StatusNet sitename, %2$s is a user's full name,
// TRANS: %3$s is a user nickname.
_('%1$s updates favorited by %2$s / %3$s.'),
$sitename,
$profile->getBestName(),
$this->user->nickname
@ -148,7 +149,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
@ -165,12 +165,12 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -181,7 +181,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -220,7 +219,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -231,7 +229,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -249,7 +246,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -270,5 +266,4 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
return null;
}
}

View File

@ -151,7 +151,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineFriendsAction extends ApiBareAuthAction
{
var $notices = null;
@ -164,13 +163,13 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed when requesting dents of a user and friends for a user that does not exist.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -189,7 +188,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -201,7 +199,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
@ -246,7 +243,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
@ -268,6 +264,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -278,7 +275,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -307,7 +303,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -318,7 +313,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -336,11 +330,9 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
@ -357,5 +349,4 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
return null;
}
}

View File

@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineGroupAction extends ApiPrivateAuthAction
{
var $group = null;
var $notices = null;
@ -64,7 +62,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -83,12 +80,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (empty($this->group)) {
// TRANS: Client error displayed requesting most recent notices to a group for a non-existing group.
$this->clientError(_('Group not found.'), 404, $this->format);
return false;
}
@ -102,7 +99,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return void
*/
function showTimeline()
{
// We'll pull common formatting out of this for other formats
@ -126,7 +122,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
try {
@ -138,19 +133,21 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
$this->raw($atom->getString());
} catch (Atom10FeedException $e) {
$this->serverError(
'Could not generate feed for group - ' . $e->getMessage(),
// TRANS: Server error displayed when generating an Atom feed fails.
// TRANS: %s is the error.
sprintf(_('Could not generate feed for group - %s'),$e->getMessage()),
400,
$this->format
);
return;
}
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
$this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
@ -164,7 +161,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -190,7 +186,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -201,7 +196,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -219,7 +213,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -240,5 +233,4 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
return null;
}
}

View File

@ -56,7 +56,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineHomeAction extends ApiBareAuthAction
{
var $notices = null;
@ -67,9 +66,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -77,6 +74,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed when requesting most recent dents by user and friends for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -95,7 +93,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -107,12 +104,12 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name');
// TRANS: Timeline title for user and friends. %s is a user nickname.
$title = sprintf(_("%s and friends"), $this->user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:HomeTimeline:" . $this->user->id;
@ -172,6 +169,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -182,7 +180,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -215,7 +212,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -226,7 +222,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -244,7 +239,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -265,5 +259,4 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
return null;
}
}

View File

@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineMentionsAction extends ApiBareAuthAction
{
var $notices = null;
/**
@ -67,9 +65,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -77,6 +73,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed when requesting most recent mentions for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -95,7 +92,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -107,7 +103,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
@ -115,6 +110,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$sitename = common_config('site', 'name');
$title = sprintf(
// TRANS: Title for timeline of most recent mentions of a user.
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
_('%1$s / Updates mentioning %2$s'),
$sitename, $this->user->nickname
);
@ -128,6 +125,9 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$self = $this->getSelfUri();
$subtitle = sprintf(
// TRANS: Subtitle for timeline of most recent mentions of a user.
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname,
// TRANS: %3$s is a user's full name.
_('%1$s updates that reply to updates from %2$s / %3$s.'),
$sitename, $this->user->nickname, $profile->getBestName()
);
@ -149,7 +149,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
@ -171,6 +170,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -181,7 +181,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -205,7 +204,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -216,7 +214,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -234,7 +231,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -255,5 +251,4 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
return null;
}
}

View File

@ -144,10 +144,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
</statuses>
@endverbatim
*/
class ApiTimelinePublicAction extends ApiPrivateAuthAction
{
var $notices = null;
/**
@ -158,7 +156,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -177,7 +174,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -189,16 +185,17 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
// TRANS: Title for site timeline. %s is the StatusNet sitename.
$title = sprintf(_("%s public timeline"), $sitename);
$taguribase = TagURI::base();
$id = "tag:$taguribase:PublicTimeline";
$link = common_local_url('public');
$self = $this->getSelfUri();
// TRANS: Subtitle for site timeline. %s is the StatusNet sitename.
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
switch($this->format) {
@ -238,6 +235,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -248,7 +246,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -272,7 +269,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -283,7 +279,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -301,7 +296,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -321,5 +315,4 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
return null;
}
}

View File

@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineRetweetedByMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
@ -64,12 +63,12 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
$this->serverError('Unimplemented.', 503);
// TRANS: Server error displayed calling unimplemented API method for 'retweeted by me'.
$this->serverError(_('Unimplemented.'), 503);
return false;
}
@ -81,7 +80,6 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;

View File

@ -42,7 +42,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineRetweetedToMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
@ -61,9 +60,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -88,7 +85,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -108,6 +104,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
case 'atom':
$profile = $this->auth_user->getProfile();
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
@ -116,8 +113,8 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
$this->showAtomTimeline($strm, $title, $id, $link);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -132,7 +129,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;

View File

@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
@ -62,9 +61,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -89,7 +86,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -111,6 +107,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
case 'atom':
$profile = $this->auth_user->getProfile();
// TRANS: Title of list of repeated notices of the logged in user.
// TRANS: %s is the nickname of the logged in user.
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
@ -147,8 +145,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
$this->raw($atom->getString());
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -163,7 +161,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;

View File

@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineTagAction extends ApiPrivateAuthAction
{
var $notices = null;
/**
@ -61,9 +59,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -85,7 +81,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -97,13 +92,16 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
// TRANS: Title for timeline with lastest notices with a given tag.
// TRANS: %s is the tag.
$title = sprintf(_("Notices tagged with %s"), $this->tag);
$subtitle = sprintf(
// TRANS: Subtitle for timeline with lastest notices with a given tag.
// TRANS: %1$s is the tag, $2$s is the StatusNet sitename.
_('Updates tagged with %1$s on %2$s!'),
$this->tag,
$sitename
@ -136,7 +134,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
@ -158,6 +155,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
@ -168,7 +166,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -193,7 +190,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -204,7 +200,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -222,7 +217,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -243,5 +237,4 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
return null;
}
}

View File

@ -57,10 +57,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineUserAction extends ApiBareAuthAction
{
var $notices = null;
/**
@ -69,9 +67,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -79,6 +75,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed requesting most recent notices for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
@ -97,7 +94,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -109,7 +105,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
@ -147,7 +142,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom->setId($self);
@ -160,10 +154,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
/**
@ -171,7 +165,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return array notices
*/
function getNotices()
{
$notices = array();
@ -195,7 +188,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -206,7 +198,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
@ -224,11 +215,9 @@ class ApiTimelineUserAction extends ApiBareAuthAction
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
@ -245,5 +234,4 @@ class ApiTimelineUserAction extends ApiBareAuthAction
return null;
}
}

View File

@ -44,10 +44,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php';
*
* @see ApiAction
*/
class ApiTrendsAction extends ApiPrivateAuthAction
{
var $callback;
/**
@ -70,7 +68,6 @@ class ApiTrendsAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -84,7 +81,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction
*/
function showTrends()
{
// TRANS: Server error for unfinished API method showTrends.
$this->serverError(_('API method under construction.'), 501);
}
}
}

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiUserFollowersAction extends ApiSubscriptionsAction
{
/**
@ -56,7 +55,6 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction
*
* @return array Profiles
*/
function getProfiles()
{
$offset = ($this->page - 1) * $this->count;
@ -85,5 +83,4 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction
return $profiles;
}
}

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiUserFriendsAction extends ApiSubscriptionsAction
{
/**
@ -56,7 +55,6 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
*
* @return array Profiles
*/
function getProfiles()
{
$offset = ($this->page - 1) * $this->count;
@ -85,5 +83,4 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
return $profiles;
}
}

View File

@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiUserShowAction extends ApiPrivateAuthAction
{
/**
@ -60,7 +59,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
@ -87,17 +85,18 @@ class ApiUserShowAction extends ApiPrivateAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (empty($this->user)) {
$this->clientError(_('Not found.'), 404, $this->format);
// TRANS: Client error displayed when requesting user information for a non-existing user.
$this->clientError(_('User not found.'), 404, $this->format);
return;
}
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
@ -105,6 +104,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction
$profile = $this->user->getProfile();
if (empty($profile)) {
// TRANS: Client error displayed when requesting user information for a user without a profile.
$this->clientError(_('User has no profile.'));
return;
}
@ -120,7 +120,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}
/**
@ -132,10 +131,8 @@ class ApiUserShowAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}