Cosmetic changes to common_redirect, clientError, serverError

Since these functions exit (or throw exception) after running, there
is no need to have a 'return' statement or similar afterwards.
This commit is contained in:
Mikael Nordfeldth 2014-03-10 00:19:35 +01:00
parent acbe94936f
commit c00491cd7a
132 changed files with 20 additions and 472 deletions

View File

@ -77,7 +77,6 @@ class AddpeopletagAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
// Only for logged-in users
@ -87,7 +86,6 @@ class AddpeopletagAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
// Profile to subscribe to
@ -99,7 +97,6 @@ class AddpeopletagAction extends Action
if (empty($this->tagged)) {
// TRANS: Client error displayed trying to perform an action related to a non-existing profile.
$this->clientError(_('No such profile.'));
return false;
}
$id = $this->arg('peopletag_id');
@ -108,7 +105,6 @@ class AddpeopletagAction extends Action
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'));
return false;
}
return true;
@ -144,7 +140,6 @@ class AddpeopletagAction extends Action
'The remote server is probably not responding correctly. ' .
'Please try retrying later.'), $this->profile->profileurl));
}
return false;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');

View File

@ -67,7 +67,6 @@ class AllrssAction extends Rss10Action
if (!$this->user) {
// TRANS: Client error when user not found for an rss related action.
$this->clientError(_('No such user.'));
return false;
} else {
$this->notices = $this->getNotices($this->limit);
return true;

View File

@ -84,7 +84,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
404,
$this->format
);
return;
}
// Note: Twitter no longer supports IM
@ -93,7 +92,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
// 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)) {
@ -124,7 +122,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
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;
}
$profile = $this->user->getProfile();

View File

@ -92,7 +92,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
if (empty($profile)) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->clientError(_('User has no profile.'));
return;
}
$original = clone($profile);
@ -128,7 +127,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
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;
}
$twitter_user = $this->twitterUserArray($profile, true);

View File

@ -64,7 +64,6 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
$twitter_user = $this->twitterUserArray($this->auth_user->getProfile(), true);

View File

@ -120,7 +120,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
return;
}
if (empty($this->source)) {
@ -129,7 +128,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
_('Could not determine source user.'),
404
);
return;
}
if (empty($this->target)) {
@ -138,7 +136,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
_('Could not find target user.'),
404
);
return;
}
$result = $this->twitterRelationshipArray($this->source, $this->target);

View File

@ -63,7 +63,6 @@ class ApiMediaUploadAction extends ApiAuthAction
_('This method requires a POST.'),
400, $this->format
);
return;
}
// Workaround for PHP returning empty $_POST and $_FILES when POST
@ -79,7 +78,6 @@ class ApiMediaUploadAction extends ApiAuthAction
'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;
}
$upload = null;
@ -88,7 +86,6 @@ class ApiMediaUploadAction extends ApiAuthAction
$upload = MediaFile::fromUpload('media', $this->auth_user->getProfile());
} catch (Exception $e) {
$this->clientError($e->getMessage(), $e->getCode());
return;
}
if (isset($upload)) {
@ -96,7 +93,6 @@ class ApiMediaUploadAction extends ApiAuthAction
} else {
// TRANS: Client error displayed when uploading a media file has failed.
$this->clientError(_('Upload failed.'));
return;
}
}

View File

@ -80,7 +80,6 @@ class ApiOAuthAccessTokenAction extends ApiOAuthAction
common_debug(var_export($req, true));
$code = $e->getCode();
$this->clientError($e->getMessage(), empty($code) ? 401 : $code, 'text');
return;
}
if (empty($atok)) {

View File

@ -101,7 +101,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
if (!in_array($this->format, array('xml', 'json', 'atom'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
return;
}
switch ($_SERVER['REQUEST_METHOD']) {
@ -114,7 +113,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
default:
// TRANS: Client error displayed calling an unsupported HTTP error in API status show.
$this->clientError(_('HTTP method not supported.'), 405);
return;
}
}
@ -223,7 +221,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
if ($this->format != 'atom') {
// TRANS: Client error displayed when trying to delete a notice not using the Atom format.
$this->clientError(_('Can only delete using the Atom format.'));
return;
}
if (empty($this->auth_user) ||
@ -231,7 +228,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
!$this->auth_user->hasRight(Right::DELETEOTHERSNOTICE))) {
// TRANS: Client error displayed when a user has no rights to delete notices of other users.
$this->clientError(_('Cannot delete this notice.'), 403);
return;
}
if (Event::handle('StartDeleteOwnNotice', array($this->auth_user, $this->notice))) {

View File

@ -57,7 +57,6 @@ class ApprovegroupAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('You must be logged in to leave a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -72,7 +71,6 @@ class ApprovegroupAction extends Action
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -80,27 +78,23 @@ class ApprovegroupAction extends Action
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (empty($cur)) {
// TRANS: Client error displayed trying to approve group membership while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
@ -108,12 +102,10 @@ class ApprovegroupAction extends Action
} else {
// TRANS: Client error displayed trying to approve group membership while not a group administrator.
$this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
return false;
}
} else {
// TRANS: Client error displayed trying to approve group membership without specifying a profile to approve.
$this->clientError(_('Must specify a profile.'));
return false;
}
$this->request = Group_join_queue::pkeyGet(array('profile_id' => $this->profile->id,
@ -186,9 +178,7 @@ class ApprovegroupAction extends Action
$this->elementEnd('body');
$this->endHTML();
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)), 303);
}
}
}

View File

@ -58,14 +58,12 @@ class ApprovesubAction extends Action
if (empty($cur)) {
// TRANS: Client error displayed trying to approve group membership while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
$this->profile = Profile::getKV('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed trying to approve subscriptionswithout specifying a profile to approve.
$this->clientError(_('Must specify a profile.'));
return false;
}
$this->request = Subscription_queue::pkeyGet(array('subscriber' => $this->profile->id,

View File

@ -118,7 +118,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
default:
// TRANS: Client error shown when using a non-supported HTTP method.
$this->clientError(_('HTTP method not supported.'), 405);
return;
}
return;

View File

@ -105,7 +105,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
default:
// TRANS: Client exception thrown when using an unsupported HTTP method.
$this->clientError(_('HTTP method not supported.'), 405);
return;
}
return;
@ -232,7 +231,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
$dom->documentElement->localName != 'entry') {
// TRANS: Client error displayed when not using an Atom entry.
$this->clientError(_('Atom post must be an Atom entry.'));
return;
}
$activity = new Activity($dom->documentElement);
@ -244,7 +242,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
if ($activity->verb != ActivityVerb::FOLLOW) {
// TRANS: Client error displayed when not using the follow verb.
$this->clientError(_('Can only handle Follow activities.'));
return;
}
$person = $activity->objects[0];
@ -252,7 +249,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
if ($person->type != ActivityObject::PERSON) {
// TRANS: Client exception thrown when subscribing to an object that is not a person.
$this->clientError(_('Can only follow people.'));
return;
}
// XXX: OStatus discovery (maybe)
@ -263,7 +259,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
// TRANS: Client exception thrown when subscribing to a non-existing profile.
// TRANS: %s is the unknown profile ID.
$this->clientError(sprintf(_('Unknown profile %s.'), $person->id));
return;
}
if (Subscription::exists($this->_profile, $profile)) {
@ -273,7 +268,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
$this->clientError(sprintf(_('Already subscribed to %s.'),
$person->id),
409);
return;
}
if (Subscription::start($this->_profile, $profile)) {

View File

@ -71,7 +71,6 @@ class AttachmentAction extends Action
if (empty($this->attachment)) {
// TRANS: Client error displayed trying to get a non-existing attachment.
$this->clientError(_('No such attachment.'), 404);
return false;
}
return true;
}

View File

