// 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
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
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');
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'));
- return false;
}
return true;
'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');
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;
404,
$this->format
);
- return;
}
// Note: Twitter no longer supports IM
// 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)) {
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();
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);
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);
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);
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)) {
_('Could not determine source user.'),
404
);
- return;
}
if (empty($this->target)) {
_('Could not find target user.'),
404
);
- return;
}
$result = $this->twitterRelationshipArray($this->source, $this->target);
_('This method requires a POST.'),
400, $this->format
);
- return;
}
// Workaround for PHP returning empty $_POST and $_FILES when POST
'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;
$upload = MediaFile::fromUpload('media', $this->auth_user->getProfile());
} catch (Exception $e) {
$this->clientError($e->getMessage(), $e->getCode());
- return;
}
if (isset($upload)) {
} else {
// TRANS: Client error displayed when uploading a media file has failed.
$this->clientError(_('Upload failed.'));
- return;
}
}
common_debug(var_export($req, true));
$code = $e->getCode();
$this->clientError($e->getMessage(), empty($code) ? 401 : $code, 'text');
- return;
}
if (empty($atok)) {
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']) {
default:
// TRANS: Client error displayed calling an unsupported HTTP error in API status show.
$this->clientError(_('HTTP method not supported.'), 405);
- return;
}
}
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) ||
!$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))) {
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');
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
}
$local = Local_group::getKV('nickname', $nickname);
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)) {
} 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,
$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);
}
}
}
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,
default:
// TRANS: Client error shown when using a non-supported HTTP method.
$this->clientError(_('HTTP method not supported.'), 405);
- return;
}
return;
default:
// TRANS: Client exception thrown when using an unsupported HTTP method.
$this->clientError(_('HTTP method not supported.'), 405);
- return;
}
return;
$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);
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];
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)
// 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)) {
$this->clientError(sprintf(_('Already subscribed to %s.'),
$person->id),
409);
- return;
}
if (Subscription::start($this->_profile, $profile)) {
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;
}
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',
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',
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'])
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;
if (!$result) {
// TRANS: Server error displayed when blocking a user fails.
$this->serverError(_('Failed to save block information.'));
- return;
}
}
$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);
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);
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;
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');
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
}
$local = Local_group::getKV('nickname', $nickname);
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)) {
// 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();
$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);
}
}
}
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();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)));
- return;
}
/* Use a session token for CSRF protection. */
// 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');
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);
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,
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();
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');
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);
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') {
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();
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();
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;
}
}
// 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');
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');
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();
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;
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')) {
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');
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
}
$local = Local_group::getKV('nickname', $nickname);
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;
} 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);
}
}
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);
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;
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');
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;
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();
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');
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');
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();
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;
}
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.'));
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');
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;
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);
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();
// 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) {
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');
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);
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.
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');
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;
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);
common_redirect(common_local_url('foaf',
array('nickname' => $this->nickname)),
301);
- return false;
}
$this->user = User::getKV('nickname', $this->nickname);
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();
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;
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);
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);
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());
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;
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();
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
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;
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();
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");
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;
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');
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');
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();
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;
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;
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
$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);
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);
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;
}
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);
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);
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);
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;
}
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) {
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);
}
}
}
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());
}
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));
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.
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
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');
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
}
$local = Local_group::getKV('nickname', $nickname);
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();
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;
$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);
}
}
}
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');
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
}
$local = Local_group::getKV('nickname', $nickname);
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 (!$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;
$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);
}
}
}
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.
$this->profile->getBestName(),
$this->group->getBestName()),
401);
- return false;
}
return true;
}
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();
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();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('showstream',
array('nickname' => $other->nickname)));
- return;
}
// CSRF protection
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);
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;
} else {
// TRANS: Client error when submitting a form with unexpected information.
$this->clientError(_('Unexpected form submission.'), 401);
- return false;
}
}
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);
// 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';
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');
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);
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');
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);
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) {
$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');
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
}
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));
}
$args['page'] = $this->page;
}
common_redirect(common_local_url('peopletag', $args), 301);
- return false;
}
$this->tag = $tag;
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
// 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();
$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);
if (!$user) {
// TRANS: Client error displayed when referring to non-existing user.
$this->clientError(_('No such user.'), 404);
- return false;
}
$this->tagger = $user->getProfile();
if (!$this->peopletag) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_('No such list.'), 404);
- return false;
}
return true;
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsbyuser', $args), 301);
- return false;
}
$this->user = User::getKV('nickname', $nickname);
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();
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;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
- return;
}
$this->showPage();
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsforuser', $args), 301);
- return false;
}
$this->user = User::getKV('nickname', $nickname);
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();
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;
$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);
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();
if (!$this->peopletag) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'), 404);
- return false;
}
return true;
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('peopletagsbyuser', $args), 301);
- return false;
}
$user = User::getKV('nickname', $nickname);
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();
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;
// 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
// 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
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');
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;
// 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
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');
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');
// 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;
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");
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);
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){
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();
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);
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);
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
// 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,
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;
}
}
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');
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Reset password form validation error message.
$this->serverError(_('Cannot save new password.'));
- return;
}
$this->clearTempUser();
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);
function handle($argarray=null)
{
common_redirect($this->file->url, 307);
- return;
}
/**
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)) {
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();
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
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',
// 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
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
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');
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->clientError(_('No such list.'));
- return false;
}
return true;
'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');
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);
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);
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;
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();
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;
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;
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();
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
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;
// 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);
if (empty($this->user)) {
// TRANS: Client error.
$this->clientError(_('No such user.'), 404);
- return false;
}
}
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
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;
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();
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;
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')) {
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');
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){
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();
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);
}
if ($target && $target != $this->selfUrl()) {
common_redirect($target, 301);
- return false;
}
}
$this->showPage();
$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);
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();
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;
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();
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
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;
!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
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');
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);
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.
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');
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');
// 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');
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);
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;
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);
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);
}
}
}
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;
}
// 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
// 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
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
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;
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
// 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');
} 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);
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;
if (!$this->profile) {
// TRANS: Client error displayed when referring to non-existing profile ID.
$this->clientError(_('No profile with that ID.'));
- return false;
}
}
// 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)
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;
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;
if (!$result) {
// TRANS: Server error displayed when removing a user block.
$this->serverError(_('Error removing the block.'));
- return;
}
}
}
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
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;
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
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;
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. */
// 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');
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);
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 {
$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);
}
}
}
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
// 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');
} 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);
} 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);
}
}
}
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);
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('usergroups', $args), 301);
- return false;
}
$this->user = User::getKV('nickname', $nickname);
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();
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);
// 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);
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"
common_set_returnto(common_local_url($action, $rargs));
common_redirect(common_local_url('login'));
- return;
}
$action_class = ucfirst($action).'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();
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
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;
{
// TRANS: Client error message.
$this->clientError(_('showForm() not implemented.'));
- return;
}
/**
{
// TRANS: Client error message
$this->clientError(_('saveSettings() not implemented.'));
- return;
}
function canAdmin($name)
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- break;
}
return;
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- break;
}
return;
}
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- return;
}
return;
}
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) {
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url($this->trimmed('action'), $args), 301);
- return false;
}
$this->user = User::getKV('nickname', $nickname);
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();
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;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
common_redirect($this->selfUrl(), 303);
- return;
}
$this->showPage();
$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);
$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;
}
}
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;
}
}
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();
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);
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;
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
// TRANS: Client error.
_m('Could not disfavor notice! Please make sure your browser has cookies enabled.')
);
- return;
}
$id = $this->trimmed('notice');
common_log_db_error($fave, 'DELETE', __FILE__);
// TRANS: Server error.
$this->serverError(_m('Could not delete favorite.'));
- return;
}
$profile->blowFavesCache();
if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error.
- $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.')
- );
- return;
+ $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.'));
}
$id = $this->trimmed('notice');
if ($profile->hasFave($notice)) {
// TRANS: Client error.
$this->clientError(_m('This notice is already a favorite!'));
- return;
}
$fave = Fave::addNew($profile, $notice);
if (!$fave) {
// TRANS: Server error.
$this->serverError(_m('Could not create favorite.'));
- return;
}
$profile->blowFavesCache();
if (!$this->user) {
// TRANS: Client error displayed when trying to display bookmarks for a non-existing user.
$this->clientError(_('No such user.'));
- return false;
}
$action->menuItem(common_local_url('bookmarks', array('nickname' => $this->user->nickname)),
if (empty($this->user)) {
// TRANS: Client error displayed when requesting most recent favourite notices by a user for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
- return;
}
$this->notices = $this->getNotices();
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
- break;
}
}
if (!$this->user) {
// TRANS: Client error displayed when trying to display bookmarks for a non-existing user.
$this->clientError(_('No such user.'));
- return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
if (!$this->user) {
// TRANS: Client error displayed when trying to get the RSS feed with bookmarks of a user that does not exist.
$this->clientError(_('No such user.'));
- return false;
} else {
$this->notices = $this->getNotices($this->limit);
return true;
if (!$user) {
// TRANS: Server error displayed when trying to log in with incorrect username or password.
$this->serverError(_m('Incorrect username or password.'));
- return;
}
// success!
if (!common_set_user($user)) {
// TRANS: Server error displayed when login fails in CAS authentication plugin.
$this->serverError(_m('Error setting user. You are probably not authorized.'));
- return;
}
common_real_login(true);
if (!empty($cur)) {
common_redirect(common_local_url('all', array('nickname' => $cur->nickname)));
- return;
}
switch ($this->state) {
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_m('Not logged in.'));
- return;
}
if (!empty($this->start)) {
} else {
// TRANS: Client error when submitting a form with unexpected information.
$this->clientError(_m('Unexpected form submission.'));
- return;
}
if ($this->boolean('ajax')) {
common_log_db_error($profile, 'UPDATE', __FILE__);
// TRANS: Server error thrown when user profile settings could not be saved.
$this->serverError(_m('Could not save profile.'));
- return;
}
// Set the user tags
if (!$result) {
// TRANS: Server error thrown when user profile settings tags could not be saved.
$this->serverError(_m('Could not save tags.'));
- return;
}
Event::handle('EndProfileSaveForm', array($this));
$action->logout();
common_redirect($logoutUrl, 303);
- return false; // probably never get here, but hey
}
return true;
if (empty($this->accessToken)) {
$this->clientError(_m("Unable to authenticate you with Facebook."));
- return false;
}
$graphUrl = 'https://graph.facebook.com/me?access_token=' . urlencode($this->accessToken);
// TRANS: in the same StatusNet site.
_m('There is already a local account linked with that Facebook account.')
);
-
- return;
}
$cur = common_current_user();
// TRANS: in the same StatusNet site.
_m('There is already a local account linked with that Facebook account.')
);
-
- return;
}
}
if (common_config('site', 'closed')) {
// TRANS: Client error trying to register with registrations not allowed.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = null;
if (empty($code)) {
// TRANS: Client error trying to register with registrations 'invite only'.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: Client error trying to register with an invalid invitation code.
$this->clientError(_m('Not a valid invitation code.'));
- return;
}
}
if (!$result) {
// TRANS: Server error displayed when connecting to Facebook fails.
$this->serverError(_m('Error connecting user to Facebook.'));
- return;
}
// Add a Foreign_user record
if (empty($result)) {
// TRANS: Server error displayed when connecting to Facebook fails.
$this->serverError(_m('Error connecting user to Facebook.'));
- return;
}
}
common_log_db_error($user, 'DELETE', __FILE__);
// TRANS: Server error displayed when deleting the link to a Facebook account fails.
$this->serverError(_m('Could not delete link to Facebook.'));
- return;
}
// TRANS: Confirmation message. StatusNet account was unlinked from Facebook.
$field->systemname = $this->trimmed('systemname');
if (!gnusocial_field_systemname_validate($field->systemname)) {
$this->clientError(_('Internal system name must be unique and consist of only alphanumeric characters!'));
- return false;
}
if ($field->id) {
if ($field->validate())
$field->update();
else {
$this->clientError(_('There was an error with the field data.'));
- return false;
}
}
else {
if ($nickname != $nicknameArg) {
$url = common_local_url('groupinbox', array('nickname' => $nickname));
common_redirect($url);
- return false;
}
$localGroup = Local_group::getKV('nickname', $nickname);
if ($nickname != $nicknameArg) {
$url = common_local_url('newgroupmessage', array('nickname' => $nickname));
common_redirect($url, 301);
- return false;
}
$localGroup = Local_group::getKV('nickname', $nickname);
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error when deleting IRC nickname confirmation.
$this->serverError(_m('Could not delete confirmation.'));
- return;
}
}
}
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url($this->trimmed('action'), $args), 301);
- return false;
}
$this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when referring to a non-existing user.
$this->clientError(_m('No such user.'), 404);
- return false;
}
$this->profile = $this->user->getProfile();
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_m('User has no profile.'));
- return false;
}
$page = $this->trimmed('page');
} else {
// TRANS: Client error displayed when not providing a valid path in parameter "f".
$this->clientError(_m('The parameter "f" is not a valid path.'),404);
- return false;
}
}else{
// TRANS: Client error displayed when not providing parameter "f".
$this->clientError(_m('The parameter "f" is required but missing.'),500);
- return false;
}
}
default:
// TRANS: Client error displayed when trying to minify an unsupported file type.
$this->clientError(_m('File type not supported.'),500);
- return false;
}
return $out;
}
// redirect to the new profile.
common_redirect(common_local_url('tagprofile', array('id' => $oprofile->profile_id)), 303);
- return false;
} catch (Exception $e) {
// TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
if (Group_block::isBlocked($this->group, $profile)) {
// TRANS: Client error displayed when trying to join a group the user is blocked from by a group admin.
$this->clientError(_m('You have been blocked from that group by the admin.'), 403);
- return false;
}
try {
if (common_logged_in()) {
// TRANS: Client error displayed when trying to list a local object as if it is remote.
$this->clientError(_m('You can use the local list functionality!'));
- return false;
}
$this->nickname = $this->trimmed('nickname');
$action = trim($args['action']);
if (in_array($action, array('login', 'register'))) {
common_redirect(common_local_url('openidlogin'));
- exit(0);
} else if ($action == 'passwordsettings') {
common_redirect(common_local_url('openidsettings'));
- exit(0);
} else if ($action == 'recoverpassword') {
// TRANS: Client exception thrown when an action is not available.
throw new ClientException(_m('Unavailable action.'));
{
if (common_config('site', 'openid_only') || (!empty($user) && User_openid::hasOpenID($user->id))) {
common_redirect(common_local_url('openidlogin'), 303);
- return false;
}
return true;
}
if (common_config('site', 'closed')) {
// TRANS: OpenID plugin message. No new user registration is allowed on the site.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = null;
if (empty($code)) {
// TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and none was provided.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and the one provided was not valid.
$this->clientError(_m('Not a valid invitation code.'));
- return;
}
}
if (!$display || !$canonical) {
// TRANS: OpenID plugin server error. A stored OpenID cannot be retrieved.
$this->serverError(_m('Stored OpenID not found.'));
- return;
}
// Possible race condition... let's be paranoid
if ($other) {
// TRANS: OpenID plugin server error.
$this->serverError(_m('Creating new account for OpenID that already has a user.'));
- return;
}
Event::handle('StartOpenIDCreateNewUser', array($canonical, &$sreg));
Event::handle('EndRegistrationTry', array($this));
- common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
- 303);
+ common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)), 303);
}
function connectUser()
if (!$display || !$canonical) {
// TRANS: OpenID plugin server error. A stored OpenID cannot be found.
$this->serverError(_m('Stored OpenID not found.'));
- return;
}
$result = oid_link_user($user->id, $canonical, $display);
if (!$result) {
// TRANS: OpenID plugin server error. The user or user profile could not be saved.
$this->serverError(_m('Error connecting user to OpenID.'));
- return;
}
if (Event::handle('StartOpenIDUpdateUser', array($user, $canonical, &$sreg))) {
// were POSTed here.
common_set_returnto($_SERVER['REQUEST_URI']);
common_redirect(common_local_url('login'), 303);
- return;
}
}else if(common_profile_url($user->nickname) == $request->identity || $request->idSelect()){
$user_openid_trustroot = User_openid_trustroot::pkeyGet(
// prompting user for form resubmission if we
// were POSTed here.
common_redirect(common_local_url('openidtrust'), 303);
- return;
}
}else{
//user has previously authorized this trust root
/* Go log in, and then come back. */
common_set_returnto($_SERVER['REQUEST_URI']);
common_redirect(common_local_url('login'));
- return;
}
$this->trust_root = $_SESSION['openid_trust_root'];
$this->allowUrl = $_SESSION['openid_allow_url'];
if(empty($this->trust_root) || empty($this->allowUrl) || empty($this->denyUrl)){
// TRANS: Client error when visiting page directly.
$this->clientError(_m('This page should only be reached during OpenID processing, not directly.'));
- return;
}
return true;
}
// TRANS: Client error displayed trying to perform any request method other than POST.
// TRANS: Do not translate POST.
$this->clientError(_m('This action only accepts POST requests.'));
- return false;
}
// CSRF protection
// TRANS: Client error displayed when the session token is not okay.
$this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
- return false;
}
// Only for logged-in users
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_m('Not logged in.'));
- return false;
}
// Profile to subscribe to
if (empty($this->search)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$this->clientError(_m('No such profile.'));
- return false;
}
return true;
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error displayed when trying to use another method than POST.
$this->clientError(_m('This action only accepts POST requests.'));
- return false;
}
// CSRF protection
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
- return false;
}
// Only for logged-in users
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_m('Not logged in.'));
- return false;
}
return true;
}
// TRANS: Client error displayed trying to perform any request method other than POST.
// TRANS: Do not translate POST.
$this->clientError(_m('This action only accepts POST requests.'));
- return false;
}
// CSRF protection
// TRANS: Client error displayed when the session token is not okay.
$this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
- return false;
}
// Only for logged-in users
if (empty($this->user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_m('Not logged in.'));
- return false;
}
// Profile to subscribe to
if (empty($this->tag)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$this->clientError(_m('No such profile.'));
- return false;
}
return true;
if (common_config('site', 'closed')) {
// TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = null;
if (empty($code)) {
// TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
- return;
}
$invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: Client error displayed when trying to create a new user with an invalid invitation code.
$this->clientError(_m('Not a valid invitation code.'));
- return;
}
}
if (empty($user)) {
// TRANS: Server error displayed when creating a new user has failed.
$this->serverError(_m('Error registering user.'));
- return;
}
$result = $this->saveForeignLink($user->id,
if (!$result) {
// TRANS: Server error displayed when connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
- return;
}
common_set_user($user);
Event::handle('EndRegistrationTry', array($this));
- common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
- 303);
+ common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)), 303);
}
function connectNewUser()
if (!$result) {
// TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
- return;
}
common_debug('TwitterBridge Plugin - ' .
if (empty($result)) {
// TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
- return;
}
common_debug('TwitterBridge Plugin - ' .
if (empty($flink)) {
// TRANS: Client error displayed when trying to remove a connected Twitter account when there isn't one connected.
$this->clientError(_m('No Twitter connection to remove.'));
- return;
}
$result = $flink->safeDelete();
common_log_db_error($flink, 'DELETE', __FILE__);
// TRANS: Server error displayed when trying to remove a connected Twitter account fails.
$this->serverError(_m('Could not remove Twitter user.'));
- return;
}
// TRANS: Success message displayed after disconnecting a Twitter account.
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_m('Not logged in.'));
- return;
}
$user = common_current_user();
if (!$user->hasRight(UserFlagPlugin::REVIEWFLAGS)) {
// TRANS: Error message displayed when trying to review profile flags while not authorised.
$this->clientError(_m('You cannot review profile flags.'));
- return false;
}
$this->page = $this->trimmed('page');