diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/all.php | 17 | ||||
-rw-r--r-- | actions/apiaccountupdatedeliverydevice.php | 16 | ||||
-rw-r--r-- | actions/apiaccountupdateprofile.php | 8 | ||||
-rw-r--r-- | actions/apiaccountupdateprofilebackgroundimage.php | 18 | ||||
-rw-r--r-- | actions/apiblockcreate.php | 8 | ||||
-rw-r--r-- | actions/apiblockdestroy.php | 7 | ||||
-rw-r--r-- | actions/apidirectmessagenew.php | 4 | ||||
-rw-r--r-- | actions/apifavoritecreate.php | 7 | ||||
-rw-r--r-- | actions/apioauthaccesstoken.php | 3 | ||||
-rw-r--r-- | actions/apioauthauthorize.php | 80 | ||||
-rw-r--r-- | actions/apistatusesupdate.php | 35 | ||||
-rw-r--r-- | actions/oauthconnectionssettings.php | 21 | ||||
-rw-r--r-- | actions/pathsadminpanel.php | 204 |
13 files changed, 279 insertions, 149 deletions
diff --git a/actions/all.php b/actions/all.php index 6c14d2f13..b65335abc 100644 --- a/actions/all.php +++ b/actions/all.php @@ -89,7 +89,7 @@ class AllAction extends ProfileAction // TRANS: Page title. %1$s is user nickname, %2$d is page number return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page); } else { - // TRANS: Page title. %1$s is user nickname + // TRANS: Page title. %s is user nickname return sprintf(_("%s and friends"), $this->user->nickname); } } @@ -103,7 +103,7 @@ class AllAction extends ProfileAction 'nickname' => $this->user->nickname) ), - // TRANS: %1$s is user nickname + // TRANS: %s is user nickname sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)), new Feed(Feed::RSS2, common_local_url( @@ -112,7 +112,7 @@ class AllAction extends ProfileAction 'id' => $this->user->nickname ) ), - // TRANS: %1$s is user nickname + // TRANS: %s is user nickname sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)), new Feed(Feed::ATOM, common_local_url( @@ -121,7 +121,7 @@ class AllAction extends ProfileAction 'id' => $this->user->nickname ) ), - // TRANS: %1$s is user nickname + // TRANS: %s is user nickname sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)) ); } @@ -134,18 +134,23 @@ class AllAction extends ProfileAction function showEmptyListMessage() { - // TRANS: %1$s is user nickname + // TRANS: %s is user nickname $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' '; if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { + // TRANS: Encouragement displayed on logged in user's empty timeline. + // TRANS: This message contains Markdown links. Keep "](" together. $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.'); } else { // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@" + // TRANS: This message contains Markdown links. Keep "](" together. $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname); } } else { + // TRANS: Encoutagement displayed on empty timeline user pages for anonymous users. + // TRANS: %s is a user nickname. This message contains Markdown links. Keep "](" together. $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname); } @@ -181,7 +186,7 @@ class AllAction extends ProfileAction // TRANS: H1 text $this->element('h1', null, _("You and friends")); } else { - // TRANS: H1 text. %1$s is user nickname + // TRANS: H1 text. %s is a user nickname $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname)); } } diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php index 2d903cb46..a7342a94f 100644 --- a/actions/apiaccountupdatedeliverydevice.php +++ b/actions/apiaccountupdatedeliverydevice.php @@ -45,7 +45,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 ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction { /** @@ -56,7 +55,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -76,7 +74,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -92,6 +89,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed handling a non-existing API method. _('API method not found.'), 404, $this->format @@ -102,16 +100,14 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction // Note: Twitter no longer supports IM if (!in_array(strtolower($this->device), array('sms', 'im', 'none'))) { - $this->clientError( - _( - 'You must specify a parameter named ' . - '\'device\' with a value of one of: sms, im, none.' - ) - ); + // TRANS: Client error displayed when no valid device parameter is provided for a user's delivery device setting. + $this->clientError(_( 'You must specify a parameter named ' . + '\'device\' with a value of one of: sms, im, none.' )); return; } if (empty($this->user)) { + // TRANS: Client error displayed when no existing user is provided for a user's delivery device setting. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -131,6 +127,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction if ($result === false) { common_log_db_error($this->user, 'UPDATE', __FILE__); + // TRANS: Server error displayed when a user's delivery device cannot be updated. $this->serverError(_('Could not update user.')); return; } @@ -155,5 +152,4 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction $this->endDocument('json'); } } - } diff --git a/actions/apiaccountupdateprofile.php b/actions/apiaccountupdateprofile.php index 92d0f6b77..aea10e33e 100644 --- a/actions/apiaccountupdateprofile.php +++ b/actions/apiaccountupdateprofile.php @@ -43,10 +43,8 @@ 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 ApiAccountUpdateProfileAction extends ApiAuthAction { - /** * Take arguments for running * @@ -55,7 +53,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -79,7 +76,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -103,6 +99,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction } if (empty($this->user)) { + // TRANS: Client error displayed if a user could not be found. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -110,6 +107,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction $profile = $this->user->getProfile(); if (empty($profile)) { + // TRANS: Client error displayed if a user profile could not be found. $this->clientError(_('User has no profile.')); return; } @@ -145,6 +143,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction if (!$result) { common_log_db_error($profile, 'UPDATE', __FILE__); + // TRANS: Server error displayed if a user profile could not be saved. $this->serverError(_('Could not save profile.')); return; } @@ -163,5 +162,4 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction $this->endDocument('json'); } } - } diff --git a/actions/apiaccountupdateprofilebackgroundimage.php b/actions/apiaccountupdateprofilebackgroundimage.php index 923fb1d11..87af962d2 100644 --- a/actions/apiaccountupdateprofilebackgroundimage.php +++ b/actions/apiaccountupdateprofilebackgroundimage.php @@ -42,10 +42,8 @@ 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 ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction { - var $tile = false; /** @@ -56,7 +54,6 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -76,7 +73,6 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -92,6 +88,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -106,8 +103,11 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction && empty($_POST) && ($_SERVER['CONTENT_LENGTH'] > 0) ) { - $msg = _('The server was unable to handle that much POST ' . - 'data (%s bytes) due to its current configuration.'); + // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit. + // TRANS: %s is the number of bytes of the CONTENT_LENGTH. + $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', + 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', + intval($_SERVER['CONTENT_LENGTH'])); $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH'])); return; @@ -125,7 +125,6 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction // is part of the img filename. if (empty($design)) { - $this->user->query('BEGIN'); // save new design @@ -134,6 +133,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction if (empty($id)) { common_log_db_error($id, 'INSERT', __FILE__); + // TRANS: Client error displayed when saving design settings fails because of an empty id. $this->clientError(_('Unable to save your design settings.')); return; } @@ -144,6 +144,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction if (empty($result)) { common_log_db_error($original, 'UPDATE', __FILE__); + // TRANS: Client error displayed when saving design settings fails because of an empty result. $this->clientError(_('Unable to save your design settings.')); $this->user->query('ROLLBACK'); return; @@ -185,6 +186,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); + // TRANS: Error displayed when updating design settings fails. $this->showForm(_('Could not update your design.')); return; } @@ -192,6 +194,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction $profile = $this->user->getProfile(); if (empty($profile)) { + // TRANS: Client error displayed when a user has no profile. $this->clientError(_('User has no profile.')); return; } @@ -208,5 +211,4 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction $this->endDocument('json'); } } - } diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php index 53844cd2f..a9f31e791 100644 --- a/actions/apiblockcreate.php +++ b/actions/apiblockcreate.php @@ -46,7 +46,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 ApiBlockCreateAction extends ApiAuthAction { var $other = null; @@ -59,7 +58,6 @@ class ApiBlockCreateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -79,7 +77,6 @@ class ApiBlockCreateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -103,6 +100,7 @@ class ApiBlockCreateAction extends ApiAuthAction if ($this->user->id == $this->other->id) { $this->clientError( + // TRANS: Client error displayed when users try to block themselves. _("You cannot block yourself!"), 403, $this->format @@ -124,10 +122,8 @@ class ApiBlockCreateAction extends ApiAuthAction $this->showProfile($this->other, $this->format); $this->endDocument($this->format); } else { + // TRANS: Server error displayed when blocking a user has failed. $this->serverError(_('Block user failed.'), 500, $this->format); } - } - } - diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index 871ce66c7..b69907784 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -45,7 +45,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 ApiBlockDestroyAction extends ApiAuthAction { var $other = null; @@ -58,7 +57,6 @@ class ApiBlockDestroyAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -78,7 +76,6 @@ class ApiBlockDestroyAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -112,10 +109,8 @@ class ApiBlockDestroyAction extends ApiAuthAction $this->showProfile($this->other, $this->format); $this->endDocument($this->format); } else { + // TRANS: Server error displayed when unblocking a user has failed. $this->serverError(_('Unblock user failed.')); } - } - } - diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php index c126cd312..ccef57b3f 100644 --- a/actions/apidirectmessagenew.php +++ b/actions/apidirectmessagenew.php @@ -121,9 +121,9 @@ class ApiDirectMessageNewAction extends ApiAuthAction } else { $content_shortened = common_shorten_links($this->content); if (Message::contentTooLong($content_shortened)) { - // TRANS: Client error displayed when message content is too long. - // TRANS: %d is the maximum number of characters for a message. $this->clientError( + // TRANS: Client error displayed when message content is too long. + // TRANS: %d is the maximum number of characters for a message. sprintf(_m('That\'s too long. Maximum message size is %d character.', 'That\'s too long. Maximum message size is %d characters.', Message::maxContent()), Message::maxContent() ), diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index 15da01013..90a29d228 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -48,7 +48,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 ApiFavoriteCreateAction extends ApiAuthAction { var $notice = null; @@ -61,7 +60,6 @@ class ApiFavoriteCreateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -81,7 +79,6 @@ class ApiFavoriteCreateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -107,6 +104,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if (empty($this->notice)) { $this->clientError( + // TRANS: Client error displayed when requesting a status with a non-existing ID. _('No status found with that ID.'), 404, $this->format @@ -118,6 +116,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if ($this->user->hasFave($this->notice)) { $this->clientError( + // TRANS: Client error displayed when trying to mark a notice favourite that already is a favourite. _('This status is already a favorite.'), 403, $this->format @@ -129,6 +128,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if (empty($fave)) { $this->clientError( + // TRANS: Client error displayed when marking a notice as favourite fails. _('Could not create favorite.'), 403, $this->format @@ -166,5 +166,4 @@ class ApiFavoriteCreateAction extends ApiAuthAction // XXX: notify by SMS } } - } diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php index d4bd493ee..f66e4af1e 100644 --- a/actions/apioauthaccesstoken.php +++ b/actions/apioauthaccesstoken.php @@ -44,7 +44,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 ApiOauthAccessTokenAction extends ApiOauthAction { protected $reqToken = null; @@ -73,7 +72,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction // Spec doesn't say they MUST be. try { - $req = OAuthRequest::from_request(); $this->reqToken = $req->get_parameter('oauth_token'); @@ -101,6 +99,7 @@ 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 { diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index 51b130296..ca32c8540 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/info.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 ApiOauthAuthorizeAction extends Action { var $oauthTokenParam; @@ -106,6 +105,7 @@ class ApiOauthAuthorizeAction extends Action // Make sure a oauth_token parameter was provided if (empty($this->oauthTokenParam)) { + // TRANS: Client error given when no oauth_token was passed to the OAuth API. $this->clientError(_('No oauth_token parameter provided.')); } else { @@ -113,11 +113,13 @@ class ApiOauthAuthorizeAction extends Action $this->reqToken = $this->store->getTokenByKey($this->oauthTokenParam); if (empty($this->reqToken)) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_('Invalid request token.')); } else { // Check to make sure we haven't already authorized the token if ($this->reqToken->state != 0) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_("Invalid request token.")); } } @@ -125,6 +127,7 @@ class ApiOauthAuthorizeAction extends Action // make sure there's an app associated with this token if (empty($this->app)) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_('Invalid request token.')); } @@ -154,10 +157,15 @@ class ApiOauthAuthorizeAction extends Action // XXX Force credentials check? - // XXX OpenID + // @fixme this should probably use a unified login form handler + $user = null; + if (Event::handle('StartOAuthLoginCheck', array($this, &$user))) { + $user = common_check_user($this->nickname, $this->password); + } + Event::handle('EndOAuthLoginCheck', array($this, &$user)); - $user = common_check_user($this->nickname, $this->password); if (empty($user)) { + // TRANS: Form validation error given when an invalid username and/or password was passed to the OAuth API. $this->showForm(_("Invalid nickname / password!")); return; } @@ -207,7 +215,6 @@ class ApiOauthAuthorizeAction extends Action } if (!empty($this->callback)) { - $targetUrl = $this->getCallback( $this->callback, array( @@ -218,9 +225,7 @@ class ApiOauthAuthorizeAction extends Action // Redirect the user to the provided OAuth callback common_redirect($targetUrl, 303); - } elseif ($this->app->type == 2) { - // Strangely, a web application seems to want to do the OOB // workflow. Because no callback was specified anywhere. common_log( @@ -257,6 +262,7 @@ class ApiOauthAuthorizeAction extends Action } } else { + // TRANS: Client error given on when invalid data was passed through a form in the OAuth API. $this->clientError(_('Unexpected form submission.')); } } @@ -307,6 +313,7 @@ class ApiOauthAuthorizeAction extends Action function title() { + // TRANS: Title for a page where a user can confirm/deny account access by an external application. return _('An application would like to connect to your account'); } @@ -324,6 +331,7 @@ class ApiOauthAuthorizeAction extends Action 'action' => common_local_url('ApiOauthAuthorize'))); $this->elementStart('fieldset'); $this->element('legend', array('id' => 'apioauthauthorize_allowdeny'), + // TRANS: Fieldset legend. _('Allow or deny access')); $this->hidden('token', common_session_token()); @@ -340,6 +348,9 @@ class ApiOauthAuthorizeAction extends Action $access = ($this->app->access_type & Oauth_application::$writeAccess) ? 'access and update' : 'access'; + // TRANS: User notification of external application requesting account access. + // TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application, + // TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename. $msg = _('The application <strong>%1$s</strong> by ' . '<strong>%2$s</strong> would like the ability ' . 'to <strong>%3$s</strong> your %4$s account data. ' . @@ -355,34 +366,43 @@ class ApiOauthAuthorizeAction extends Action $this->elementEnd('li'); $this->elementEnd('ul'); + // quickie hack + $button = false; if (!common_logged_in()) { - - $this->elementStart('fieldset'); - $this->element('legend', null, _('Account')); - $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->input('nickname', _('Nickname')); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->password('password', _('Password')); - $this->elementEnd('li'); - $this->elementEnd('ul'); - - $this->elementEnd('fieldset'); - + if (Event::handle('StartOAuthLoginForm', array($this, &$button))) { + $this->elementStart('fieldset'); + // TRANS: Fieldset legend. + $this->element('legend', null, _m('LEGEND','Account')); + $this->elementStart('ul', 'form_data'); + $this->elementStart('li'); + // TRANS: Field label on OAuth API authorisation form. + $this->input('nickname', _('Nickname')); + $this->elementEnd('li'); + $this->elementStart('li'); + // TRANS: Field label on OAuth API authorisation form. + $this->password('password', _('Password')); + $this->elementEnd('li'); + $this->elementEnd('ul'); + + $this->elementEnd('fieldset'); + } + Event::handle('EndOAuthLoginForm', array($this, &$button)); } $this->element('input', array('id' => 'cancel_submit', 'class' => 'submit submit form_action-primary', 'name' => 'cancel', 'type' => 'submit', - 'value' => _('Cancel'))); + // TRANS: Button text that when clicked will cancel the process of allowing access to an account + // TRANS: by an external application. + 'value' => _m('BUTTON','Cancel'))); $this->element('input', array('id' => 'allow_submit', 'class' => 'submit submit form_action-secondary', 'name' => 'allow', 'type' => 'submit', - 'value' => _('Allow'))); + // TRANS: Button text that when clicked will allow access to an account by an external application. + 'value' => $button ? $button : _m('BUTTON','Allow'))); $this->elementEnd('fieldset'); $this->elementEnd('form'); @@ -396,9 +416,9 @@ class ApiOauthAuthorizeAction extends Action * * @return void */ - function getInstructions() { + // TRANS: Form instructions. return _('Authorize access to your account information.'); } @@ -409,7 +429,6 @@ class ApiOauthAuthorizeAction extends Action * * @return void */ - function showLocalNav() { // NOP @@ -420,7 +439,6 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showSiteNotice() { // NOP @@ -433,7 +451,6 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showNoticeForm() { // NOP @@ -445,12 +462,14 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showCanceled() { $info = new InfoAction( + // TRANS: Header for user notification after revoking OAuth access to an application. _('Authorization canceled.'), sprintf( + // TRANS: User notification after revoking OAuth access to an application. + // TRANS: %s is an OAuth token. _('The request token %s has been revoked.'), $this->oauthTokenParm ) @@ -465,15 +484,18 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showAuthorized() { $title = sprintf( + // TRANS: Header of user notification after authorising an application access to a profile. + // TRANS: %s is the authorised application name. _("You have successfully authorized %s."), $this->app->name ); $msg = sprintf( + // TRANS: Uer notification after authorising an application access to a profile. + // TRANS: %s is the authorised application name. _('Please return to %s and enter the following security code to complete the process.'), $this->app->name ); @@ -508,7 +530,6 @@ class ApiOauthAuthorizeAction extends Action * * @return string $url a URL to use for redirecting to */ - function getCallback($url, $params) { foreach ($params as $k => $v) { @@ -532,7 +553,6 @@ class ApiOauthAuthorizeAction extends Action * * @return string $url the new URL with added parameter */ - function appendQueryVar($url, $k, $v) { $url = preg_replace('/(.*)(\?|&)' . $k . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 91dcdd10f..822ebacbd 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -147,7 +147,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 ApiStatusesUpdateAction extends ApiAuthAction { var $status = null; @@ -163,7 +162,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -187,7 +185,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -209,8 +206,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction && empty($_POST) && ($_SERVER['CONTENT_LENGTH'] > 0) ) { - $msg = _('The server was unable to handle that much POST ' . - 'data (%s bytes) due to its current configuration.'); + // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit. + // TRANS: %s is the number of bytes of the CONTENT_LENGTH. + $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', + 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', + intval($_SERVER['CONTENT_LENGTH'])); $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH'])); return; @@ -218,6 +218,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (empty($this->status)) { $this->clientError( + // TRANS: Client error displayed when the parameter "status" is missing. _('Client must provide a \'status\' parameter with a value.'), 400, $this->format @@ -239,7 +240,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction $this->clientError( sprintf( - _('That\'s too long. Max notice size is %d chars.'), + // TRANS: Client error displayed when the parameter "status" is missing. + // TRANS: %d is the maximum number of character for a notice. + _m('That\'s too long. Maximum notice size is %d character.', + 'That\'s too long. Maximum notice size is %d characters.', + Notice::maxContent()), Notice::maxContent() ), 406, @@ -255,7 +260,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction $cmd = $inter->handle_command($this->auth_user, $status_shortened); if ($cmd) { - if ($this->supported($cmd)) { $cmd->execute(new Channel()); } @@ -265,13 +269,10 @@ class ApiStatusesUpdateAction extends ApiAuthAction // or not! $this->notice = $this->auth_user->getCurrentNotice(); - } else { - $reply_to = null; if (!empty($this->in_reply_to_status_id)) { - // Check whether notice actually exists $reply = Notice::staticGet($this->in_reply_to_status_id); @@ -280,7 +281,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction $reply_to = $this->in_reply_to_status_id; } else { $this->clientError( - _('Not found.'), + // TRANS: Client error displayed when replying to a non-existing notice. + _('Parent notice not found.'), $code = 404, $this->format ); @@ -302,10 +304,9 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (Notice::contentTooLong($status_shortened)) { $upload->delete(); - $msg = _( - 'Max notice size is %d chars, ' . - 'including attachment URL.' - ); + $msg = _m('Maximum notice size is %d character, including attachment URL.', + 'Maximum notice size is %d characters, including attachment URL.', + Notice::maxContent()); $this->clientError( sprintf($msg, Notice::maxContent()), 400, @@ -344,7 +345,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (isset($upload)) { $upload->attachToNotice($this->notice); } - } $this->showNotice(); @@ -355,7 +355,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return void */ - function showNotice() { if (!empty($this->notice)) { @@ -374,7 +373,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return boolean true or false */ - function supported($cmd) { static $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', @@ -386,5 +384,4 @@ class ApiStatusesUpdateAction extends ApiAuthAction return false; } - } diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index 0590b729c..9a7cda924 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -46,10 +46,8 @@ require_once INSTALLDIR . '/lib/apioauthstore.php'; * * @see SettingsAction */ - class OauthconnectionssettingsAction extends ConnectSettingsAction { - var $page = null; var $oauth_token = null; @@ -69,6 +67,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function title() { + // TRANS: Title for OAuth connection settings. return _('Connected applications'); } @@ -80,6 +79,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function getInstructions() { + // TRANS: Instructions for OAuth connection settings. return _('The following connections exist for your account.'); } @@ -129,7 +129,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction * * @return void */ - function handlePost() { // CSRF protection @@ -144,6 +143,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction if ($this->arg('revoke')) { $this->revokeAccess($this->oauth_token); } else { + // TRANS: Client error when submitting a form with unexpected information. $this->clientError(_('Unexpected form submission.'), 401); return false; } @@ -157,7 +157,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction * @param int $appId the ID of the application * */ - function revokeAccess($token) { $cur = common_current_user(); @@ -165,6 +164,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $appUser = Oauth_application_user::getByUserAndToken($cur, $token); if (empty($appUser)) { + // TRANS: Client error when trying to revoke access for an application while not being a user of it. $this->clientError(_('You are not a user of that application.'), 401); return false; } @@ -178,7 +178,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction if (!$result) { common_log_db_error($orig, 'DELETE', __FILE__); - $this->clientError(sprintf(_('Unable to revoke access for app: %s.'), $app->id)); + // TRANS: Client error when revoking access has failed for some reason. + // TRANS: %s is the application ID revoking access failed for. + $this->clientError(sprintf(_('Unable to revoke access for application: %s.'), $app->id)); return false; } @@ -195,7 +197,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction ); $msg = sprintf( - _('You have successfully revoked access for %s and the access token starting with %s'), + // TRANS: Success message after revoking access for an application. + // TRANS: %1$s is the application name, %2$s is the first part of the user token. + _('You have successfully revoked access for %1$s and the access token starting with %2$s.'), $app->name, substr($appUser->token, 0, 7) ); @@ -205,6 +209,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function showEmptyListMessage() { + // TRANS: Empty list message when no applications have been authorised yet. $message = _('You have not authorized any applications to use your account.'); $this->elementStart('div', 'guide'); @@ -222,6 +227,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $this->elementStart('p'); $devMsg = sprintf( + // TRANS: Note for developers in the OAuth connection settings form. + // TRANS: This message contains a Markdown link. Do not separate "](". + // TRANS: %s is the URL to the OAuth settings. _('Are you a developer? [Register an OAuth client application](%s) to use with this instance of StatusNet.'), common_local_url('oauthappssettings') ); @@ -233,5 +241,4 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $this->elementEnd('section'); } - } diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php index e073b0a2a..dd65a7a13 100644 --- a/actions/pathsadminpanel.php +++ b/actions/pathsadminpanel.php @@ -44,10 +44,8 @@ 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 PathsadminpanelAction extends AdminPanelAction { - /** * Returns the page title * @@ -56,6 +54,7 @@ class PathsadminpanelAction extends AdminPanelAction function title() { + // TRANS: Title for Paths admin panel. return _('Paths'); } @@ -64,9 +63,9 @@ class PathsadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { + // TRANS: Form instructions for Path admin panel. return _('Path and server settings for this StatusNet site'); } @@ -75,7 +74,6 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new PathsAdminPanelForm($this); @@ -88,7 +86,6 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( @@ -148,25 +145,29 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function validate(&$values) { - // Validate theme dir if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) { + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the directory that could not be read from. $this->clientError(sprintf(_("Theme directory not readable: %s."), $values['theme']['dir'])); } // Validate avatar dir if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) { + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the avatar directory that could not be written to. $this->clientError(sprintf(_("Avatar directory not writable: %s."), $values['avatar']['dir'])); } // Validate background dir if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) { + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the background directory that could not be written to. $this->clientError(sprintf(_("Background directory not writable: %s."), $values['background']['dir'])); } @@ -175,27 +176,28 @@ class PathsadminpanelAction extends AdminPanelAction // XXX: What else do we need to validate for lacales path here? --Z if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) { + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the locales directory that could not be read from. $this->clientError(sprintf(_("Locales directory not readable: %s."), $values['site']['locale_path'])); } // Validate SSL setup if (mb_strlen($values['site']['sslserver']) > 255) { + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the SSL server URL that is too long. $this->clientError(_('Invalid SSL server. The maximum length is 255 characters.')); } } - } class PathsAdminPanelForm extends AdminForm { - /** * ID of the form * * @return int ID of the form */ - function id() { return 'form_paths_admin_panel'; @@ -206,7 +208,6 @@ class PathsAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -217,7 +218,6 @@ class PathsAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('pathsadminpanel'); @@ -228,27 +228,39 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('Site'), 'site'); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Server'), _('Site\'s server hostname.')); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + _('Site\'s server hostname.')); $this->unli(); $this->li(); - $this->input('path', _('Path'), _('Site path')); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + _('Site path.')); $this->unli(); $this->li(); - $this->input('locale_path', _('Locale Directory'), _('Directory path to locales'), 'site'); + $this->input('locale_path', + // TRANS: Field label in Paths admin panel. + _('Locale directory'), + _('Directory path to locales.'), + 'site'); $this->unli(); $this->li(); - $this->out->checkbox('fancy', _('Fancy URLs'), + $this->out->checkbox('fancy', + // TRANS: Checkbox label in Paths admin panel. + _('Fancy URLs'), (bool) $this->value('fancy'), _('Use fancy (more readable and memorable) URLs?')); $this->unli(); @@ -262,43 +274,84 @@ class PathsAdminPanelForm extends AdminForm $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Server'), _('Server for themes'), 'theme'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for themes.'), + 'theme'); $this->unli(); $this->li(); - $this->input('path', _('Path'), _('Web path to themes'), 'theme'); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to themes.'), + 'theme'); $this->unli(); $this->li(); - $this->input('sslserver', _('SSL server'), _('SSL server for themes (default: SSL server)'), 'theme'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('SSL server for themes (default: SSL server).'), + 'theme'); $this->unli(); $this->li(); - $this->input('sslpath', _('SSL path'), _('SSL path to themes (default: /theme/)'), 'theme'); + $this->input('sslpath', + // TRANS: Field label in Paths admin panel. + _('SSL path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('SSL path to themes (default: /theme/).'), + 'theme'); $this->unli(); $this->li(); - $this->input('dir', _('Directory'), _('Directory where themes are located'), 'theme'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where themes are located.'), + 'theme'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_avatar-paths')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('Avatars')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Avatar server'), 'Server for avatars', 'avatar'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Avatar server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for avatars.'), + 'avatar'); $this->unli(); $this->li(); - $this->input('path', _('Avatar path'), 'Web path to avatars', 'avatar'); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Avatar path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to avatars.'), + 'avatar'); $this->unli(); $this->li(); - $this->input('dir', _('Avatar directory'), 'Directory where avatars are located', 'avatar'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Avatar directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where avatars are located.'), + 'avatar'); $this->unli(); $this->out->elementEnd('ul'); @@ -307,27 +360,53 @@ class PathsAdminPanelForm extends AdminForm $this->out->elementStart('fieldset', array('id' => 'settings_design_background-paths')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('Backgrounds')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Server'), 'Server for backgrounds', 'background'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for backgrounds.'), + 'background'); $this->unli(); $this->li(); - $this->input('path', _('Path'), 'Web path to backgrounds', 'background'); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to backgrounds.'), + 'background'); $this->unli(); $this->li(); - $this->input('sslserver', _('SSL server'), 'Server for backgrounds on SSL pages', 'background'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for backgrounds on SSL pages.'), + 'background'); $this->unli(); $this->li(); - $this->input('sslpath', _('SSL path'), 'Web path to backgrounds on SSL pages', 'background'); + $this->input('sslpath', + // TRANS: Field label in Paths admin panel. + _('SSL path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to backgrounds on SSL pages.'), + 'background'); $this->unli(); $this->li(); - $this->input('dir', _('Directory'), 'Directory where backgrounds are located', 'background'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where backgrounds are located.'), + 'background'); $this->unli(); $this->out->elementEnd('ul'); @@ -336,53 +415,90 @@ class PathsAdminPanelForm extends AdminForm $this->out->elementStart('fieldset', array('id' => 'settings_design_attachments-paths')); + // TRANS: Fieldset legens in Paths admin panel. $this->out->element('legend', null, _('Attachments')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Server'), 'Server for attachments', 'attachments'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for attachments.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('path', _('Path'), 'Web path to attachments', 'attachments'); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to attachments.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('sslserver', _('SSL server'), 'Server for attachments on SSL pages', 'attachments'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for attachments on SSL pages.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('sslpath', _('SSL path'), 'Web path to attachments on SSL pages', 'attachments'); + $this->input('sslpath', + // TRANS: Field label in Paths admin panel. + _('SSL path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to attachments on SSL pages.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('dir', _('Directory'), 'Directory where attachments are located', 'attachments'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where attachments are located.'), + 'attachments'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('SSL')); $this->out->elementStart('ul', 'form_data'); $this->li(); + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). $ssl = array('never' => _('Never'), + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). 'sometimes' => _('Sometimes'), + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). 'always' => _('Always')); - $this->out->dropdown('site-ssl', _('Use SSL'), - $ssl, _('When to use SSL'), - false, $this->value('ssl', 'site')); + // TRANS: Drop down label in Paths admin panel. + $this->out->dropdown('site-ssl', + _('Use SSL'), + // TRANS: Tooltip for field label in Paths admin panel. + $ssl, _('When to use SSL.'), + false, + $this->value('ssl', 'site')); $this->unli(); $this->li(); - $this->input('sslserver', _('SSL server'), - _('Server to direct SSL requests to'), 'site'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server to direct SSL requests to.'), + 'site'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); - } /** @@ -390,10 +506,11 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('save', _('Save'), 'submit', + // TRANS: Button text to store form data in the Paths admin panel. + $this->out->submit('save', _m('BUTTON','Save'), 'submit', + // TRANS: Button title text to store form data in the Paths admin panel. 'save', _('Save paths')); } @@ -410,7 +527,6 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function input($setting, $title, $instructions, $section='site') { $this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions); |