@ -106,7 +106,6 @@ class AvatarsettingsAction extends SettingsAction
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return;
}
$this->elementStart('form', array('enctype' => 'multipart/form-data',
@ -195,7 +194,6 @@ class AvatarsettingsAction extends SettingsAction
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return;
}
$this->elementStart('form', array('method' => 'post',
@ -362,7 +360,6 @@ class AvatarsettingsAction extends SettingsAction
if (!$filedata) {
// TRANS: Server error displayed if an avatar upload went wrong somehow server side.
$this->serverError(_('Lost our file data.'));
return;
}
$file_d = ($filedata['width'] > $filedata['height'])

View File

@ -66,7 +66,6 @@ class BlockAction extends ProfileFormAction
if ($cur->hasBlocked($this->profile)) {
// TRANS: Client error displayed when blocking a user that has already been blocked.
$this->clientError(_('You already blocked that user.'));
return false;
}
return true;
@ -187,7 +186,6 @@ class BlockAction extends ProfileFormAction
if (!$result) {
// TRANS: Server error displayed when blocking a user fails.
$this->serverError(_('Failed to save block information.'));
return;
}
}

View File

@ -65,13 +65,11 @@ class BlockedfromgroupAction extends GroupAction
$args['page'] = $this->page;
}
common_redirect(common_local_url('blockedfromgroup', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed when requesting a list of blocked users for a group without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -79,7 +77,6 @@ class BlockedfromgroupAction extends GroupAction
if (!$local) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
@ -87,7 +84,6 @@ class BlockedfromgroupAction extends GroupAction
if (!$this->group) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
return true;

View File

@ -57,7 +57,6 @@ class CancelgroupAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('You must be logged in to leave a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -71,7 +70,6 @@ class CancelgroupAction extends Action
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -79,27 +77,23 @@ class CancelgroupAction extends Action
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (empty($cur)) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
@ -108,7 +102,6 @@ class CancelgroupAction extends Action
// TRANS: Client error displayed when trying to approve or cancel a group join request without
// TRANS: being a group administrator.
$this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
return false;
}
} else {
$this->profile = $cur->getProfile();
@ -164,9 +157,7 @@ class CancelgroupAction extends Action
$this->elementEnd('body');
$this->endHTML();
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)), 303);
}
}
}

View File

@ -55,7 +55,6 @@ class CancelsubscriptionAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return;
}
$user = common_current_user();
@ -63,7 +62,6 @@ class CancelsubscriptionAction extends Action
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)));
return;
}
/* Use a session token for CSRF protection. */
@ -74,7 +72,6 @@ class CancelsubscriptionAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. ' .
'Try again, please.'));
return;
}
$other_id = $this->arg('unsubscribeto');
@ -82,7 +79,6 @@ class CancelsubscriptionAction extends Action
if (!$other_id) {
// TRANS: Client error displayed when trying to leave a group without specifying an ID.
$this->clientError(_('No profile ID in request.'));
return;
}
$other = Profile::getKV('id', $other_id);
@ -90,7 +86,6 @@ class CancelsubscriptionAction extends Action
if (!$other) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No profile with that ID.'));
return;
}
$this->request = Subscription_queue::pkeyGet(array('subscriber' => $user->id,

View File

@ -66,25 +66,21 @@ class ConfirmaddressAction extends Action
if (!common_logged_in()) {
common_set_returnto($this->selfUrl());
common_redirect(common_local_url('login'));
return;
}
$code = $this->trimmed('code');
if (!$code) {
// TRANS: Client error displayed when not providing a confirmation code in the contact address confirmation action.
$this->clientError(_('No confirmation code.'));
return;
}
$confirm = Confirm_address::getKV('code', $code);
if (!$confirm) {
// TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action.
$this->clientError(_('Confirmation code not found.'));
return;
}
$cur = common_current_user();
if ($cur->id != $confirm->user_id) {
// TRANS: Client error displayed when not providing a confirmation code for another user in the contact address confirmation action.
$this->clientError(_('That confirmation code is not for you!'));
return;
}
$type = $confirm->address_type;
$transports = array();
@ -92,7 +88,6 @@ class ConfirmaddressAction extends Action
if (!in_array($type, array('email', 'sms')) && !in_array($type, array_keys($transports))) {
// TRANS: Server error for an unknown address type, which can be 'email', 'sms', or the name of an IM network (such as 'xmpp' or 'aim')
$this->serverError(sprintf(_('Unrecognized address type %s'), $type));
return;
}
$this->address = $confirm->address;
$cur->query('BEGIN');
@ -101,7 +96,6 @@ class ConfirmaddressAction extends Action
if ($cur->$type == $confirm->address) {
// TRANS: Client error for an already confirmed email/jabber/sms address.
$this->clientError(_('That address has already been confirmed.'));
return;
}
$orig_user = clone($cur);
@ -120,7 +114,6 @@ class ConfirmaddressAction extends Action
common_log_db_error($cur, 'UPDATE', __FILE__);
// TRANS: Server error displayed when confirming an e-mail address or IM address fails.
$this->serverError(_('Could not update user.'));
return;
}
if ($type == 'email') {
@ -136,7 +129,6 @@ class ConfirmaddressAction extends Action
if($user_im_prefs->screenname == $confirm->address){
// TRANS: Client error for an already confirmed IM address.
$this->clientError(_('That address has already been confirmed.'));
return;
}
$user_im_prefs->screenname = $confirm->address;
$result = $user_im_prefs->update();
@ -145,7 +137,6 @@ class ConfirmaddressAction extends Action
common_log_db_error($user_im_prefs, 'UPDATE', __FILE__);
// TRANS: Server error displayed when updating IM preferences fails.
$this->serverError(_('Could not update user IM preferences.'));
return;
}
}else{
$user_im_prefs = new User_im_prefs();
@ -158,7 +149,6 @@ class ConfirmaddressAction extends Action
common_log_db_error($user_im_prefs, 'INSERT', __FILE__);
// TRANS: Server error displayed when adding IM preferences fails.
$this->serverError(_('Could not insert user IM preferences.'));
return;
}
}
@ -171,7 +161,6 @@ class ConfirmaddressAction extends Action
// TRANS: Server error displayed when an address confirmation code deletion from the
// TRANS: database fails in the contact address confirmation action.
$this->serverError(_('Could not delete address confirmation.'));
return;
}
$cur->query('COMMIT');

View File

@ -60,7 +60,6 @@ class DeleteapplicationAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed trying to delete an application while not logged in.
$this->clientError(_('You must be logged in to delete an application.'));
return false;
}
$id = (int)$this->arg('id');
@ -69,7 +68,6 @@ class DeleteapplicationAction extends Action
if (empty($this->app)) {
// TRANS: Client error displayed trying to delete an application that does not exist.
$this->clientError(_('Application not found.'));
return false;
}
$cur = common_current_user();
@ -77,7 +75,6 @@ class DeleteapplicationAction extends Action
if ($cur->id != $this->app->owner) {
// TRANS: Client error displayed trying to delete an application the current user does not own.
$this->clientError(_('You are not the owner of this application.'), 401);
return false;
}
return true;
@ -101,7 +98,6 @@ class DeleteapplicationAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'));
return;
}
if ($this->arg('no')) {

View File

@ -62,7 +62,6 @@ class DeletegroupAction extends RedirectingAction
if (!common_logged_in()) {
// TRANS: Client error when trying to delete group while not logged in.
$this->clientError(_('You must be logged in to delete a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -77,7 +76,6 @@ class DeletegroupAction extends RedirectingAction
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -85,27 +83,23 @@ class DeletegroupAction extends RedirectingAction
if (!$local) {
// TRANS: Client error when trying to delete a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error when trying to delete a group without providing a nickname or ID for the group.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error when trying to delete a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (!$cur->hasRight(Right::DELETEGROUP)) {
// TRANS: Client error when trying to delete a group without having the rights to delete it.
$this->clientError(_('You are not allowed to delete this group.'), 403);
return false;
}
return true;
@ -166,8 +160,7 @@ class DeletegroupAction extends RedirectingAction
} else {
// @fixme if we could direct to the page on which this group
// would have shown... that would be awesome
common_redirect(common_local_url('groups'),
303);
common_redirect(common_local_url('groups'), 303);
}
}

View File

@ -64,7 +64,6 @@ class DeleteuserAction extends ProfileFormAction
if (!$cur->hasRight(Right::DELETEUSER)) {
// TRANS: Client error displayed when trying to delete a user without having the right to delete users.
$this->clientError(_('You cannot delete users.'));
return false;
}
$this->user = User::getKV('id', $this->profile->id);
@ -72,7 +71,6 @@ class DeleteuserAction extends ProfileFormAction
if (empty($this->user)) {
// TRANS: Client error displayed when trying to delete a non-local user.
$this->clientError(_('You can only delete local users.'));
return false;
}
return true;

View File

@ -64,7 +64,6 @@ class EditApplicationAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed trying to edit an application while not logged in.
$this->clientError(_('You must be logged in to edit an application.'));
return false;
}
$id = (int)$this->arg('id');
@ -81,7 +80,6 @@ class EditApplicationAction extends Action
if (!$this->app) {
// TRANS: Client error displayed trying to edit an application that does not exist.
$this->clientError(_('No such application.'));
return false;
}
return true;
@ -130,7 +128,6 @@ class EditApplicationAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'));
return;
}
$cur = common_current_user();

View File

