diff options
Diffstat (limited to 'actions')
66 files changed, 273 insertions, 273 deletions
diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 072ce27eb..ad03b7019 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -38,7 +38,7 @@ class AccesstokenAction extends Action common_debug('printing the access token', __FILE__); print $token; } catch (OAuthException $e) { - common_server_error($e->getMessage()); + $this->serverError($e->getMessage()); } } } diff --git a/actions/all.php b/actions/all.php index a8a74fb33..4ad7f12ae 100644 --- a/actions/all.php +++ b/actions/all.php @@ -33,14 +33,14 @@ class AllAction extends StreamAction $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->client_error(_('No such user.')); + $this->clientError(_('No such user.')); return; } $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } diff --git a/actions/allrss.php b/actions/allrss.php index 660afb9e2..56818d605 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -34,7 +34,7 @@ class AllrssAction extends Rss10Action $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); return false; } else { return true; diff --git a/actions/api.php b/actions/api.php index 9cbf9a468..64971774d 100644 --- a/actions/api.php +++ b/actions/api.php @@ -103,10 +103,10 @@ class ApiAction extends Action call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata); } else { - common_user_error("API method not found!", $code=404); + $this->clientError("API method not found!", $code=404); } } else { - common_user_error("API method not found!", $code=404); + $this->clientError("API method not found!", $code=404); } } diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 666f386f6..d2d078b61 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -26,28 +26,28 @@ class AvatarbynicknameAction extends Action parent::handle($args); $nickname = $this->trimmed('nickname'); if (!$nickname) { - $this->client_error(_('No nickname.')); + $this->clientError(_('No nickname.')); return; } $size = $this->trimmed('size'); if (!$size) { - $this->client_error(_('No size.')); + $this->clientError(_('No size.')); return; } $size = strtolower($size); if (!in_array($size, array('original', '96', '48', '24'))) { - $this->client_error(_('Invalid size.')); + $this->clientError(_('Invalid size.')); return; } $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->client_error(_('No such user.')); + $this->clientError(_('No such user.')); return; } $profile = $user->getProfile(); if (!$profile) { - $this->client_error(_('User has no profile.')); + $this->clientError(_('User has no profile.')); return; } if ($size == 'original') { diff --git a/actions/block.php b/actions/block.php index f8f6f24fd..738cbfbf7 100644 --- a/actions/block.php +++ b/actions/block.php @@ -30,28 +30,28 @@ class BlockAction extends Action parent::prepare($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return false; } $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } $id = $this->trimmed('blockto'); if (!$id) { - $this->client_error(_('No profile specified.')); + $this->clientError(_('No profile specified.')); return false; } $this->profile = Profile::staticGet('id', $id); if (!$this->profile) { - $this->client_error(_('No profile with that ID.')); + $this->clientError(_('No profile with that ID.')); return false; } @@ -119,14 +119,14 @@ class BlockAction extends Action $cur = common_current_user(); if ($cur->hasBlocked($this->profile)) { - $this->client_error(_('You have already blocked this user.')); + $this->clientError(_('You have already blocked this user.')); return; } $result = $cur->block($this->profile); if (!$result) { - $this->server_error(_('Failed to save block information.')); + $this->serverError(_('Failed to save block information.')); return; } diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index 31a157768..53410fbe6 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -32,26 +32,26 @@ class ConfirmaddressAction extends Action } $code = $this->trimmed('code'); if (!$code) { - $this->client_error(_('No confirmation code.')); + $this->clientError(_('No confirmation code.')); return; } $confirm = Confirm_address::staticGet('code', $code); if (!$confirm) { - $this->client_error(_('Confirmation code not found.')); + $this->clientError(_('Confirmation code not found.')); return; } $cur = common_current_user(); if ($cur->id != $confirm->user_id) { - $this->client_error(_('That confirmation code is not for you!')); + $this->clientError(_('That confirmation code is not for you!')); return; } $type = $confirm->address_type; if (!in_array($type, array('email', 'jabber', 'sms'))) { - $this->server_error(sprintf(_('Unrecognized address type %s'), $type)); + $this->serverError(sprintf(_('Unrecognized address type %s'), $type)); return; } if ($cur->$type == $confirm->address) { - $this->client_error(_('That address has already been confirmed.')); + $this->clientError(_('That address has already been confirmed.')); return; } @@ -71,7 +71,7 @@ class ConfirmaddressAction extends Action if (!$result) { common_log_db_error($cur, 'UPDATE', __FILE__); - $this->server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } @@ -83,7 +83,7 @@ class ConfirmaddressAction extends Action if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - $this->server_error(_('Couldn\'t delete email confirmation.')); + $this->serverError(_('Couldn\'t delete email confirmation.')); return; } diff --git a/actions/deleteprofile.php b/actions/deleteprofile.php index ef4687d5f..cc236f847 100644 --- a/actions/deleteprofile.php +++ b/actions/deleteprofile.php @@ -24,7 +24,7 @@ class DeleteprofileAction extends Action function handle($args) { parent::handle($args); - $this->server_error(_('Code not yet ready.')); + $this->serverError(_('Code not yet ready.')); return; if ('POST' === $_SERVER['REQUEST_METHOD']) { $this->handle_post(); diff --git a/actions/disfavor.php b/actions/disfavor.php index 9a27f34b1..fc36f7c75 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -28,7 +28,7 @@ class DisfavorAction extends Action parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return; } @@ -46,7 +46,7 @@ class DisfavorAction extends Action $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { - $this->client_error(_("There was a problem with your session token. Try again, please.")); + $this->clientError(_("There was a problem with your session token. Try again, please.")); return; } @@ -54,7 +54,7 @@ class DisfavorAction extends Action $fave->user_id = $this->id; $fave->notice_id = $notice->id; if (!$fave->find(true)) { - $this->client_error(_('This notice is not a favorite!')); + $this->clientError(_('This notice is not a favorite!')); return; } @@ -62,7 +62,7 @@ class DisfavorAction extends Action if (!$result) { common_log_db_error($fave, 'DELETE', __FILE__); - $this->server_error(_('Could not delete favorite.')); + $this->serverError(_('Could not delete favorite.')); return; } diff --git a/actions/doc.php b/actions/doc.php index 98da31267..3d14b25b8 100644 --- a/actions/doc.php +++ b/actions/doc.php @@ -28,7 +28,7 @@ class DocAction extends Action $title = $this->trimmed('title'); $filename = INSTALLDIR.'/doc/'.$title; if (!file_exists($filename)) { - common_user_error(_('No such document.')); + $this->clientError(_('No such document.')); return; } $c = file_get_contents($filename); diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 39f186bff..6210c07b4 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -182,7 +182,7 @@ class EmailsettingsAction extends SettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } @@ -232,7 +232,7 @@ class EmailsettingsAction extends SettingsAction if ($result === false) { common_log_db_error($confirm, 'INSERT', __FILE__); - common_server_error(_('Couldn\'t insert confirmation code.')); + $this->serverError(_('Couldn\'t insert confirmation code.')); return; } @@ -260,7 +260,7 @@ class EmailsettingsAction extends SettingsAction if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - $this->server_error(_('Couldn\'t delete email confirmation.')); + $this->serverError(_('Couldn\'t delete email confirmation.')); return; } @@ -286,7 +286,7 @@ class EmailsettingsAction extends SettingsAction $result = $user->updateKeys($original); if (!$result) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } $user->query('COMMIT'); @@ -308,7 +308,7 @@ class EmailsettingsAction extends SettingsAction if (!$user->updateKeys($orig)) { common_log_db_error($user, 'UPDATE', __FILE__); - $this->server_error(_("Couldn't update user record.")); + $this->serverError(_("Couldn't update user record.")); } $this->show_form(_('Incoming email address removed.'), true); @@ -323,7 +323,7 @@ class EmailsettingsAction extends SettingsAction if (!$user->updateKeys($orig)) { common_log_db_error($user, 'UPDATE', __FILE__); - $this->server_error(_("Couldn't update user record.")); + $this->serverError(_("Couldn't update user record.")); } $this->show_form(_('New incoming email address added.'), true); diff --git a/actions/facebookremove.php b/actions/facebookremove.php index a200fefbf..d0a0dd951 100644 --- a/actions/facebookremove.php +++ b/actions/facebookremove.php @@ -53,7 +53,7 @@ class FacebookremoveAction extends FacebookAction if (!$result) { common_log_db_error($flink, 'DELETE', __FILE__); - common_server_error(_('Couldn\'t remove Facebook user.')); + $this->serverError(_('Couldn\'t remove Facebook user.')); return; } diff --git a/actions/favor.php b/actions/favor.php index 1dfef9bbb..8d751a7a9 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -29,7 +29,7 @@ class FavorAction extends Action parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return; } @@ -48,19 +48,19 @@ class FavorAction extends Action $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { - $this->client_error(_("There was a problem with your session token. Try again, please.")); + $this->clientError(_("There was a problem with your session token. Try again, please.")); return; } if ($user->hasFave($notice)) { - $this->client_error(_('This notice is already a favorite!')); + $this->clientError(_('This notice is already a favorite!')); return; } $fave = Fave::addNew($user, $notice); if (!$fave) { - $this->server_error(_('Could not create favorite.')); + $this->serverError(_('Could not create favorite.')); return; } diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php index 8c7ce52bf..3f4ffc63a 100644 --- a/actions/favoritesrss.php +++ b/actions/favoritesrss.php @@ -34,7 +34,7 @@ class FavoritesrssAction extends Rss10Action $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); return false; } else { return true; diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index 7de631712..708e8d4bf 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -28,7 +28,7 @@ class FinishaddopenidAction extends Action { parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); } else { $this->try_login(); } diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 112429002..bc33ac330 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -28,7 +28,7 @@ class FinishopenidloginAction extends Action { parent::handle($args); if (common_logged_in()) { - common_user_error(_('Already logged in.')); + $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { @@ -179,7 +179,7 @@ class FinishopenidloginAction extends Action # FIXME: save invite code before redirect, and check here if (common_config('site', 'closed') || common_config('site', 'inviteonly')) { - common_user_error(_('Registration not allowed.')); + $this->clientError(_('Registration not allowed.')); return; } @@ -205,7 +205,7 @@ class FinishopenidloginAction extends Action list($display, $canonical, $sreg) = $this->get_saved_values(); if (!$display || !$canonical) { - common_server_error(_('Stored OpenID not found.')); + $this->serverError(_('Stored OpenID not found.')); return; } @@ -214,7 +214,7 @@ class FinishopenidloginAction extends Action $other = oid_get_user($canonical); if ($other) { - common_server_error(_('Creating new account for OpenID that already has a user.')); + $this->serverError(_('Creating new account for OpenID that already has a user.')); return; } @@ -274,14 +274,14 @@ class FinishopenidloginAction extends Action list($display, $canonical, $sreg) = $this->get_saved_values(); if (!$display || !$canonical) { - common_server_error(_('Stored OpenID not found.')); + $this->serverError(_('Stored OpenID not found.')); return; } $result = oid_link_user($user->id, $canonical, $display); if (!$result) { - common_server_error(_('Error connecting user to OpenID.')); + $this->serverError(_('Error connecting user to OpenID.')); return; } diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index cee3a1818..f9094a50c 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -30,14 +30,14 @@ class FinishremotesubscribeAction extends Action parent::handle($args); if (common_logged_in()) { - common_user_error(_('You can use the local subscription!')); + $this->clientError(_('You can use the local subscription!')); return; } $omb = $_SESSION['oauth_authorization_request']; if (!$omb) { - common_user_error(_('Not expecting this response!')); + $this->clientError(_('Not expecting this response!')); return; } @@ -51,38 +51,38 @@ class FinishremotesubscribeAction extends Action # I think this is the success metric if ($token != $omb['token']) { - common_user_error(_('Not authorized.')); + $this->clientError(_('Not authorized.')); return; } $version = $req->get_parameter('omb_version'); if ($version != OMB_VERSION_01) { - common_user_error(_('Unknown version of OMB protocol.')); + $this->clientError(_('Unknown version of OMB protocol.')); return; } $nickname = $req->get_parameter('omb_listener_nickname'); if (!$nickname) { - common_user_error(_('No nickname provided by remote server.')); + $this->clientError(_('No nickname provided by remote server.')); return; } $profile_url = $req->get_parameter('omb_listener_profile'); if (!$profile_url) { - common_user_error(_('No profile URL returned by server.')); + $this->clientError(_('No profile URL returned by server.')); return; } if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) { - common_user_error(_('Invalid profile URL returned by server.')); + $this->clientError(_('Invalid profile URL returned by server.')); return; } if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) { - common_user_error(_('You can use the local subscription!')); + $this->clientError(_('You can use the local subscription!')); return; } @@ -91,14 +91,14 @@ class FinishremotesubscribeAction extends Action $user = User::staticGet('nickname', $omb['listenee']); if (!$user) { - common_user_error(_('User being listened to doesn\'t exist.')); + $this->clientError(_('User being listened to doesn\'t exist.')); return; } $other = User::staticGet('uri', $omb['listener']); if ($other) { - common_user_error(_('You can use the local subscription!')); + $this->clientError(_('You can use the local subscription!')); return; } @@ -111,7 +111,7 @@ class FinishremotesubscribeAction extends Action list($newtok, $newsecret) = $this->access_token($omb); if (!$newtok || !$newsecret) { - common_user_error(_('Couldn\'t convert request tokens to access tokens.')); + $this->clientError(_('Couldn\'t convert request tokens to access tokens.')); return; } @@ -155,7 +155,7 @@ class FinishremotesubscribeAction extends Action $profile->created = DB_DataObject_Cast::dateTime(); # current time $id = $profile->insert(); if (!$id) { - common_server_error(_('Error inserting new profile')); + $this->serverError(_('Error inserting new profile')); return; } $remote->id = $id; @@ -163,7 +163,7 @@ class FinishremotesubscribeAction extends Action if ($avatar_url) { if (!$this->add_avatar($profile, $avatar_url)) { - common_server_error(_('Error inserting avatar')); + $this->serverError(_('Error inserting avatar')); return; } } @@ -173,19 +173,19 @@ class FinishremotesubscribeAction extends Action if ($exists) { if (!$remote->update($orig_remote)) { - common_server_error(_('Error updating remote profile')); + $this->serverError(_('Error updating remote profile')); return; } } else { $remote->created = DB_DataObject_Cast::dateTime(); # current time if (!$remote->insert()) { - common_server_error(_('Error inserting remote profile')); + $this->serverError(_('Error inserting remote profile')); return; } } if ($user->hasBlocked($profile)) { - $this->client_error(_('That user has blocked you from subscribing.')); + $this->clientError(_('That user has blocked you from subscribing.')); return; } @@ -215,7 +215,7 @@ class FinishremotesubscribeAction extends Action if (!$result) { common_log_db_error($sub, ($sub_exists) ? 'UPDATE' : 'INSERT', __FILE__); - common_user_error(_('Couldn\'t insert new subscription.')); + $this->clientError(_('Couldn\'t insert new subscription.')); return; } diff --git a/actions/foaf.php b/actions/foaf.php index 6f73ce505..a0f8a1ff3 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -40,14 +40,14 @@ class FoafAction extends Action $user = User::staticGet('nickname', $nickname); if (!$user) { - common_user_error(_('No such user.'), 404); + $this->clientError(_('No such user.'), 404); return; } $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.'), 500); + $this->serverError(_('User has no profile.'), 500); return; } diff --git a/actions/imsettings.php b/actions/imsettings.php index 693f49efa..14df3451a 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -149,7 +149,7 @@ class ImsettingsAction extends SettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } @@ -199,7 +199,7 @@ class ImsettingsAction extends SettingsAction if ($result === false) { common_log_db_error($confirm, 'INSERT', __FILE__); - common_server_error(_('Couldn\'t insert confirmation code.')); + $this->serverError(_('Couldn\'t insert confirmation code.')); return; } @@ -231,7 +231,7 @@ class ImsettingsAction extends SettingsAction if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - $this->server_error(_('Couldn\'t delete email confirmation.')); + $this->serverError(_('Couldn\'t delete email confirmation.')); return; } @@ -257,7 +257,7 @@ class ImsettingsAction extends SettingsAction $result = $user->updateKeys($original); if (!$result) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } $user->query('COMMIT'); diff --git a/actions/invite.php b/actions/invite.php index 15233602e..879264deb 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -31,7 +31,7 @@ class InviteAction extends Action { parent::handle($args); if (!common_logged_in()) { - $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'), + $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'), common_config('site', 'name'))); return; } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { diff --git a/actions/login.php b/actions/login.php index fd98e656d..060d16ad6 100644 --- a/actions/login.php +++ b/actions/login.php @@ -31,7 +31,7 @@ class LoginAction extends Action { parent::handle($args); if (common_is_real_login()) { - common_user_error(_('Already logged in.')); + $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->check_login(); } else { @@ -46,7 +46,7 @@ class LoginAction extends Action # CSRF protection - token set in common_notice_form() $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } @@ -55,7 +55,7 @@ class LoginAction extends Action if (common_check_user($nickname, $password)) { # success! if (!common_set_user($nickname)) { - common_server_error(_('Error setting user.')); + $this->serverError(_('Error setting user.')); return; } common_real_login(true); @@ -81,7 +81,7 @@ class LoginAction extends Action # success! if (!common_set_user($user)) { - common_server_error(_('Error setting user.')); + $this->serverError(_('Error setting user.')); return; } diff --git a/actions/logout.php b/actions/logout.php index 201378730..3001f3613 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -33,7 +33,7 @@ class LogoutAction extends Action { parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); } else { common_set_user(null); common_real_login(false); # not logged in diff --git a/actions/microsummary.php b/actions/microsummary.php index 13ddc4e3e..b46c5bee5 100644 --- a/actions/microsummary.php +++ b/actions/microsummary.php @@ -31,14 +31,14 @@ class MicrosummaryAction extends Action $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->client_error(_('No such user'), 404); + $this->clientError(_('No such user'), 404); return; } $notice = $user->getCurrentNotice(); if (!$notice) { - $this->client_error(_('No current status'), 404); + $this->clientError(_('No current status'), 404); } header('Content-Type: text/plain'); diff --git a/actions/newmessage.php b/actions/newmessage.php index 6221b67e9..510a5f8f3 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -27,7 +27,7 @@ class NewmessageAction extends Action parent::handle($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in.'), 403); + $this->clientError(_('Not logged in.'), 403); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->save_new_message(); } else { @@ -71,10 +71,10 @@ class NewmessageAction extends Action $this->show_form(_('No recipient specified.')); return; } else if (!$user->mutuallySubscribed($other)) { - $this->client_error(_('You can\'t send a message to this user.'), 404); + $this->clientError(_('You can\'t send a message to this user.'), 404); return; } else if ($user->id == $other->id) { - $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403); + $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403); return; } @@ -113,12 +113,12 @@ class NewmessageAction extends Action $other = User::staticGet('id', $to); if (!$other) { - $this->client_error(_('No such user'), 404); + $this->clientError(_('No such user'), 404); return; } if (!$user->mutuallySubscribed($other)) { - $this->client_error(_('You can\'t send a message to this user.'), 404); + $this->clientError(_('You can\'t send a message to this user.'), 404); return; } diff --git a/actions/newnotice.php b/actions/newnotice.php index 89792d95a..cb02854a1 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -29,13 +29,13 @@ class NewnoticeAction extends Action parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { # CSRF protection - token set in common_notice_form() $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } diff --git a/actions/noticesearch.php b/actions/noticesearch.php index d998b9da8..336e39bd3 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -97,7 +97,7 @@ class NoticesearchAction extends SearchAction $profile = $notice->getProfile(); if (!$profile) { common_log_db_error($notice, 'SELECT', __FILE__); - $this->server_error(_('Notice without matching profile')); + $this->serverError(_('Notice without matching profile')); return; } # XXX: RDFa diff --git a/actions/nudge.php b/actions/nudge.php index de930e462..49223d431 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -29,7 +29,7 @@ class NudgeAction extends Action parent::handle($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return; } @@ -46,12 +46,12 @@ class NudgeAction extends Action $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } if (!$other->email || !$other->emailnotifynudge) { - $this->client_error(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.')); + $this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.')); return; } diff --git a/actions/openidlogin.php b/actions/openidlogin.php index 82791af34..d1989e0de 100644 --- a/actions/openidlogin.php +++ b/actions/openidlogin.php @@ -28,7 +28,7 @@ class OpenidloginAction extends Action { parent::handle($args); if (common_logged_in()) { - common_user_error(_('Already logged in.')); + $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $openid_url = $this->trimmed('openid_url'); diff --git a/actions/othersettings.php b/actions/othersettings.php index 97cbd0094..51f6f8197 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -177,7 +177,7 @@ class OthersettingsAction extends SettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } diff --git a/actions/peopletag.php b/actions/peopletag.php index 2680638d7..7bcfcb93e 100644 --- a/actions/peopletag.php +++ b/actions/peopletag.php @@ -32,7 +32,7 @@ class PeopletagAction extends Action $tag = $this->trimmed('tag'); if (!common_valid_profile_tag($tag)) { - $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag)); + $this->clientError(sprintf(_('Not a valid people tag: %s'), $tag)); return; } diff --git a/actions/postnotice.php b/actions/postnotice.php index dec62a678..0b4735296 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -36,7 +36,7 @@ class PostnoticeAction extends Action print "omb_version=".OMB_VERSION_01; } } catch (OAuthException $e) { - common_server_error($e->getMessage()); + $this->serverError($e->getMessage()); return; } } @@ -45,36 +45,36 @@ class PostnoticeAction extends Action { $version = $req->get_parameter('omb_version'); if ($version != OMB_VERSION_01) { - common_user_error(_('Unsupported OMB version'), 400); + $this->clientError(_('Unsupported OMB version'), 400); return false; } # First, check to see $listenee = $req->get_parameter('omb_listenee'); $remote_profile = Remote_profile::staticGet('uri', $listenee); if (!$remote_profile) { - common_user_error(_('Profile unknown'), 403); + $this->clientError(_('Profile unknown'), 403); return false; } $sub = Subscription::staticGet('token', $token->key); if (!$sub) { - common_user_error(_('No such subscription'), 403); + $this->clientError(_('No such subscription'), 403); return false; } $content = $req->get_parameter('omb_notice_content'); $content_shortened = common_shorten_links($content); if (mb_strlen($content_shortened) > 140) { - common_user_error(_('Invalid notice content'), 400); + $this->clientError(_('Invalid notice content'), 400); return false; } $notice_uri = $req->get_parameter('omb_notice'); if (!Validate::uri($notice_uri) && !common_valid_tag($notice_uri)) { - common_user_error(_('Invalid notice uri'), 400); + $this->clientError(_('Invalid notice uri'), 400); return false; } $notice_url = $req->get_parameter('omb_notice_url'); if ($notice_url && !common_valid_http_url($notice_url)) { - common_user_error(_('Invalid notice url'), 400); + $this->clientError(_('Invalid notice url'), 400); return false; } $notice = Notice::staticGet('uri', $notice_uri); diff --git a/actions/profilesettings.php b/actions/profilesettings.php index ef45fc1d9..6ad3f2ef5 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -125,7 +125,7 @@ class ProfilesettingsAction extends SettingsAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->server_error(_('User without matching profile')); + $this->serverError(_('User without matching profile')); return; } @@ -298,7 +298,7 @@ class ProfilesettingsAction extends SettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } else { # Re-initialize language environment if it changed @@ -318,7 +318,7 @@ class ProfilesettingsAction extends SettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user for autosubscribe.')); + $this->serverError(_('Couldn\'t update user for autosubscribe.')); return; } } @@ -341,7 +341,7 @@ class ProfilesettingsAction extends SettingsAction if (!$result) { common_log_db_error($profile, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t save profile.')); + $this->serverError(_('Couldn\'t save profile.')); return; } @@ -350,7 +350,7 @@ class ProfilesettingsAction extends SettingsAction $result = $user->setSelfTags($tags); if (!$result) { - common_server_error(_('Couldn\'t save tags.')); + $this->serverError(_('Couldn\'t save tags.')); return; } @@ -475,7 +475,7 @@ class ProfilesettingsAction extends SettingsAction } if (!$user->update($original)) { - common_server_error(_('Can\'t save new password.')); + $this->serverError(_('Can\'t save new password.')); return; } diff --git a/actions/public.php b/actions/public.php index 62071eccc..0ceeef98e 100644 --- a/actions/public.php +++ b/actions/public.php @@ -165,7 +165,7 @@ class PublicAction extends Action NOTICES_PER_PAGE + 1); if (!$notice) { - $this->server_error(_('Could not retrieve public stream.')); + $this->serverError(_('Could not retrieve public stream.')); return; } diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index 3e6ecfb1f..3d839e751 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -30,7 +30,7 @@ class RecoverpasswordAction extends Action { parent::handle($args); if (common_logged_in()) { - $this->client_error(_('You are already logged in!')); + $this->clientError(_('You are already logged in!')); return; } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($this->arg('recover')) { @@ -38,7 +38,7 @@ class RecoverpasswordAction extends Action } else if ($this->arg('reset')) { $this->reset_password(); } else { - $this->client_error(_('Unexpected form submission.')); + $this->clientError(_('Unexpected form submission.')); } } else { if ($this->trimmed('code')) { @@ -56,18 +56,18 @@ class RecoverpasswordAction extends Action $confirm = Confirm_address::staticGet('code', $code); if (!$confirm) { - $this->client_error(_('No such recovery code.')); + $this->clientError(_('No such recovery code.')); return; } if ($confirm->address_type != 'recover') { - $this->client_error(_('Not a recovery code.')); + $this->clientError(_('Not a recovery code.')); return; } $user = User::staticGet($confirm->user_id); if (!$user) { - $this->server_error(_('Recovery code for unknown user.')); + $this->serverError(_('Recovery code for unknown user.')); return; } @@ -80,7 +80,7 @@ class RecoverpasswordAction extends Action if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - common_server_error(_('Error with confirmation code.')); + $this->serverError(_('Error with confirmation code.')); return; } @@ -91,7 +91,7 @@ class RecoverpasswordAction extends Action common_log(LOG_WARNING, 'Attempted redemption on recovery code ' . 'that is ' . $touched . ' seconds old. '); - $this->client_error(_('This confirmation code is too old. ' . + $this->clientError(_('This confirmation code is too old. ' . 'Please start again.')); return; } @@ -105,7 +105,7 @@ class RecoverpasswordAction extends Action $result = $user->updateKeys($orig); if (!$result) { common_log_db_error($user, 'UPDATE', __FILE__); - $this->server_error(_('Could not update user with confirmed email address.')); + $this->serverError(_('Could not update user with confirmed email address.')); return; } } @@ -240,7 +240,7 @@ class RecoverpasswordAction extends Action } if (!$user->email && !$confirm_email) { - $this->client_error(_('No registered email address for that user.')); + $this->clientError(_('No registered email address for that user.')); return; } @@ -254,7 +254,7 @@ class RecoverpasswordAction extends Action if (!$confirm->insert()) { common_log_db_error($confirm, 'INSERT', __FILE__); - $this->server_error(_('Error saving address confirmation.')); + $this->serverError(_('Error saving address confirmation.')); return; } @@ -298,7 +298,7 @@ class RecoverpasswordAction extends Action $user = $this->get_temp_user(); if (!$user) { - $this->client_error(_('Unexpected password reset.')); + $this->clientError(_('Unexpected password reset.')); return; } @@ -322,14 +322,14 @@ class RecoverpasswordAction extends Action if (!$user->update($original)) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Can\'t save new password.')); + $this->serverError(_('Can\'t save new password.')); return; } $this->clear_temp_user(); if (!common_set_user($user->nickname)) { - common_server_error(_('Error setting user.')); + $this->serverError(_('Error setting user.')); return; } diff --git a/actions/register.php b/actions/register.php index bac179687..b4d0d43fb 100644 --- a/actions/register.php +++ b/actions/register.php @@ -26,9 +26,9 @@ class RegisterAction extends Action parent::handle($args); if (common_config('site', 'closed')) { - common_user_error(_('Registration not allowed.')); + $this->clientError(_('Registration not allowed.')); } else if (common_logged_in()) { - common_user_error(_('Already logged in.')); + $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->try_register(); } else { @@ -65,7 +65,7 @@ class RegisterAction extends Action } if (common_config('site', 'inviteonly') && !($code && $invite)) { - $this->client_error(_('Sorry, only invited people can register.')); + $this->clientError(_('Sorry, only invited people can register.')); return; } @@ -115,7 +115,7 @@ class RegisterAction extends Action } # success! if (!common_set_user($user)) { - common_server_error(_('Error setting user.')); + $this->serverError(_('Error setting user.')); return; } # this is a real login @@ -179,7 +179,7 @@ class RegisterAction extends Action } if (common_config('site', 'inviteonly') && !($code && $invite)) { - $this->client_error(_('Sorry, only invited people can register.')); + $this->clientError(_('Sorry, only invited people can register.')); return; } diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index b9e29d645..32e9bf3d3 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -30,7 +30,7 @@ class RemotesubscribeAction extends Action parent::handle($args); if (common_logged_in()) { - common_user_error(_('You can use the local subscription!')); + $this->clientError(_('You can use the local subscription!')); return; } @@ -342,7 +342,7 @@ class RemotesubscribeAction extends Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->server_error(_('User without matching profile')); + $this->serverError(_('User without matching profile')); return; } diff --git a/actions/replies.php b/actions/replies.php index 878550888..84fd894ff 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -40,7 +40,7 @@ class RepliesAction extends StreamAction $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -57,7 +57,7 @@ class RepliesAction extends StreamAction function no_such_user() { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); } function show_header($user) diff --git a/actions/repliesrss.php b/actions/repliesrss.php index 5f85f8d2e..43be133a4 100644 --- a/actions/repliesrss.php +++ b/actions/repliesrss.php @@ -34,7 +34,7 @@ class RepliesrssAction extends Rss10Action $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); return false; } else { return true; diff --git a/actions/requesttoken.php b/actions/requesttoken.php index a74548739..378db4403 100644 --- a/actions/requesttoken.php +++ b/actions/requesttoken.php @@ -39,7 +39,7 @@ class RequesttokenAction extends Action $token = $server->fetch_request_token($req); print $token; } catch (OAuthException $e) { - common_server_error($e->getMessage()); + $this->serverError($e->getMessage()); } } } diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 1dec3ba5b..caa823893 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -33,14 +33,14 @@ class ShowfavoritesAction extends StreamAction $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->client_error(_('No such user.')); + $this->clientError(_('No such user.')); return; } $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -90,7 +90,7 @@ class ShowfavoritesAction extends StreamAction $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); if (!$notice) { - $this->server_error(_('Could not retrieve favorite notices.')); + $this->serverError(_('Could not retrieve favorite notices.')); return; } diff --git a/actions/showmessage.php b/actions/showmessage.php index 25330a568..d13e9f671 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -32,7 +32,7 @@ class ShowmessageAction extends MailboxAction $message = $this->get_message(); if (!$message) { - $this->client_error(_('No such message.'), 404); + $this->clientError(_('No such message.'), 404); return; } @@ -41,7 +41,7 @@ class ShowmessageAction extends MailboxAction if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) { $this->show_page($cur, 1); } else { - $this->client_error(_('Only the sender and recipient may read this message.'), 403); + $this->clientError(_('Only the sender and recipient may read this message.'), 403); return; } } diff --git a/actions/shownotice.php b/actions/shownotice.php index c519af0ba..82d4bd270 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -37,14 +37,14 @@ class ShownoticeAction extends StreamAction $this->notice = Notice::staticGet($id); if (!$this->notice) { - $this->client_error(_('No such notice.'), 404); + $this->clientError(_('No such notice.'), 404); return false; } $this->profile = $this->notice->getProfile(); if (!$this->profile) { - $this->server_error(_('Notice has no profile'), 500); + $this->serverError(_('Notice has no profile'), 500); return false; } @@ -119,6 +119,6 @@ class ShownoticeAction extends StreamAction function no_such_notice() { - common_user_error(_('No such notice.')); + $this->clientError(_('No such notice.')); } } diff --git a/actions/showstream.php b/actions/showstream.php index 9a59f7ae4..ed38c67f9 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -56,7 +56,7 @@ class ShowstreamAction extends StreamAction $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -159,7 +159,7 @@ class ShowstreamAction extends StreamAction function no_such_user() { - $this->client_error(_('No such user.'), 404); + $this->clientError(_('No such user.'), 404); } function show_profile($profile) diff --git a/actions/smssettings.php b/actions/smssettings.php index 1be45d1ce..c5879e4d9 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -168,7 +168,7 @@ class SmssettingsAction extends EmailsettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } @@ -218,7 +218,7 @@ class SmssettingsAction extends EmailsettingsAction if ($result === false) { common_log_db_error($confirm, 'INSERT', __FILE__); - common_server_error(_('Couldn\'t insert confirmation code.')); + $this->serverError(_('Couldn\'t insert confirmation code.')); return; } @@ -254,7 +254,7 @@ class SmssettingsAction extends EmailsettingsAction if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - $this->server_error(_('Couldn\'t delete email confirmation.')); + $this->serverError(_('Couldn\'t delete email confirmation.')); return; } @@ -283,7 +283,7 @@ class SmssettingsAction extends EmailsettingsAction $result = $user->updateKeys($original); if (!$result) { common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t update user.')); + $this->serverError(_('Couldn\'t update user.')); return; } $user->query('COMMIT'); diff --git a/actions/subedit.php b/actions/subedit.php index 1142b7a03..e22384869 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -30,28 +30,28 @@ class SubeditAction extends Action parent::prepare($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return false; } $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } $id = $this->trimmed('profile'); if (!$id) { - $this->client_error(_('No profile specified.')); + $this->clientError(_('No profile specified.')); return false; } $this->profile = Profile::staticGet('id', $id); if (!$this->profile) { - $this->client_error(_('No profile with that ID.')); + $this->clientError(_('No profile with that ID.')); return false; } @@ -68,7 +68,7 @@ class SubeditAction extends Action 'subscribed' => $this->profile->id)); if (!$sub) { - $this->client_error(_('You are not subscribed to that profile.')); + $this->clientError(_('You are not subscribed to that profile.')); return false; } @@ -81,7 +81,7 @@ class SubeditAction extends Action if (!$result) { common_log_db_error($sub, 'UPDATE', __FILE__); - $this->server_error(_('Could not save subscription.')); + $this->serverError(_('Could not save subscription.')); return false; } diff --git a/actions/subscribe.php b/actions/subscribe.php index 99f9acc24..b6f03f0f1 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -27,7 +27,7 @@ class SubscribeAction extends Action parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return; } @@ -43,7 +43,7 @@ class SubscribeAction extends Action $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } @@ -52,14 +52,14 @@ class SubscribeAction extends Action $other = User::staticGet('id', $other_id); if (!$other) { - $this->client_error(_('Not a local user.')); + $this->clientError(_('Not a local user.')); return; } $result = subs_subscribe_to($user, $other); if($result != true) { - common_user_error($result); + $this->clientError($result); return; } diff --git a/actions/tagother.php b/actions/tagother.php index f0105ec8b..e11e3a00d 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -30,7 +30,7 @@ class TagotherAction extends Action parent::handle($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in'), 403); + $this->clientError(_('Not logged in'), 403); return; } @@ -39,12 +39,12 @@ class TagotherAction extends Action } else { $id = $this->trimmed('id'); if (!$id) { - $this->client_error(_('No id argument.')); + $this->clientError(_('No id argument.')); return; } $profile = Profile::staticGet('id', $id); if (!$profile) { - $this->client_error(_('No profile with that ID.')); + $this->clientError(_('No profile with that ID.')); return; } $this->show_form($profile); @@ -121,7 +121,7 @@ class TagotherAction extends Action $profile = Profile::staticGet('id', $id); if (!$profile) { - $this->client_error(_('No such profile.')); + $this->clientError(_('No such profile.')); return; } @@ -147,14 +147,14 @@ class TagotherAction extends Action !Subscription::pkeyGet(array('subscriber' => $profile->id, 'subscribed' => $user->id))) { - $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.')); + $this->clientError(_('You can only tag people you are subscribed to or who are subscribed to you.')); return; } $result = Profile_tag::setTags($user->id, $profile->id, $tags); if (!$result) { - $this->client_error(_('Could not save tags.')); + $this->clientError(_('Could not save tags.')); return; } diff --git a/actions/tagrss.php b/actions/tagrss.php index 912d71413..b0227ab39 100644 --- a/actions/tagrss.php +++ b/actions/tagrss.php @@ -32,7 +32,7 @@ class TagrssAction extends Rss10Action $this->tag = Notice_tag::staticGet('tag', $tag); if (!$this->tag) { - common_user_error(_('No such tag.')); + $this->clientError(_('No such tag.')); return false; } else { return true; diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php index 79e1ed990..e51a29a2d 100644 --- a/actions/twitapiaccount.php +++ b/actions/twitapiaccount.php @@ -29,7 +29,7 @@ class TwitapiaccountAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } @@ -39,7 +39,7 @@ class TwitapiaccountAction extends TwitterapiAction function end_session($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } function update_location($args, $apidata) @@ -47,7 +47,7 @@ class TwitapiaccountAction extends TwitterapiAction parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']); return; } @@ -56,7 +56,7 @@ class TwitapiaccountAction extends TwitterapiAction if (!is_null($location) && strlen($location) > 255) { // XXX: But Twitter just truncates and runs with it. -- Zach - $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']); + $this->clientError(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']); return; } @@ -64,7 +64,7 @@ class TwitapiaccountAction extends TwitterapiAction $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -75,7 +75,7 @@ class TwitapiaccountAction extends TwitterapiAction if (!$result) { common_log_db_error($profile, 'UPDATE', __FILE__); - common_server_error(_('Couldn\'t save profile.')); + $this->serverError(_('Couldn\'t save profile.')); return; } @@ -91,12 +91,12 @@ class TwitapiaccountAction extends TwitterapiAction function update_delivery_device($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } function rate_limit_status($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } }
\ No newline at end of file diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php index 5d64f2f7d..8135adef3 100644 --- a/actions/twitapiblocks.php +++ b/actions/twitapiblocks.php @@ -32,7 +32,7 @@ class TwitapiblocksAction extends TwitterapiAction $blockee = $this->get_user($apidata['api_arg'], $apidata); if (!$blockee) { - $this->client_error('Not Found', 404, $apidata['content-type']); + $this->clientError('Not Found', 404, $apidata['content-type']); return; } @@ -44,7 +44,7 @@ class TwitapiblocksAction extends TwitterapiAction $this->show_profile($blockee, $type); $this->end_document($type); } else { - common_server_error(_('Block user failed.')); + $this->serverError(_('Block user failed.')); } } @@ -54,7 +54,7 @@ class TwitapiblocksAction extends TwitterapiAction $blockee = $this->get_user($apidata['api_arg'], $apidata); if (!$blockee) { - $this->client_error('Not Found', 404, $apidata['content-type']); + $this->clientError('Not Found', 404, $apidata['content-type']); return; } @@ -66,7 +66,7 @@ class TwitapiblocksAction extends TwitterapiAction $this->show_profile($blockee, $type); $this->end_document($type); } else { - common_server_error(_('Unblock user failed.')); + $this->serverError(_('Unblock user failed.')); } } }
\ No newline at end of file diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php index 36d2a7e09..db55e8cd0 100644 --- a/actions/twitapidirect_messages.php +++ b/actions/twitapidirect_messages.php @@ -108,7 +108,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction $this->show_json_dmsgs($message); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); } } @@ -119,7 +119,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']); return; } @@ -134,11 +134,11 @@ class Twitapidirect_messagesAction extends TwitterapiAction $content = $this->trimmed('text'); if (!$content) { - $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']); + $this->clientError(_('No message text!'), $code = 406, $apidata['content-type']); } else { $content_shortened = common_shorten_links($content); if (mb_strlen($content_shortened) > 140) { - $this->client_error(_('That\'s too long. Max message size is 140 chars.'), + $this->clientError(_('That\'s too long. Max message size is 140 chars.'), $code = 406, $apidata['content-type']); return; } @@ -147,15 +147,15 @@ class Twitapidirect_messagesAction extends TwitterapiAction $other = $this->get_user($this->trimmed('user')); if (!$other) { - $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']); + $this->clientError(_('Recipient user not found.'), $code = 403, $apidata['content-type']); return; } else if (!$user->mutuallySubscribed($other)) { - $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'), + $this->clientError(_('Can\'t send direct messages to users who aren\'t your friend.'), $code = 403, $apidata['content-type']); return; } else if ($user->id == $other->id) { // Sending msgs to yourself is allowed by Twitter - $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), + $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), $code = 403, $apidata['content-type']); return; } @@ -164,7 +164,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source); if (is_string($message)) { - $this->server_error($message); + $this->serverError($message); return; } @@ -181,7 +181,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction function destroy($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } function show_xml_dmsgs($message) diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php index 55e04732f..737b7229f 100644 --- a/actions/twitapifavorites.php +++ b/actions/twitapifavorites.php @@ -32,14 +32,14 @@ class TwitapifavoritesAction extends TwitterapiAction $user = $this->get_user($apidata['api_arg'], $apidata); if (!$user) { - $this->client_error('Not Found', 404, $apidata['content-type']); + $this->clientError('Not Found', 404, $apidata['content-type']); return; } $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -56,7 +56,7 @@ class TwitapifavoritesAction extends TwitterapiAction $notice = $user->favoriteNotices((($page-1)*20), $count); if (!$notice) { - common_server_error(_('Could not retrieve favorite notices.')); + $this->serverError(_('Could not retrieve favorite notices.')); return; } @@ -82,7 +82,7 @@ class TwitapifavoritesAction extends TwitterapiAction $this->show_json_timeline($notice); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); } } @@ -94,12 +94,12 @@ class TwitapifavoritesAction extends TwitterapiAction // Check for RESTfulness if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { // XXX: Twitter just prints the err msg, no XML / JSON. - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); return; } if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } @@ -109,20 +109,20 @@ class TwitapifavoritesAction extends TwitterapiAction $notice = Notice::staticGet($notice_id); if (!$notice) { - $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']); + $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']); return; } // XXX: Twitter lets you fave things repeatedly via api. if ($user->hasFave($notice)) { - $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']); + $this->clientError(_('This notice is already a favorite!'), 403, $apidata['content-type']); return; } $fave = Fave::addNew($user, $notice); if (!$fave) { - common_server_error(_('Could not create favorite.')); + $this->serverError(_('Could not create favorite.')); return; } @@ -140,7 +140,7 @@ class TwitapifavoritesAction extends TwitterapiAction function destroy($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } // XXX: these two funcs swiped from faves. Maybe put in util.php, or some common base class? diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index 458ff48a5..c50c5e84a 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -29,7 +29,7 @@ class TwitapifriendshipsAction extends TwitterapiAction parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']); return; } @@ -38,7 +38,7 @@ class TwitapifriendshipsAction extends TwitterapiAction $other = $this->get_user($id); if (!$other) { - $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']); + $this->clientError(_('Could not follow user: User not found.'), 403, $apidata['content-type']); return; } @@ -46,7 +46,7 @@ class TwitapifriendshipsAction extends TwitterapiAction if ($user->isSubscribed($other)) { $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname); - $this->client_error($errmsg, 403, $apidata['content-type']); + $this->clientError($errmsg, 403, $apidata['content-type']); return; } @@ -62,7 +62,7 @@ class TwitapifriendshipsAction extends TwitterapiAction if (!$result) { $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname); - $this->client_error($errmsg, 400, $apidata['content-type']); + $this->clientError($errmsg, 400, $apidata['content-type']); return; } @@ -82,7 +82,7 @@ class TwitapifriendshipsAction extends TwitterapiAction parent::handle($args); if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); return; } @@ -102,7 +102,7 @@ class TwitapifriendshipsAction extends TwitterapiAction $sub->delete(); $sub->query('COMMIT'); } else { - $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']); + $this->clientError(_('You are not friends with the specified user.'), 403, $apidata['content-type']); return; } @@ -118,7 +118,7 @@ class TwitapifriendshipsAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } @@ -129,7 +129,7 @@ class TwitapifriendshipsAction extends TwitterapiAction $user_b = $this->get_user($user_b_id); if (!$user_a || !$user_b) { - $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']); + $this->clientError(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']); return; } diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php index 531c6e9d3..db5892baf 100644 --- a/actions/twitapihelp.php +++ b/actions/twitapihelp.php @@ -41,7 +41,7 @@ class TwitapihelpAction extends TwitterapiAction print '"ok"'; $this->end_document('json'); } else { - common_user_error(_('API method not found!'), $code=404); + $this->clientError(_('API method not found!'), $code=404); } } @@ -49,7 +49,7 @@ class TwitapihelpAction extends TwitterapiAction function downtime_schedule($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } }
\ No newline at end of file diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php index 34c8f88fc..8cd7a64b9 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapilaconica.php @@ -79,7 +79,7 @@ class TwitapilaconicaAction extends TwitterapiAction $this->end_document('json'); break; default: - $this->client_error(_('API method not found!'), $code=404); + $this->clientError(_('API method not found!'), $code=404); } } @@ -148,7 +148,7 @@ class TwitapilaconicaAction extends TwitterapiAction $this->end_document('json'); break; default: - $this->client_error(_('API method not found!'), $code=404); + $this->clientError(_('API method not found!'), $code=404); } } @@ -169,6 +169,6 @@ class TwitapilaconicaAction extends TwitterapiAction function wadl($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), 501); + $this->serverError(_('API method under construction.'), 501); } } diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php index a19d652c3..411971af1 100644 --- a/actions/twitapinotifications.php +++ b/actions/twitapinotifications.php @@ -28,13 +28,13 @@ class TwitapinotificationsAction extends TwitterapiAction function follow($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } function leave($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } }
\ No newline at end of file diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index 8d175ecab..a35f4b12e 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -76,12 +76,12 @@ class TwitapistatusesAction extends TwitterapiAction $this->show_json_timeline($notice); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); break; } } else { - common_server_error(_('Couldn\'t find any statuses.'), $code = 503); + $this->serverError(_('Couldn\'t find any statuses.'), $code = 503); } } @@ -144,7 +144,7 @@ class TwitapistatusesAction extends TwitterapiAction $this->show_json_timeline($notice); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); } } @@ -157,14 +157,14 @@ class TwitapistatusesAction extends TwitterapiAction $user = $this->get_user($apidata['api_arg'], $apidata); if (!$user) { - $this->client_error('Not Found', 404, $apidata['content-type']); + $this->clientError('Not Found', 404, $apidata['content-type']); return; } $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -225,7 +225,7 @@ class TwitapistatusesAction extends TwitterapiAction $this->show_json_timeline($notice); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); } } @@ -236,12 +236,12 @@ class TwitapistatusesAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']); return; } @@ -273,7 +273,7 @@ class TwitapistatusesAction extends TwitterapiAction // as "truncated." Sending this error may screw up some clients // that assume Twitter will truncate for them. Should we just // truncate too? -- Zach - $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']); + $this->clientError(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']); return; } @@ -306,7 +306,7 @@ class TwitapistatusesAction extends TwitterapiAction if ($reply) { $reply_to = $in_reply_to_status_id; } else { - $this->client_error(_('Not found'), $code = 404, $apidata['content-type']); + $this->clientError(_('Not found'), $code = 404, $apidata['content-type']); return; } } @@ -315,7 +315,7 @@ class TwitapistatusesAction extends TwitterapiAction $source, 1, $reply_to); if (is_string($notice)) { - $this->server_error($notice); + $this->serverError($notice); return; } @@ -389,7 +389,7 @@ class TwitapistatusesAction extends TwitterapiAction $this->show_json_timeline($notices); break; default: - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); } } @@ -399,7 +399,7 @@ class TwitapistatusesAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } @@ -415,7 +415,7 @@ class TwitapistatusesAction extends TwitterapiAction } } else { // XXX: Twitter just sets a 404 header and doens't bother to return an err msg - $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']); + $this->clientError(_('No status with that ID found.'), 404, $apidata['content-type']); } } @@ -426,14 +426,14 @@ class TwitapistatusesAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } // Check for RESTfulness if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { // XXX: Twitter just prints the err msg, no XML / JSON. - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); + $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); return; } @@ -443,7 +443,7 @@ class TwitapistatusesAction extends TwitterapiAction $notice = Notice::staticGet($notice_id); if (!$notice) { - $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']); + $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']); return; } @@ -460,7 +460,7 @@ class TwitapistatusesAction extends TwitterapiAction $this->show_single_json_status($notice); } } else { - $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']); + $this->clientError(_('You may not delete another user\'s status.'), 403, $apidata['content-type']); } } @@ -487,7 +487,7 @@ class TwitapistatusesAction extends TwitterapiAction $user = $this->get_user($apidata['api_arg'], $apidata); if (!$user) { - $this->client_error('Not Found', 404, $apidata['content-type']); + $this->clientError('Not Found', 404, $apidata['content-type']); return; } @@ -500,7 +500,7 @@ class TwitapistatusesAction extends TwitterapiAction $profile = $user->getProfile(); if (!$profile) { - common_server_error(_('User has no profile.')); + $this->serverError(_('User has no profile.')); return; } @@ -552,14 +552,14 @@ class TwitapistatusesAction extends TwitterapiAction print json_encode($arrays); break; default: - $this->client_error(_('unsupported file type')); + $this->clientError(_('unsupported file type')); } } function featured($args, $apidata) { parent::handle($args); - common_server_error(_('API method under construction.'), $code=501); + $this->serverError(_('API method under construction.'), $code=501); } function supported($cmd) diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php index 409986985..ed2417561 100644 --- a/actions/twitapiusers.php +++ b/actions/twitapiusers.php @@ -29,7 +29,7 @@ class TwitapiusersAction extends TwitterapiAction parent::handle($args); if (!in_array($apidata['content-type'], array('xml', 'json'))) { - common_user_error(_('API method not found!'), $code = 404); + $this->clientError(_('API method not found!'), $code = 404); return; } @@ -44,7 +44,7 @@ class TwitapiusersAction extends TwitterapiAction if (!$user) { // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach - $this->client_error(_('Not found.'), 404, $apidata['content-type']); + $this->clientError(_('Not found.'), 404, $apidata['content-type']); return; } diff --git a/actions/twittersettings.php b/actions/twittersettings.php index 663688037..9c879c965 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -285,7 +285,7 @@ class TwittersettingsAction extends SettingsAction if (!$result) { common_log_db_error($flink, 'DELETE', __FILE__); - common_server_error(_('Couldn\'t remove Twitter user.')); + $this->serverError(_('Couldn\'t remove Twitter user.')); return; } diff --git a/actions/unblock.php b/actions/unblock.php index 112304f71..59270f882 100644 --- a/actions/unblock.php +++ b/actions/unblock.php @@ -30,28 +30,28 @@ class UnblockAction extends Action parent::prepare($args); if (!common_logged_in()) { - $this->client_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return false; } $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } $id = $this->trimmed('unblockto'); if (!$id) { - $this->client_error(_('No profile specified.')); + $this->clientError(_('No profile specified.')); return false; } $this->profile = Profile::staticGet('id', $id); if (!$this->profile) { - $this->client_error(_('No profile with that ID.')); + $this->clientError(_('No profile with that ID.')); return false; } @@ -74,7 +74,7 @@ class UnblockAction extends Action $result = $cur->unblock($this->profile); if (!$result) { - $this->server_error(_('Error removing the block.')); + $this->serverError(_('Error removing the block.')); return; } diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index 455c5e28e..32511a4b4 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -24,7 +24,7 @@ class UnsubscribeAction extends Action { parent::handle($args); if (!common_logged_in()) { - common_user_error(_('Not logged in.')); + $this->clientError(_('Not logged in.')); return; } @@ -40,28 +40,28 @@ class UnsubscribeAction extends Action $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->client_error(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } $other_id = $this->arg('unsubscribeto'); if (!$other_id) { - $this->client_error(_('No profile id in request.')); + $this->clientError(_('No profile id in request.')); return; } $other = Profile::staticGet('id', $other_id); if (!$other_id) { - $this->client_error(_('No profile with that id.')); + $this->clientError(_('No profile with that id.')); return; } $result = subs_unsubscribe_to($user, $other); if ($result != true) { - common_user_error($result); + $this->clientError($result); return; } diff --git a/actions/updateprofile.php b/actions/updateprofile.php index abb034c81..c79112dac 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -37,7 +37,7 @@ class UpdateprofileAction extends Action print "omb_version=".OMB_VERSION_01; } } catch (OAuthException $e) { - $this->server_error($e->getMessage()); + $this->serverError($e->getMessage()); return; } } @@ -46,14 +46,14 @@ class UpdateprofileAction extends Action { $version = $req->get_parameter('omb_version'); if ($version != OMB_VERSION_01) { - $this->client_error(_('Unsupported OMB version'), 400); + $this->clientError(_('Unsupported OMB version'), 400); return false; } # First, check to see if listenee exists $listenee = $req->get_parameter('omb_listenee'); $remote = Remote_profile::staticGet('uri', $listenee); if (!$remote) { - $this->client_error(_('Profile unknown'), 404); + $this->clientError(_('Profile unknown'), 404); return false; } # Second, check to see if they should be able to post updates! @@ -64,72 +64,72 @@ class UpdateprofileAction extends Action $sub->subscribed = $remote->id; $sub->token = $token->key; if (!$sub->find(true)) { - $this->client_error(_('You did not send us that profile'), 403); + $this->clientError(_('You did not send us that profile'), 403); return false; } $profile = Profile::staticGet('id', $remote->id); if (!$profile) { # This one is our fault - $this->server_error(_('Remote profile with no matching profile'), 500); + $this->serverError(_('Remote profile with no matching profile'), 500); return false; } $nickname = $req->get_parameter('omb_listenee_nickname'); if ($nickname && !Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { - $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.')); + $this->clientError(_('Nickname must have only lowercase letters and numbers and no spaces.')); return false; } $license = $req->get_parameter('omb_listenee_license'); if ($license && !common_valid_http_url($license)) { - $this->client_error(sprintf(_("Invalid license URL '%s'"), $license)); + $this->clientError(sprintf(_("Invalid license URL '%s'"), $license)); return false; } $profile_url = $req->get_parameter('omb_listenee_profile'); if ($profile_url && !common_valid_http_url($profile_url)) { - $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url)); + $this->clientError(sprintf(_("Invalid profile URL '%s'."), $profile_url)); return false; } # optional stuff $fullname = $req->get_parameter('omb_listenee_fullname'); if ($fullname && strlen($fullname) > 255) { - $this->client_error(_("Full name is too long (max 255 chars).")); + $this->clientError(_("Full name is too long (max 255 chars).")); return false; } $homepage = $req->get_parameter('omb_listenee_homepage'); if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) { - $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage)); + $this->clientError(sprintf(_("Invalid homepage '%s'"), $homepage)); return false; } $bio = $req->get_parameter('omb_listenee_bio'); if ($bio && strlen($bio) > 140) { - $this->client_error(_("Bio is too long (max 140 chars).")); + $this->clientError(_("Bio is too long (max 140 chars).")); return false; } $location = $req->get_parameter('omb_listenee_location'); if ($location && strlen($location) > 255) { - $this->client_error(_("Location is too long (max 255 chars).")); + $this->clientError(_("Location is too long (max 255 chars).")); return false; } $avatar = $req->get_parameter('omb_listenee_avatar'); if ($avatar) { if (!common_valid_http_url($avatar) || strlen($avatar) > 255) { - $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar)); + $this->clientError(sprintf(_("Invalid avatar URL '%s'"), $avatar)); return false; } $size = @getimagesize($avatar); if (!$size) { - $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar)); + $this->clientError(sprintf(_("Can't read avatar URL '%s'"), $avatar)); return false; } if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) { - $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar)); + $this->clientError(sprintf(_("Wrong size image at '%s'"), $avatar)); return false; } if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) { - $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar)); + $this->clientError(sprintf(_("Wrong image type for '%s'"), $avatar)); return false; } } @@ -156,14 +156,14 @@ class UpdateprofileAction extends Action } if (!$profile->update($orig_profile)) { - $this->server_error(_('Could not save new profile info'), 500); + $this->serverError(_('Could not save new profile info'), 500); return false; } else { if ($avatar) { $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar'); copy($avatar, $temp_filename); if (!$profile->setOriginal($temp_filename)) { - $this->server_error(_('Could not save avatar info'), 500); + $this->serverError(_('Could not save avatar info'), 500); return false; } } diff --git a/actions/userauthorization.php b/actions/userauthorization.php index 196fae9ad..838458932 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -54,7 +54,7 @@ class UserauthorizationAction extends Action common_debug('getting new request', __FILE__); $req = $this->get_new_request(); if (!$req) { - $this->client_error(_('No request found!')); + $this->clientError(_('No request found!')); } common_debug('validating request', __FILE__); # XXX: only validate new requests, since nonce is one-time use @@ -64,7 +64,7 @@ class UserauthorizationAction extends Action $this->show_form($req); } catch (OAuthException $e) { $this->clear_request(); - $this->client_error($e->getMessage()); + $this->clientError($e->getMessage()); return; } @@ -137,7 +137,7 @@ class UserauthorizationAction extends Action $req = $this->get_stored_request(); if (!$req) { - common_user_error(_('No authorization request!')); + $this->clientError(_('No authorization request!')); return; } @@ -145,10 +145,10 @@ class UserauthorizationAction extends Action if ($this->arg('accept')) { if (!$this->authorize_token($req)) { - $this->client_error(_('Error authorizing token')); + $this->clientError(_('Error authorizing token')); } if (!$this->save_remote_profile($req)) { - $this->client_error(_('Error saving remote profile')); + $this->clientError(_('Error saving remote profile')); } if (!$callback) { $this->show_accept_message($req->get_parameter('oauth_token')); @@ -160,7 +160,7 @@ class UserauthorizationAction extends Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->server_error(_('User without matching profile')); + $this->serverError(_('User without matching profile')); return; } $params['omb_listener_nickname'] = $user->nickname; diff --git a/actions/userbyid.php b/actions/userbyid.php index d57ed21a5..3ff2c9c41 100644 --- a/actions/userbyid.php +++ b/actions/userbyid.php @@ -32,11 +32,11 @@ class UserbyidAction extends Action parent::handle($args); $id = $this->trimmed('id'); if (!$id) { - $this->client_error(_('No id.')); + $this->clientError(_('No id.')); } $user =& User::staticGet($id); if (!$user) { - $this->client_error(_('No such user.')); + $this->clientError(_('No such user.')); } // support redirecting to FOAF rdf/xml if the agent prefers it diff --git a/actions/userrss.php b/actions/userrss.php index 1e9fe121f..d14fc523e 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -34,7 +34,7 @@ class UserrssAction extends Rss10Action $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); return false; } else { return true; @@ -78,7 +78,7 @@ class UserrssAction extends Rss10Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->server_error(_('User without matching profile')); + $this->serverError(_('User without matching profile')); return null; } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); diff --git a/actions/xrds.php b/actions/xrds.php index 9c51f1dd2..7cb2cd210 100644 --- a/actions/xrds.php +++ b/actions/xrds.php @@ -35,7 +35,7 @@ class XrdsAction extends Action $nickname = $this->trimmed('nickname'); $user = User::staticGet('nickname', $nickname); if (!$user) { - common_user_error(_('No such user.')); + $this->clientError(_('No such user.')); return; } $this->show_xrds($user); |