* Update punctuation in form validation message for consistency.
* Remove superfluous whitespace.
<?php
-
/**
* Disfavor action.
*
} elseif (Oauth_application::descriptionTooLong($description)) {
$this->showForm(sprintf(
// TRANS: Validation error shown when providing too long a description in the "Edit application" form.
+ // TRANS: %d is the maximum number of allowed characters.
_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
Oauth_application::maxDesc()),
$this->showForm(_('Organization is too long (maximum 255 characters).'));
return;
} elseif (empty($homepage)) {
+ // TRANS: Form validation error show when an organisation name has not been provided in the edit application form.
$this->showForm(_('Organization homepage is required.'));
return;
} elseif ((mb_strlen($homepage) > 0)
*
* @see Widget
*/
-
class EmailsettingsAction extends AccountSettingsAction
{
/**
*
* @return string Title of the page
*/
-
function title()
{
// TRANS: Title for e-mail settings.
*
* @return instructions for use
*/
-
function getInstructions()
{
// XXX: For consistency of parameters in messages, this should be a
*
* @return void
*/
-
function showContent()
{
$user = common_current_user();
$confirm = $this->getConfirmation();
if ($confirm) {
$this->element('p', array('id' => 'form_unconfirmed'), $confirm->address);
- // TRANS: Form note in e-mail settings form.
$this->element('p', array('class' => 'form_note'),
+ // TRANS: Form note in e-mail settings form.
_('Awaiting confirmation on this address. '.
'Check your inbox (and spam box!) for a message '.
'with further instructions.'));
if ($user->incomingemail) {
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
- // XXX: Looks a little awkward in the UI.
+ // @todo XXX: Looks a little awkward in the UI.
// Something like "xxxx@identi.ca Send email ..". Needs improvement.
$this->element('span', 'input_instructions',
// TRANS: Form instructions for incoming e-mail form in e-mail settings.
$this->element('legend', null, _('Email preferences'));
$this->elementStart('ul', 'form_data');
-
+
if (Event::handle('StartEmailFormData', array($this))) {
$this->elementStart('li');
$this->checkbox('emailnotifysub',
*
* @return Confirm_address Email address confirmation for user, or null
*/
-
function getConfirmation()
{
$user = common_current_user();
*
* @return void
*/
-
function handlePost()
{
// CSRF protection
*
* @return void
*/
-
function savePreferences()
{
$user = common_current_user();
-
+
if (Event::handle('StartEmailSaveForm', array($this, &$user))) {
-
+
$emailnotifysub = $this->boolean('emailnotifysub');
$emailnotifyfav = $this->boolean('emailnotifyfav');
$emailnotifymsg = $this->boolean('emailnotifymsg');
$emailnotifyattn = $this->boolean('emailnotifyattn');
$emailmicroid = $this->boolean('emailmicroid');
$emailpost = $this->boolean('emailpost');
-
+
assert(!is_null($user)); // should already be checked
-
+
$user->query('BEGIN');
-
+
$original = clone($user);
-
+
$user->emailnotifysub = $emailnotifysub;
$user->emailnotifyfav = $emailnotifyfav;
$user->emailnotifymsg = $emailnotifymsg;
$user->emailnotifyattn = $emailnotifyattn;
$user->emailmicroid = $emailmicroid;
$user->emailpost = $emailpost;
-
+
$result = $user->update($original);
-
+
if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating e-mail preferences.
$this->serverError(_('Could not update user.'));
return;
}
-
+
$user->query('COMMIT');
-
+
Event::handle('EndEmailSaveForm', array($this));
-
+
// TRANS: Confirmation message for successful e-mail preferences save.
$this->showForm(_('Email preferences saved.'), true);
}
*
* @return void
*/
-
function addAddress()
{
$user = common_current_user();
if (!$email) {
// TRANS: Message given saving e-mail address that cannot be normalised.
- $this->showForm(_('Cannot normalize that email address'));
+ $this->showForm(_('Cannot normalize that email address.'));
return;
}
if (!Validate::email($email, common_config('email', 'check_domain'))) {
*
* @return void
*/
-
function cancelConfirmation()
{
$email = $this->arg('email');
*
* @return void
*/
-
function removeAddress()
{
$user = common_current_user();
*
* @return void
*/
-
function removeIncoming()
{
$user = common_current_user();
if (!$user->incomingemail) {
+ // TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
$this->showForm(_('No incoming email address.'));
return;
}
*
* @return void
*/
-
function newIncoming()
{
$user = common_current_user();
<?php
-
/**
* Favor action.
*
{
parent::handle($args);
if (!common_logged_in()) {
+ // TRANS: Client error displayed when trying to mark a notice as favorite without being logged in.
$this->clientError(_('Not logged in.'));
return;
}
return;
}
if ($user->hasFave($notice)) {
+ // TRANS: Client error displayed when trying to mark a notice as favorite that already is a favorite.
$this->clientError(_('This notice is already a favorite!'));
return;
}
$fave = Fave::addNew($user->getProfile(), $notice);
if (!$fave) {
+ // TRANS: Server error displayed when trying to mark a notice as favorite fails in the database.
$this->serverError(_('Could not create favorite.'));
return;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
+ // TRANS: Page title for page on which favorite notices can be unfavourited.
$this->element('title', null, _('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');
}
}
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class FavoritedAction extends Action
{
var $page = null;
function title()
{
if ($this->page == 1) {
+ // TRANS: Page title for first page of favorited notices.
return _('Popular notices');
} else {
+ // TRANS: Page title for all but first page of favorited notices.
+ // TRANS: %d is the page number being displayed.
return sprintf(_('Popular notices, page %d'), $this->page);
}
}
*
* @return instructions for use
*/
-
function getInstructions()
{
+ // TRANS: Description on page displaying favorited notices.
return _('The most popular notices on the site right now.');
}
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @todo move queries from showContent() to here
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showPageNotice()
{
$instr = $this->getInstructions();
function showEmptyList()
{
+ // TRANS: Text displayed instead of a list when a site does not yet have any favourited notices.
$message = _('Favorite notices appear on this page but no one has favorited one yet.') . ' ';
if (common_logged_in()) {
+ // TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for logged in users.
$message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
}
else {
+ // TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for not logged in users.
+ // TRANS: %%action.register%% is a registration link. "[link text](link)" is Mark Down. Do not change the formatting.
$message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
}
*
* @return void
*/
-
function showLocalNav()
{
$nav = new PublicGroupNav($this);
*
* @return void
*/
-
function showContent()
{
$pop = new Popularity();
<?php
-
/**
* RSS feed for user favorites action class.
*
*/
class FavoritesrssAction extends Rss10Action
{
-
/** The user whose favorites to display */
var $user = null;
*
* @return boolean success
*/
-
function prepare($args)
{
parent::prepare($args);
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
+ // TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist.
$this->clientError(_('No such user.'));
return false;
} else {
$c = array('url' => common_local_url('favoritesrss',
array('nickname' =>
$user->nickname)),
+ // TRANS: Title of RSS feed with favourite notices of a user.
+ // TRANS: %s is a user's nickname.
'title' => sprintf(_("%s's favorite notices"), $user->nickname),
'link' => common_local_url('showfavorites',
array('nickname' =>
$user->nickname)),
+ // TRANS: Desciption of RSS feed with favourite notices of a user.
+ // TRANS: %1$s is a user's nickname, %2$s is the name of the StatusNet site.
'description' => sprintf(_('Updates favored by %1$s on %2$s!'),
$user->nickname, common_config('site', 'name')));
return $c;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class FeaturedAction extends Action
{
var $page = null;
function title()
{
if ($this->page == 1) {
+ // TRANS: Page title for first page of featured users.
return _('Featured users');
} else {
+ // TRANS: Page title for all but first page of featured users.
+ // TRANS: %d is the page number being displayed.
return sprintf(_('Featured users, page %d'), $this->page);
}
}
function getInstructions()
{
- return sprintf(_('A selection of some great users on %s'),
+ // TRANS: Description on page displaying featured users.
+ return sprintf(_('A selection of some great users on %s.'),
common_config('site', 'name'));
}
require_once(INSTALLDIR.'/actions/shownotice.php');
+// @todo FIXME: Add documentation.
class FileAction extends Action
{
var $id = null;
parent::prepare($args);
$this->id = $this->trimmed('notice');
if (empty($this->id)) {
+ // TRANS: Client error displayed when no notice ID was given trying do display a file.
$this->clientError(_('No notice ID.'));
}
$notice = Notice::staticGet('id', $this->id);
if (empty($notice)) {
+ // TRANS: Client error displayed when an invalid notice ID was given trying do display a file.
$this->clientError(_('No notice.'));
}
$atts = $notice->attachments();
if (empty($atts)) {
+ // TRANS: Client error displayed when trying do display a file for a notice without a file attachement.
$this->clientError(_('No attachments.'));
}
foreach ($atts as $att) {
}
}
if (empty($this->filerec)) {
+ // XXX: Is this translation hint correct? If yes, please remove comment, if no, please correct and remove comment.
+ // TRANS: Client error displayed when trying do display a file for a notice with file attachements
+ // TRANS: that could not be found.
$this->clientError(_('No uploaded attachments.'));
}
return true;
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
}
-
}
-
/**
* Prepare to run
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
} elseif ($this->arg('save')) {
$this->trySave();
} else {
+ // TRANS: Client error displayed when encountering an unexpected action on form submission.
$this->clientError(_('Unexpected form submission.'));
}
}
$this->element('p', 'error', $this->msg);
} else {
$this->element('p', 'instructions',
+ // TRANS: Form instructions for registering a new application.
_('Use this form to register a new application.'));
}
}
$access_type = $this->arg('default_access_type');
if (empty($name)) {
+ // TRANS: Validation error shown when not providing a name in the "New application" form.
$this->showForm(_('Name is required.'));
return;
} else if ($this->nameExists($name)) {
+ // TRANS: Validation error shown when providing a name for an application that already exists in the "New application" form.
$this->showForm(_('Name already in use. Try another one.'));
return;
} elseif (mb_strlen($name) > 255) {
+ // TRANS: Validation error shown when providing too long a name in the "New application" form.
$this->showForm(_('Name is too long (maximum 255 characters).'));
return;
} elseif (empty($description)) {
+ // TRANS: Validation error shown when not providing a description in the "New application" form.
$this->showForm(_('Description is required.'));
return;
} elseif (Oauth_application::descriptionTooLong($description)) {
Oauth_application::maxDesc()));
return;
} elseif (empty($source_url)) {
+ // TRANS: Validation error shown when not providing a source URL in the "New application" form.
$this->showForm(_('Source URL is required.'));
return;
} elseif ((strlen($source_url) > 0)
)
)
{
+ // TRANS: Validation error shown when providing an invalid source URL in the "New application" form.
$this->showForm(_('Source URL is not valid.'));
return;
} elseif (empty($organization)) {
+ // TRANS: Validation error shown when not providing an organisation in the "New application" form.
$this->showForm(_('Organization is required.'));
return;
} elseif (mb_strlen($organization) > 255) {
+ // TRANS: Validation error shown when providing too long an arganisation name in the "Edit application" form.
$this->showForm(_('Organization is too long (maximum 255 characters).'));
return;
} elseif (empty($homepage)) {
+ // TRANS: Form validation error show when an organisation name has not been provided in the new application form.
$this->showForm(_('Organization homepage is required.'));
return;
} elseif ((strlen($homepage) > 0)
)
)
{
+ // TRANS: Validation error shown when providing an invalid homepage URL in the "New application" form.
$this->showForm(_('Homepage is not a valid URL.'));
return;
} elseif (mb_strlen($callback_url) > 255) {
+ // TRANS: Validation error shown when providing too long a callback URL in the "New application" form.
$this->showForm(_('Callback is too long.'));
return;
} elseif (strlen($callback_url) > 0
)
)
{
+ // TRANS: Validation error shown when providing an invalid callback URL in the "New application" form.
$this->showForm(_('Callback URL is not valid.'));
return;
}
if (!$result) {
common_log_db_error($consumer, 'INSERT', __FILE__);
+ // TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.'));
}
if (!$this->app_id) {
common_log_db_error($app, 'INSERT', __FILE__);
+ // TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.'));
$app->query('ROLLBACK');
}
$app->query('COMMIT');
common_redirect(common_local_url('oauthappssettings'), 303);
-
}
/**
*
* @return boolean true if the name already exists
*/
-
function nameExists($name)
{
$app = Oauth_application::staticGet('name', $name);
return !empty($app);
}
-
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ShowfavoritesAction extends OwnerDesignAction
{
/** User we're getting the faves of */
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string title of page
*/
-
function title()
{
if ($this->page == 1) {
+ // TRANS: Title for first page of favourite notices of a user.
+ // TRANS: %s is the user for whom the favourite notices are displayed.
return sprintf(_('%s\'s favorite notices'), $this->user->nickname);
} else {
+ // TRANS: Title for all but the first page of favourite notices of a user.
+ // TRANS: %1$s is the user for whom the favourite notices are displayed, %2$d is the page number.
return sprintf(_('%1$s\'s favorite notices, page %2$d'),
$this->user->nickname,
$this->page);
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
+ // TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
$this->clientError(_('No such user.'));
return false;
}
}
if (empty($this->notice)) {
+ // TRANS: Server error displayed when favourite notices could not be retrieved from the database.
$this->serverError(_('Could not retrieve favorite notices.'));
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return array Feed objects to show
*/
-
function getFeeds()
{
return array(new Feed(Feed::RSS1,
common_local_url('favoritesrss',
array('nickname' => $this->user->nickname)),
+ // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 1.0)'),
$this->user->nickname)),
new Feed(Feed::RSS2,
array(
'id' => $this->user->nickname,
'format' => 'rss')),
+ // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 2.0)'),
$this->user->nickname)),
new Feed(Feed::ATOM,
array(
'id' => $this->user->nickname,
'format' => 'atom')),
+ // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (Atom)'),
$this->user->nickname)));
}
*
* @return void
*/
-
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
if (common_logged_in()) {
$current_user = common_current_user();
if ($this->user->id === $current_user->id) {
+ // TRANS: Text displayed instead of favourite notices for the current logged in user that has no favourites.
$message = _('You haven\'t chosen any favorite notices yet. Click the fave button on notices you like to bookmark them for later or shed a spotlight on them.');
} else {
+ // TRANS: Text displayed instead of favourite notices for a user that has no favourites while logged in.
+ // TRANS: %s is a username.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->user->nickname);
}
}
else {
+ // TRANS: Text displayed instead of favourite notices for a user that has no favourites while not logged in.
+ // TRANS: %s is a username, %%%%action.register%%%% is a link to the user registration page.
+ // TRANS: (link text)[link] is a Mark Down link.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->user->nickname);
}
*
* @return void
*/
-
function showContent()
{
$nl = new FavoritesNoticeList($this->notice, $this);
}
function showPageNotice() {
+ // TRANS: Page notice for show favourites page.
$this->element('p', 'instructions', _('This is a way to share what you like.'));
}
}
if (!$code) {
// TRANS: Message given saving SMS phone number confirmation code without having provided one.
- $this->showForm(_('No code entered'));
+ $this->showForm(_('No code entered.'));
return;
}
$user = common_current_user();
if (!$user->incomingemail) {
+ // TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
$this->showForm(_('No incoming email address.'));
return;
}