@ -66,7 +66,6 @@ class EditgroupAction extends GroupAction
if (!common_logged_in()) {
// TRANS: Client error displayed trying to edit a group while not logged in.
$this->clientError(_('You must be logged in to create a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -77,13 +76,11 @@ class EditgroupAction extends GroupAction
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('editgroup', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed trying to edit a group while not proving a nickname for the group to edit.
$this->clientError(_('No nickname.'), 404);
return false;
}
$groupid = $this->trimmed('groupid');
@ -100,7 +97,6 @@ class EditgroupAction extends GroupAction
if (!$this->group) {
// TRANS: Client error displayed trying to edit a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
@ -108,7 +104,6 @@ class EditgroupAction extends GroupAction
if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed trying to edit a group while not being a group admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
return true;
@ -274,9 +269,7 @@ class EditgroupAction extends GroupAction
}
if ($this->group->nickname != $orig->nickname) {
common_redirect(common_local_url('editgroup',
array('nickname' => $nickname)),
303);
common_redirect(common_local_url('editgroup', array('nickname' => $nickname)), 303);
} else {
// TRANS: Group edit form success message.
$this->showForm(_('Options saved.'));

View File

@ -67,7 +67,6 @@ class EditpeopletagAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$id = $this->arg('id');
@ -88,7 +87,6 @@ class EditpeopletagAction extends Action
if ($tagger_arg != $tagger || $tag_arg != $tag) {
$args = array('tagger' => $tagger, 'tag' => $tag);
common_redirect(common_local_url('editpeopletag', $args), 301);
return false;
}
$user = null;
@ -101,7 +99,6 @@ class EditpeopletagAction extends Action
if (!$tagger) {
// TRANS: Error message displayed when trying to perform an action that requires a tagging user or ID.
$this->clientError(_('No tagger or ID.'), 404);
return false;
}
$user = User::getKV('nickname', $tagger);
@ -111,20 +108,17 @@ class EditpeopletagAction extends Action
if (!$this->peopletag) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
if (!$user) {
// This should not be happening
// TRANS: Client error displayed when referring to non-local user.
$this->clientError(_('Not a local user.'), 404);
return false;
}
if ($current->id != $user->id) {
// TRANS: Client error displayed when reting to edit a tag that was not self-created.
$this->clientError(_('You must be the creator of the tag to edit it.'), 404);
return false;
}
$this->tagger = $user->getProfile();
@ -311,9 +305,7 @@ class EditpeopletagAction extends Action
// This might take quite a bit of time.
$this->peopletag->delete();
// send home.
common_redirect(common_local_url('all',
array('nickname' => $this->tagger->nickname)),
303);
common_redirect(common_local_url('all', array('nickname' => $this->tagger->nickname)), 303);
}
if ($tag != $orig->tag) {

View File

@ -351,7 +351,6 @@ class EmailsettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating e-mail preferences.
$this->serverError(_('Could not update user.'));
return;
}
$user->query('COMMIT');
@ -419,7 +418,6 @@ class EmailsettingsAction extends SettingsAction
common_log_db_error($confirm, 'INSERT', __FILE__);
// TRANS: Server error thrown on database error adding e-mail confirmation code.
$this->serverError(_('Could not insert confirmation code.'));
return;
}
mail_confirm_address($user, $confirm->code, $user->nickname, $email);
@ -463,7 +461,6 @@ class EmailsettingsAction extends SettingsAction
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling e-mail address confirmation.
$this->serverError(_('Could not delete email confirmation.'));
return;
}
// TRANS: Message given after successfully canceling e-mail address confirmation.
@ -502,7 +499,6 @@ class EmailsettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered e-mail address.
$this->serverError(_('Could not update user.'));
return;
}
$user->query('COMMIT');

View File

@ -70,7 +70,6 @@ class FavoritesrssAction extends Rss10Action
if (!$this->user) {
// TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist.
$this->clientError(_('No such user.'));
return false;
} else {
$this->notices = $this->getNotices($this->limit);
return true;

View File

@ -40,7 +40,6 @@ class FoafAction extends Action
if (empty($nickname_arg)) {
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a user nickname.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->nickname = common_canonical_nickname($nickname_arg);
@ -51,7 +50,6 @@ class FoafAction extends Action
common_redirect(common_local_url('foaf',
array('nickname' => $this->nickname)),
301);
return false;
}
$this->user = User::getKV('nickname', $this->nickname);
@ -59,7 +57,6 @@ class FoafAction extends Action
if (!$this->user) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
@ -67,7 +64,6 @@ class FoafAction extends Action
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'), 500);
return false;
}
return true;

View File

@ -44,7 +44,6 @@ class FoafGroupAction extends Action
if (empty($nickname_arg)) {
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a group nickname.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->nickname = common_canonical_nickname($nickname_arg);
@ -63,7 +62,6 @@ class FoafGroupAction extends Action
if (!$local) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
@ -71,7 +69,6 @@ class FoafGroupAction extends Action
if (!$this->group) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}
common_set_returnto($this->selfUrl());

View File

@ -71,12 +71,10 @@ class GetfileAction extends Action
if (empty($path) or !file_exists($path)) {
// TRANS: Client error displayed when requesting a non-existent file.
$this->clientError(_('No such file.'), 404);
return false;
}
if (!is_readable($path)) {
// TRANS: Client error displayed when requesting a file without having read access to it.
$this->clientError(_('Cannot read file.'), 403);
return false;
}
$this->path = $path;

View File

