Convert _t() to _() for gettext.

darcs-hash:20080708094531-533db-83399a46e6ec4c0fcc6249b0235961f969d1ae73.gz
This commit is contained in:
Mike Cochrane 2008-07-08 05:45:31 -04:00
parent a25f5010e6
commit 87b494f1eb
43 changed files with 552 additions and 559 deletions

View File

@ -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) {

View File

@ -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;
@ -67,11 +67,11 @@ class AllrssAction extends Rss10Action {
$c = array('url' => common_local_url('allrss',
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;
}

View File

@ -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']);

View File

@ -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();
}
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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. ' .
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.'));
' 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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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,18 +37,31 @@ class LoginAction extends Action {
# XXX: login throttle
$nickname = $this->arg('nickname');
$password = $this->arg('password');
$user = common_check_user($nickname, $password);
if (!$user) {
$this->show_form(_t('Incorrect username or password.'));
return;
}
if (common_check_user($nickname, $password)) {
# success!
if (!common_set_user($user)) {
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.'));
}
common_real_login(true);
@ -70,42 +83,30 @@ 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%%). ');
}
}
function show_top($error=NULL) {
if ($error) {

View File

@ -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

View File

@ -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) {

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -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,7 +58,7 @@ 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;
}
@ -66,7 +66,7 @@ class PasswordAction extends SettingsAction {
$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);
}
}

View File

@ -41,35 +41,35 @@ class PostnoticeAction extends Action {
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);

View File

@ -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) {

View File

@ -30,7 +30,7 @@ class PublicAction extends StreamAction {
header('X-XRDS-Location: '. common_local_url('publicxrds'));
common_show_header(_t('Public timeline'),
common_show_header(_('Public timeline'),
array($this, 'show_header'), NULL,
array($this, 'show_top'));
@ -51,7 +51,7 @@ class PublicAction extends StreamAction {
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')));

View File

@ -57,9 +57,9 @@ class PublicrssAction extends Rss10Action {
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;
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -38,13 +38,13 @@ 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'));
@ -58,7 +58,7 @@ class RepliesAction extends StreamAction {
'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) {

View File

@ -32,7 +32,7 @@ class RepliesrssAction 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;
@ -73,11 +73,11 @@ class RepliesrssAction extends Rss10Action {
$c = array('url' => common_local_url('repliesrss',
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;
}

View File

@ -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)),
@ -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('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();

View File

@ -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;
}
@ -40,12 +40,12 @@ class SubscribeAction extends Action {
$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;
}
@ -78,21 +78,17 @@ class SubscribeAction extends Action {
$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'];
$headers['Subject'] = sprintf(_('%1$s is now listening to your notices on %2$s.'), $name, $config['site']['name']);
$body =
($other->fullname) ?
($other->fullname . ' (' . $other->nickname . ')') : $other->nickname;
$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";

View File

@ -24,15 +24,15 @@ 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);
}
}

View File

@ -24,15 +24,15 @@ 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);
}
}

View File

@ -21,7 +21,7 @@ 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;
}
@ -35,12 +35,12 @@ class UnsubscribeAction extends Action {
$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');
@ -53,7 +53,7 @@ class UnsubscribeAction extends Action {
// 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;
}

View File

@ -41,14 +41,14 @@ class UpdateprofileAction extends Action {
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!
@ -59,72 +59,72 @@ class UpdateprofileAction extends Action {
$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;
}
}
@ -151,14 +151,14 @@ class UpdateprofileAction extends Action {
}
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;
}
}

View File

@ -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();

View File

@ -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));

View File

@ -32,7 +32,7 @@ class UserrssAction 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;
@ -67,7 +67,7 @@ class UserrssAction extends Rss10Action {
$user->nickname)),
'title' => $user->nickname,
'link' => $profile->profileurl,
'description' => _t('Microblog by ') . $user->nickname);
'description' => sprintf(_('Microblog by %s'), $user->nickname));
return $c;
}

View File

@ -28,7 +28,7 @@ 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);

View File

