summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorMike Cochrane <mikec@mikenz.geek.nz>2008-07-08 05:45:31 -0400
committerMike Cochrane <mikec@mikenz.geek.nz>2008-07-08 05:45:31 -0400
commit87b494f1ebbe7640d194ef322af12fdf378295df (patch)
treef4b616fd8306bb92d3063d4e86dd1b87607163f4 /actions
parenta25f5010e682a0fc950e2ef2476af7b631ada5bf (diff)
Convert _t() to _() for gettext.
darcs-hash:20080708094531-533db-83399a46e6ec4c0fcc6249b0235961f969d1ae73.gz
Diffstat (limited to 'actions')
-rw-r--r--actions/all.php8
-rw-r--r--actions/allrss.php8
-rw-r--r--actions/avatar.php20
-rw-r--r--actions/confirmaddress.php19
-rw-r--r--actions/doc.php4
-rw-r--r--actions/finishaddopenid.php16
-rw-r--r--actions/finishopenidlogin.php64
-rw-r--r--actions/finishremotesubscribe.php28
-rw-r--r--actions/foaf.php4
-rw-r--r--actions/imsettings.php60
-rw-r--r--actions/login.php69
-rw-r--r--actions/logout.php2
-rw-r--r--actions/newnotice.php17
-rw-r--r--actions/openidlogin.php12
-rw-r--r--actions/openidsettings.php28
-rw-r--r--actions/password.php28
-rw-r--r--actions/postnotice.php16
-rw-r--r--actions/profilesettings.php54
-rw-r--r--actions/public.php20
-rw-r--r--actions/publicrss.php24
-rw-r--r--actions/recoverpassword.php62
-rw-r--r--actions/register.php50
-rw-r--r--actions/remotesubscribe.php30
-rw-r--r--actions/replies.php20
-rw-r--r--actions/repliesrss.php22
-rw-r--r--actions/showstream.php32
-rw-r--r--actions/subscribe.php26
-rw-r--r--actions/subscribers.php10
-rw-r--r--actions/subscriptions.php10
-rw-r--r--actions/unsubscribe.php16
-rw-r--r--actions/updateprofile.php46
-rw-r--r--actions/userauthorization.php24
-rw-r--r--actions/userbyid.php4
-rw-r--r--actions/userrss.php22
-rw-r--r--actions/xrds.php26
35 files changed, 446 insertions, 455 deletions
diff --git a/actions/all.php b/actions/all.php
index c19440052..9ca020015 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -31,20 +31,20 @@ class AllAction extends StreamAction {
$user = User::staticGet('nickname', $nickname);
if (!$user) {
- $this->client_error(_t('No such user: ') . $nickname);
+ $this->client_error(sprintf(_('No such user: %s'), $nickname));
return;
}
$profile = $user->getProfile();
if (!$profile) {
- common_server_error(_t('User record exists without profile.'));
+ common_server_error(_('User record exists without profile.'));
return;
}
# Looks like we're good; show the header
- common_show_header($profile->nickname . _t(" and friends"),
+ common_show_header(sprintf(_("%s and friends"), $profile->nickname),
array($this, 'show_header'), $user,
array($this, 'show_top'));
@@ -58,7 +58,7 @@ class AllAction extends StreamAction {
'href' => common_local_url('allrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',
- 'title' => _t('Feed for friends of ') . $user->nickname));
+ 'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
}
function show_top($user) {
diff --git a/actions/allrss.php b/actions/allrss.php
index 081360a59..64e16ec6c 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -32,7 +32,7 @@ class AllrssAction extends Rss10Action {
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
- common_user_error(_t('No such nickname.'));
+ common_user_error(_('No such nickname.'));
return false;
} else {
return true;
@@ -65,13 +65,13 @@ class AllrssAction extends Rss10Action {
function get_channel() {
$user = $this->user;
$c = array('url' => common_local_url('allrss',
- array('nickname' =>
+ array('nickname' =>
$user->nickname)),
- 'title' => $user->nickname . _t(' and friends'),
+ 'title' => sprintf(_('%s and friends'), $user->nickname),
'link' => common_local_url('all',
array('nickname' =>
$user->nickname)),
- 'description' => _t('Feed for friends of ') . $user->nickname);
+ 'description' => sprintf(_('Feed for friends of %s'), $user->nickname));
return $c;
}
diff --git a/actions/avatar.php b/actions/avatar.php
index ac28d8170..1029abd1e 100644
--- a/actions/avatar.php
+++ b/actions/avatar.php
@@ -24,7 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
class AvatarAction extends SettingsAction {
function get_instructions() {
- return _t('Upload a new "avatar" (user image) here. ' .
+ return _('Upload a new "avatar" (user image) here. ' .
'You can\'t edit the picture after you upload it, so ' .
'make sure it\'s more or less square. ' .
'It must be under the site license, also. ' .
@@ -34,7 +34,7 @@ class AvatarAction extends SettingsAction {
function show_form($msg=NULL, $success=false) {
- $this->form_header(_t('Avatar'), $msg, $success);
+ $this->form_header(_('Avatar'), $msg, $success);
$user = common_current_user();
$profile = $user->getProfile();
@@ -70,7 +70,7 @@ class AvatarAction extends SettingsAction {
common_element('input', array('name' => 'avatarfile',
'type' => 'file',
'id' => 'avatarfile'));
- common_submit('submit', _t('Upload'));
+ common_submit('submit', _('Upload'));
common_element_end('form');
common_show_footer();
}
@@ -82,14 +82,14 @@ class AvatarAction extends SettingsAction {
break;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
- $this->show_form(_t('That file is too big.'));
+ $this->show_form(_('That file is too big.'));
return;
case UPLOAD_ERR_PARTIAL:
@unlink($_FILES['avatarfile']['tmp_name']);
- $this->show_form(_t('Partial upload.'));
+ $this->show_form(_('Partial upload.'));
return;
default:
- $this->show_form(_t('System error uploading file.'));
+ $this->show_form(_('System error uploading file.'));
return;
}
@@ -97,7 +97,7 @@ class AvatarAction extends SettingsAction {
if (!$info) {
@unlink($_FILES['avatarfile']['tmp_name']);
- $this->show_form(_t('Not an image or corrupt file.'));
+ $this->show_form(_('Not an image or corrupt file.'));
return;
}
@@ -107,7 +107,7 @@ class AvatarAction extends SettingsAction {
case IMAGETYPE_PNG:
break;
default:
- $this->show_form(_t('Unsupported image file format.'));
+ $this->show_form(_('Unsupported image file format.'));
return;
}
@@ -115,9 +115,9 @@ class AvatarAction extends SettingsAction {
$profile = $user->getProfile();
if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
- $this->show_form(_t('Avatar updated.'), true);
+ $this->show_form(_('Avatar updated.'), true);
} else {
- $this->show_form(_t('Failed updating avatar.'));
+ $this->show_form(_('Failed updating avatar.'));
}
@unlink($_FILES['avatarfile']['tmp_name']);
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 9e0d7b211..28849d41b 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -30,26 +30,26 @@ class ConfirmaddressAction extends Action {
}
$code = $this->trimmed('code');
if (!$code) {
- $this->client_error(_t('No confirmation code.'));
+ $this->client_error(_('No confirmation code.'));
return;
}
$confirm = Confirm_address::staticGet('code', $code);
if (!$confirm) {
- $this->client_error(_t('Confirmation code not found.'));
+ $this->client_error(_('Confirmation code not found.'));
return;
}
$cur = common_current_user();
if ($cur->id != $confirm->user_id) {
- $this->client_error(_t('That confirmation code is not for you!'));
+ $this->client_error(_('That confirmation code is not for you!'));
return;
}
$type = $confirm->address_type;
if (!in_array($type, array('email', 'jabber', 'sms'))) {
- $this->server_error(_t('Unrecognized address type ') . $type);
+ $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
return;
}
if ($cur->$type == $confirm->address) {
- $this->client_error(_t('That address has already been confirmed.'));
+ $this->client_error(_('That address has already been confirmed.'));
return;
}
@@ -67,7 +67,7 @@ class ConfirmaddressAction extends Action {
if (!$result) {
common_log_db_error($cur, 'UPDATE', __FILE__);
- $this->server_error(_t('Couldn\'t update user.'));
+ $this->server_error(_('Couldn\'t update user.'));
return;
}
@@ -75,16 +75,15 @@ class ConfirmaddressAction extends Action {
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
- $this->server_error(_t('Couldn\'t delete email confirmation.'));
+ $this->server_error(_('Couldn\'t delete email confirmation.'));
return;
}
$cur->query('COMMIT');
- common_show_header(_t('Confirm Address'));
+ common_show_header(_('Confirm Address'));
common_element('p', NULL,
- _t('The address "') . $cur->$type .
- _t('" has been confirmed for your account.'));
+ sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer();
}
}
diff --git a/actions/doc.php b/actions/doc.php
index 728bf24b1..f3327048f 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -26,12 +26,12 @@ class DocAction extends Action {
$title = $this->trimmed('title');
$filename = INSTALLDIR.'/doc/'.$title;
if (!file_exists($filename)) {
- common_user_error(_t('No such document.'));
+ common_user_error(_('No such document.'));
return;
}
$c = file_get_contents($filename);
$output = common_markup_to_html($c);
- common_show_header(_t(ucfirst($title)));
+ common_show_header(_(ucfirst($title)));
common_raw($output);
common_show_footer();
}
diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php
index b1dce1474..49e54a34f 100644
--- a/actions/finishaddopenid.php
+++ b/actions/finishaddopenid.php
@@ -26,7 +26,7 @@ class FinishaddopenidAction extends Action {
function handle($args) {
parent::handle($args);
if (!common_logged_in()) {
- common_user_error(_t('Not logged in.'));
+ common_user_error(_('Not logged in.'));
} else {
$this->try_login();
}
@@ -39,11 +39,11 @@ class FinishaddopenidAction extends Action {
$response = $consumer->complete(common_local_url('finishaddopenid'));
if ($response->status == Auth_OpenID_CANCEL) {
- $this->message(_t('OpenID authentication cancelled.'));
+ $this->message(_('OpenID authentication cancelled.'));
return;
} else if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message.
- $this->message(_t('OpenID authentication failed: ') . $response->message);
+ $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) {
$display = $response->getDisplayIdentifier();
@@ -61,9 +61,9 @@ class FinishaddopenidAction extends Action {
if ($other) {
if ($other->id == $cur->id) {
- $this->message(_t('You already have this OpenID!'));
+ $this->message(_('You already have this OpenID!'));
} else {
- $this->message(_t('Someone else already has this OpenID.'));
+ $this->message(_('Someone else already has this OpenID.'));
}
return;
}
@@ -75,12 +75,12 @@ class FinishaddopenidAction extends Action {
$result = oid_link_user($cur->id, $canonical, $display);
if (!$result) {
- $this->message(_t('Error connecting user.'));
+ $this->message(_('Error connecting user.'));
return;
}
if ($sreg) {
if (!oid_update_user($cur, $sreg)) {
- $this->message(_t('Error updating profile'));
+ $this->message(_('Error updating profile'));
return;
}
}
@@ -96,7 +96,7 @@ class FinishaddopenidAction extends Action {
}
function message($msg) {
- common_show_header(_t('OpenID Login'));
+ common_show_header(_('OpenID Login'));
common_element('p', NULL, $msg);
common_show_footer();
}
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php
index cdebf8fc8..6eb45ec8e 100644
--- a/actions/finishopenidlogin.php
+++ b/actions/finishopenidlogin.php
@@ -26,11 +26,11 @@ class FinishopenidloginAction extends Action {
function handle($args) {
parent::handle($args);
if (common_logged_in()) {
- common_user_error(_t('Already logged in.'));
+ common_user_error(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('create')) {
if (!$this->boolean('license')) {
- $this->show_form(_t('You can\'t register if you don\'t agree to the license.'),
+ $this->show_form(_('You can\'t register if you don\'t agree to the license.'),
$this->trimmed('newname'));
return;
}
@@ -39,7 +39,7 @@ class FinishopenidloginAction extends Action {
$this->connect_user();
} else {
common_debug(print_r($this->args, true), __FILE__);
- $this->show_form(_t('Something weird happened.'),
+ $this->show_form(_('Something weird happened.'),
$this->trimmed('newname'));
}
} else {
@@ -53,11 +53,11 @@ class FinishopenidloginAction extends Action {
} else {
global $config;
common_element('div', 'instructions',
- _t('This is the first time you\'ve logged into ') .
- $config['site']['name'] .
- _t(' so we must connect your OpenID to a local account. ' .
- ' You can either create a new account, or connect with ' .
- ' your existing account, if you have one.'));
+ sprintf(_('This is the first time you\'ve logged into %s' .
+ ' so we must connect your OpenID to a local account. ' .
+ ' You can either create a new account, or connect with ' .
+ ' your existing account, if you have one.'
+ ), $config['site']['name']));
}
}
@@ -69,31 +69,31 @@ class FinishopenidloginAction extends Action {
'id' => 'account_connect',
'action' => common_local_url('finishopenidlogin')));
common_element('h2', NULL,
- 'Create new account');
+ _('Create new account'));
common_element('p', NULL,
- _t('Create a new user with this nickname.'));
- common_input('newname', _t('New nickname'),
+ _('Create a new user with this nickname.'));
+ common_input('newname', _('New nickname'),
($username) ? $username : '',
- _t('1-64 lowercase letters or numbers, no punctuation or spaces'));
+ _('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_element_start('p');
common_element('input', array('type' => 'checkbox',
'id' => 'license',
'name' => 'license',
'value' => 'true'));
- common_text(_t('My text and files are available under '));
+ common_text(_('My text and files are available under '));
common_element('a', array(href => common_config('license', 'url')),
common_config('license', 'title'));
- common_text(_t(' except this private data: password, email address, IM address, phone number.'));
+ common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
- common_submit('create', _t('Create'));
+ common_submit('create', _('Create'));
common_element('h2', NULL,
- 'Connect existing account');
+ _('Connect existing account'));
common_element('p', NULL,
- _t('If you already have an account, login with your username and password '.
+ _('If you already have an account, login with your username and password '.
'to connect it to your OpenID.'));
- common_input('nickname', _t('Existing nickname'));
- common_password('password', _t('Password'));
- common_submit('connect', _t('Connect'));
+ common_input('nickname', _('Existing nickname'));
+ common_password('password', _('Password'));
+ common_submit('connect', _('Connect'));
common_element_end('form');
common_show_footer();
}
@@ -105,11 +105,11 @@ class FinishopenidloginAction extends Action {
$response = $consumer->complete(common_local_url('finishopenidlogin'));
if ($response->status == Auth_OpenID_CANCEL) {
- $this->message(_t('OpenID authentication cancelled.'));
+ $this->message(_('OpenID authentication cancelled.'));
return;
} else if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message.
- $this->message(_t('OpenID authentication failed: ') . $response->message);
+ $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) {
// This means the authentication succeeded; extract the
// identity URL and Simple Registration data (if it was
@@ -142,7 +142,7 @@ class FinishopenidloginAction extends Action {
}
function message($msg) {
- common_show_header(_t('OpenID Login'));
+ common_show_header(_('OpenID Login'));
common_element('p', NULL, $msg);
common_show_footer();
}
@@ -167,24 +167,24 @@ class FinishopenidloginAction extends Action {
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
- $this->show_form(_t('Nickname must have only letters and numbers and no spaces.'));
+ $this->show_form(_('Nickname must have only letters and numbers and no spaces.'));
return;
}
if (!User::allowed_nickname($nickname)) {
- $this->show_form(_t('Nickname not allowed.'));
+ $this->show_form(_('Nickname not allowed.'));
return;
}
if (User::staticGet('nickname', $nickname)) {
- $this->show_form(_t('Nickname already in use. Try another one.'));
+ $this->show_form(_('Nickname already in use. Try another one.'));
return;
}
list($display, $canonical, $sreg) = $this->get_saved_values();
if (!$display || !$canonical) {
- common_server_error(_t('Stored OpenID not found.'));
+ common_server_error(_('Stored OpenID not found.'));
return;
}
@@ -193,7 +193,7 @@ class FinishopenidloginAction extends Action {
$other = oid_get_user($canonical);
if ($other) {
- common_server_error(_t('Creating new account for OpenID that already has a user.'));
+ common_server_error(_('Creating new account for OpenID that already has a user.'));
return;
}
@@ -224,7 +224,7 @@ class FinishopenidloginAction extends Action {
$id = $profile->insert();
if (!$id) {
- common_server_error(_t('Error saving the profile.'));
+ common_server_error(_('Error saving the profile.'));
return;
}
@@ -266,7 +266,7 @@ class FinishopenidloginAction extends Action {
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
- $this->show_form(_t('Invalid username or password.'));
+ $this->show_form(_('Invalid username or password.'));
return;
}
@@ -277,14 +277,14 @@ class FinishopenidloginAction extends Action {
list($display, $canonical, $sreg) = $this->get_saved_values();
if (!$display || !$canonical) {
- common_server_error(_t('Stored OpenID not found.'));
+ common_server_error(_('Stored OpenID not found.'));
return;
}
$result = oid_link_user($user->id, $canonical, $display);
if (!$result) {
- common_server_error(_t('Error connecting user to OpenID.'));
+ common_server_error(_('Error connecting user to OpenID.'));
return;
}
diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php
index 06fd3f52c..7d7b6d146 100644
--- a/actions/finishremotesubscribe.php
+++ b/actions/finishremotesubscribe.php
@@ -28,14 +28,14 @@ class FinishremotesubscribeAction extends Action {
parent::handle($args);
if (common_logged_in()) {
- common_user_error(_t('You can use the local subscription!'));
+ common_user_error(_('You can use the local subscription!'));
return;
}
$omb = $_SESSION['oauth_authorization_request'];
if (!$omb) {
- common_user_error(_t('Not expecting this response!'));
+ common_user_error(_('Not expecting this response!'));
return;
}
@@ -48,33 +48,33 @@ class FinishremotesubscribeAction extends Action {
# I think this is the success metric
if ($token != $omb['token']) {
- common_user_error(_t('Not authorized.'));
+ common_user_error(_('Not authorized.'));
return;
}
$version = $req->get_parameter('omb_version');
if ($version != OMB_VERSION_01) {
- common_user_error(_t('Unknown version of OMB protocol.'));
+ common_user_error(_('Unknown version of OMB protocol.'));
return;
}
$nickname = $req->get_parameter('omb_listener_nickname');
if (!$nickname) {
- common_user_error(_t('No nickname provided by remote server.'));
+ common_user_error(_('No nickname provided by remote server.'));
return;
}
$profile_url = $req->get_parameter('omb_listener_profile');
if (!$profile_url) {
- common_user_error(_t('No profile URL returned by server.'));
+ common_user_error(_('No profile URL returned by server.'));
return;
}
if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
- common_user_error(_t('Invalid profile URL returned by server.'));
+ common_user_error(_('Invalid profile URL returned by server.'));
return;
}
@@ -83,7 +83,7 @@ class FinishremotesubscribeAction extends Action {
$user = User::staticGet('nickname', $omb['listenee']);
if (!$user) {
- common_user_error(_t('User being listened to doesn\'t exist.'));
+ common_user_error(_('User being listened to doesn\'t exist.'));
return;
}
@@ -96,7 +96,7 @@ class FinishremotesubscribeAction extends Action {
list($newtok, $newsecret) = $this->access_token($omb);
if (!$newtok || !$newsecret) {
- common_user_error(_t('Couldn\'t convert request tokens to access tokens.'));
+ common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
return;
}
@@ -140,7 +140,7 @@ class FinishremotesubscribeAction extends Action {
$profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert();
if (!$id) {
- common_server_error(_t('Error inserting new profile'));
+ common_server_error(_('Error inserting new profile'));
return;
}
$remote->id = $id;
@@ -148,7 +148,7 @@ class FinishremotesubscribeAction extends Action {
if ($avatar_url) {
if (!$this->add_avatar($profile, $avatar_url)) {
- common_server_error(_t('Error inserting avatar'));
+ common_server_error(_('Error inserting avatar'));
return;
}
}
@@ -158,13 +158,13 @@ class FinishremotesubscribeAction extends Action {
if ($exists) {
if (!$remote->update($orig_remote)) {
- common_server_error(_t('Error updating remote profile'));
+ common_server_error(_('Error updating remote profile'));
return;
}
} else {
$remote->created = DB_DataObject_Cast::dateTime(); # current time
if (!$remote->insert()) {
- common_server_error(_t('Error inserting remote profile'));
+ common_server_error(_('Error inserting remote profile'));
return;
}
}
@@ -177,7 +177,7 @@ class FinishremotesubscribeAction extends Action {
$sub->created = DB_DataObject_Cast::dateTime(); # current time
if (!$sub->insert()) {
- common_user_error(_t('Couldn\'t insert new subscription.'));
+ common_user_error(_('Couldn\'t insert new subscription.'));
return;
}
diff --git a/actions/foaf.php b/actions/foaf.php
index db6ce78f2..d5ff00a76 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -33,14 +33,14 @@ class FoafAction extends Action {
$user = User::staticGet('nickname', $nickname);
if (!$user) {
- common_user_error(_t('No such user'), 404);
+ common_user_error(_('No such user'), 404);
return;
}
$profile = $user->getProfile();
if (!$profile) {
- common_server_error(_t('User has no profile'), 500);
+ common_server_error(_('User has no profile'), 500);
return;
}
diff --git a/actions/imsettings.php b/actions/imsettings.php
index bad0bc18a..f4c6a3e3a 100644
--- a/actions/imsettings.php
+++ b/actions/imsettings.php
@@ -25,61 +25,61 @@ require_once(INSTALLDIR.'/lib/jabber.php');
class ImsettingsAction extends SettingsAction {
function get_instructions() {
- return _t('You can send and receive notices through '.
+ return _('You can send and receive notices through '.
'Jabber/GTalk [instant messages](%%doc.im%%). Configure '.
'your address and settings below.');
}
function show_form($msg=NULL, $success=false) {
$user = common_current_user();
- $this->form_header(_t('IM Settings'), $msg, $success);
+ $this->form_header(_('IM Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
'id' => 'imsettings',
'action' =>
common_local_url('imsettings')));
- common_element('h2', NULL, _t('Address'));
+ common_element('h2', NULL, _('Address'));
if ($user->jabber) {
common_element_start('p');
common_element('span', 'address confirmed', $user->jabber);
common_element('span', 'input_instructions',
- _t('Current confirmed Jabber/GTalk address.'));
+ _('Current confirmed Jabber/GTalk address.'));
common_hidden('jabber', $user->jabber);
common_element_end('p');
- common_submit('remove', 'Remove');
+ common_submit('remove', _('Remove'));
} else {
$confirm = $this->get_confirmation();
if ($confirm) {
common_element_start('p');
common_element('span', 'address unconfirmed', $confirm->address);
common_element('span', 'input_instructions',
- _t('Awaiting confirmation on this address. Check your ' .
+ sprintf(_('Awaiting confirmation on this address. Check your ' .
'Jabber/GTalk account for a message with further ' .
- 'instructions. (Did you add ' . jabber_daemon_address() .
- ' to your buddy list?)'));
+ 'instructions. (Did you add %s to your buddy list?)',
+ jabber_daemon_address())));
common_hidden('jabber', $confirm->address);
common_element_end('p');
- common_submit('cancel', _t('Cancel'));
+ common_submit('cancel', _('Cancel'));
} else {
- common_input('jabber', _t('IM Address'),
+ common_input('jabber', _('IM Address'),
($this->arg('jabber')) ? $this->arg('jabber') : NULL,
- _t('Jabber or GTalk address, like "UserName@example.org". ' .
- 'First, make sure to add ' . jabber_daemon_address() .
- ' to your buddy list in your IM client or on GTalk.'));
- common_submit('add', 'Add');
+ sprintf(_('Jabber or GTalk address, like "UserName@example.org". ' .
+ 'First, make sure to add %s' .
+ ' to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
+ common_submit('add', _('Add'));
}
}
- common_element('h2', NULL, _t('Preferences'));
+ common_element('h2', NULL, _('Preferences'));
common_checkbox('jabbernotify',
- _t('Send me notices through Jabber/GTalk.'),
+ _('Send me notices through Jabber/GTalk.'),
$user->jabbernotify);
common_checkbox('updatefrompresence',
- _t('Post a notice when my Jabber/GTalk status changes.'),
+ _('Post a notice when my Jabber/GTalk status changes.'),
$user->updatefrompresence);
- common_submit('save', _t('Save'));
+ common_submit('save', _('Save'));
common_element_end('form');
common_show_footer();
@@ -108,7 +108,7 @@ class ImsettingsAction extends SettingsAction {
} else if ($this->arg('remove')) {
$this->remove_address();
} else {
- $this->show_form(_t('Unexpected form submission.'));
+ $this->show_form(_('Unexpected form submission.'));
}
}
@@ -132,13 +132,13 @@ class ImsettingsAction extends SettingsAction {
if ($result === FALSE) {
common_log_db_error($user, 'UPDATE', __FILE__);
- common_server_error(_t('Couldnt update user.'));
+ common_server_error(_('Couldnt update user.'));
return;
}
$user->query('COMMIT');
- $this->show_form(_t('Preferences saved.'), true);
+ $this->show_form(_('Preferences saved.'), true);
}
function add_address() {
@@ -150,7 +150,7 @@ class ImsettingsAction extends SettingsAction {
# Some validation
if (!$jabber) {
- $this->show_form(_t('No Jabber ID.'));
+ $this->show_form(_('No Jabber ID.'));
return;
}
@@ -181,7 +181,7 @@ class ImsettingsAction extends SettingsAction {
if ($result === FALSE) {
common_log_db_error($confirm, 'INSERT', __FILE__);
- common_server_error(_t('Couldnt insert confirmation code.'));
+ common_server_error(_('Couldnt insert confirmation code.'));
return;
}
@@ -204,11 +204,11 @@ class ImsettingsAction extends SettingsAction {
$jabber = $this->arg('jabber');
$confirm = $this->get_confirmation();
if (!$confirm) {
- $this->show_form(_t('No pending confirmation to cancel.'));
+ $this->show_form(_('No pending confirmation to cancel.'));
return;
}
if ($confirm->address != $jabber) {
- $this->show_form(_t('That is the wrong IM address.'));
+ $this->show_form(_('That is the wrong IM address.'));
return;
}
@@ -216,11 +216,11 @@ class ImsettingsAction extends SettingsAction {
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
- $this->server_error(_t('Couldn\'t delete email confirmation.'));
+ $this->server_error(_('Couldn\'t delete email confirmation.'));
return;
}
- $this->show_form(_t('Confirmation cancelled.'), TRUE);
+ $this->show_form(_('Confirmation cancelled.'), TRUE);
}
function remove_address() {
@@ -231,7 +231,7 @@ class ImsettingsAction extends SettingsAction {
# Maybe an old tab open...?
if ($user->jabber != $jabber) {
- $this->show_form(_t('That is not your Jabber ID.'));
+ $this->show_form(_('That is not your Jabber ID.'));
return;
}
@@ -241,14 +241,14 @@ class ImsettingsAction extends SettingsAction {
$result = $user->updateKeys($original);
if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__);
- common_server_error(_t('Couldnt update user.'));
+ common_server_error(_('Couldnt update user.'));
return;
}
$user->query('COMMIT');
# XXX: unsubscribe to the old address
- $this->show_form(_t('The address was removed.'), TRUE);
+ $this->show_form(_('The address was removed.'), TRUE);
}
function jabber_exists($jabber) {
diff --git a/actions/login.php b/actions/login.php
index 12ded51ed..400957e05 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -24,7 +24,7 @@ class LoginAction extends Action {
function handle($args) {
parent::handle($args);
if (common_is_real_login()) {
- common_user_error(_t('Already logged in.'));
+ common_user_error(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->check_login();
} else {
@@ -37,17 +37,30 @@ class LoginAction extends Action {
# XXX: login throttle
$nickname = $this->arg('nickname');
$password = $this->arg('password');
- $user = common_check_user($nickname, $password);
-
- if (!$user) {
+ if (common_check_user($nickname, $password)) {
+ # success!
+ if (!common_set_user($nickname)) {
+ common_server_error(_t('Error setting user.'));
+ return;
+ }
+ common_real_login(true);
+ if ($this->boolean('rememberme')) {
+ common_debug('Adding rememberme cookie for ' . $nickname);
+ common_rememberme();
+ }
+ # success!
+ $url = common_get_returnto();
+ if ($url) {
+ # We don't have to return to it again
+ common_set_returnto(NULL);
+ } else {
+ $url = common_local_url('all',
+ array('nickname' =>
+ $nickname));
+ }
+ common_redirect($url);
+ } else {
$this->show_form(_t('Incorrect username or password.'));
- return;
- }
-
- # success!
- if (!common_set_user($user)) {
- common_server_error(_t('Error setting user.'));
- return;
}
common_real_login(true);
@@ -70,41 +83,29 @@ class LoginAction extends Action {
}
function show_form($error=NULL) {
- common_show_header(_t('Login'), NULL, $error, array($this, 'show_top'));
+ common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'login',
'action' => common_local_url('login')));
- common_input('nickname', _t('Nickname'));
- common_password('password', _t('Password'));
- common_checkbox('rememberme', _t('Remember me'), false,
- _t('Automatically login in the future; ' .
+ common_input('nickname', _('Nickname'));
+ common_password('password', _('Password'));
+ common_checkbox('rememberme', _('Remember me'), false,
+ _('Automatically login in the future; ' .
'not for shared computers!'));
- common_submit('submit', _t('Login'));
+ common_submit('submit', _('Login'));
common_element_end('form');
common_element_start('p');
common_element('a', array('href' => common_local_url('recoverpassword')),
- _t('Lost or forgotten password?'));
+ _('Lost or forgotten password?'));
common_element_end('p');
common_show_footer();
}
function get_instructions() {
- if (common_logged_in() &&
- !common_is_real_login() &&
- common_get_returnto())
- {
- # rememberme logins have to reauthenticate before
- # changing any profile settings (cookie-stealing protection)
- return _t('For security reasons, ' .
- 'please re-enter your ' .
- 'user name and password ' .
- 'before changing your settings. ');
- } else {
- return _t('Login with your username and password. ' .
- 'Don\'t have a username yet? ' .
- '[Register](%%action.register%%) a new account, or ' .
- 'try [OpenID](%%action.openidlogin%%). ');
- }
+ return _t('Login with your username and password. ' .
+ 'Don\'t have a username yet? ' .
+ '[Register](%%action.register%%) a new account, or ' .
+ 'try [OpenID](%%action.openidlogin%%). ');
}
function show_top($error=NULL) {
diff --git a/actions/logout.php b/actions/logout.php
index 3d52da0d6..fb61689ee 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -25,7 +25,7 @@ class LogoutAction extends Action {
function handle($args) {
parent::handle($args);
if (!common_logged_in()) {
- common_user_error(_t('Not logged in.'));
+ common_user_error(_('Not logged in.'));
} else {
common_set_user(NULL);
common_real_login(false); # not logged in
diff --git a/actions/newnotice.php b/actions/newnotice.php
index de040ef77..961bbb639 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -26,7 +26,7 @@ class NewnoticeAction extends Action {
# XXX: Ajax!
if (!common_logged_in()) {
- common_user_error(_t('Not logged in.'));
+ common_user_error(_('Not logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->save_new_notice();
} else {
@@ -46,10 +46,10 @@ class NewnoticeAction extends Action {
$notice->content = $this->trimmed('status_textarea');
if (!$notice->content) {
- $this->show_form(_t('No content!'));
+ $this->show_form(_('No content!'));
return;
} else if (strlen($notice->content) > 140) {
- $this->show_form(_t('That\'s too long. Max notice size is 140 chars.'));
+ $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
return;
}
@@ -58,7 +58,7 @@ class NewnoticeAction extends Action {
$id = $notice->insert();
if (!$id) {
- common_server_error(_t('Problem saving notice.'));
+ common_server_error(_('Problem saving notice.'));
return;
}
@@ -66,7 +66,7 @@ class NewnoticeAction extends Action {
$notice->uri = common_notice_uri($notice);
if (!$notice->update($orig)) {
- common_server_error(_t('Problem saving notice.'));
+ common_server_error(_('Problem saving notice.'));
return;
}
@@ -90,13 +90,6 @@ class NewnoticeAction extends Action {
function show_form($msg=NULL) {
$content = $this->trimmed('status_textarea');
- if (!$content) {
- $replyto = $this->trimmed('replyto');
- $profile = Profile::staticGet('nickname', $replyto);
- if ($profile) {
- $content = '@' . $profile->nickname . ' ';
- }
- }
common_show_header(_t('New notice'), NULL, $content,
array($this, 'show_top'));
if ($msg) {
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index f9743ecde..874ef81b2 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -26,7 +26,7 @@ class OpenidloginAction extends Action {
function handle($args) {
parent::handle($args);
if (common_logged_in()) {
- common_user_error(_t('Already logged in.'));
+ common_user_error(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$openid_url = $this->trimmed('openid_url');
$result = oid_authenticate($openid_url,
@@ -41,7 +41,7 @@ class OpenidloginAction extends Action {
}
function get_instructions() {
- return _t('Login with an [OpenID](%%doc.openid%%) account.');
+ return _('Login with an [OpenID](%%doc.openid%%) account.');
}
function show_top($error=NULL) {
@@ -57,15 +57,15 @@ class OpenidloginAction extends Action {
}
function show_form($error=NULL, $openid_url) {
- common_show_header(_t('OpenID Login'), NULL, $error, array($this, 'show_top'));
+ common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
$formaction = common_local_url('openidlogin');
common_element_start('form', array('method' => 'post',
'id' => 'openidlogin',
'action' => $formaction));
- common_input('openid_url', _t('OpenID URL'),
+ common_input('openid_url', _('OpenID URL'),
$openid_url,
- _t('Your OpenID URL'));
- common_submit('submit', _t('Login'));
+ _('Your OpenID URL'));
+ common_submit('submit', _('Login'));
common_element_end('form');
common_show_footer();
}
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index 6cdb19817..e77de88b1 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/openid.php');
class OpenidsettingsAction extends SettingsAction {
function get_instructions() {
- return _t('[OpenID](%%doc.openid%%) lets you log into many sites ' .
+ return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
' with the same user account. '.
' Manage your associated OpenIDs from here.');
}
@@ -34,19 +34,19 @@ class OpenidsettingsAction extends SettingsAction {
$user = common_current_user();
- $this->form_header(_t('OpenID settings'), $msg, $success);
+ $this->form_header(_('OpenID settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
'id' => 'openidadd',
'action' =>
common_local_url('openidsettings')));
- common_element('h2', NULL, _t('Add OpenID'));
+ common_element('h2', NULL, _('Add OpenID'));
common_element('p', NULL,
- _t('If you want to add an OpenID to your account, ' .
+ _('If you want to add an OpenID to your account, ' .
'enter it in the box below and click "Add".'));
common_element_start('p');
common_element('label', array('for' => 'openid_url'),
- _t('OpenID URL'));
+ _('OpenID URL'));
common_element('input', array('name' => 'openid_url',
'type' => 'text',
'id' => 'openid_url'));
@@ -54,7 +54,7 @@ class OpenidsettingsAction extends SettingsAction {
'id' => 'add',
'name' => 'add',
'class' => 'submit',
- 'value' => _t('Add')));
+ 'value' => _('Add')));
common_element_end('p');
common_element_end('form');
@@ -65,12 +65,12 @@ class OpenidsettingsAction extends SettingsAction {
if ($cnt > 0) {
- common_element('h2', NULL, _t('Remove OpenID'));
+ common_element('h2', NULL, _('Remove OpenID'));
if ($cnt == 1 && !$user->password) {
common_element('p', NULL,
- _t('Removing your only OpenID would make it impossible to log in! ' .
+ _('Removing your only OpenID would make it impossible to log in! ' .
'If you need to remove it, add another OpenID first.'));
if ($oid->fetch()) {
@@ -83,7 +83,7 @@ class OpenidsettingsAction extends SettingsAction {
} else {
common_element('p', NULL,
- _t('You can remove an OpenID from your account '.
+ _('You can remove an OpenID from your account '.
'by clicking the button marked "Remove".'));
$idx = 0;
@@ -103,7 +103,7 @@ class OpenidsettingsAction extends SettingsAction {
'id' => 'remove'.$idx,
'name' => 'remove',
'class' => 'submit',
- 'value' => _t('Remove')));
+ 'value' => _('Remove')));
common_element_end('p');
common_element_end('form');
$idx++;
@@ -123,7 +123,7 @@ class OpenidsettingsAction extends SettingsAction {
} else if ($this->arg('remove')) {
$this->remove_openid();
} else {
- $this->show_form(_t('Something weird happened.'));
+ $this->show_form(_('Something weird happened.'));
}
}
@@ -132,16 +132,16 @@ class OpenidsettingsAction extends SettingsAction {
$openid_url = $this->trimmed('openid_url');
$oid = User_openid::staticGet('canonical', $openid_url);
if (!$oid) {
- $this->show_form(_t('No such OpenID.'));
+ $this->show_form(_('No such OpenID.'));
return;
}
$cur = common_current_user();
if (!$cur || $oid->user_id != $cur->id) {
- $this->show_form(_t('That OpenID does not belong to you.'));
+ $this->show_form(_('That OpenID does not belong to you.'));
return;
}
$oid->delete();
- $this->show_form(_t('OpenID removed.'), true);
+ $this->show_form(_('OpenID removed.'), true);
return;
}
}
diff --git a/actions/password.php b/actions/password.php
index ed3f2ada0..5acfd1620 100644
--- a/actions/password.php
+++ b/actions/password.php
@@ -24,25 +24,25 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
class PasswordAction extends SettingsAction {
function get_instructions() {
- return _t('You can change your password here. Choose a good one!');
+ return _('You can change your password here. Choose a good one!');
}
function show_form($msg=NULL, $success=false) {
$user = common_current_user();
- $this->form_header(_t('Change password'), $msg, $success);
+ $this->form_header(_('Change password'), $msg, $success);
common_element_start('form', array('method' => 'post',
'id' => 'password',
'action' =>
common_local_url('password')));
# Users who logged in with OpenID won't have a pwd
if ($user->password) {
- common_password('oldpassword', _t('Old password'));
+ common_password('oldpassword', _('Old password'));
}
- common_password('newpassword', _t('New password'),
- _t('6 or more characters'));
- common_password('confirm', _t('Confirm'),
- _t('same as password above'));
- common_submit('submit', _t('Change'));
+ common_password('newpassword', _('New password'),
+ _('6 or more characters'));
+ common_password('confirm', _('Confirm'),
+ _('same as password above'));
+ common_submit('submit', _('Change'));
common_element_end('form');
common_show_footer();
}
@@ -58,15 +58,15 @@ class PasswordAction extends SettingsAction {
$confirm = $this->arg('confirm');
if (0 != strcmp($newpassword, $confirm)) {
- $this->show_form(_t('Passwords don\'t match'));
+ $this->show_form(_('Passwords don\'t match'));
return;
}
if ($user->password) {
$oldpassword = $this->arg('oldpassword');
-
+
if (!common_check_user($user->nickname, $oldpassword)) {
- $this->show_form(_t('Incorrect old password'));
+ $this->show_form(_('Incorrect old password'));
return;
}
}
@@ -77,15 +77,15 @@ class PasswordAction extends SettingsAction {
$val = $user->validate();
if ($val !== TRUE) {
- $this->show_form(_t('Error saving user; invalid.'));
+ $this->show_form(_('Error saving user; invalid.'));
return;
}
if (!$user->update($original)) {
- common_server_error(_t('Can\'t save new password.'));
+ common_server_error(_('Can\'t save new password.'));
return;
}
- $this->show_form(_t('Password saved'), true);
+ $this->show_form(_('Password saved'), true);
}
}
diff --git a/actions/postnotice.php b/actions/postnotice.php
index d83ceb971..c86e095ff 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -37,39 +37,39 @@ class PostnoticeAction extends Action {
return;
}
}
-
+
function save_notice(&$req, &$consumer, &$token) {
$version = $req->get_parameter('omb_version');
if ($version != OMB_VERSION_01) {
- common_user_error(_t('Unsupported OMB version'), 400);
+ common_user_error(_('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(_t('Profile unknown'), 403);
+ common_user_error(_('Profile unknown'), 403);
return false;
}
$sub = Subscription::staticGet('token', $token->key);
if (!$sub) {
- common_user_error(_t('No such subscription'), 403);
+ common_user_error(_('No such subscription'), 403);
return false;
}
$content = $req->get_parameter('omb_notice_content');
if (!$content || strlen($content) > 140) {
- common_user_error(_t('Invalid notice content'), 400);
+ common_user_error(_('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(_t('Invalid notice uri'), 400);
+ common_user_error(_('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(_t('Invalid notice url'), 400);
+ common_user_error(_('Invalid notice url'), 400);
return false;
}
$notice = Notice::staticGet('uri', $notice_uri);
@@ -85,7 +85,7 @@ class PostnoticeAction extends Action {
$notice->created = DB_DataObject_Cast::dateTime(); # current time
$id = $notice->insert();
if (!$id) {
- common_server_error(_t('Error inserting notice'), 500);
+ common_server_error(_('Error inserting notice'), 500);
return false;
}
common_save_replies($notice);
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index ad4bb968f..c793457c7 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -24,38 +24,38 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
class ProfilesettingsAction extends SettingsAction {
function get_instructions() {
- return _t('You can update your personal profile info here '.
+ return _('You can update your personal profile info here '.
'so people know more about you.');
}
function show_form($msg=NULL, $success=false) {
$user = common_current_user();
$profile = $user->getProfile();
- $this->form_header(_t('Profile settings'), $msg, $success);
+ $this->form_header(_('Profile settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
'id' => 'profilesettings',
'action' =>
common_local_url('profilesettings')));
# too much common patterns here... abstractable?
- common_input('nickname', _t('Nickname'),
+ common_input('nickname', _('Nickname'),
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
- _t('1-64 lowercase letters or numbers, no punctuation or spaces'));
- common_input('fullname', _t('Full name'),
+ _('1-64 lowercase letters or numbers, no punctuation or spaces'));
+ common_input('fullname', _('Full name'),
($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
- common_input('email', _t('Email address'),
+ common_input('email', _('Email address'),
($this->arg('email')) ? $this->arg('email') : $user->email,
- _t('Used only for updates, announcements, and password recovery'));
- common_input('homepage', _t('Homepage'),
+ _('Used only for updates, announcements, and password recovery'));
+ common_input('homepage', _('Homepage'),
($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
- _t('URL of your homepage, blog, or profile on another site'));
- common_textarea('bio', _t('Bio'),
+ _('URL of your homepage, blog, or profile on another site'));
+ common_textarea('bio', _('Bio'),
($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
- _t('Describe yourself and your interests in 140 chars'));
- common_input('location', _t('Location'),
+ _('Describe yourself and your interests in 140 chars'));
+ common_input('location', _('Location'),
($this->arg('location')) ? $this->arg('location') : $profile->location,
- _t('Where you are, like "City, State (or Region), Country"'));
- common_submit('submit', _t('Save'));
+ _('Where you are, like "City, State (or Region), Country"'));
+ common_submit('submit', _('Save'));
common_element_end('form');
common_show_footer();
}
@@ -72,34 +72,34 @@ class ProfilesettingsAction extends SettingsAction {
# Some validation
if ($email && !Validate::email($email, true)) {
- $this->show_form(_t('Not a valid email address.'));
+ $this->show_form(_('Not a valid email address.'));
return;
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
- $this->show_form(_t('Nickname must have only letters and numbers and no spaces.'));
+ $this->show_form(_('Nickname must have only letters and numbers and no spaces.'));
return;
} else if (!User::allowed_nickname($nickname)) {
- $this->show_form(_t('Not a valid nickname.'));
+ $this->show_form(_('Not a valid nickname.'));
return;
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
- $this->show_form(_t('Homepage is not a valid URL.'));
+ $this->show_form(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && strlen($fullname) > 255) {
- $this->show_form(_t('Fullname is too long (max 255 chars).'));
+ $this->show_form(_('Fullname is too long (max 255 chars).'));
return;
} else if (!is_null($bio) && strlen($bio) > 140) {
- $this->show_form(_t('Bio is too long (max 140 chars).'));
+ $this->show_form(_('Bio is too long (max 140 chars).'));
return;
} else if (!is_null($location) && strlen($location) > 255) {
- $this->show_form(_t('Location is too long (max 255 chars).'));
+ $this->show_form(_('Location is too long (max 255 chars).'));
return;
} else if ($this->nickname_exists($nickname)) {
- $this->show_form(_t('Nickname already exists.'));
+ $this->show_form(_('Nickname already exists.'));
return;
} else if ($this->email_exists($email)) {
- $this->show_form(_t('Email address already exists.'));
+ $this->show_form(_('Email address already exists.'));
return;
}
@@ -120,7 +120,7 @@ class ProfilesettingsAction extends SettingsAction {
if ($result === FALSE) {
common_log_db_error($user, 'UPDATE', __FILE__);
- common_server_error(_t('Couldnt update user.'));
+ common_server_error(_('Couldnt update user.'));
return;
}
}
@@ -143,7 +143,7 @@ class ProfilesettingsAction extends SettingsAction {
if (!$result) {
common_log_db_error($confirm, 'INSERT', __FILE__);
- common_server_error(_t('Couldnt confirm email.'));
+ common_server_error(_('Couldnt confirm email.'));
return FALSE;
}
@@ -172,7 +172,7 @@ class ProfilesettingsAction extends SettingsAction {
if (!$result) {
common_log_db_error($profile, 'UPDATE', __FILE__);
- common_server_error(_t('Couldnt save profile.'));
+ common_server_error(_('Couldnt save profile.'));
return;
}
@@ -180,7 +180,7 @@ class ProfilesettingsAction extends SettingsAction {
common_broadcast_profile($profile);
- $this->show_form(_t('Settings saved.'), TRUE);
+ $this->show_form(_('Settings saved.'), TRUE);
}
function nickname_exists($nickname) {
diff --git a/actions/public.php b/actions/public.php
index 23d9f0397..745285961 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -29,9 +29,9 @@ class PublicAction extends StreamAction {
$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
header('X-XRDS-Location: '. common_local_url('publicxrds'));
-
- common_show_header(_t('Public timeline'),
- array($this, 'show_header'), NULL,
+
+ common_show_header(_('Public timeline'),
+ array($this, 'show_header'), NULL,
array($this, 'show_top'));
# XXX: Public sidebar here?
@@ -46,29 +46,29 @@ class PublicAction extends StreamAction {
common_notice_form('public');
}
}
-
+
function show_header() {
common_element('link', array('rel' => 'alternate',
'href' => common_local_url('publicrss'),
'type' => 'application/rss+xml',
- 'title' => _t('Public Stream Feed')));
+ 'title' => _('Public Stream Feed')));
# for client side of OpenID authentication
common_element('meta', array('http-equiv' => 'X-XRDS-Location',
'content' => common_local_url('publicxrds')));
}
-
+
function show_notices($page) {
$notice = DB_DataObject::factory('notice');
# FIXME: bad performance
-
+
$notice->whereAdd('EXISTS (SELECT user.id from user where user.id = notice.profile_id)');
$notice->orderBy('created DESC');
-
+
# We fetch one extra, to see if we need an "older" link
-
+
$notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
$cnt = $notice->find();
@@ -85,7 +85,7 @@ class PublicAction extends StreamAction {
}
common_element_end('ul');
}
-
+
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'public');
}
diff --git a/actions/publicrss.php b/actions/publicrss.php
index 93314ee32..0916da009 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -28,41 +28,41 @@ class PublicrssAction extends Rss10Action {
function init() {
return true;
}
-
+
function get_notices($limit=0) {
-
+
$user = $this->user;
$notices = array();
-
+
$notice = DB_DataObject::factory('notice');
# FIXME: bad performance
-
+
$notice->whereAdd('EXISTS (SELECT user.id from user where user.id = notice.profile_id)');
-
+
$notice->orderBy('created DESC');
-
+
if ($limit != 0) {
$notice->limit(0, $limit);
}
$notice->find();
-
+
while ($notice->fetch()) {
$notices[] = clone($notice);
}
-
+
return $notices;
}
-
+
function get_channel() {
global $config;
$c = array('url' => common_local_url('publicrss'),
- 'title' => $config['site']['name'] . _t(' Public Stream'),
+ 'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
'link' => common_local_url('public'),
- 'description' => _t('All updates for ') . $config['site']['name']);
+ 'description' => sprintf(_('All updates for %s'), $config['site']['name']));
return $c;
}
-
+
function get_image() {
return NULL;
}
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index 06a7f62c8..feb200163 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -28,7 +28,7 @@ class RecoverpasswordAction extends Action {
function handle($args) {
parent::handle($args);
if (common_logged_in()) {
- $this->client_error(_t('You are already logged in!'));
+ $this->client_error(_('You are already logged in!'));
return;
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('recover')) {
@@ -36,7 +36,7 @@ class RecoverpasswordAction extends Action {
} else if ($this->arg('reset')) {
$this->reset_password();
} else {
- $this->client_error(_t('Unexpected form.'));
+ $this->client_error(_('Unexpected form.'));
}
} else {
if ($this->trimmed('code')) {
@@ -53,18 +53,18 @@ class RecoverpasswordAction extends Action {
$confirm = Confirm_address::staticGet($code);
if (!$confirm) {
- $this->client_error(_t('No such recovery code.'));
+ $this->client_error(_('No such recovery code.'));
return;
}
if ($confirm->address_type != 'recover') {
- $this->client_error(_t('Not a recovery code.'));
+ $this->client_error(_('Not a recovery code.'));
return;
}
$user = User::staticGet($confirm->user_id);
if (!$user) {
- $this->server_error(_t('Recovery code for unknown user.'));
+ $this->server_error(_('Recovery code for unknown user.'));
return;
}
@@ -76,7 +76,7 @@ class RecoverpasswordAction extends Action {
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
- common_server_error(_t('Error with confirmation code.'));
+ common_server_error(_('Error with confirmation code.'));
return;
}
@@ -84,7 +84,7 @@ class RecoverpasswordAction extends Action {
# Note: it's still deleted; let's avoid a second attempt!
if ((time() - $touched) > MAX_RECOVERY_TIME) {
- $this->client_error(_t('This confirmation code is too old. ' .
+ $this->client_error(_('This confirmation code is too old. ' .
'Please start again.'));
return;
}
@@ -119,7 +119,7 @@ class RecoverpasswordAction extends Action {
common_element('div', 'error', $msg);
} else {
common_element('div', 'instructions',
- _t('If you\'ve forgotten or lost your' .
+ _('If you\'ve forgotten or lost your' .
' password, you can get a new one sent ' .
' the email address you have stored ' .
' in your account.'));
@@ -131,41 +131,41 @@ class RecoverpasswordAction extends Action {
common_element('div', 'error', $msg);
} else {
common_element('div', 'instructions',
- _t('You\'ve been identified. Enter a ' .
+ _('You\'ve been identified. Enter a ' .
' new password below. '));
}
}
function show_form($msg=NULL) {
- common_show_header(_t('Recover password'), NULL,
+ common_show_header(_('Recover password'), NULL,
$msg, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword')));
- common_input('nicknameoremail', _t('Nickname or email'),
+ common_input('nicknameoremail', _('Nickname or email'),
$this->trimmed('nicknameoremail'),
- _t('Your nickname on this server, ' .
+ _('Your nickname on this server, ' .
'or your registered email address.'));
- common_submit('recover', _t('Recover'));
+ common_submit('recover', _('Recover'));
common_element_end('form');
common_show_footer();
}
function show_password_form($msg=NULL) {
- common_show_header(_t('Reset password'), NULL,
+ common_show_header(_('Reset password'), NULL,
$msg, array($this, 'show_password_top'));
common_element_start('form', array('method' => 'post',
'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword')));
- common_password('newpassword', _t('New password'),
- _t('6 or more characters, and don\'t forget it!'));
- common_password('confirm', _t('Confirm'),
- _t('Same as password above'));
- common_submit('reset', _t('Reset'));
+ common_password('newpassword', _('New password'),
+ _('6 or more characters, and don\'t forget it!'));
+ common_password('confirm', _('Confirm'),
+ _('Same as password above'));
+ common_submit('reset', _('Reset'));
common_element_end('form');
common_show_footer();
}
@@ -173,7 +173,7 @@ class RecoverpasswordAction extends Action {
function recover_password() {
$nore = $this->trimmed('nicknameoremail');
if (!$nore) {
- $this->show_form(_t('Enter a nickname or email address.'));
+ $this->show_form(_('Enter a nickname or email address.'));
return;
}
$user = User::staticGet('email', common_canonical_email($nore));
@@ -182,11 +182,11 @@ class RecoverpasswordAction extends Action {
}
if (!$user) {
- $this->show_form(_t('No such user.'));
+ $this->show_form(_('No such user.'));
return;
}
if (!$user->email) {
- $this->client_error(_t('No registered email address for that user.'));
+ $this->client_error(_('No registered email address for that user.'));
return;
}
@@ -198,7 +198,7 @@ class RecoverpasswordAction extends Action {
if (!$confirm->insert()) {
common_log_db_error($confirm, 'INSERT', __FILE__);
- $this->server_error(_t('Error saving address confirmation.'));
+ $this->server_error(_('Error saving address confirmation.'));
return;
}
@@ -219,11 +219,11 @@ class RecoverpasswordAction extends Action {
$body .= common_config('site', 'name');
$body .= "\n";
- mail_to_user($user, _t('Password recovery requested'), $body);
+ mail_to_user($user, _('Password recovery requested'), $body);
common_show_header(_('Password recovery requested'));
common_element('p', NULL,
- _t('Instructions for recovering your password ' .
+ _('Instructions for recovering your password ' .
'have been sent to the email address registered to your ' .
'account.'));
common_show_footer();
@@ -234,7 +234,7 @@ class RecoverpasswordAction extends Action {
$user = $this->get_temp_user();
if (!$user) {
- $this->client_error(_t('Unexpected password reset.'));
+ $this->client_error(_('Unexpected password reset.'));
return;
}
@@ -242,11 +242,11 @@ class RecoverpasswordAction extends Action {
$confirm = $this->trimmed('confirm');
if (!$newpassword || strlen($newpassword) < 6) {
- $this->show_password_form(_t('Password must be 6 chars or more.'));
+ $this->show_password_form(_('Password must be 6 chars or more.'));
return;
}
if ($newpassword != $confirm) {
- $this->show_password_form(_t('Password and confirmation do not match.'));
+ $this->show_password_form(_('Password and confirmation do not match.'));
return;
}
@@ -258,21 +258,21 @@ class RecoverpasswordAction extends Action {
if (!$user->update($original)) {
common_log_db_error($user, 'UPDATE', __FILE__);
- common_server_error(_t('Can\'t save new password.'));
+ common_server_error(_('Can\'t save new password.'));
return;
}
$this->clear_temp_user();
if (!common_set_user($user->nickname)) {
- common_server_error(_t('Error setting user.'));
+ common_server_error(_('Error setting user.'));
return;
}
common_real_login(true);
common_show_header(_('Password saved.'));
- common_element('p', NULL, _t('New password successfully saved. ' .
+ common_element('p', NULL, _('New password successfully saved. ' .
'You are now logged in.'));
common_show_footer();
}
diff --git a/actions/register.php b/actions/register.php
index 74a41e706..0ee332f0f 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -25,7 +25,7 @@ class RegisterAction extends Action {
parent::handle($args);
if (common_logged_in()) {
- common_user_error(_t('Already logged in.'));
+ common_user_error(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->try_register();
} else {
@@ -48,21 +48,21 @@ class RegisterAction extends Action {
$email = common_canonical_email($email);
if (!$this->boolean('license')) {
- $this->show_form(_t('You can\'t register if you don\'t agree to the license.'));
+ $this->show_form(_('You can\'t register if you don\'t agree to the license.'));
} else if ($email && !Validate::email($email, true)) {
- $this->show_form(_t('Not a valid email address.'));
+ $this->show_form(_('Not a valid email address.'));
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
- $this->show_form(_t('Nickname must have only lowercase letters and numbers and no spaces.'));
+ $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
} else if ($this->nickname_exists($nickname)) {
- $this->show_form(_t('Nickname already exists.'));
+ $this->show_form(_('Nickname already exists.'));
} else if (!User::allowed_nickname($nickname)) {
- $this->show_form(_t('Not a valid nickname.'));
+ $this->show_form(_('Not a valid nickname.'));
} else if ($this->email_exists($email)) {
- $this->show_form(_t('Email address already exists.'));
+ $this->show_form(_('Email address already exists.'));
} else if ($password != $confirm) {
- $this->show_form(_t('Passwords don\'t match.'));
+ $this->show_form(_('Passwords don\'t match.'));
} else {
$user = $this->register_user($nickname, $password, $email);
if (!$user) {
@@ -71,7 +71,7 @@ class RegisterAction extends Action {
}
# success!
if (!common_set_user($user)) {
- common_server_error(_t('Error setting user.'));
+ common_server_error(_('Error setting user.'));
return;
}
# this is a real login
@@ -81,6 +81,8 @@ class RegisterAction extends Action {
common_rememberme($user);
}
common_redirect(common_local_url('profilesettings'));
+ } else {
+ $this->show_form(_t('Invalid username or password.'));
}
}
@@ -160,39 +162,39 @@ class RegisterAction extends Action {
common_element('p', 'error', $error);
} else {
common_element('div', 'instructions',
- _t('You can create a new account to start posting notices.'));
+ _('You can create a new account to start posting notices.'));
}
}
function show_form($error=NULL) {
global $config;
- common_show_header(_t('Register'), NULL, $error, array($this, 'show_top'));
+ common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'login',
'action' => common_local_url('register')));
- common_input('nickname', _t('Nickname'), NULL,
- _t('1-64 lowercase letters or numbers, no punctuation or spaces'));
- common_password('password', _t('Password'),
- _t('6 or more characters'));
- common_password('confirm', _t('Confirm'),
- _t('Same as password above'));
- common_input('email', _t('Email'), NULL,
- _t('Used only for updates, announcements, and password recovery'));
- common_checkbox('rememberme', _t('Remember me'), false,
- _t('Automatically login in the future; ' .
+ common_input('nickname', _('Nickname'), NULL,
+ _('1-64 lowercase letters or numbers, no punctuation or spaces'));
+ common_password('password', _('Password'),
+ _('6 or more characters'));
+ common_password('confirm', _('Confirm'),
+ _('Same as password above'));
+ common_input('email', _('Email'), NULL,
+ _('Used only for updates, announcements, and password recovery'));
+ common_checkbox('rememberme', _('Remember me'), false,
+ _('Automatically login in the future; ' .
'not for shared computers!'));
common_element_start('p');
common_element('input', array('type' => 'checkbox',
'id' => 'license',
'name' => 'license',
'value' => 'true'));
- common_text(_t('My text and files are available under '));
+ common_text(_('My text and files are available under '));
common_element('a', array(href => $config['license']['url']),
$config['license']['title']);
- common_text(_t(' except this private data: password, email address, IM address, phone number.'));
+ common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
- common_submit('submit', _t('Register'));
+ common_submit('submit', _('Register'));
common_element_end('form');
common_show_footer();
}
diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php
index ea63f2229..a37ca8c3f 100644
--- a/actions/remotesubscribe.php
+++ b/actions/remotesubscribe.php
@@ -28,7 +28,7 @@ class RemotesubscribeAction extends Action {
parent::handle($args);
if (common_logged_in()) {
- common_user_error(_t('You can use the local subscription!'));
+ common_user_error(_('You can use the local subscription!'));
return;
}
@@ -40,7 +40,7 @@ class RemotesubscribeAction extends Action {
}
function get_instructions() {
- return _t('To subscribe, you can [login](%%action.login%%),' .
+ return _('To subscribe, you can [login](%%action.login%%),' .
' or [register](%%action.register%%) a new ' .
' account. If you already have an account ' .
' on a [compatible microblogging site](%%doc.openmublog%%), ' .
@@ -62,17 +62,17 @@ class RemotesubscribeAction extends Action {
function show_form($err=NULL) {
$nickname = $this->trimmed('nickname');
$profile = $this->trimmed('profile_url');
- common_show_header(_t('Remote subscribe'), NULL, $err,
+ common_show_header(_('Remote subscribe'), NULL, $err,
array($this, 'show_top'));
# id = remotesubscribe conflicts with the
# button on profile page
common_element_start('form', array('id' => 'remsub', 'method' => 'post',
'action' => common_local_url('remotesubscribe')));
- common_input('nickname', _t('User nickname'), $nickname,
- _t('Nickname of the user you want to follow'));
- common_input('profile_url', _t('Profile URL'), $profile,
- _t('URL of your profile on another compatible microblogging service'));
- common_submit('submit', _t('Subscribe'));
+ common_input('nickname', _('User nickname'), $nickname,
+ _('Nickname of the user you want to follow'));
+ common_input('profile_url', _('Profile URL'), $profile,
+ _('URL of your profile on another compatible microblogging service'));
+ common_submit('submit', _('Subscribe'));
common_element_end('form');
common_show_footer();
}
@@ -81,19 +81,19 @@ class RemotesubscribeAction extends Action {
$user = $this->get_user();
if (!$user) {
- $this->show_form(_t('No such user!'));
+ $this->show_form(_('No such user!'));
return;
}
$profile = $this->trimmed('profile_url');
if (!$profile) {
- $this->show_form(_t('No such user!'));
+ $this->show_form(_('No such user!'));
return;
}
if (!Validate::uri($profile, array('allowed_schemes' => array('http', 'https')))) {
- $this->show_form(_t('Invalid profile URL (bad format)'));
+ $this->show_form(_('Invalid profile URL (bad format)'));
return;
}
@@ -101,28 +101,28 @@ class RemotesubscribeAction extends Action {
$yadis = Auth_Yadis_Yadis::discover($profile, $fetcher);
if (!$yadis || $yadis->failed) {
- $this->show_form(_t('Not a valid profile URL (no YADIS document).'));
+ $this->show_form(_('Not a valid profile URL (no YADIS document).'));
return;
}
$xrds =& Auth_Yadis_XRDS::parseXRDS($yadis->response_text);
if (!$xrds) {
- $this->show_form(_t('Not a valid profile URL (no XRDS defined).'));
+ $this->show_form(_('Not a valid profile URL (no XRDS defined).'));
return;
}
$omb = $this->getOmb($xrds);
if (!$omb) {
- $this->show_form(_t('Not a valid profile URL (incorrect services).'));
+ $this->show_form(_('Not a valid profile URL (incorrect services).'));
return;
}
list($token, $secret) = $this->request_token($omb);
if (!$token || !$secret) {
- $this->show_form(_t('Couldn\'t get a request token.'));
+ $this->show_form(_('Couldn\'t get a request token.'));
return;
}
diff --git a/actions/replies.php b/actions/replies.php
index d7c1d7a80..ddbbddff8 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -38,39 +38,39 @@ class RepliesAction extends StreamAction {
$profile = $user->getProfile();
if (!$profile) {
- common_server_error(_t('User record exists without profile.'));
+ common_server_error(_('User record exists without profile.'));
return;
}
# Looks like we're good; show the header
- common_show_header(_t("Replies to ") . $profile->nickname,
+ common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
array($this, 'show_header'), $user,
array($this, 'show_top'));
-
+
$this->show_replies($profile);
-
+
common_show_footer();
}
-
+
function show_header($user) {
common_element('link', array('rel' => 'alternate',
'href' => common_local_url('repliesrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',
- 'title' => _t('Feed for replies to ') . $user->nickname));
+ 'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
}
function show_top($user) {
$cur = common_current_user();
-
+
if ($cur && $cur->id == $user->id) {
common_notice_form('replies');
}
-
+
$this->views_menu();
}
-
+
function show_replies($profile) {
$reply = new Reply();
@@ -103,7 +103,7 @@ class RepliesAction extends StreamAction {
}
common_element_end('ul');
}
-
+
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'replies', array('nickname' => $profile->nickname));
}
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index b5e271585..549182fb9 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -30,17 +30,17 @@ class RepliesrssAction extends Rss10Action {
function init() {
$nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
-
+
if (!$this->user) {
- common_user_error(_t('No such nickname.'));
+ common_user_error(_('No such nickname.'));
return false;
} else {
return true;
}
}
-
+
function get_notices($limit=0) {
-
+
$user = $this->user;
$notices = array();
@@ -50,7 +50,7 @@ class RepliesrssAction extends Rss10Action {
if ($limit) {
$reply->limit(0, $limit);
}
-
+
$cnt = $reply->find();
if ($cnt) {
@@ -64,23 +64,23 @@ class RepliesrssAction extends Rss10Action {
$notices[] = clone($notice);
}
}
-
+
return $notices;
}
-
+
function get_channel() {
$user = $this->user;
$c = array('url' => common_local_url('repliesrss',
- array('nickname' =>
+ array('nickname' =>
$user->nickname)),
- 'title' => _t("Replies to ") . $profile->nickname,
+ 'title' => sprintf(_("Replies to %s"), $profile->nickname),
'link' => common_local_url('replies',
array('nickname' =>
$user->nickname)),
- 'description' => _t('Feed for replies to ') . $user->nickname);
+ 'description' => sprintf(_('Feed for replies to '), $user->nickname));
return $c;
}
-
+
function get_image() {
$user = $this->user;
$profile = $user->getProfile();
diff --git a/actions/showstream.php b/actions/showstream.php
index 12ffe9598..74409d4b6 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -41,7 +41,7 @@ class ShowstreamAction extends StreamAction {
$profile = $user->getProfile();
if (!$profile) {
- common_server_error(_t('User record exists without profile.'));
+ common_server_error(_('User record exists without profile.'));
return;
}
@@ -79,7 +79,7 @@ class ShowstreamAction extends StreamAction {
'href' => common_local_url('userrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',
- 'title' => _t('Notice feed for ') . $user->nickname));
+ 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
common_element('link', array('rel' => 'meta',
'href' => common_local_url('foaf', array('nickname' =>
$user->nickname)),
@@ -141,7 +141,7 @@ class ShowstreamAction extends StreamAction {
common_element('h1', NULL, $profile->nickname);
}
-
+
if ($profile->location) {
common_element('p', 'location', $profile->location);
}
@@ -169,7 +169,7 @@ class ShowstreamAction extends StreamAction {
'value' => $profile->nickname));
common_element('input', array('type' => 'submit',
'class' => 'submit',
- 'value' => _t('Subscribe')));
+ 'value' => _('Subscribe')));
common_element_end('form');
}
@@ -178,7 +178,7 @@ class ShowstreamAction extends StreamAction {
array('nickname' => $profile->nickname));
common_element('a', array('href' => $url,
'id' => 'remotesubscribe'),
- _t('Subscribe'));
+ _('Subscribe'));
}
function show_unsubscribe_form($profile) {
@@ -190,7 +190,7 @@ class ShowstreamAction extends StreamAction {
'value' => $profile->nickname));
common_element('input', array('type' => 'submit',
'class' => 'submit',
- 'value' => _t('Unsubscribe')));
+ 'value' => _('Unsubscribe')));
common_element_end('form');
}
@@ -209,7 +209,7 @@ class ShowstreamAction extends StreamAction {
common_element_start('div', array('id' => 'subscriptions'));
- common_element('h2', NULL, _t('Subscriptions'));
+ common_element('h2', NULL, _('Subscriptions'));
if ($subs_count > 0) {
@@ -251,7 +251,7 @@ class ShowstreamAction extends StreamAction {
common_element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'),
- _t('All subscriptions'));
+ _('All subscriptions'));
common_element_end('p');
}
@@ -274,27 +274,27 @@ class ShowstreamAction extends StreamAction {
$notice_count = (int) $notices->count();
common_element_start('div', 'statistics');
- common_element('h2', 'statistics', _t('Statistics'));
+ common_element('h2', 'statistics', _('Statistics'));
# Other stats...?
common_element_start('dl', 'statistics');
- common_element('dt', 'membersince', _t('Member since'));
- common_element('dd', 'membersince', date('j M Y',
+ common_element('dt', 'membersince', _('Member since'));
+ common_element('dd', 'membersince', date('j M Y',
strtotime($profile->created)));
-
+
common_element_start('dt', 'subscriptions');
common_element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname))),
- _t('Subscriptions'));
+ _('Subscriptions'));
common_element_end('dt');
common_element('dd', 'subscriptions', $subs_count);
common_element_start('dt', 'subscribers');
common_element('a', array('href' => common_local_url('subscribers',
array('nickname' => $profile->nickname))),
- _t('Subscribers'));
+ _('Subscribers'));
common_element_end('dt');
common_element('dd', 'subscribers', $subbed_count);
- common_element('dt', 'notices', _t('Notices'));
+ common_element('dt', 'notices', _('Notices'));
common_element('dd', 'notices', $notice_count);
common_element_end('dl');
@@ -334,7 +334,7 @@ class ShowstreamAction extends StreamAction {
function show_last_notice($profile) {
- common_element('h2', NULL, _t('Currently'));
+ common_element('h2', NULL, _('Currently'));
$notice = $profile->getCurrentNotice();
diff --git a/actions/subscribe.php b/actions/subscribe.php
index fe683828a..bf9797576 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -24,7 +24,7 @@ class SubscribeAction extends Action {
parent::handle($args);
if (!common_logged_in()) {
- common_user_error(_t('Not logged in.'));
+ common_user_error(_('Not logged in.'));
return;
}
@@ -34,18 +34,18 @@ class SubscribeAction extends Action {
common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
return;
}
-
+
$other_nickname = $this->arg('subscribeto');
$other = User::staticGet('nickname', $other_nickname);
if (!$other) {
- common_user_error(_t('No such user.'));
+ common_user_error(_('No such user.'));
return;
}
if ($user->isSubscribed($other)) {
- common_user_error(_t('Already subscribed!.'));
+ common_user_error(_('Already subscribed!.'));
return;
}
@@ -56,7 +56,7 @@ class SubscribeAction extends Action {
$sub->created = DB_DataObject_Cast::dateTime(); # current time
if (!$sub->insert()) {
- common_server_error(_t('Couldn\'t create subscription.'));
+ common_server_error(_('Couldn\'t create subscription.'));
return;
}
@@ -65,34 +65,30 @@ class SubscribeAction extends Action {
common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname)));
}
-
+
function notify($listenee, $listener) {
# XXX: add other notifications (Jabber, SMS) here
# XXX: queue this and handle it offline
$this->notify_email($listenee, $listener);
}
-
+
function notify_email($listenee, $listener) {
if ($listenee->email) {
global $config;
$profile = $listenee->getProfile();
$other = $listener->getProfile();
$name = $profile->getBestName();
- $other_name = $other->getBestName();
+ $long_name = ($other->fullname) ? ($other->fullname . ' (' . $other->nickname . ')') : $other->nickname;
$recipients = $listenee->email;
$headers['From'] = mail_notify_from();
$headers['To'] = $name . ' <' . $listenee->email . '>';
- $headers['Subject'] = $other_name . _t(' is now listening to your notices on ') . $config['site']['name'];
-
- $body =
- ($other->fullname) ?
- ($other->fullname . ' (' . $other->nickname . ')') : $other->nickname;
+ $headers['Subject'] = sprintf(_('%1$s is now listening to your notices on %2$s.'), $name, $config['site']['name']);
- $body .= _t(' is now listening to your notices on ') . $config['site']['name'] . '.';
+ $body = sprintf(_('%1$s is now listening to your notices on %2$s.'), $long_name, $config['site']['name']);
$body .= "\n\n";
$body .= "\t".$other->profileurl;
$body .= "\n\n";
- $body .= _t('Faithfully yours, ');
+ $body .= _('Faithfully yours, ');
$body .= "\n";
$body .= $config['site']['name'];
$body .= "\n";
diff --git a/actions/subscribers.php b/actions/subscribers.php
index de374d57a..de2090cf1 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -24,26 +24,26 @@ require_once(INSTALLDIR.'/lib/gallery.php');
class SubscribersAction extends GalleryAction {
function gallery_type() {
- return _t('Subscribers');
+ return _('Subscribers');
}
function get_instructions(&$profile) {
$user =& common_current_user();
if ($user && ($user->id == $profile->id)) {
- return _t('These are the people who listen to your notices.');
+ return _('These are the people who listen to your notices.');
} else {
- return _t('These are the people who listen to ') . $profile->nickname . _t('\'s notices.');
+ return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname);
}
}
function define_subs(&$subs, &$profile) {
$subs->subscribed = $profile->id;
}
-
+
function div_class() {
return 'subscribers';
}
-
+
function get_other(&$subs) {
return $subs->subscriber;
}
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index 10aef54d8..e0643e0dc 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -24,26 +24,26 @@ require_once(INSTALLDIR.'/lib/gallery.php');
class SubscriptionsAction extends GalleryAction {
function gallery_type() {
- return _t('Subscriptions');
+ return _('Subscriptions');
}
function get_instructions(&$profile) {
$user =& common_current_user();
if ($user && ($user->id == $profile->id)) {
- return _t('These are the people whose notices you listen to.');
+ return _('These are the people whose notices you listen to.');
} else {
- return _t('These are the people whose notices ') . $profile->nickname . _t(' listens to.');
+ return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname);
}
}
function define_subs(&$subs, &$profile) {
$subs->subscriber = $profile->id;
}
-
+
function div_class() {
return 'subscriptions';
}
-
+
function get_other(&$subs) {
return $subs->subscribed;
}
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 1bf95fb61..0c66946b2 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -21,39 +21,39 @@ class UnsubscribeAction extends Action {
function handle($args) {
parent::handle($args);
if (!common_logged_in()) {
- common_user_error(_t('Not logged in.'));
+ common_user_error(_('Not logged in.'));
return;
}
-
+
$user = common_current_user();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
return;
}
-
+
$other_nickname = $this->arg('unsubscribeto');
$other = User::staticGet('nickname', $other_nickname);
if (!$other) {
- common_user_error(_t('No such user.'));
+ common_user_error(_('No such user.'));
return;
}
if (!$user->isSubscribed($other)) {
- common_server_error(_t('Not subscribed!.'));
+ common_server_error(_('Not subscribed!.'));
}
$sub = DB_DataObject::factory('subscription');
-
+
$sub->subscriber = $user->id;
$sub->subscribed = $other->id;
$sub->find(true);
// note we checked for existence above
-
+
if (!$sub->delete()) {
- common_server_error(_t('Couldn\'t delete subscription.'));
+ common_server_error(_('Couldn\'t delete subscription.'));
return;
}
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index 16afba618..2d523b342 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -37,100 +37,100 @@ class UpdateprofileAction extends Action {
return;
}
}
-
+
function update_profile($req, $consumer, $token) {
$version = $req->get_parameter('omb_version');
if ($version != OMB_VERSION_01) {
- $this->client_error(_t('Unsupported OMB version'), 400);
+ $this->client_error(_('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(_t('Profile unknown'), 404);
+ $this->client_error(_('Profile unknown'), 404);
return false;
}
# Second, check to see if they should be able to post updates!
# We see if there are any subscriptions to that remote user with
# the given token.
-
+
$sub = new Subscription();
$sub->subscribed = $remote->id;
$sub->token = $token->key;
if (!$sub->find(true)) {
- $this->client_error(_t('You did not send us that profile'), 403);
+ $this->client_error(_('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(_t('Remote profile with no matching profile'), 500);
+ $this->server_error(_('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(_t('Nickname must have only letters and numbers and no spaces.'));
+ $this->client_error(_('Nickname must have only 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(_t("Invalid license URL '$license'"));
+ $this->client_error(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(_t("Invalid profile URL '$profile_url'."));
+ $this->client_error(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(_t("Full name '$fullname' too long."));
+ $this->client_error(sprintf(_("Full name '%s' too long."), $fullname));
return false;
}
$homepage = $req->get_parameter('omb_listenee_homepage');
if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
- $this->client_error(_t("Invalid homepage '$homepage'"));
+ $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
return false;
}
$bio = $req->get_parameter('omb_listenee_bio');
if ($bio && strlen($bio) > 140) {
- $this->client_error(_t("Bio too long '$bio'"));
+ $this->client_error(sprintf(_("Bio too long '%s'"), $bio));
return false;
}
$location = $req->get_parameter('omb_listenee_location');
if ($location && strlen($location) > 255) {
- $this->client_error(_t("Location too long '$location'"));
+ $this->client_error(sprintf(_("Location too long '%s'"), $location));
return false;
}
$avatar = $req->get_parameter('omb_listenee_avatar');
if ($avatar) {
if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
- $this->client_error(_t("Invalid avatar URL '$avatar'"));
+ $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
return false;
}
$size = @getimagesize($avatar);
if (!$size) {
- $this->client_error(_t("Can't read avatar URL '$avatar'"));
+ $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
return false;
}
if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
- $this->client_error(_t("Wrong size image at '$avatar'"));
+ $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
return false;
}
if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
IMAGETYPE_PNG))) {
- $this->client_error(_t("Wrong image type for '$avatar'"));
+ $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
return false;
}
}
-
+
$orig_profile = clone($profile);
-
+
if ($nickname) {
$profile->nickname = $nickname;
}
@@ -149,16 +149,16 @@ class UpdateprofileAction extends Action {
if ($location) {
$profile->location = $location;
}
-
+
if (!$profile->update($orig_profile)) {
- $this->server_error(_t('Could not save new profile info'), 500);
+ $this->server_error(_('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(_t('Could not save avatar info'), 500);
+ $this->server_error(_('Could not save avatar info'), 500);
return false;
}
}
diff --git a/actions/userauthorization.php b/actions/userauthorization.php
index 3139cec5b..19fe69313 100644
--- a/actions/userauthorization.php
+++ b/actions/userauthorization.php
@@ -45,7 +45,7 @@ class UserauthorizationAction extends Action {
common_debug('userauthorization.php - getting new request');
$req = $this->get_new_request();
if (!$req) {
- common_server_error(_t('No request found!'));
+ common_server_error(_('No request found!'));
}
common_debug('userauthorization.php - validating request');
# XXX: only validate new requests, since nonce is one-time use
@@ -73,8 +73,8 @@ class UserauthorizationAction extends Action {
$location = $req->get_parameter('omb_listenee_location');
$avatar = $req->get_parameter('omb_listenee_avatar');
- common_show_header(_t('Authorize subscription'));
- common_element('p', NULL, _t('Please check these details to make sure '.
+ common_show_header(_('Authorize subscription'));
+ common_element('p', NULL, _('Please check these details to make sure '.
'that you want to subscribe to this user\'s notices. '.
'If you didn\'t just ask to subscribe to someone\'s notices, '.
'click "Cancel".'));
@@ -115,8 +115,8 @@ class UserauthorizationAction extends Action {
'id' => 'userauthorization',
'name' => 'userauthorization',
'action' => common_local_url('userauthorization')));
- common_submit('accept', _t('Accept'));
- common_submit('reject', _t('Reject'));
+ common_submit('accept', _('Accept'));
+ common_submit('reject', _('Reject'));
common_element_end('form');
common_show_footer();
}
@@ -125,7 +125,7 @@ class UserauthorizationAction extends Action {
$req = $this->get_stored_request();
if (!$req) {
- common_user_error(_t('No authorization request!'));
+ common_user_error(_('No authorization request!'));
return;
}
@@ -133,10 +133,10 @@ class UserauthorizationAction extends Action {
if ($this->arg('accept')) {
if (!$this->authorize_token($req)) {
- common_server_error(_t('Error authorizing token'));
+ common_server_error(_('Error authorizing token'));
}
if (!$this->save_remote_profile($req)) {
- common_server_error(_t('Error saving remote profile'));
+ common_server_error(_('Error saving remote profile'));
}
if (!$callback) {
$this->show_accept_message($req->get_parameter('oauth_token'));
@@ -306,9 +306,9 @@ class UserauthorizationAction extends Action {
}
function show_accept_message($tok) {
- common_show_header(_t('Subscription authorized'));
+ common_show_header(_('Subscription authorized'));
common_element('p', NULL,
- _t('The subscription has been authorized, but no '.
+ _('The subscription has been authorized, but no '.
'callback URL was passed. Check with the site\'s instructions for '.
'details on how to authorize the subscription. Your subscription token is:'));
common_element('blockquote', 'token', $tok);
@@ -316,9 +316,9 @@ class UserauthorizationAction extends Action {
}
function show_reject_message($tok) {
- common_show_header(_t('Subscription rejected'));
+ common_show_header(_('Subscription rejected'));
common_element('p', NULL,
- _t('The subscription has been rejected, but no '.
+ _('The subscription has been rejected, but no '.
'callback URL was passed. Check with the site\'s instructions for '.
'details on how to fully reject the subscription.'));
common_show_footer();
diff --git a/actions/userbyid.php b/actions/userbyid.php
index da61c7b6e..7b95d0725 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -24,11 +24,11 @@ class UserbyidAction extends Action {
parent::handle($args);
$id = $this->trimmed('id');
if (!$id) {
- $this->client_error(_t('No id.'));
+ $this->client_error(_('No id.'));
}
$user =& User::staticGet($id);
if (!$user) {
- $this->client_error(_t('No such user.'));
+ $this->client_error(_('No such user.'));
}
$url=common_local_url('showstream',
array('nickname' => $user->nickname));
diff --git a/actions/userrss.php b/actions/userrss.php
index 92a6bccc9..445afeca5 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -30,20 +30,20 @@ class UserrssAction extends Rss10Action {
function init() {
$nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
-
+
if (!$this->user) {
- common_user_error(_t('No such nickname.'));
+ common_user_error(_('No such nickname.'));
return false;
} else {
return true;
}
}
-
+
function get_notices($limit=0) {
-
+
$user = $this->user;
$notices = array();
-
+
$notice = DB_DataObject::factory('notice');
$notice->profile_id = $user->id; # user id === profile id
$notice->orderBy('created DESC');
@@ -51,26 +51,26 @@ class UserrssAction extends Rss10Action {
$notice->limit(0, $limit);
}
$notice->find();
-
+
while ($notice->fetch()) {
$notices[] = clone($notice);
}
-
+
return $notices;
}
-
+
function get_channel() {
$user = $this->user;
$profile = $user->getProfile();
$c = array('url' => common_local_url('userrss',
- array('nickname' =>
+ array('nickname' =>
$user->nickname)),
'title' => $user->nickname,
'link' => $profile->profileurl,
- 'description' => _t('Microblog by ') . $user->nickname);
+ 'description' => sprintf(_('Microblog by %s'), $user->nickname));
return $c;
}
-
+
function get_image() {
$user = $this->user;
$profile = $user->getProfile();
diff --git a/actions/xrds.php b/actions/xrds.php
index 1b10f9477..70a18a6b9 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -28,19 +28,19 @@ class XrdsAction extends Action {
$nickname = $this->trimmed('nickname');
$user = User::staticGet('nickname', $nickname);
if (!$user) {
- common_user_error(_t('No such user.'));
+ common_user_error(_('No such user.'));
return;
}
$this->show_xrds($user);
}
function show_xrds($user) {
-
+
header('Content-Type: application/xrds+xml');
common_start_xml();
common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
-
+
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xml:id' => 'oauth',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
@@ -68,18 +68,18 @@ class XrdsAction extends Action {
NULL,
array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
array(OAUTH_HMAC_SHA1));
-
+
common_element_end('XRD');
-
+
# XXX: decide whether to include user's ID/nickname in postNotice URL
-
+
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xml:id' => 'omb',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0'));
-
+
common_element('Type', NULL, 'xri://$xrds*simple');
-
+
$this->show_service(OMB_ENDPOINT_POSTNOTICE,
common_local_url('postnotice'));
@@ -87,23 +87,23 @@ class XrdsAction extends Action {
common_local_url('updateprofile'));
common_element_end('XRD');
-
+
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'version' => '2.0'));
common_element('Type', NULL, 'xri://$xrds*simple');
-
+
$this->show_service(OAUTH_DISCOVERY,
'#oauth');
$this->show_service(OMB_NAMESPACE,
'#omb');
-
+
common_element_end('XRD');
-
+
common_element_end('XRDS');
common_end_xml();
}
-
+
function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
common_element_start('Service');
if ($uri) {