@ -59,12 +59,10 @@ class GrantRoleAction extends ProfileFormAction
if (!Profile_role::isValid($this->role)) {
// TRANS: Client error displayed when trying to assign an invalid role to a user.
$this->clientError(_('Invalid role.'));
return false;
}
if (!Profile_role::isSettable($this->role)) {
// TRANS: Client error displayed when trying to assign an reserved role to a user.
$this->clientError(_('This role is reserved and cannot be set.'));
return false;
}
$cur = common_current_user();
@ -74,7 +72,6 @@ class GrantRoleAction extends ProfileFormAction
if (!$cur->hasRight(Right::GRANTROLE)) {
// TRANS: Client error displayed when trying to assign a role to a user while not being allowed to set roles.
$this->clientError(_('You cannot grant user roles on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -82,7 +79,6 @@ class GrantRoleAction extends ProfileFormAction
if ($this->profile->hasRole($this->role)) {
// TRANS: Client error displayed when trying to assign a role to a user that already has that role.
$this->clientError(_('User already has this role.'));
return false;
}
return true;

View File

@ -205,7 +205,6 @@ class GroupblockAction extends RedirectingAction
if (empty($block)) {
// TRANS: Server error displayed when trying to block a user from a group fails because of an application error.
$this->serverError(_("Database error blocking user from group."));
return false;
}
$this->returnToPrevious();

View File

@ -71,7 +71,6 @@ class GroupbyidAction extends Action
if (!$id) {
// TRANS: Client error displayed referring to a group's permalink without providing a group ID.
$this->clientError(_('No ID.'));
return false;
}
common_debug("Got ID $id");
@ -81,7 +80,6 @@ class GroupbyidAction extends Action
if (!$this->group) {
// TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
$this->clientError(_('No such group.'), 404);
return false;
}
return true;

View File

@ -67,7 +67,6 @@ class GrouplogoAction extends GroupAction
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to create a group while not logged in.
$this->clientError(_('You must be logged in to create a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -78,13 +77,11 @@ class GrouplogoAction extends GroupAction
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('grouplogo', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed when trying to change group logo settings without providing a nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$groupid = $this->trimmed('groupid');
@ -101,7 +98,6 @@ class GrouplogoAction extends GroupAction
if (!$this->group) {
// TRANS: Client error displayed when trying to update logo settings for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
@ -109,7 +105,6 @@ class GrouplogoAction extends GroupAction
if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to change group logo settings while not being a group admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
return true;
@ -182,7 +177,6 @@ class GrouplogoAction extends GroupAction
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return;
}
$original = $this->group->original_logo;
@ -389,7 +383,6 @@ class GrouplogoAction extends GroupAction
if (!$filedata) {
// TRANS: Server error displayed trying to crop an uploaded group logo that is no longer present.
$this->serverError(_('Lost our file data.'));
return;
}
// If image is not being cropped assume pos & dimentions of original

View File

@ -69,13 +69,11 @@ class GroupqueueAction extends GroupAction
$args['page'] = $this->page;
}
common_redirect(common_local_url('groupqueue', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed when trying to view group members without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -83,7 +81,6 @@ class GroupqueueAction extends GroupAction
if (!$local) {
// TRANS: Client error displayed when trying to view group members for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
@ -91,14 +88,12 @@ class GroupqueueAction extends GroupAction
if (!$this->group) {
// TRANS: Client error displayed when trying to view group members for an object that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (!$cur || !$cur->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to approve group applicants without being a group administrator.
$this->clientError(_('Only the group admin may approve users.'));
return false;
}
return true;
}

View File

@ -81,13 +81,11 @@ class groupRssAction extends Rss10Action
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('showgroup', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed when requesting a group RSS feed without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -95,7 +93,6 @@ class groupRssAction extends Rss10Action
if (!$local) {
// TRANS: Client error displayed when requesting a group RSS feed for group that does not exist.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
@ -103,7 +100,6 @@ class groupRssAction extends Rss10Action
if (!$this->group) {
// TRANS: Client error displayed when requesting a group RSS feed for an object that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->notices = $this->getNotices($this->limit);

View File

@ -58,48 +58,40 @@ class GroupunblockAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$token = $this->trimmed('token');
if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.'));
return;
}
$id = $this->trimmed('unblockto');
if (empty($id)) {
// TRANS: Client error displayed when trying to unblock a user from a group without providing a profile.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::getKV('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed when trying to unblock a user from a group without providing an existing profile.
$this->clientError(_('No profile with that ID.'));
return false;
}
$group_id = $this->trimmed('unblockgroup');
if (empty($group_id)) {
// TRANS: Client error displayed when trying to unblock a user from a group without providing a group.
$this->clientError(_('No group specified.'));
return false;
}
$this->group = User_group::getKV('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed when trying to unblock a user from a non-existing group.
$this->clientError(_('No such group.'));
return false;
}
$user = common_current_user();
if (!$user->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to unblock a user from a group without being an administrator for the group.
$this->clientError(_('Only an admin can unblock group members.'), 401);
return false;
}
if (!Group_block::isBlocked($this->group, $this->profile)) {
// TRANS: Client error displayed when trying to unblock a non-blocked user from a group.
$this->clientError(_('User is not blocked from group.'));
return false;
}
return true;
}
@ -131,7 +123,6 @@ class GroupunblockAction extends Action
if (!$result) {
// TRANS: Server error displayed when unblocking a user from a group fails because of an unknown error.
$this->serverError(_('Error removing the block.'));
return;
}
foreach ($this->args as $k => $v) {
@ -145,9 +136,7 @@ class GroupunblockAction extends Action
if ($action) {
common_redirect(common_local_url($action, $args), 303);
} else {
common_redirect(common_local_url('blockedfromgroup',
array('nickname' => $this->group->nickname)),
303);
common_redirect(common_local_url('blockedfromgroup', array('nickname' => $this->group->nickname)), 303);
}
}
}

View File

@ -292,7 +292,6 @@ class ImsettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating IM preferences.
$this->serverError(_('Could not update IM preferences.'));
return;
}
}while($user_im_prefs->fetch());
}
@ -364,7 +363,6 @@ class ImsettingsAction extends SettingsAction
common_log_db_error($confirm, 'INSERT', __FILE__);
// TRANS: Server error thrown on database error adding Instant Messaging confirmation code.
$this->serverError(_('Could not insert confirmation code.'));
return;
}
Event::handle('SendImConfirmationCode', array($transport, $screenname, $confirm->code, $user));
@ -407,7 +405,6 @@ class ImsettingsAction extends SettingsAction
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling IM address confirmation.
$this->serverError(_('Could not delete confirmation.'));
return;
}
// TRANS: Message given after successfully canceling IM address confirmation.
@ -445,7 +442,6 @@ class ImsettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered IM address.
$this->serverError(_('Could not update user IM preferences.'));
return;
}
// XXX: unsubscribe to the old address

View File

@ -57,7 +57,6 @@ class JoingroupAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to join a group while not logged in.
$this->clientError(_('You must be logged in to join a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -72,7 +71,6 @@ class JoingroupAction extends Action
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -80,20 +78,17 @@ class JoingroupAction extends Action
if (!$local) {
// TRANS: Client error displayed when trying to join a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to join a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to join a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
@ -101,13 +96,11 @@ class JoingroupAction extends Action
if ($cur->isMember($this->group)) {
// TRANS: Client error displayed when trying to join a group while already a member.
$this->clientError(_('You are already a member of that group.'), 403);
return false;
}
if (Group_block::isBlocked($this->group, $cur->getProfile())) {
// TRANS: Client error displayed when trying to join a group while being blocked form joining it.
$this->clientError(_('You have been blocked from that group by the admin.'), 403);
return false;
}
return true;
@ -165,9 +158,7 @@ class JoingroupAction extends Action
$this->elementEnd('body');
$this->endHTML();
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)), 303);
}
}
}

View File

@ -57,7 +57,6 @@ class LeavegroupAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('You must be logged in to leave a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
@ -72,7 +71,6 @@ class LeavegroupAction extends Action
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -80,20 +78,17 @@ class LeavegroupAction extends Action
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
@ -101,7 +96,6 @@ class LeavegroupAction extends Action
if (!$cur->isMember($this->group)) {
// TRANS: Client error displayed when trying to join a group while already a member.
$this->clientError(_('You are not a member of that group.'), 403);
return false;
}
return true;
@ -147,9 +141,7 @@ class LeavegroupAction extends Action
$this->elementEnd('body');
$this->endHTML();
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)), 303);
}
}
}

View File

@ -60,44 +60,37 @@ class MakeadminAction extends RedirectingAction
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$token = $this->trimmed('token');
if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.'));
return;
}
$id = $this->trimmed('profileid');
if (empty($id)) {
// TRANS: Client error displayed when not providing a profile ID on the Make Admin page.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::getKV('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page.
$this->clientError(_('No profile with that ID.'));
return false;
}
$group_id = $this->trimmed('groupid');
if (empty($group_id)) {
// TRANS: Client error displayed when not providing a group ID on the Make Admin page.
$this->clientError(_('No group specified.'));
return false;
}
$this->group = User_group::getKV('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed when providing an invalid group ID on the Make Admin page.
$this->clientError(_('No such group.'));
return false;
}
$user = common_current_user();
if (!$user->isAdmin($this->group) &&
!$user->hasRight(Right::MAKEGROUPADMIN)) {
// TRANS: Client error displayed when trying to make another user admin on the Make Admin page while not an admin.
$this->clientError(_('Only an admin can make another user an admin.'), 401);
return false;
}
if ($this->profile->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to make another user admin on the Make Admin page who already is admin.
@ -106,7 +99,6 @@ class MakeadminAction extends RedirectingAction
$this->profile->getBestName(),
$this->group->getBestName()),
401);
return false;
}
return true;
}

View File

@ -61,7 +61,6 @@ class MicrosummaryAction extends Action
if (!$user) {
// TRANS: Client error displayed trying to make a micro summary without providing a valid user.
$this->clientError(_('No such user.'), 404);
return;
}
$notice = $user->getCurrentNotice();

View File

@ -62,7 +62,6 @@ class NudgeAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return;
}
$user = common_current_user();
@ -71,7 +70,6 @@ class NudgeAction extends Action
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('showstream',
array('nickname' => $other->nickname)));
return;
}
// CSRF protection
@ -80,13 +78,11 @@ class NudgeAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.'));
return;
}
if (!$other->email || !$other->emailnotifynudge) {
// TRANS: Client error displayed trying to nudge a user that cannot be nudged.
$this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set their email address yet.'));
return;
}
$this->notify($user, $other);

View File

@ -57,7 +57,6 @@ class OauthappssettingsAction extends SettingsAction
if (!common_logged_in()) {
// TRANS: Message displayed to an anonymous user trying to view OAuth application list.
$this->clientError(_('You must be logged in to list your applications.'));
return false;
}
return true;

View File

@ -142,7 +142,6 @@ class OauthconnectionssettingsAction extends SettingsAction
} else {
// TRANS: Client error when submitting a form with unexpected information.
$this->clientError(_('Unexpected form submission.'), 401);
return false;
}
}
@ -163,7 +162,6 @@ class OauthconnectionssettingsAction extends SettingsAction
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;
}
$app = Oauth_application::getKV('id', $appUser->application_id);
@ -178,7 +176,6 @@ class OauthconnectionssettingsAction extends SettingsAction
// 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;
}
$msg = 'API OAuth - user %s (id: %d) revoked access token %s for app id %d';

View File