@ -1,8 +1,8 @@
[DB_DataObject]
database = mysql://root:@localhost/stoica
schema_location = /home/evan/code/stoica/classes
class_location = /home/evan/code/stoica/classes
database = mysql://laconica:microblog@10.0.0.253/laconica
schema_location = /home/gardyneholt/laconica/classes
class_location = /home/gardyneholt/laconica/classes
require_prefix = classes/
class_prefix =
db_driver = DB #Use this if you wish to use MDB2 as the driver

View File

@ -36,5 +36,5 @@ if (file_exists($actionfile)) {
$action_obj = new $action_class();
call_user_func(array($action_obj, 'handle'), $_REQUEST);
} else {
common_user_error(_t('Unknown action'));
common_user_error(_('Unknown action'));
}

View File

@ -50,7 +50,7 @@ class GalleryAction extends Action {
}
function no_such_user() {
$this->client_error(_t('No such user.'));
$this->client_error(_('No such user.'));
}
function show_top($profile) {
@ -73,7 +73,7 @@ class GalleryAction extends Action {
$subs_count = $subs->find();
if ($subs_count == 0) {
common_element('p', _t('Nobody to show!'));
common_element('p', _('Nobody to show!'));
return;
}

View File

@ -79,7 +79,7 @@ function mail_confirm_address($code, $nickname, $address) {
$recipients = $address;
$headers['From'] = mail_notify_from();
$headers['To'] = $nickname . ' <' . $address . '>';
$headers['Subject'] = _t('Email address confirmation');
$headers['Subject'] = _('Email address confirmation');
$body = "Hey, $nickname.";
$body .= "\n\n";

View File

@ -118,7 +118,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
$consumer = oid_consumer();
if (!$consumer) {
common_server_error(_t('Cannot instantiate OpenID consumer object.'));
common_server_error(_('Cannot instantiate OpenID consumer object.'));
return false;
}
@ -128,9 +128,9 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
// Handle failure status return values.
if (!$auth_request) {
return _t('Not a valid OpenID.');
return _('Not a valid OpenID.');
} else if (Auth_OpenID::isFailure($auth_request)) {
return _t('OpenID failure: ') . $auth_request->message;
return sprintf(_('OpenID failure: %s'), $auth_request->message);
}
$sreg_request = Auth_OpenID_SRegRequest::build(// Required
@ -157,7 +157,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
$immediate);
if (!$redirect_url) {
} else if (Auth_OpenID::isFailure($redirect_url)) {
return _t('Could not redirect to server: ') . $redirect_url->message;
return sprintf(_('Could not redirect to server: %s'), $redirect_url->message);
} else {
common_redirect($redirect_url);
}
@ -175,9 +175,9 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID::isFailure($form_html)) {
$this->show_form(_t('Could not create OpenID form: ') . $form_html->message);
$this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
} else {
common_show_header(_t('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
common_raw($form_html);
common_element('script', NULL,
'$(document).ready(function() { ' .
@ -192,7 +192,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) {
function _oid_print_instructions() {
common_element('div', 'instructions',
_t('This form should automatically submit itself. '.
_('This form should automatically submit itself. '.
'If not, click the submit button to go to your '.
'OpenID provider.'));
}
@ -223,7 +223,7 @@ function oid_update_user(&$user, &$sreg) {
# XXX save timezone if it's passed
if (!$profile->update($orig_profile)) {
common_server_error(_t('Error saving the profile.'));
common_server_error(_('Error saving the profile.'));
return false;
}
@ -234,7 +234,7 @@ function oid_update_user(&$user, &$sreg) {
}
if (!$user->update($orig_user)) {
common_server_error(_t('Error saving the user.'));
common_server_error(_('Error saving the user.'));
return false;
}

View File

@ -24,7 +24,7 @@ class SettingsAction 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;
} else if (!common_is_real_login()) {
# Cookie theft means that automatic logins can't
@ -95,6 +95,15 @@ class SettingsAction extends Action {
'imsettings' =>
array('IM',
'Updates by instant messenger (IM)'));
$this->nav_menu($menu);
$action = $this->trimmed('action');
common_element_start('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) {
common_menu_item(common_local_url($menuaction),
_t($menudesc[0]),
_t($menudesc[1]),
$action == $menuaction);
}
common_element_end('ul');
}
}

View File

@ -41,17 +41,17 @@ class StreamAction extends Action {
common_menu_item(common_local_url('all', array('nickname' =>
$nickname)),
_t('Personal'),
(($user && $user->fullname) ? $user->fullname : $nickname) . _t(' and friends'),
_('Personal'),
sprintf(_('%s and friends'), (($user && $user->fullname) ? $user->fullname : $nickname)),
$action == 'all');
common_menu_item(common_local_url('replies', array('nickname' =>
$nickname)),
_t('Replies'),
_t('Replies to ') . (($user && $user->fullname) ? $user->fullname : $nickname),
_('Replies'),
sprintf(_('Replies to %s'), (($user && $user->fullname) ? $user->fullname : $nickname)),
$action == 'replies');
common_menu_item(common_local_url('showstream', array('nickname' =>
$nickname)),
_t('Profile'),
_('Profile'),
($user && $user->fullname) ? $user->fullname : $nickname,
$action == 'showstream');
common_element_end('ul');
@ -98,7 +98,7 @@ class StreamAction extends Action {
common_text(' (');
common_element('a', array('class' => 'inreplyto',
'href' => $replyurl),
_t('in reply to...'));
_t(' in reply to...'));
common_text(')');
}
common_element_start('a',

View File

@ -144,7 +144,7 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
common_accept_to_prefs(PAGE_TYPE_PREFS));
if (!$type) {
common_user_error(_t('This page is not available in a media type you accept'), 406);
common_user_error(_('This page is not available in a media type you accept'), 406);
exit(0);
}
@ -230,15 +230,15 @@ function common_show_footer() {
common_element_start('div', array('id' => 'footer'));
common_element_start('div', 'laconica');
if (common_config('site', 'broughtby')) {
$instr = _t('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
} else {
$instr = _t('**%%site.name%%** is a microblogging service. ');
$instr = _('**%%site.name%%** is a microblogging service. ');
}
$instr .= _t('It runs the [Laconica](http://laconi.ca/) ' .
'microblogging software, version ' . LACONICA_VERSION . ', ' .
$instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) ' .
'microblogging software, version %s, ' .
'available under the ' .
'[GNU Affero General Public License]' .
'(http://www.fsf.org/licensing/licenses/agpl-3.0.html).');
'(http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
$output = common_markup_to_html($instr);
common_raw($output);
common_element_end('div');
@ -246,12 +246,12 @@ function common_show_footer() {
'src' => $config['license']['image'],
'alt' => $config['license']['title']));
common_element_start('p');
common_text(_t('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
common_element('a', array('class' => 'license',
'rel' => 'license',
href => $config['license']['url']),
$config['license']['title']);
common_text(_t('. Contributors should be attributed by full name or nickname.'));
common_text(_('. Contributors should be attributed by full name or nickname.'));
common_element_end('p');
common_element_end('div');
common_element_end('div');
@ -275,21 +275,20 @@ function common_nav_menu() {
common_element_start('ul', array('id' => 'nav'));
if ($user) {
common_menu_item(common_local_url('all', array('nickname' => $user->nickname)),
_t('Home'));
_('Home'));
}
common_menu_item(common_local_url('public'), _t('Public'));
common_menu_item(common_local_url('peoplesearch'), _t('Search'));
common_menu_item(common_local_url('doc', array('title' => 'help')),
_t('Help'));
_('Help'));
if ($user) {
common_menu_item(common_local_url('profilesettings'),
_t('Settings'));
_('Settings'));
common_menu_item(common_local_url('logout'),
_t('Logout'));
_('Logout'));
} else {
common_menu_item(common_local_url('login'), _t('Login'));
common_menu_item(common_local_url('register'), _t('Register'));
common_menu_item(common_local_url('openidlogin'), _t('OpenID'));
common_menu_item(common_local_url('login'), _('Login'));
common_menu_item(common_local_url('register'), _('Register'));
common_menu_item(common_local_url('openidlogin'), _('OpenID'));
}
common_element_end('ul');
}
@ -297,15 +296,15 @@ function common_nav_menu() {
function common_foot_menu() {
common_element_start('ul', array('id' => 'nav_sub'));
common_menu_item(common_local_url('doc', array('title' => 'about')),
_t('About'));
_('About'));
common_menu_item(common_local_url('doc', array('title' => 'faq')),
_t('FAQ'));
_('FAQ'));
common_menu_item(common_local_url('doc', array('title' => 'privacy')),
_t('Privacy'));
_('Privacy'));
common_menu_item(common_local_url('doc', array('title' => 'source')),
_t('Source'));
_('Source'));
common_menu_item(common_local_url('doc', array('title' => 'contact')),
_t('Contact'));
_('Contact'));
common_element_end('ul');
}
@ -815,25 +814,25 @@ function common_date_string($dt) {
if ($now < $t) { # that shouldn't happen!
return common_exact_date($dt);
} else if ($diff < 60) {
return _t('a few seconds ago');
return _('a few seconds ago');
} else if ($diff < 92) {
return _t('about a minute ago');
return _('about a minute ago');
} else if ($diff < 3300) {
return _t('about ') . round($diff/60) . _t(' minutes ago');
return sprintf(_('about %d minutes ago'), round($diff/60));
} else if ($diff < 5400) {
return _t('about an hour ago');
return _('about an hour ago');
} else if ($diff < 22 * 3600) {
return _t('about ') . round($diff/3600) . _t(' hours ago');
return sprintf(_('about %d hours ago'), round($diff/3600));
} else if ($diff < 37 * 3600) {
return _t('about a day ago');
return _('about a day ago');
} else if ($diff < 24 * 24 * 3600) {
return _t('about ') . round($diff/(24*3600)) . _t(' days ago');
return sprintf(_('about %d days ago', round($diff/(24*3600))));
} else if ($diff < 46 * 24 * 3600) {
return _t('about a month ago');
return _('about a month ago');
} else if ($diff < 330 * 24 * 3600) {
return _t('about ') . round($diff/(30*24*3600)) . _t(' months ago');
return sprintf(_('about %d months ago'), round($diff/(30*24*3600)));
} else if ($diff < 480 * 24 * 3600) {
return _t('about a year ago');
return _('about a year ago');
} else {
return common_exact_date($dt);
}
@ -969,7 +968,7 @@ function common_notice_form($action=NULL, $content=NULL) {
common_element_start('p');
common_element('label', array('for' => 'status_textarea',
'id' => 'status_label'),
_t('What\'s up, ').$user->nickname.'?');
sprintf(_('What\'s up, %s?'), $user->nickname));
common_element('span', array('id' => 'counter', 'class' => 'counter'), '140');
common_element('textarea', array('id' => 'status_textarea',
'cols' => 60,
@ -982,7 +981,7 @@ function common_notice_form($action=NULL, $content=NULL) {
common_element('input', array('id' => 'status_submit',
'name' => 'status_submit',
'type' => 'submit',
'value' => _t('Send')));
'value' => _('Send')));
common_element_end('p');
common_element_end('form');
}
@ -1046,12 +1045,6 @@ function common_timestamp() {
return date('YmdHis');
}
// XXX: set up gettext
function _t($str) {
return $str;
}
function common_ensure_syslog() {
static $initialized = false;
if (!$initialized) {
@ -1133,7 +1126,7 @@ function common_pagination($have_before, $have_after, $page, $action, $args=NULL
common_element_start('li', 'before');
common_element('a', array('href' => common_local_url($action, $newargs)),
_t('« After'));
_('« After'));
common_element_end('li');
}
@ -1142,7 +1135,7 @@ function common_pagination($have_before, $have_after, $page, $action, $args=NULL
$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
common_element_start('li', 'after');
common_element('a', array('href' => common_local_url($action, $newargs)),
_t('Before »'));
_('Before »'));
common_element_end('li');
}