@ -60,7 +60,6 @@ class OtpAction extends Action
if (common_is_real_login()) {
// TRANS: Client error displayed trying to use "one time password login" when already logged in.
$this->clientError(_('Already logged in.'));
return false;
}
$id = $this->trimmed('user_id');
@ -68,7 +67,6 @@ class OtpAction extends Action
if (empty($id)) {
// TRANS: Client error displayed trying to use "one time password login" without specifying a user.
$this->clientError(_('No user ID specified.'));
return false;
}
$this->user = User::getKV('id', $id);
@ -76,7 +74,6 @@ class OtpAction extends Action
if (empty($this->user)) {
// TRANS: Client error displayed trying to use "one time password login" without using an existing user.
$this->clientError(_('No such user.'));
return false;
}
$this->token = $this->trimmed('token');
@ -84,7 +81,6 @@ class OtpAction extends Action
if (empty($this->token)) {
// TRANS: Client error displayed trying to use "one time password login" without specifying a login token.
$this->clientError(_('No login token specified.'));
return false;
}
$this->lt = Login_token::getKV('user_id', $id);
@ -92,13 +88,11 @@ class OtpAction extends Action
if (empty($this->lt)) {
// TRANS: Client error displayed trying to use "one time password login" without requesting a login token.
$this->clientError(_('No login token requested.'));
return false;
}
if ($this->lt->token != $this->token) {
// TRANS: Client error displayed trying to use "one time password login" while specifying an invalid login token.
$this->clientError(_('Invalid login token specified.'));
return false;
}
if ($this->lt->modified > time() + Login_token::TIMEOUT) {
@ -108,7 +102,6 @@ class OtpAction extends Action
$this->lt = null;
// TRANS: Client error displayed trying to use "one time password login" while specifying an expired login token.
$this->clientError(_('Login token expired.'));
return false;
}
$this->rememberme = $this->boolean('rememberme');
@ -125,7 +118,6 @@ class OtpAction extends Action
if (!common_set_user($this->user)) {
// TRANS: Server error displayed when a user object could not be created trying to login using "one time password login".
$this->serverError(_('Error setting user. You are probably not authorized.'));
return;
}
// We're now logged in; disable the lt

View File

@ -196,10 +196,9 @@ class PasswordsettingsAction extends SettingsAction
}
if (!$user->update($original)) {
// TRANS: Server error displayed on page where to change password when password change
// TRANS: could not be made because of a server error.
$this->serverError(_('Cannot save new password.'));
return;
// TRANS: Server error displayed on page where to change password when password change
// TRANS: could not be made because of a server error.
$this->serverError(_('Cannot save new password.'));
}
Event::handle('EndChangePassword', array($user));
}

View File

@ -78,7 +78,6 @@ class PeopletagAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('peopletag', $args), 301);
return false;
}
$this->tag = $tag;

View File

@ -55,7 +55,6 @@ class PeopletagautocompleteAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
// CSRF protection
@ -66,7 +65,6 @@ class PeopletagautocompleteAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
$profile = $this->user->getProfile();

View File

@ -76,13 +76,11 @@ class PeopletaggedAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('peopletagged', $args), 301);
return false;
}
if (!$tagger) {
// TRANS: Client error displayed when a tagger is expected but not provided.
$this->clientError(_('No tagger.'), 404);
return false;
}
$user = User::getKV('nickname', $tagger);
@ -90,7 +88,6 @@ class PeopletaggedAction extends Action
if (!$user) {
// TRANS: Client error displayed when referring to non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->tagger = $user->getProfile();
@ -99,7 +96,6 @@ class PeopletaggedAction extends Action
if (!$this->peopletag) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
return true;

View File

@ -92,7 +92,6 @@ class PeopletagsbyuserAction extends Action
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsbyuser', $args), 301);
return false;
}
$this->user = User::getKV('nickname', $nickname);
@ -100,7 +99,6 @@ class PeopletagsbyuserAction extends Action
if (!$this->user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->tagger = $this->user->getProfile();
@ -108,7 +106,6 @@ class PeopletagsbyuserAction extends Action
if (!$this->tagger) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@ -146,7 +143,6 @@ class PeopletagsbyuserAction extends Action
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
return;
}
$this->showPage();

View File

@ -74,7 +74,6 @@ class PeopletagsforuserAction extends Action
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsforuser', $args), 301);
return false;
}
$this->user = User::getKV('nickname', $nickname);
@ -82,7 +81,6 @@ class PeopletagsforuserAction extends Action
if (!$this->user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->tagged = $this->user->getProfile();
@ -90,7 +88,6 @@ class PeopletagsforuserAction extends Action
if (!$this->tagged) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;

View File

@ -76,13 +76,11 @@ class PeopletagsubscribersAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('peopletagged', $args), 301);
return false;
}
if (!$tagger) {
// TRANS: Client error displayed when a tagger is expected but not provided.
$this->clientError(_('No tagger.'), 404);
return false;
}
$user = User::getKV('nickname', $tagger);
@ -90,7 +88,6 @@ class PeopletagsubscribersAction extends Action
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->tagger = $user->getProfile();
@ -99,7 +96,6 @@ class PeopletagsubscribersAction extends Action
if (!$this->peopletag) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
return true;

View File

@ -76,7 +76,6 @@ class PeopletagsubscriptionsAction extends Action
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsbyuser', $args), 301);
return false;
}
$user = User::getKV('nickname', $nickname);
@ -84,7 +83,6 @@ class PeopletagsubscriptionsAction extends Action
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $user->getProfile();
@ -92,7 +90,6 @@ class PeopletagsubscriptionsAction extends Action
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;

View File

@ -76,7 +76,6 @@ class PluginEnableAction extends Action
// TRANS: Client error displayed when trying to use another method than POST.
// TRANS: Do not translate POST.
$this->clientError(_('This action only accepts POST requests.'));
return false;
}
// CSRF protection
@ -87,7 +86,6 @@ class PluginEnableAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
// Only for logged-in users
@ -97,13 +95,11 @@ class PluginEnableAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
if (!AdminPanelAction::canAdmin('plugins')) {
// TRANS: Client error displayed when trying to enable or disable a plugin without access rights.
$this->clientError(_('You cannot administer plugins.'));
return false;
}
$this->plugin = $this->arg('plugin');
@ -111,7 +107,6 @@ class PluginEnableAction extends Action
if (!array_key_exists($this->plugin, $defaultPlugins)) {
// TRANS: Client error displayed when trying to enable or disable a non-existing plugin.
$this->clientError(_('No such plugin.'));
return false;
}
return true;

View File

@ -80,7 +80,6 @@ class ProfilecompletionAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
// Only for logged-in users
@ -90,7 +89,6 @@ class ProfilecompletionAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$id = $this->arg('peopletag_id');
@ -99,7 +97,6 @@ class ProfilecompletionAction extends Action
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'));
return false;
}
$field = $this->arg('field');
@ -107,7 +104,6 @@ class ProfilecompletionAction extends Action
// TRANS: Client error displayed when trying to add an unindentified field to profile.
// TRANS: %s is a field name.
$this->clientError(sprintf(_('Unidentified field %s.'), htmlspecialchars($field)), 404);
return false;
}
$this->field = $field;

View File

@ -55,7 +55,6 @@ class ProfiletagbyidAction extends Action
if (!$id) {
// TRANS: Client error displayed trying to perform an action without providing an ID.
$this->clientError(_('No ID.'));
return false;
}
common_debug("Peopletag id $id by user id $tagger_id");
@ -65,7 +64,6 @@ class ProfiletagbyidAction extends Action
if (!$this->peopletag) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
$user = User::getKV('id', $tagger_id);

View File

@ -102,7 +102,6 @@ class PublicAction extends Action
if (!$this->notice) {
// TRANS: Server error displayed when a public timeline cannot be retrieved.
$this->serverError(_('Could not retrieve public timeline.'));
return;
}
if($this->page > 1 && $this->notice->N == 0){

View File

@ -35,7 +35,6 @@ class RecoverpasswordAction extends Action
if (common_logged_in()) {
// TRANS: Client error displayed trying to recover password while already logged in.
$this->clientError(_('You are already logged in!'));
return;
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('recover')) {
$this->recoverPassword();
@ -62,12 +61,10 @@ class RecoverpasswordAction extends Action
if (!$confirm) {
// TRANS: Client error displayed when password recovery code is not correct.
$this->clientError(_('No such recovery code.'));
return;
}
if ($confirm->address_type != 'recover') {
// TRANS: Client error displayed when no proper password recovery code was submitted.
$this->clientError(_('Not a recovery code.'));
return;
}
$user = User::getKV($confirm->user_id);
@ -75,7 +72,6 @@ class RecoverpasswordAction extends Action
if (!$user) {
// TRANS: Server error displayed trying to recover password without providing a user.
$this->serverError(_('Recovery code for unknown user.'));
return;
}
$touched = strtotime($confirm->modified);
@ -89,7 +85,6 @@ class RecoverpasswordAction extends Action
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error displayed removing a password recovery code from the database.
$this->serverError(_('Error with confirmation code.'));
return;
}
// These should be reaped, but for now we just check mod time
@ -102,7 +97,6 @@ class RecoverpasswordAction extends Action
// TRANS: Client error displayed trying to recover password with too old a recovery code.
$this->clientError(_('This confirmation code is too old. ' .
'Please start again.'));
return;
}
// If we used an outstanding confirmation to send the email,
@ -116,7 +110,6 @@ class RecoverpasswordAction extends Action
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error displayed when updating a user's e-mail address in the database fails while recovering a password.
$this->serverError(_('Could not update user with confirmed email address.'));
return;
}
}
@ -310,7 +303,6 @@ class RecoverpasswordAction extends Action
if (!$user) {
// TRANS: Client error displayed when trying to reset as password without providing a user.
$this->clientError(_('Unexpected password reset.'));
return;
}
$newpassword = $this->trimmed('newpassword');
@ -337,7 +329,6 @@ class RecoverpasswordAction extends Action
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Reset password form validation error message.
$this->serverError(_('Cannot save new password.'));
return;
}
$this->clearTempUser();
@ -345,7 +336,6 @@ class RecoverpasswordAction extends Action
if (!common_set_user($user->nickname)) {
// TRANS: Server error displayed when something does wrong with the user object during password reset.
$this->serverError(_('Error setting user.'));
return;
}
common_real_login(true);

View File

@ -93,7 +93,6 @@ class RedirecturlAction extends Action
function handle($argarray=null)
{
common_redirect($this->file->url, 307);
return;
}
/**

View File

@ -79,7 +79,6 @@ class RegisterAction extends Action
if (common_config('site', 'inviteonly') && empty($this->code)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.'));
return false;
}
if (!empty($this->code)) {
@ -87,7 +86,6 @@ class RegisterAction extends Action
if (empty($this->invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation.
$this->clientError(_('Sorry, invalid invitation code.'));
return false;
}
// Store this in case we need it
common_ensure_session();
@ -187,7 +185,6 @@ class RegisterAction extends Action
if (common_config('site', 'inviteonly') && !($code && $invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.'));
return;
}
// Input scrubbing
@ -387,7 +384,6 @@ class RegisterAction extends Action
if (common_config('site', 'inviteonly') && !($code && $invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.'));
return;
}
$this->elementStart('form', array('method' => 'post',

View File

@ -78,7 +78,6 @@ class RemovepeopletagAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
// Only for logged-in users
@ -88,7 +87,6 @@ class RemovepeopletagAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
// Profile to subscribe to
@ -100,7 +98,6 @@ class RemovepeopletagAction extends Action
if (empty($this->tagged)) {
// TRANS: Client error displayed when referring to a non-existing profile.
$this->clientError(_('No such profile.'));
return false;
}
$id = $this->arg('peopletag_id');
@ -109,7 +106,6 @@ class RemovepeopletagAction extends Action
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'));
return false;
}
return true;
@ -146,7 +142,6 @@ class RemovepeopletagAction extends Action
'The remote server is probably not responding correctly, ' .
'please try retrying later.'), $this->profile->profileurl));
}
return false;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');

View File

@ -56,7 +56,6 @@ class RepeatAction extends Action
if (empty($id)) {
// TRANS: Client error displayed when trying to repeat a notice while not providing a notice ID.
$this->clientError(_('No notice specified.'));
return false;
}
$this->notice = Notice::getKV('id', $id);
@ -64,7 +63,6 @@ class RepeatAction extends Action
if (!($this->notice instanceof Notice)) {
// TRANS: Client error displayed when trying to repeat a non-existing notice.
$this->clientError(_('No notice specified.'));
return false;
}
$token = $this->trimmed('token-'.$id);
@ -72,7 +70,6 @@ class RepeatAction extends Action
if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.'));
return false;
}
return true;

View File

@ -70,7 +70,6 @@ class RepliesAction extends Action
if (!$this->user) {
// TRANS: Client error displayed when trying to reply to a non-exsting user.
$this->clientError(_('No such user.'));
return false;
}
$profile = $this->user->getProfile();
@ -78,7 +77,6 @@ class RepliesAction extends Action
if (!$profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;

View File

@ -36,7 +36,6 @@ class RepliesrssAction extends Rss10Action
if (!$this->user) {
// TRANS: Client error displayed when providing a non-existing nickname in a RSS 1.0 action.
$this->clientError(_('No such user.'));
return false;
} else {
$this->notices = $this->getNotices($this->limit);
return true;

View File

@ -59,12 +59,10 @@ class RevokeRoleAction extends ProfileFormAction
if (!Profile_role::isValid($this->role)) {
// TRANS: Client error displayed when trying to revoke an invalid role.
$this->clientError(_('Invalid role.'));
return false;
}
if (!Profile_role::isSettable($this->role)) {
// TRANS: Client error displayed when trying to revoke a reserved role.
$this->clientError(_('This role is reserved and cannot be set.'));
return false;
}
$cur = common_current_user();
@ -74,7 +72,6 @@ class RevokeRoleAction extends ProfileFormAction
if (!$cur->hasRight(Right::REVOKEROLE)) {
// TRANS: Client error displayed when trying to revoke a role without having the right to do that.
$this->clientError(_('You cannot revoke user roles on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -82,7 +79,6 @@ class RevokeRoleAction extends ProfileFormAction
if (!$this->profile->hasRole($this->role)) {
// TRANS: Client error displayed when trying to revoke a role that is not set.
$this->clientError(_('User does not have this role.'));
return false;
}
return true;

View File

@ -101,10 +101,7 @@ class RsdAction extends Action
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
common_redirect(common_local_url('rsd',
array('nickname' => $nickname)),
301);
return false;
common_redirect(common_local_url('rsd', array('nickname' => $nickname)), 301);
}
$this->user = User::getKV('nickname', $nickname);
@ -112,7 +109,6 @@ class RsdAction extends Action
if (empty($this->user)) {
// TRANS: Client error.
$this->clientError(_('No such user.'), 404);
return false;
}
}

View File

@ -62,7 +62,6 @@ class SandboxAction extends ProfileFormAction
if (!$cur->hasRight(Right::SANDBOXUSER)) {
// TRANS: Client error displayed trying to sandbox users on a site where the feature is not enabled.
$this->clientError(_('You cannot sandbox users on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -70,7 +69,6 @@ class SandboxAction extends ProfileFormAction
if ($this->profile->isSandboxed()) {
// TRANS: Client error displayed trying to sandbox an already sandboxed user.
$this->clientError(_('User is already sandboxed.'));
return false;
}
return true;

View File

@ -77,13 +77,11 @@ class ShowApplicationAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed trying to display an OAuth application while not logged in.
$this->clientError(_('You must be logged in to view an application.'));
return false;
}
if (empty($this->application)) {
// TRANS: Client error displayed trying to display a non-existing OAuth application.
$this->clientError(_('No such application.'), 404);
return false;
}
$cur = common_current_user();
@ -91,7 +89,6 @@ class ShowApplicationAction extends Action
if ($cur->id != $this->owner->id) {
// TRANS: Client error displayed trying to display an OAuth application for which the logged in user is not the owner.
$this->clientError(_('You are not the owner of this application.'), 401);
return false;
}
return true;
@ -115,7 +112,6 @@ class ShowApplicationAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'));
return;
}
if ($this->arg('reset')) {

View File

@ -104,7 +104,6 @@ class ShowfavoritesAction extends Action
if (!$this->user) {
// TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
$this->clientError(_('No such user.'));
return false;
}
$this->page = $this->trimmed('page');
@ -132,7 +131,6 @@ class ShowfavoritesAction extends Action
if (empty($this->notice)) {
// TRANS: Server error displayed when favourite notices could not be retrieved from the database.
$this->serverError(_('Could not retrieve favorite notices.'));
return;
}
if($this->page > 1 && $this->notice->N == 0){

View File

@ -74,7 +74,6 @@ class ShowmessageAction extends Action
if (!$this->message) {
// TRANS: Client error displayed requesting a single message that does not exist.
$this->clientError(_('No such message.'), 404);
return false;
}
$this->user = common_current_user();

View File

@ -97,7 +97,6 @@ class ShownoticeAction extends Action
if (empty($this->profile)) {
// TRANS: Server error displayed trying to show a notice without a connected profile.
$this->serverError(_('Notice has no profile.'), 500);
return false;
}
$this->user = User::getKV('id', $this->profile->id);
@ -230,7 +229,6 @@ class ShownoticeAction extends Action
}
if ($target && $target != $this->selfUrl()) {
common_redirect($target, 301);
return false;
}
}
$this->showPage();

View File

@ -61,13 +61,11 @@ class ShowprofiletagAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('showprofiletag', $args), 301);
return false;
}
if (!$tagger) {
// TRANS: Client error displayed when a tagger is expected but not provided.
$this->clientError(_('No tagger.'), 404);
return false;
}
$user = User::getKV('nickname', $tagger);
@ -75,7 +73,6 @@ class ShowprofiletagAction extends Action
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->tagger = $user->getProfile();
@ -88,7 +85,6 @@ class ShowprofiletagAction extends Action
if (!$can_see) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@ -114,7 +110,6 @@ class ShowprofiletagAction extends Action
if (!$this->peopletag) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'));
return;
}
$this->showPage();

View File

@ -62,7 +62,6 @@ class SilenceAction extends ProfileFormAction
if (!$cur->hasRight(Right::SILENCEUSER)) {
// TRANS: Client error displayed trying to silence a user on a site where the feature is not enabled.
$this->clientError(_('You cannot silence users on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -70,7 +69,6 @@ class SilenceAction extends ProfileFormAction
if ($this->profile->isSilenced()) {
// TRANS: Client error displayed trying to silence an already silenced user.
$this->clientError(_('User is already silenced.'));
return false;
}
return true;

View File

@ -173,7 +173,6 @@ class SiteadminpanelAction extends AdminPanelAction
!in_array($values['site']['timezone'], DateTimeZone::listIdentifiers())) {
// TRANS: Client error displayed trying to save site settings without a timezone.
$this->clientError(_('Timezone not selected.'));
return;
}
// Validate language

View File

@ -299,7 +299,6 @@ class SmssettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating SMS preferences.
$this->serverError(_('Could not update user.'));
return;
}
$user->query('COMMIT');
@ -363,7 +362,6 @@ class SmssettingsAction extends SettingsAction
common_log_db_error($confirm, 'INSERT', __FILE__);
// TRANS: Server error thrown on database error adding SMS confirmation code.
$this->serverError(_('Could not insert confirmation code.'));
return;
}
$carrier = Sms_carrier::getKV($carrier_id);
@ -411,7 +409,6 @@ class SmssettingsAction extends SettingsAction
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling SMS phone number confirmation.
$this->serverError(_('Could not delete SMS confirmation.'));
return;
}
// TRANS: Message given after successfully canceling SMS phone number confirmation.
@ -452,7 +449,6 @@ class SmssettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered SMS phone number.
$this->serverError(_('Could not update user.'));
return;
}
$user->query('COMMIT');

View File

@ -31,7 +31,6 @@ class SubeditAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$token = $this->trimmed('token');
@ -40,7 +39,6 @@ class SubeditAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. '.
'Try again, please.'));
return false;
}
$id = $this->trimmed('profile');
@ -48,7 +46,6 @@ class SubeditAction extends Action
if (!$id) {
// TRANS: Client error displayed trying a change a subscription without providing a profile.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::getKV('id', $id);
@ -56,7 +53,6 @@ class SubeditAction extends Action
if (!$this->profile) {
// TRANS: Client error displayed trying a change a subscription for a non-existant profile ID.
$this->clientError(_('No profile with that ID.'));
return false;
}
return true;
@ -74,7 +70,6 @@ class SubeditAction extends Action
if (!$sub) {
// TRANS: Client error displayed trying a change a subscription for a non-subscribed profile.
$this->clientError(_('You are not subscribed to that profile.'));
return false;
}
$orig = clone($sub);
@ -88,12 +83,9 @@ class SubeditAction extends Action
common_log_db_error($sub, 'UPDATE', __FILE__);
// TRANS: Server error displayed when updating a subscription fails with a database error.
$this->serverError(_('Could not save subscription.'));
return false;
}
common_redirect(common_local_url('subscriptions',
array('nickname' => $cur->nickname)),
303);
common_redirect(common_local_url('subscriptions', array('nickname' => $cur->nickname)), 303);
}
}
}

View File

@ -60,7 +60,6 @@ class SubqueueAction extends GalleryAction
if (!$cur || $cur->id != $this->profile->id) {
// TRANS: Client error displayed when trying to approve group applicants without being a group administrator.
$this->clientError(_('You may only approve your own pending subscriptions.'));
return false;
}
return true;
}

View File

@ -74,7 +74,6 @@ class SubscribeAction extends Action
// TRANS: Client error displayed trying to perform any request method other than POST.
// TRANS: Do not translate POST.
$this->clientError(_('This action only accepts POST requests.'));
return false;
}
// CSRF protection
@ -85,7 +84,6 @@ class SubscribeAction extends Action
// TRANS: Client error displayed when the session token is not okay.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
// Only for logged-in users
@ -95,7 +93,6 @@ class SubscribeAction extends Action
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
// Profile to subscribe to
@ -107,7 +104,6 @@ class SubscribeAction extends Action
if (empty($this->other)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$this->clientError(_('No such profile.'));
return false;
}
return true;

View File

@ -57,14 +57,12 @@ class SubscribepeopletagAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to perform an action while not logged in.
$this->clientError(_('You must be logged in to unsubscribe from a list.'));
return false;
}
// Only allow POST requests
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error displayed when trying to use another method than POST.
$this->clientError(_('This action only accepts POST requests.'));
return false;
}
// CSRF protection
@ -75,7 +73,6 @@ class SubscribepeopletagAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
$tagger_arg = $this->trimmed('tagger');
@ -87,13 +84,11 @@ class SubscribepeopletagAction extends Action
} else {
// TRANS: Client error displayed when trying to perform an action without providing an ID.
$this->clientError(_('No ID given.'), 404);
return false;
}
if (!$this->peopletag || $this->peopletag->private) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
$this->tagger = Profile::getKV('id', $this->peopletag->tagger);

View File

@ -34,13 +34,10 @@ class TagAction extends Action
if (!$this->tag) {
common_redirect(common_local_url('publictagcloud'), 301);
return false;
}
if ($this->tag != $taginput) {
common_redirect(common_local_url('tag', array('tag' => $this->tag)),
301);
return false;
common_redirect(common_local_url('tag', array('tag' => $this->tag)), 301);
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;

View File

@ -46,7 +46,6 @@ class TagprofileAction extends Action
if (!$this->profile) {
// TRANS: Client error displayed when referring to non-existing profile ID.
$this->clientError(_('No profile with that ID.'));
return false;
}
}
@ -55,7 +54,6 @@ class TagprofileAction extends Action
// TRANS: Client error displayed when trying to tag a user that cannot be tagged.
$this->clientError(_('You cannot tag this user.'));
}
return true;
}
function handle($args)

View File

@ -33,7 +33,6 @@ class TagrssAction extends Rss10Action
if (!$this->tag) {
// TRANS: Client error when requesting a tag feed for a non-existing tag.
$this->clientError(_('No such tag.'));
return false;
} else {
$this->notices = $this->getNotices($this->limit);
return true;

View File

@ -57,7 +57,6 @@ class UnblockAction extends ProfileFormAction
if (!$cur->hasBlocked($this->profile)) {
// TRANS: Client error displayed when trying to unblock a non-blocked user.
$this->clientError(_("You haven't blocked that user."));
return false;
}
return true;
@ -84,7 +83,6 @@ class UnblockAction extends ProfileFormAction
if (!$result) {
// TRANS: Server error displayed when removing a user block.
$this->serverError(_('Error removing the block.'));
return;
}
}
}

View File

@ -62,7 +62,6 @@ class UnsandboxAction extends ProfileFormAction
if (!$cur->hasRight(Right::SANDBOXUSER)) {
// TRANS: Client error on page to unsandbox a user when the feature is not enabled.
$this->clientError(_('You cannot sandbox users on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -70,7 +69,6 @@ class UnsandboxAction extends ProfileFormAction
if (!$this->profile->isSandboxed()) {
// TRANS: Client error on page to unsilence a user when the to be unsandboxed user has not been sandboxed.
$this->clientError(_('User is not sandboxed.'));
return false;
}
return true;

View File

@ -62,7 +62,6 @@ class UnsilenceAction extends ProfileFormAction
if (!$cur->hasRight(Right::SILENCEUSER)) {
// TRANS: Client error on page to unsilence a user when the feature is not enabled.
$this->clientError(_('You cannot silence users on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
@ -70,7 +69,6 @@ class UnsilenceAction extends ProfileFormAction
if (!$this->profile->isSilenced()) {
// TRANS: Client error on page to unsilence a user when the to be unsilenced user has not been silenced.
$this->clientError(_('User is not silenced.'));
return false;
}
return true;

View File

@ -50,13 +50,11 @@ class UnsubscribeAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return;
}
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions',
array('nickname' => $this->scoped->nickname)));
return;
}
/* Use a session token for CSRF protection. */
@ -67,7 +65,6 @@ class UnsubscribeAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. ' .
'Try again, please.'));
return;
}
$other_id = $this->arg('unsubscribeto');
@ -75,7 +72,6 @@ class UnsubscribeAction extends Action
if (!$other_id) {
// TRANS: Client error displayed when trying to unsubscribe without providing a profile ID.
$this->clientError(_('No profile ID in request.'));
return;
}
$other = Profile::getKV('id', $other_id);
@ -83,7 +79,6 @@ class UnsubscribeAction extends Action
if (!($other instanceof Profile)) {
// TRANS: Client error displayed when trying to unsubscribe while providing a non-existing profile ID.
$this->clientError(_('No profile with that ID.'));
return;
}
try {
@ -104,9 +99,7 @@ class UnsubscribeAction extends Action
$this->elementEnd('body');
$this->endHTML();
} else {
common_redirect(common_local_url('subscriptions',
array('nickname' => $this->scoped->nickname)),
303);
common_redirect(common_local_url('subscriptions', array('nickname' => $this->scoped->nickname)), 303);
}
}
}

View File

@ -58,14 +58,12 @@ class UnsubscribepeopletagAction extends Action
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to perform an action while not logged in.
$this->clientError(_('You must be logged in to unsubscribe from a list.'));
return false;
}
// Only allow POST requests
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error displayed when trying to use another method than POST.
$this->clientError(_('This action only accepts POST requests.'));
return false;
}
// CSRF protection
@ -76,7 +74,6 @@ class UnsubscribepeopletagAction extends Action
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
$tagger_arg = $this->trimmed('tagger');
@ -88,13 +85,11 @@ class UnsubscribepeopletagAction extends Action
} else {
// TRANS: Client error displayed when trying to perform an action without providing an ID.
$this->clientError(_('No ID given.'), 404);
return false;
}
if (!$this->peopletag || $this->peopletag->private) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
return false;
}
$this->tagger = Profile::getKV('id', $this->peopletag->tagger);
@ -137,11 +132,8 @@ class UnsubscribepeopletagAction extends Action
} else {
if (common_get_returnto()) {
common_redirect(common_get_returnto(), 303);
return true;
}
common_redirect(common_local_url('peopletagsbyuser',
array('nickname' => $this->tagger->nickname)),
303);
common_redirect(common_local_url('peopletagsbyuser', array('nickname' => $this->tagger->nickname)), 303);
}
}
}

View File

@ -211,7 +211,6 @@ class UrlsettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error displayed when "Other" settings in user profile could not be updated on the server.
$this->serverError(_('Could not update user.'));
return;
}
$prefs = User_urlshortener_prefs::getPrefs($user);

View File

@ -85,7 +85,6 @@ class UsergroupsAction extends ProfileAction
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('usergroups', $args), 301);
return false;
}
$this->user = User::getKV('nickname', $nickname);
@ -93,7 +92,6 @@ class UsergroupsAction extends ProfileAction
if (!$this->user) {
// TRANS: Client error displayed requesting groups for a non-existing user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
@ -101,7 +99,6 @@ class UsergroupsAction extends ProfileAction
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = $this->trimmed('page', 1);

View File

@ -286,7 +286,6 @@ function main()
// If the request is HTTP and it should be HTTPS...
if ($site_ssl != 'never' && !StatusNet::isHTTPS() && common_is_sensitive($args['action'])) {
common_redirect(common_local_url($args['action'], $args));
return;
}
$args = array_merge($args, $_REQUEST);
@ -297,7 +296,6 @@ function main()
if (!$action || !preg_match('/^[a-zA-Z0-9_-]*$/', $action)) {
common_redirect(common_local_url('public'));
return;
}
// If the site is private, and they're not on one of the "public"
@ -324,7 +322,6 @@ function main()
common_set_returnto(common_local_url($action, $rargs));
common_redirect(common_local_url('login'));
return;
}
$action_class = ucfirst($action).'Action';

View File

@ -69,7 +69,6 @@ class AdminPanelAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return false;
}
$user = common_current_user();
@ -94,7 +93,6 @@ class AdminPanelAction extends Action
if (!$user->hasRight(Right::CONFIGURESITE)) {
// TRANS: Client error message thrown when a user tries to change admin settings but has no access rights.
$this->clientError(_('You cannot make changes to this site.'));
return false;
}
// This panel must be enabled
@ -106,7 +104,6 @@ class AdminPanelAction extends Action
if (!self::canAdmin($name)) {
// TRANS: Client error message throw when a certain panel's settings cannot be changed.
$this->clientError(_('Changes to that panel are not allowed.'), 403);
return false;
}
return true;
@ -220,7 +217,6 @@ class AdminPanelAction extends Action
{
// TRANS: Client error message.
$this->clientError(_('showForm() not implemented.'));
return;
}
/**
@ -248,7 +244,6 @@ class AdminPanelAction extends Action
{
// TRANS: Client error message
$this->clientError(_('saveSettings() not implemented.'));
return;
}
function canAdmin($name)

View File

@ -1324,7 +1324,6 @@ class ApiAction extends Action
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
break;
}
return;
@ -1351,7 +1350,6 @@ class ApiAction extends Action
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
break;
}
return;
}
@ -1406,7 +1404,6 @@ class ApiAction extends Action
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
return;
}
return;
}

View File

@ -63,7 +63,6 @@ class ApiListUsersAction extends ApiBareAuthAction
if (empty($this->list)) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_('List not found.'), 404, $this->format);
return false;
}
if(!$this->create && !$this->delete) {

View File

@ -51,7 +51,6 @@ class GalleryAction extends ProfileAction
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url($this->trimmed('action'), $args), 301);
return false;
}
$this->user = User::getKV('nickname', $nickname);
@ -59,7 +58,6 @@ class GalleryAction extends ProfileAction
if (!$this->user) {
// TRANS: Client error displayed when trying to perform a gallery action with an unknown user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
@ -67,7 +65,6 @@ class GalleryAction extends ProfileAction
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@ -91,7 +88,6 @@ class GalleryAction extends ProfileAction
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
common_redirect($this->selfUrl(), 303);
return;
}
$this->showPage();

View File

@ -61,13 +61,11 @@ class GroupAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('showgroup', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed if no nickname argument was given requesting a group page.
$this->clientError(_('No nickname.'), 404);
return false;
}
$local = Local_group::getKV('nickname', $nickname);
@ -80,12 +78,10 @@ class GroupAction extends Action
$args['page'] = $this->page;
}
common_redirect(common_local_url('groupbyid', $args), 301);
return false;
} else {
common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'");
// TRANS: Client error displayed if no remote group with a given name was found requesting group page.
$this->clientError(_('No such group.'), 404);
return false;
}
}
@ -94,7 +90,6 @@ class GroupAction extends Action
if (!$this->group) {
// TRANS: Client error displayed if no local group with a given name was found requesting group page.
$this->clientError(_('No such group.'), 404);
return false;
}
}

View File

@ -77,16 +77,13 @@ class MailboxAction extends Action
if (!$this->user) {
// TRANS: Client error displayed when trying to access a mailbox without providing a user.
$this->clientError(_('No such user.'), 404);
return;
}
$cur = common_current_user();
if (!$cur || $cur->id != $this->user->id) {
// TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
$this->clientError(_('Only the user can read their own mailboxes.'),
403);
return;
$this->clientError(_('Only the user can read their own mailboxes.'), 403);
}
$this->showPage();

View File

@ -77,7 +77,6 @@ class ProfileFormAction extends RedirectingAction
if (!$id) {
// TRANS: Client error displayed when trying to change user options without specifying a user to work on.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::getKV('id', $id);
@ -85,7 +84,6 @@ class ProfileFormAction extends RedirectingAction
if (!$this->profile) {
// TRANS: Client error displayed when trying to change user options without specifying an existing user to work on.
$this->clientError(_('No profile with that ID.'));
return false;
}
return true;

View File

@ -71,7 +71,6 @@ class SettingsAction extends Action
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return;
} else if (!common_is_real_login()) {
// Cookie theft means that automatic logins can't
// change important settings or see private info, and

Some files were not shown because too many files have changed in this diff Show More