Merge branch '1.0.x' into testing

Conflicts:
	plugins/Event/RSVP.php
This commit is contained in:
Evan Prodromou 2011-04-05 13:16:28 -04:00
commit 36b331d469
1703 changed files with 92273 additions and 26282 deletions

View File

@ -742,19 +742,19 @@ EndUnsubscribe: when an unsubscribe is done
StartJoinGroup: when a user is joining a group StartJoinGroup: when a user is joining a group
- $group: the group being joined - $group: the group being joined
- $user: the user joining - $profile: the local or remote user joining
EndJoinGroup: when a user finishes joining a group EndJoinGroup: when a user finishes joining a group
- $group: the group being joined - $group: the group being joined
- $user: the user joining - $profile: the local or remote user joining
StartLeaveGroup: when a user is leaving a group StartLeaveGroup: when a user is leaving a group
- $group: the group being left - $group: the group being left
- $user: the user leaving - $profile: the local or remote user leaving
EndLeaveGroup: when a user has left a group EndLeaveGroup: when a user has left a group
- $group: the group being left - $group: the group being left
- $user: the user leaving - $profile: the local or remote user leaving
StartShowContentLicense: Showing the default license for content StartShowContentLicense: Showing the default license for content
- $action: the current action - $action: the current action

2
README
View File

@ -1472,6 +1472,8 @@ Configuration options specific to notices.
contentlimit: max length of the plain-text content of a notice. contentlimit: max length of the plain-text content of a notice.
Default is null, meaning to use the site-wide text limit. Default is null, meaning to use the site-wide text limit.
0 means no limit. 0 means no limit.
defaultscope: default scope for notices. Defaults to 0; set to
1 to keep notices private to this site by default.
message message
------- -------

View File

@ -66,6 +66,7 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -88,7 +88,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed handling a non-existing API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -90,7 +90,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -88,7 +88,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -111,7 +111,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method updating profile colours. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -64,7 +64,7 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
parent::handle($args); parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed trying to execute an unknown API method verifying user credentials. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
return; return;
} }

View File

@ -92,7 +92,7 @@ class ApiBlockCreateAction extends ApiAuthAction
} }
if (empty($this->user) || empty($this->other)) { if (empty($this->user) || empty($this->other)) {
// TRANS: Client error displayed when trying to block a non-existing user or a user from another site. // TRANS: Client error displayed when trying to block a non-existing user or a user from another site.
$this->clientError(_('No such user.'), 404, $this->format); $this->clientError(_('No such user.'), 404, $this->format);
return; return;
} }

View File

@ -153,7 +153,7 @@ class ApiDirectMessageAction extends ApiAuthAction
$this->showJsonDirectMessages(); $this->showJsonDirectMessages();
break; break;
default: default:
// TRANS: Client error given when an API method was not found (404). // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -94,7 +94,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -94,7 +94,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -95,7 +95,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -95,7 +95,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -120,7 +120,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
parent::handle($args); parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed trying to execute an unknown API method showing friendship. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404); $this->clientError(_('API method not found.'), 404);
return; return;
} }

View File

@ -134,7 +134,7 @@ class ApiGroupCreateAction extends ApiAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error given when an API method was not found (404). // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -111,7 +111,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method showing group membership. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
400, 400,
$this->format $this->format

View File

@ -126,10 +126,7 @@ class ApiGroupJoinAction extends ApiAuthAction
} }
try { try {
if (Event::handle('StartJoinGroup', array($this->group, $this->user))) { $this->user->joinGroup($this->group);
Group_member::join($this->group->id, $this->user->id);
Event::handle('EndJoinGroup', array($this->group, $this->user));
}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error displayed when joining a group failed in the database. // TRANS: Server error displayed when joining a group failed in the database.
// TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed. // TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
@ -147,7 +144,7 @@ class ApiGroupJoinAction extends ApiAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method joining a group. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -117,10 +117,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
} }
try { try {
if (Event::handle('StartLeaveGroup', array($this->group,$this->user))) { $this->user->leaveGroup($this->group);
Group_member::leave($this->group->id, $this->user->id);
Event::handle('EndLeaveGroup', array($this->group, $this->user));
}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error displayed when leaving a group failed in the database. // TRANS: Server error displayed when leaving a group failed in the database.
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed. // TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
@ -137,7 +134,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method leaving a group. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -67,6 +67,7 @@ class ApiGroupListAction extends ApiBareAuthAction
$this->user = $this->getTargetUser(null); $this->user = $this->getTargetUser(null);
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client error displayed when user not found for an action.
$this->clientError(_('No such user.'), 404, $this->format); $this->clientError(_('No such user.'), 404, $this->format);
return false; return false;
} }
@ -130,7 +131,7 @@ class ApiGroupListAction extends ApiBareAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method checking group membership. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -116,7 +116,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method listing the latest 20 groups. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -101,7 +101,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method showing group membership. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -85,6 +85,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError( $this->clientError(
// TRANS: Client error message. POST is a HTTP command. It should not be translated.
_('This method requires a POST.'), _('This method requires a POST.'),
400, $this->format 400, $this->format
); );
@ -93,7 +94,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when using an unsupported API format. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format
@ -211,7 +212,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
$this->showSingleJsonGroup($this->group); $this->showSingleJsonGroup($this->group);
break; break;
default: default:
// TRANS: Client error displayed when using an unsupported API format. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404, $this->format); $this->clientError(_('API method not found.'), 404, $this->format);
break; break;
} }

View File

@ -110,7 +110,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
$this->showSingleJsonGroup($this->group); $this->showSingleJsonGroup($this->group);
break; break;
default: default:
// TRANS: Client error displayed trying to execute an unknown API method showing a group. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404, $this->format); $this->clientError(_('API method not found.'), 404, $this->format);
break; break;
} }

View File

@ -80,7 +80,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
$this->endDocument('json'); $this->endDocument('json');
} else { } else {
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method testing API connectivity. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -97,7 +97,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed trying to execute an unknown API method deleting a status. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404 404
); );

View File

@ -78,22 +78,6 @@ class ApiStatusesRetweetAction extends ApiAuthAction
$this->user = $this->auth_user; $this->user = $this->auth_user;
if ($this->user->id == $this->original->profile_id) {
// TRANS: Client error displayed trying to repeat an own notice through the API.
$this->clientError(_('Cannot repeat your own notice.'),
400, $this->format);
return false;
}
$profile = $this->user->getProfile();
if ($profile->hasRepeated($id)) {
// TRANS: Client error displayed trying to re-repeat a notice through the API.
$this->clientError(_('Already repeated that notice.'),
400, $this->format);
return false;
}
return true; return true;
} }

View File

@ -106,7 +106,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
$this->showJsonTimeline($strm); $this->showJsonTimeline($strm);
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -101,7 +101,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
parent::handle($args); parent::handle($args);
if (!in_array($this->format, array('xml', 'json', 'atom'))) { if (!in_array($this->format, array('xml', 'json', 'atom'))) {
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404); $this->clientError(_('API method not found.'), 404);
return; return;
} }

View File

@ -239,8 +239,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$this->clientError( $this->clientError(
sprintf( sprintf(
// TRANS: Client error displayed when the parameter "status" is missing. // TRANS: Client error displayed exceeding the maximum notice length.
// TRANS: %d is the maximum number of character for a notice. // TRANS: %d is the maximum length for a notice.
_m('That\'s too long. Maximum notice size is %d character.', _m('That\'s too long. Maximum notice size is %d character.',
'That\'s too long. Maximum notice size is %d characters.', 'That\'s too long. Maximum notice size is %d characters.',
Notice::maxContent()), Notice::maxContent()),

View File

@ -135,7 +135,7 @@ class ApiStatusnetConfigAction extends ApiAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -87,7 +87,7 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
break; break;
default: default:
$this->clientError( $this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
404, 404,
$this->format $this->format

View File

@ -105,7 +105,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
parent::handle($args); parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
return; return;
} }

View File

@ -178,7 +178,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -204,6 +204,8 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$profile = $this->user->getProfile(); $profile = $this->user->getProfile();
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name'); $sitename = common_config('site', 'name');
// TRANS: Title of API timeline for a user and friends.
// TRANS: %s is a username.
$title = sprintf(_("%s and friends"), $this->user->nickname); $title = sprintf(_("%s and friends"), $this->user->nickname);
$taguribase = TagURI::base(); $taguribase = TagURI::base();
$id = "tag:$taguribase:FriendsTimeline:" . $this->user->id; $id = "tag:$taguribase:FriendsTimeline:" . $this->user->id;
@ -272,7 +274,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -177,7 +177,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -178,7 +178,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -243,7 +243,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -95,6 +95,9 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname. // TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname); $title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
$subtitle = sprintf( $subtitle = sprintf(
// @todo FIXME: $profile is not defined.
// TRANS: Subtitle for API action that shows most recent notices that are repeats in user's inbox.
// TRANS: %1$s is the sitename, %2$s is a user nickname, %3$s is a user profile name.
_('%1$s notices that were to repeated to %2$s / %3$s.'), _('%1$s notices that were to repeated to %2$s / %3$s.'),
$sitename, $this->user->nickname, $profile->getBestName() $sitename, $this->user->nickname, $profile->getBestName()
); );
@ -143,7 +146,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -101,6 +101,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
$profile = $this->auth_user->getProfile(); $profile = $this->auth_user->getProfile();
$subtitle = sprintf( $subtitle = sprintf(
// TRANS: Subtitle of API time with retweets of me.
// TRANS: %1$s is the StatusNet sitename, %2$s is the user nickname, %3$s is the user profile name.
_('%1$s notices that %2$s / %3$s has repeated.'), _('%1$s notices that %2$s / %3$s has repeated.'),
$sitename, $this->auth_user->nickname, $profile->getBestName() $sitename, $this->auth_user->nickname, $profile->getBestName()
); );
@ -143,7 +145,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404); $this->clientError(_('API method not found.'), 404);
break; break;
} }

View File

@ -161,7 +161,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -213,7 +213,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$this->raw($doc->asString()); $this->raw($doc->asString());
break; break;
default: default:
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
break; break;
} }

View File

@ -96,7 +96,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction
} }
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when trying to handle an unknown API method. // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(_('API method not found.'), $code = 404);
return; return;
} }

194
actions/approvegroup.php Normal file
View File

@ -0,0 +1,194 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Leave a group
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
/**
* Leave a group
*
* This is the action for leaving a group. It works more or less like the subscribe action
* for users.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApprovegroupAction extends Action
{
var $group = null;
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('You must be logged in to leave a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
$this->group = User_group::staticGet('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::staticGet('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::staticGet('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (empty($cur)) {
// TRANS: Client error displayed trying to approve group membership while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
$this->profile = Profile::staticGet('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed trying to approve group membership while not a group administrator.
$this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
return false;
}
} else {
// TRANS: Client error displayed trying to approve group membership without specifying a profile to approve.
$this->clientError(_('Must specify a profile.'));
return false;
}
$this->request = Group_join_queue::pkeyGet(array('profile_id' => $this->profile->id,
'group_id' => $this->group->id));
if (empty($this->request)) {
// TRANS: Client error displayed trying to approve group membership for a non-existing request.
// TRANS: %s is a nickname.
$this->clientError(sprintf(_('%s is not in the moderation queue for this group.'), $this->profile->nickname), 403);
}
$this->approve = (bool)$this->arg('approve');
$this->cancel = (bool)$this->arg('cancel');
if (!$this->approve && !$this->cancel) {
// TRANS: Client error displayed trying to approve/deny group membership.
$this->clientError(_('Internal error: received neither cancel nor abort.'));
}
if ($this->approve && $this->cancel) {
// TRANS: Client error displayed trying to approve/deny group membership.
$this->clientError(_('Internal error: received both cancel and abort.'));
}
return true;
}
/**
* Handle the request
*
* On POST, add the current user to the group
*
* @param array $args unused
*
* @return void
*/
function handle($args)
{
parent::handle($args);
try {
if ($this->approve) {
$this->request->complete();
} elseif ($this->cancel) {
$this->request->abort();
}
} catch (Exception $e) {
common_log(LOG_ERR, "Exception canceling group sub: " . $e->getMessage());
// TRANS: Server error displayed when cancelling a queued group join request fails.
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
$this->serverError(sprintf(_('Could not cancel request for user %1$s to join group %2$s.'),
$this->profile->nickname, $this->group->nickname));
return;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title for leave group page after group join request is approved/disapproved.
// TRANS: %1$s is the user nickname, %2$s is the group nickname.
$this->element('title', null, sprintf(_m('TITLE','%1$s\'s request for %2$s'),
$this->profile->nickname,
$this->group->nickname));
$this->elementEnd('head');
$this->elementStart('body');
if ($this->approve) {
// TRANS: Message on page for group admin after approving a join request.
$this->element('p', 'success', _('Join request approved.'));
} elseif ($this->cancel) {
// TRANS: Message on page for group admin after rejecting a join request.
$this->element('p', 'success', _('Join request canceled.'));
}
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
}
}
}

145
actions/approvesub.php Normal file
View File

@ -0,0 +1,145 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Approve group subscription request
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
/**
* Leave a group
*
* This is the action for leaving a group. It works more or less like the subscribe action
* for users.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApprovesubAction extends Action
{
var $profile = null;
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
$cur = common_current_user();
if (empty($cur)) {
// TRANS: Client error displayed trying to approve group membership while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
$this->profile = Profile::staticGet('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed trying to approve subscriptionswithout specifying a profile to approve.
$this->clientError(_('Must specify a profile.'));
return false;
}
$this->request = Subscription_queue::pkeyGet(array('subscriber' => $this->profile->id,
'subscribed' => $cur->id));
if (empty($this->request)) {
// TRANS: Client error displayed trying to approve subscription for a non-existing request.
$this->clientError(sprintf(_('%s is not in the moderation queue for your subscriptions.'), $this->profile->nickname), 403);
}
$this->approve = (bool)$this->arg('approve');
$this->cancel = (bool)$this->arg('cancel');
if (!$this->approve && !$this->cancel) {
// TRANS: Client error displayed trying to approve/deny subscription.
$this->clientError(_('Internal error: received neither cancel nor abort.'));
}
if ($this->approve && $this->cancel) {
// TRANS: Client error displayed trying to approve/deny subscription
$this->clientError(_('Internal error: received both cancel and abort.'));
}
return true;
}
/**
* Handle the request
*
* On POST, add the current user to the group
*
* @param array $args unused
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$cur = common_current_user();
try {
if ($this->approve) {
$this->request->complete();
} elseif ($this->cancel) {
$this->request->abort();
}
} catch (Exception $e) {
common_log(LOG_ERR, "Exception canceling sub: " . $e->getMessage());
// TRANS: Server error displayed when cancelling a queued subscription request fails.
// TRANS: %1$s is the leaving user's nickname, $2$s is the nickname for which the leave failed.
$this->serverError(sprintf(_('Could not cancel or approve request for user %1$s to join group %2$s.'),
$this->profile->nickname, $cur->nickname));
return;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title for subscription approval ajax return
// TRANS: %1$s is the approved user's nickname
$this->element('title', null, sprintf(_m('TITLE','%1$s\'s request'),
$this->profile->nickname));
$this->elementEnd('head');
$this->elementStart('body');
if ($this->approve) {
// TRANS: Message on page for user after approving a subscription request.
$this->element('p', 'success', _('Subscription approved.'));
} elseif ($this->cancel) {
// TRANS: Message on page for user after rejecting a subscription request.
$this->element('p', 'success', _('Subscription canceled.'));
}
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('subqueue', array('nickname' =>
$cur->nickname)),
303);
}
}
}

View File

@ -141,7 +141,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
// TRANS: Title for group membership feed. // TRANS: Title for group membership feed.
// TRANS: %s is a username. // TRANS: %s is a username.
$feed->setTitle(sprintf(_("%s group memberships"), $feed->setTitle(sprintf(_('Group memberships of %s'),
$this->_profile->getBestName())); $this->_profile->getBestName()));
// TRANS: Subtitle for group membership feed. // TRANS: Subtitle for group membership feed.
@ -237,8 +237,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) { if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
if ($activity->verb != ActivityVerb::JOIN) { if ($activity->verb != ActivityVerb::JOIN) {
// TRANS: Client error displayed when not using the POST verb. // TRANS: Client error displayed when not using the join verb.
// TRANS: Do not translate POST.
throw new ClientException(_('Can only handle join activities.')); throw new ClientException(_('Can only handle join activities.'));
return; return;
} }
@ -275,10 +274,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
throw new ClientException(_('Blocked by admin.')); throw new ClientException(_('Blocked by admin.'));
} }
if (Event::handle('StartJoinGroup', array($group, $this->auth_user))) { $this->auth_user->joinGroup($group);
$membership = Group_member::join($group->id, $this->auth_user->id);
Event::handle('EndJoinGroup', array($group, $this->auth_user));
}
Event::handle('EndAtomPubNewActivity', array($activity, $membership)); Event::handle('EndAtomPubNewActivity', array($activity, $membership));
} }

View File

@ -151,10 +151,7 @@ class AtompubshowmembershipAction extends ApiAuthAction
" membership."), 403); " membership."), 403);
} }
if (Event::handle('StartLeaveGroup', array($this->_group, $this->auth_user))) { $this->auth_user->leaveGroup($this->_group);
Group_member::leave($this->_group->id, $this->auth_user->id);
Event::handle('EndLeaveGroup', array($this->_group, $this->auth_user));
}
return; return;
} }

View File

@ -277,6 +277,7 @@ class AvatarsettingsAction extends SettingsAction
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;

172
actions/cancelgroup.php Normal file
View File

@ -0,0 +1,172 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Leave a group
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
/**
* Leave a group
*
* This is the action for leaving a group. It works more or less like the subscribe action
* for users.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class CancelgroupAction extends Action
{
var $group = null;
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('You must be logged in to leave a group.'));
return false;
}
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
$this->group = User_group::staticGet('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
common_redirect(common_local_url('leavegroup', $args), 301);
return false;
}
$local = Local_group::staticGet('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::staticGet('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
return false;
}
if (!$this->group) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (empty($cur)) {
// TRANS: Client error displayed when trying to leave a group while not logged in.
$this->clientError(_('Must be logged in.'), 403);
return false;
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
$this->profile = Profile::staticGet('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed when trying to approve or cancel a group join request without
// TRANS: being a group administrator.
$this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
return false;
}
} else {
$this->profile = $cur->getProfile();
}
$this->request = Group_join_queue::pkeyGet(array('profile_id' => $this->profile->id,
'group_id' => $this->group->id));
if (empty($this->request)) {
// TRANS: Client error displayed when trying to approve a non-existing group join request.
// TRANS: %s is a user nickname.
$this->clientError(sprintf(_('%s is not in the moderation queue for this group.'), $this->profile->nickname), 403);
}
return true;
}
/**
* Handle the request
*
* On POST, add the current user to the group
*
* @param array $args unused
*
* @return void
*/
function handle($args)
{
parent::handle($args);
try {
$this->request->abort();
} catch (Exception $e) {
common_log(LOG_ERR, "Exception canceling group sub: " . $e->getMessage());
// TRANS: Server error displayed when cancelling a queued group join request fails.
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
$this->serverError(sprintf(_('Could not cancel request for user %1$s to join group %2$s.'),
$this->profile->nickname, $this->group->nickname));
return;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title for leave group page after leaving.
// TRANS: %s$s is the leaving user's name, %2$s is the group name.
$this->element('title', null, sprintf(_m('TITLE','%1$s left group %2$s'),
$this->profile->nickname,
$this->group->nickname));
$this->elementEnd('head');
$this->elementStart('body');
$jf = new JoinForm($this, $this->group);
$jf->show();
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('groupmembers', array('nickname' =>
$this->group->nickname)),
303);
}
}
}

View File

@ -0,0 +1,124 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Leave a group
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
/**
* Leave a group
*
* This is the action for leaving a group. It works more or less like the subscribe action
* for users.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class CancelsubscriptionAction extends Action
{
function handle($args)
{
parent::handle($args);
if ($this->boolean('ajax')) {
StatusNet::setApi(true);
}
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
return;
}
$user = common_current_user();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)));
return;
}
/* Use a session token for CSRF protection. */
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. ' .
'Try again, please.'));
return;
}
$other_id = $this->arg('unsubscribeto');
if (!$other_id) {
// TRANS: Client error displayed when trying to leave a group without specifying an ID.
$this->clientError(_('No profile ID in request.'));
return;
}
$other = Profile::staticGet('id', $other_id);
if (!$other) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No profile with that ID.'));
return;
}
$this->request = Subscription_queue::pkeyGet(array('subscriber' => $user->id,
'subscribed' => $other->id));
if (empty($this->request)) {
// TRANS: Client error displayed when trying to approve a non-existing group join request.
// TRANS: %s is a user nickname.
$this->clientError(sprintf(_('%s is not in the moderation queue for this group.'), $this->profile->nickname), 403);
}
$this->request->abort();
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title after unsubscribing from a group.
$this->element('title', null, _m('TITLE','Unsubscribed'));
$this->elementEnd('head');
$this->elementStart('body');
$subscribe = new SubscribeForm($this, $other);
$subscribe->show();
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)),
303);
}
}
}

View File

@ -99,7 +99,7 @@ class ConfirmaddressAction extends Action
if (in_array($type, array('email', 'sms'))) if (in_array($type, array('email', 'sms')))
{ {
if ($cur->$type == $confirm->address) { if ($cur->$type == $confirm->address) {
// TRANS: Client error for an already confirmed email/jabber/sms address. // TRANS: Client error for an already confirmed email/jabber/sms address.
$this->clientError(_('That address has already been confirmed.')); $this->clientError(_('That address has already been confirmed.'));
return; return;
} }
@ -118,7 +118,8 @@ class ConfirmaddressAction extends Action
if (!$result) { if (!$result) {
common_log_db_error($cur, 'UPDATE', __FILE__); common_log_db_error($cur, 'UPDATE', __FILE__);
$this->serverError(_('Couldn\'t update user.')); // TRANS: Server error displayed when confirming an e-mail address or IM address fails.
$this->serverError(_('Could not update user.'));
return; return;
} }
@ -133,6 +134,7 @@ class ConfirmaddressAction extends Action
$user_im_prefs->user_id = $cur->id; $user_im_prefs->user_id = $cur->id;
if ($user_im_prefs->find() && $user_im_prefs->fetch()) { if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
if($user_im_prefs->screenname == $confirm->address){ if($user_im_prefs->screenname == $confirm->address){
// TRANS: Client error for an already confirmed IM address.
$this->clientError(_('That address has already been confirmed.')); $this->clientError(_('That address has already been confirmed.'));
return; return;
} }
@ -141,7 +143,8 @@ class ConfirmaddressAction extends Action
if (!$result) { if (!$result) {
common_log_db_error($user_im_prefs, 'UPDATE', __FILE__); common_log_db_error($user_im_prefs, 'UPDATE', __FILE__);
$this->serverError(_('Couldn\'t update user im preferences.')); // TRANS: Server error displayed when updating IM preferences fails.
$this->serverError(_('Could not update user IM preferences.'));
return; return;
} }
}else{ }else{
@ -153,7 +156,8 @@ class ConfirmaddressAction extends Action
if (!$result) { if (!$result) {
common_log_db_error($user_im_prefs, 'INSERT', __FILE__); common_log_db_error($user_im_prefs, 'INSERT', __FILE__);
$this->serverError(_('Couldn\'t insert user im preferences.')); // TRANS: Server error displayed when adding IM preferences fails.
$this->serverError(_('Could not insert user IM preferences.'));
return; return;
} }
} }

View File

@ -0,0 +1,106 @@
<?php
/**
* Display a conversation in the browser
*
* PHP version 5
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
// XXX: not sure how to do paging yet,
// so set a 60-notice limit
require_once INSTALLDIR.'/lib/noticelist.php';
/**
* Conversation tree in the browser
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class ConversationRepliesAction extends ConversationAction
{
function handle($args)
{
if ($this->boolean('ajax')) {
$this->showAjax();
} else {
parent::handle($args);
}
}
/**
* Show content.
*
* Display a hierarchical unordered list in the content area.
* Uses ConversationTree to do most of the heavy lifting.
*
* @return void
*/
function showContent()
{
$notices = Notice::conversationStream($this->id, null, null);
$ct = new FullThreadedNoticeList($notices, $this);
$cnt = $ct->show();
}
function showAjax()
{
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Title for conversation page.
$this->element('title', null, _m('TITLE','Notice'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showContent();
$this->elementEnd('body');
$this->elementEnd('html');
}
}
class FullThreadedNoticeList extends ThreadedNoticeList
{
function newListItem($notice)
{
return new FullThreadedNoticeListItem($notice, $this->out);
}
}
class FullThreadedNoticeListItem extends ThreadedNoticeListItem
{
function initialItems()
{
return 1000; // @fixme
}
}

View File

@ -99,6 +99,7 @@ class DeleteapplicationAction extends Action
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.')); $this->clientError(_('There was a problem with your session token.'));
return; return;
} }

View File

@ -48,7 +48,7 @@ class DeletenoticeAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (!$this->user) { if (!$this->user) {
// TRANS: Error message displayed trying to delete a notice while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
common_user_error(_('Not logged in.')); common_user_error(_('Not logged in.'));
exit; exit;
} }
@ -174,6 +174,7 @@ class DeletenoticeAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. ' . $this->showForm(_('There was a problem with your session token. ' .
'Try again, please.')); 'Try again, please.'));
return; return;

View File

@ -57,7 +57,7 @@ class DisfavorAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed when trying to remove a favorite while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return; return;
} }

View File

@ -128,6 +128,7 @@ class EditApplicationAction extends OwnerDesignAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.')); $this->clientError(_('There was a problem with your session token.'));
return; return;
} }

View File

@ -185,6 +185,15 @@ class EditgroupAction extends GroupDesignAction
$description = $this->trimmed('description'); $description = $this->trimmed('description');
$location = $this->trimmed('location'); $location = $this->trimmed('location');
$aliasstring = $this->trimmed('aliases'); $aliasstring = $this->trimmed('aliases');
$private = $this->boolean('private');
if ($private) {
$force_scope = 1;
$join_policy = User_group::JOIN_POLICY_MODERATE;
} else {
$force_scope = 0;
$join_policy = User_group::JOIN_POLICY_OPEN;
}
if ($this->nicknameExists($nickname)) { if ($this->nicknameExists($nickname)) {
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
@ -265,6 +274,8 @@ class EditgroupAction extends GroupDesignAction
$this->group->description = $description; $this->group->description = $description;
$this->group->location = $location; $this->group->location = $location;
$this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname)); $this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
$this->group->join_policy = $join_policy;
$this->group->force_scope = $force_scope;
$result = $this->group->update($orig); $result = $this->group->update($orig);

View File

@ -207,45 +207,45 @@ class EmailsettingsAction extends SettingsAction
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
if (Event::handle('StartEmailFormData', array($this))) { if (Event::handle('StartEmailFormData', array($this))) {
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailnotifysub', $this->checkbox('emailnotifysub',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Send me notices of new subscriptions through email.'), _('Send me notices of new subscriptions through email.'),
$user->emailnotifysub); $user->emailnotifysub);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailnotifyfav', $this->checkbox('emailnotifyfav',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Send me email when someone '. _('Send me email when someone '.
'adds my notice as a favorite.'), 'adds my notice as a favorite.'),
$user->emailnotifyfav); $user->emailnotifyfav);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailnotifymsg', $this->checkbox('emailnotifymsg',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Send me email when someone sends me a private message.'), _('Send me email when someone sends me a private message.'),
$user->emailnotifymsg); $user->emailnotifymsg);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailnotifyattn', $this->checkbox('emailnotifyattn',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Send me email when someone sends me an "@-reply".'), _('Send me email when someone sends me an "@-reply".'),
$user->emailnotifyattn); $user->emailnotifyattn);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailnotifynudge', $this->checkbox('emailnotifynudge',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Allow friends to nudge me and send me an email.'), _('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge); $user->emailnotifynudge);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailmicroid', $this->checkbox('emailmicroid',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_('Publish a MicroID for my email address.'), _('Publish a MicroID for my email address.'),
$user->emailmicroid); $user->emailmicroid);
$this->elementEnd('li'); $this->elementEnd('li');
Event::handle('EndEmailFormData', array($this)); Event::handle('EndEmailFormData', array($this));
} }
$this->elementEnd('ul'); $this->elementEnd('ul');
// TRANS: Button label to save e-mail preferences. // TRANS: Button label to save e-mail preferences.
$this->submit('save', _m('BUTTON','Save')); $this->submit('save', _m('BUTTON','Save'));
@ -289,6 +289,7 @@ class EmailsettingsAction extends SettingsAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->show_form(_('There was a problem with your session token. '. $this->show_form(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
@ -319,48 +320,47 @@ class EmailsettingsAction extends SettingsAction
*/ */
function savePreferences() function savePreferences()
{ {
$user = common_current_user(); $user = common_current_user();
if (Event::handle('StartEmailSaveForm', array($this, &$user))) { if (Event::handle('StartEmailSaveForm', array($this, &$user))) {
$emailnotifysub = $this->boolean('emailnotifysub');
$emailnotifyfav = $this->boolean('emailnotifyfav');
$emailnotifymsg = $this->boolean('emailnotifymsg');
$emailnotifynudge = $this->boolean('emailnotifynudge');
$emailnotifyattn = $this->boolean('emailnotifyattn');
$emailmicroid = $this->boolean('emailmicroid');
$emailpost = $this->boolean('emailpost');
$emailnotifysub = $this->boolean('emailnotifysub'); assert(!is_null($user)); // should already be checked
$emailnotifyfav = $this->boolean('emailnotifyfav');
$emailnotifymsg = $this->boolean('emailnotifymsg');
$emailnotifynudge = $this->boolean('emailnotifynudge');
$emailnotifyattn = $this->boolean('emailnotifyattn');
$emailmicroid = $this->boolean('emailmicroid');
$emailpost = $this->boolean('emailpost');
assert(!is_null($user)); // should already be checked $user->query('BEGIN');
$user->query('BEGIN'); $original = clone($user);
$original = clone($user); $user->emailnotifysub = $emailnotifysub;
$user->emailnotifyfav = $emailnotifyfav;
$user->emailnotifymsg = $emailnotifymsg;
$user->emailnotifynudge = $emailnotifynudge;
$user->emailnotifyattn = $emailnotifyattn;
$user->emailmicroid = $emailmicroid;
$user->emailpost = $emailpost;
$user->emailnotifysub = $emailnotifysub; $result = $user->update($original);
$user->emailnotifyfav = $emailnotifyfav;
$user->emailnotifymsg = $emailnotifymsg;
$user->emailnotifynudge = $emailnotifynudge;
$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;
}
if ($result === false) { $user->query('COMMIT');
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));
Event::handle('EndEmailSaveForm', array($this)); // TRANS: Confirmation message for successful e-mail preferences save.
$this->showForm(_('Email preferences saved.'), true);
// TRANS: Confirmation message for successful e-mail preferences save. }
$this->showForm(_('Email preferences saved.'), true);
}
} }
/** /**

View File

@ -58,7 +58,7 @@ class FavorAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed when trying to mark a notice as favorite without being logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return; return;
} }
@ -72,6 +72,7 @@ class FavorAction extends Action
$notice = Notice::staticGet($id); $notice = Notice::staticGet($id);
$token = $this->trimmed('token-'.$notice->id); $token = $this->trimmed('token-'.$notice->id);
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -52,6 +52,7 @@ class GeocodeAction extends Action
parent::prepare($args); parent::prepare($args);
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. '. $this->clientError(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
} }

View File

@ -56,12 +56,13 @@ class GroupblockAction extends RedirectingAction
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to block a user from a group while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return false; return false;
} }
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (empty($token) || $token != common_session_token()) { if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -152,376 +152,3 @@ class GroupmembersAction extends GroupDesignAction
array('nickname' => $this->group->nickname)); array('nickname' => $this->group->nickname));
} }
} }
class GroupMemberList extends ProfileList
{
var $group = null;
function __construct($profile, $group, $action)
{
parent::__construct($profile, $action);
$this->group = $group;
}
function newListItem($profile)
{
return new GroupMemberListItem($profile, $this->group, $this->action);
}
}
class GroupMemberListItem extends ProfileListItem
{
var $group = null;
function __construct($profile, $group, $action)
{
parent::__construct($profile, $action);
$this->group = $group;
}
function showFullName()
{
parent::showFullName();
if ($this->profile->isAdmin($this->group)) {
$this->out->text(' '); // for separating the classes.
// TRANS: Indicator in group members list that this user is a group administrator.
$this->out->element('span', 'role', _('Admin'));
}
}
function showActions()
{
$this->startActions();
if (Event::handle('StartProfileListItemActionElements', array($this))) {
$this->showSubscribeButton();
$this->showMakeAdminForm();
$this->showGroupBlockForm();
Event::handle('EndProfileListItemActionElements', array($this));
}
$this->endActions();
}
function showMakeAdminForm()
{
$user = common_current_user();
if (!empty($user) &&
$user->id != $this->profile->id &&
($user->isAdmin($this->group) || $user->hasRight(Right::MAKEGROUPADMIN)) &&
!$this->profile->isAdmin($this->group)) {
$this->out->elementStart('li', 'entity_make_admin');
$maf = new MakeAdminForm($this->out, $this->profile, $this->group,
$this->returnToArgs());
$maf->show();
$this->out->elementEnd('li');
}
}
function showGroupBlockForm()
{
$user = common_current_user();
if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group)) {
$this->out->elementStart('li', 'entity_block');
$bf = new GroupBlockForm($this->out, $this->profile, $this->group,
$this->returnToArgs());
$bf->show();
$this->out->elementEnd('li');
}
}
function linkAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'members')) {
$aAttrs['rel'] .= ' nofollow';
}
return $aAttrs;
}
function homepageAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'members')) {
$aAttrs['rel'] = 'nofollow';
}
return $aAttrs;
}
/**
* Fetch necessary return-to arguments for the profile forms
* to return to this list when they're done.
*
* @return array
*/
protected function returnToArgs()
{
$args = array('action' => 'groupmembers',
'nickname' => $this->group->nickname);
$page = $this->out->arg('page');
if ($page) {
$args['param-page'] = $page;
}
return $args;
}
}
/**
* Form for blocking a user from a group
*
* @category Form
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
* @see BlockForm
*/
class GroupBlockForm extends Form
{
/**
* Profile of user to block
*/
var $profile = null;
/**
* Group to block the user from
*/
var $group = null;
/**
* Return-to args
*/
var $args = null;
/**
* Constructor
*
* @param HTMLOutputter $out output channel
* @param Profile $profile profile of user to block
* @param User_group $group group to block user from
* @param array $args return-to args
*/
function __construct($out=null, $profile=null, $group=null, $args=null)
{
parent::__construct($out);
$this->profile = $profile;
$this->group = $group;
$this->args = $args;
}
/**
* ID of the form
*
* @return int ID of the form
*/
function id()
{
// This should be unique for the page.
return 'block-' . $this->profile->id;
}
/**
* class of the form
*
* @return string class of the form
*/
function formClass()
{
return 'form_group_block';
}
/**
* Action of the form
*
* @return string URL of the action
*/
function action()
{
return common_local_url('groupblock');
}
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
// TRANS: Form legend for form to block user from a group.
$this->out->element('legend', null, _('Block user from group'));
}
/**
* Data elements of the form
*
* @return void
*/
function formData()
{
$this->out->hidden('blockto-' . $this->profile->id,
$this->profile->id,
'blockto');
$this->out->hidden('blockgroup-' . $this->group->id,
$this->group->id,
'blockgroup');
if ($this->args) {
foreach ($this->args as $k => $v) {
$this->out->hidden('returnto-' . $k, $v);
}
}
}
/**
* Action elements
*
* @return void
*/
function formActions()
{
$this->out->submit(
'submit',
// TRANS: Button text for the form that will block a user from a group.
_m('BUTTON','Block'),
'submit',
null,
// TRANS: Submit button title.
_m('TOOLTIP', 'Block this user'));
}
}
/**
* Form for making a user an admin for a group
*
* @category Form
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class MakeAdminForm extends Form
{
/**
* Profile of user to block
*/
var $profile = null;
/**
* Group to block the user from
*/
var $group = null;
/**
* Return-to args
*/
var $args = null;
/**
* Constructor
*
* @param HTMLOutputter $out output channel
* @param Profile $profile profile of user to block
* @param User_group $group group to block user from
* @param array $args return-to args
*/
function __construct($out=null, $profile=null, $group=null, $args=null)
{
parent::__construct($out);
$this->profile = $profile;
$this->group = $group;
$this->args = $args;
}
/**
* ID of the form
*
* @return int ID of the form
*/
function id()
{
// This should be unique for the page.
return 'makeadmin-' . $this->profile->id;
}
/**
* class of the form
*
* @return string class of the form
*/
function formClass()
{
return 'form_make_admin';
}
/**
* Action of the form
*
* @return string URL of the action
*/
function action()
{
return common_local_url('makeadmin', array('nickname' => $this->group->nickname));
}
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
// TRANS: Form legend for form to make a user a group admin.
$this->out->element('legend', null, _('Make user an admin of the group'));
}
/**
* Data elements of the form
*
* @return void
*/
function formData()
{
$this->out->hidden('profileid-' . $this->profile->id,
$this->profile->id,
'profileid');
$this->out->hidden('groupid-' . $this->group->id,
$this->group->id,
'groupid');
if ($this->args) {
foreach ($this->args as $k => $v) {
$this->out->hidden('returnto-' . $k, $v);
}
}
}
/**
* Action elements
*
* @return void
*/
function formActions()
{
$this->out->submit(
'submit',
// TRANS: Button text for the form that will make a user administrator.
_m('BUTTON','Make Admin'),
'submit',
null,
// TRANS: Submit button title.
_m('TOOLTIP','Make this user an admin'));
}
}

193
actions/groupqueue.php Normal file
View File

@ -0,0 +1,193 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* List of group members
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once(INSTALLDIR.'/lib/profilelist.php');
require_once INSTALLDIR.'/lib/publicgroupnav.php';
/**
* List of group members
*
* @category Group
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class GroupqueueAction extends GroupDesignAction
{
var $page = null;
function isReadOnly($args)
{
return true;
}
// @todo FIXME: most of this belongs in a base class, sounds common to most group actions?
function prepare($args)
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
$nickname_arg = $this->arg('nickname');
$nickname = common_canonical_nickname($nickname_arg);
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
if ($this->page != 1) {
$args['page'] = $this->page;
}
common_redirect(common_local_url('groupqueue', $args), 301);
return false;
}
if (!$nickname) {
// TRANS: Client error displayed when trying to view group members without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$local = Local_group::staticGet('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to view group members for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when trying to view group members for an object that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (!$cur || !$cur->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to approve group applicants without being a group administrator.
$this->clientError(_('Only the group admin may approve users.'));
return false;
}
return true;
}
function title()
{
if ($this->page == 1) {
// TRANS: Title of the first page showing pending group members still awaiting approval to join the group.
// TRANS: %s is the name of the group.
return sprintf(_('%s group members awaiting approval'),
$this->group->nickname);
} else {
// TRANS: Title of all but the first page showing pending group members still awaiting approval to join the group.
// TRANS: %1$s is the name of the group, %2$d is the page number of the members list.
return sprintf(_('%1$s group members awaiting approval, page %2$d'),
$this->group->nickname,
$this->page);
}
}
function handle($args)
{
parent::handle($args);
$this->showPage();
}
function showPageNotice()
{
$this->element('p', 'instructions',
// TRANS: Page notice for group members page.
_('A list of users awaiting approval to join this group.'));
}
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
function showContent()
{
$offset = ($this->page-1) * PROFILES_PER_PAGE;
$limit = PROFILES_PER_PAGE + 1;
$cnt = 0;
$members = $this->group->getRequests($offset, $limit);
if ($members) {
// @fixme change!
$member_list = new GroupQueueList($members, $this->group, $this);
$cnt = $member_list->show();
}
$members->free();
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
$this->page, 'groupqueue',
array('nickname' => $this->group->nickname));
}
}
// @todo FIXME: documentation missing.
class GroupQueueList extends GroupMemberList
{
function newListItem($profile)
{
return new GroupQueueListItem($profile, $this->group, $this->action);
}
}
// @todo FIXME: documentation missing.
class GroupQueueListItem extends GroupMemberListItem
{
function showActions()
{
$this->startActions();
if (Event::handle('StartProfileListItemActionElements', array($this))) {
$this->showApproveButtons();
Event::handle('EndProfileListItemActionElements', array($this));
}
$this->endActions();
}
function showApproveButtons()
{
$this->out->elementStart('li', 'entity_approval');
$form = new ApproveGroupForm($this->out, $this->group, $this->profile);
$form->show();
$this->out->elementEnd('li');
}
}

View File

@ -56,12 +56,13 @@ class GroupunblockAction extends Action
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed when trying to unblock a user from a group while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return false; return false;
} }
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (empty($token) || $token != common_session_token()) { if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -111,8 +111,8 @@ class ImsettingsAction extends SettingsAction
if ($user_im_prefs = User_im_prefs::pkeyGet( array('transport' => $transport, 'user_id' => $user->id) )) { if ($user_im_prefs = User_im_prefs::pkeyGet( array('transport' => $transport, 'user_id' => $user->id) )) {
$user_im_prefs_by_transport[$transport] = $user_im_prefs; $user_im_prefs_by_transport[$transport] = $user_im_prefs;
$this->element('p', 'form_confirmed', $user_im_prefs->screenname); $this->element('p', 'form_confirmed', $user_im_prefs->screenname);
// TRANS: Form note in IM settings form.
$this->element('p', 'form_note', $this->element('p', 'form_note',
// TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
sprintf(_('Current confirmed %s address.'),$transport_info['display'])); sprintf(_('Current confirmed %s address.'),$transport_info['display']));
$this->hidden('screenname', $user_im_prefs->screenname); $this->hidden('screenname', $user_im_prefs->screenname);
// TRANS: Button label to remove a confirmed IM address. // TRANS: Button label to remove a confirmed IM address.
@ -124,11 +124,11 @@ class ImsettingsAction extends SettingsAction
// TRANS: Form note in IM settings form. // TRANS: Form note in IM settings form.
$this->element('p', 'form_note', $this->element('p', 'form_note',
// TRANS: Form note in IM settings form. // TRANS: Form note in IM settings form.
// TRANS: %s is the IM address set for the site. // TRANS: %s is the IM service name, %2$s is the IM address set.
sprintf(_('Awaiting confirmation on this address. '. sprintf(_('Awaiting confirmation on this address. '.
'Check your %s account for a '. 'Check your %1$s account for a '.
'message with further instructions. '. 'message with further instructions. '.
'(Did you add %s to your buddy list?)'), '(Did you add %2$s to your buddy list?)'),
$transport_info['display'], $transport_info['display'],
$transport_info['daemonScreenname'])); $transport_info['daemonScreenname']));
$this->hidden('screenname', $confirm->address); $this->hidden('screenname', $confirm->address);
@ -137,8 +137,10 @@ class ImsettingsAction extends SettingsAction
} else { } else {
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label for IM address.
$this->input('screenname', _('IM address'), $this->input('screenname', _('IM address'),
($this->arg('screenname')) ? $this->arg('screenname') : null, ($this->arg('screenname')) ? $this->arg('screenname') : null,
// TRANS: Field title for IM address. %s is the IM service name.
sprintf(_('%s screenname.'), sprintf(_('%s screenname.'),
$transport_info['display'])); $transport_info['display']));
$this->elementEnd('li'); $this->elementEnd('li');
@ -238,6 +240,7 @@ class ImsettingsAction extends SettingsAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
@ -288,7 +291,7 @@ class ImsettingsAction extends SettingsAction
if ($result === false) { if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating IM preferences. // TRANS: Server error thrown on database error updating IM preferences.
$this->serverError(_('Couldn\'t update IM preferences.')); $this->serverError(_('Could not update IM preferences.'));
return; return;
} }
}while($user_im_prefs->fetch()); }while($user_im_prefs->fetch());
@ -322,6 +325,7 @@ class ImsettingsAction extends SettingsAction
} }
if (!$transport) { if (!$transport) {
// TRANS: Form validation error when no transport is available setting an IM address.
$this->showForm(_('No transport.')); $this->showForm(_('No transport.'));
return; return;
} }
@ -330,14 +334,14 @@ class ImsettingsAction extends SettingsAction
if (!$screenname) { if (!$screenname) {
// TRANS: Message given saving IM address that cannot be normalised. // TRANS: Message given saving IM address that cannot be normalised.
$this->showForm(_('Cannot normalize that screenname')); $this->showForm(_('Cannot normalize that screenname.'));
return; return;
} }
$valid = false; $valid = false;
Event::handle('ValidateImScreenname', array($transport, $screenname, &$valid)); Event::handle('ValidateImScreenname', array($transport, $screenname, &$valid));
if (!$valid) { if (!$valid) {
// TRANS: Message given saving IM address that not valid. // TRANS: Message given saving IM address that not valid.
$this->showForm(_('Not a valid screenname')); $this->showForm(_('Not a valid screenname.'));
return; return;
} else if ($this->screennameExists($transport, $screenname)) { } else if ($this->screennameExists($transport, $screenname)) {
// TRANS: Message given saving IM address that is already set for another user. // TRANS: Message given saving IM address that is already set for another user.
@ -402,7 +406,7 @@ class ImsettingsAction extends SettingsAction
if (!$result) { if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__); common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling IM address confirmation. // TRANS: Server error thrown on database error canceling IM address confirmation.
$this->serverError(_('Couldn\'t delete confirmation.')); $this->serverError(_('Could not delete confirmation.'));
return; return;
} }
@ -440,8 +444,7 @@ class ImsettingsAction extends SettingsAction
if (!$result) { if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered IM address. // TRANS: Server error thrown on database error removing a registered IM address.
$this->serverError(_('Couldn\'t update user im prefs.')); $this->serverError(_('Could not update user IM preferences.'));
$this->serverError(_('Couldn\'t update user.'));
return; return;
} }

View File

@ -54,9 +54,10 @@ class InviteAction extends CurrentUserDesignAction
function sendInvitations() function sendInvitations()
{ {
# CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. Try again, please.')); $this->showForm(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -129,10 +129,7 @@ class JoingroupAction extends Action
$cur = common_current_user(); $cur = common_current_user();
try { try {
if (Event::handle('StartJoinGroup', array($this->group, $cur))) { $result = $cur->joinGroup($this->group);
Group_member::join($this->group->id, $cur->id);
Event::handle('EndJoinGroup', array($this->group, $cur));
}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error displayed when joining a group failed in the database. // TRANS: Server error displayed when joining a group failed in the database.
// TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed. // TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
@ -150,8 +147,17 @@ class JoingroupAction extends Action
$this->group->nickname)); $this->group->nickname));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
$lf = new LeaveForm($this, $this->group);
$lf->show(); if ($result instanceof Group_member) {
$form = new LeaveForm($this, $this->group);
} else if ($result instanceof Group_join_queue) {
$form = new CancelGroupForm($this, $this->group);
} else {
// wtf?
// TRANS: Exception thrown when there is an unknown error joining a group.
throw new Exception(_("Unknown error joining group."));
}
$form->show();
$this->elementEnd('body'); $this->elementEnd('body');
$this->elementEnd('html'); $this->elementEnd('html');
} else { } else {

View File

@ -123,10 +123,7 @@ class LeavegroupAction extends Action
$cur = common_current_user(); $cur = common_current_user();
try { try {
if (Event::handle('StartLeaveGroup', array($this->group, $cur))) { $cur->leaveGroup($this->group);
Group_member::leave($this->group->id, $cur->id);
Event::handle('EndLeaveGroup', array($this->group, $cur));
}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error displayed when leaving a group failed in the database. // TRANS: Server error displayed when leaving a group failed in the database.
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed. // TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.

View File

@ -65,7 +65,7 @@ class LogoutAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to log out when not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
} else { } else {
if (Event::handle('StartLogout', array($this))) { if (Event::handle('StartLogout', array($this))) {

View File

@ -58,12 +58,13 @@ class MakeadminAction extends RedirectingAction
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed when trying to access the "make admin" page while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return false; return false;
} }
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (empty($token) || $token != common_session_token()) { if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -109,6 +109,7 @@ class NewApplicationAction extends OwnerDesignAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.')); $this->clientError(_('There was a problem with your session token.'));
return; return;
} }
@ -294,8 +295,9 @@ class NewApplicationAction extends OwnerDesignAction
$app->uploadLogo(); $app->uploadLogo();
} catch (Exception $e) { } catch (Exception $e) {
$app->query('ROLLBACK'); $app->query('ROLLBACK');
// TRANS: Form validation error on New application page when providing an invalid image upload.
$this->showForm(_('Invalid image.')); $this->showForm(_('Invalid image.'));
return; return;
} }
$app->query('COMMIT'); $app->query('COMMIT');

View File

@ -130,6 +130,7 @@ class NewgroupAction extends Action
$homepage = $this->trimmed('homepage'); $homepage = $this->trimmed('homepage');
$description = $this->trimmed('description'); $description = $this->trimmed('description');
$location = $this->trimmed('location'); $location = $this->trimmed('location');
$private = $this->boolean('private');
$aliasstring = $this->trimmed('aliases'); $aliasstring = $this->trimmed('aliases');
if ($this->nicknameExists($nickname)) { if ($this->nicknameExists($nickname)) {
@ -202,6 +203,14 @@ class NewgroupAction extends Action
} }
} }
if ($private) {
$force_scope = 1;
$join_policy = User_group::JOIN_POLICY_MODERATE;
} else {
$force_scope = 0;
$join_policy = User_group::JOIN_POLICY_OPEN;
}
$cur = common_current_user(); $cur = common_current_user();
// Checked in prepare() above // Checked in prepare() above
@ -215,6 +224,8 @@ class NewgroupAction extends Action
'location' => $location, 'location' => $location,
'aliases' => $aliases, 'aliases' => $aliases,
'userid' => $cur->id, 'userid' => $cur->id,
'join_policy' => $join_policy,
'force_scope' => $force_scope,
'local' => true)); 'local' => true));
$this->group = $group; $this->group = $group;

View File

@ -85,7 +85,7 @@ class NewmessageAction extends Action
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to create a new direct message while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'), 403); $this->clientError(_('Not logged in.'), 403);
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->saveNewMessage(); $this->saveNewMessage();
@ -137,6 +137,7 @@ class NewmessageAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. ' . $this->showForm(_('There was a problem with your session token. ' .
'Try again, please.')); 'Try again, please.'));
return; return;

View File

@ -64,7 +64,7 @@ class NewnoticeAction extends Action
function title() function title()
{ {
// TRANS: Page title for sending a new notice. // TRANS: Page title for sending a new notice.
return _('New notice'); return _m('TITLE','New notice');
} }
/** /**
@ -83,7 +83,7 @@ class NewnoticeAction extends Action
function handle($args) function handle($args)
{ {
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to send a notice while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// check for this before token since all POST and FILES data // check for this before token since all POST and FILES data
@ -101,6 +101,7 @@ class NewnoticeAction extends Action
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. '. $this->clientError(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
} }
@ -180,6 +181,8 @@ class NewnoticeAction extends Action
if (Notice::contentTooLong($content_shortened)) { if (Notice::contentTooLong($content_shortened)) {
$upload->delete(); $upload->delete();
// TRANS: Client error displayed exceeding the maximum notice length.
// TRANS: %d is the maximum length for a notice.
$this->clientError(sprintf(_m('Maximum notice size is %d character, including attachment URL.', $this->clientError(sprintf(_m('Maximum notice size is %d character, including attachment URL.',
'Maximum notice size is %d characters, including attachment URL.', 'Maximum notice size is %d characters, including attachment URL.',
Notice::maxContent()), Notice::maxContent()),
@ -209,6 +212,10 @@ class NewnoticeAction extends Action
$author_id = $user->id; $author_id = $user->id;
$text = $content_shortened; $text = $content_shortened;
// Does the heavy-lifting for getting "To:" information
ToSelector::fillOptions($this, $options);
if (Event::handle('StartNoticeSaveWeb', array($this, &$author_id, &$text, &$options))) { if (Event::handle('StartNoticeSaveWeb', array($this, &$author_id, &$text, &$options))) {
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options); $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
@ -282,7 +289,8 @@ class NewnoticeAction extends Action
{ {
$this->startHTML('text/xml;charset=utf-8', true); $this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head'); $this->elementStart('head');
$this->element('title', null, _('New notice')); // TRANS: Title for form to send a new notice.
$this->element('title', null, _m('TITLE','New notice'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
@ -344,7 +352,9 @@ class NewnoticeAction extends Action
$inreplyto = null; $inreplyto = null;
} }
$notice_form = new NoticeForm($this, '', $content, null, $inreplyto); $notice_form = new NoticeForm($this, array('content' => $content,
'inreplyto' => $inreplyto));
$notice_form->show(); $notice_form->show();
} }

View File

@ -60,7 +60,7 @@ class NudgeAction extends Action
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to nudge a user without being logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return; return;
} }
@ -78,6 +78,7 @@ class NudgeAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return; return;
} }

View File

@ -132,6 +132,7 @@ class OauthconnectionssettingsAction extends SettingsAction
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;

View File

@ -143,6 +143,7 @@ class PasswordsettingsAction extends SettingsAction
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
@ -156,14 +157,15 @@ class PasswordsettingsAction extends SettingsAction
$newpassword = $this->arg('newpassword'); $newpassword = $this->arg('newpassword');
$confirm = $this->arg('confirm'); $confirm = $this->arg('confirm');
# Some validation // Some validation
if (strlen($newpassword) < 6) { if (strlen($newpassword) < 6) {
// TRANS: Form validation error on page where to change password. // TRANS: Form validation error on page where to change password.
$this->showForm(_('Password must be 6 or more characters.')); $this->showForm(_('Password must be 6 or more characters.'));
return; return;
} else if (0 != strcmp($newpassword, $confirm)) { } else if (0 != strcmp($newpassword, $confirm)) {
$this->showForm(_('Passwords don\'t match.')); // TRANS: Form validation error on password change when password confirmation does not match.
$this->showForm(_('Passwords do not match.'));
return; return;
} }

View File

@ -485,8 +485,8 @@ class PathsAdminPanelForm extends AdminForm
// TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). // TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
'always' => _('Always')); 'always' => _('Always'));
// TRANS: Drop down label in Paths admin panel.
$this->out->dropdown('site-ssl', $this->out->dropdown('site-ssl',
// TRANS: Drop down label in Paths admin panel.
_('Use SSL'), _('Use SSL'),
// TRANS: Tooltip for field label in Paths admin panel. // TRANS: Tooltip for field label in Paths admin panel.
$ssl, _('When to use SSL.'), $ssl, _('When to use SSL.'),

View File

@ -84,6 +84,7 @@ class PluginEnableAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.'. $this->clientError(_('There was a problem with your session token.'.
' Try again, please.')); ' Try again, please.'));
return false; return false;
@ -94,7 +95,7 @@ class PluginEnableAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client error displayed when trying to enable or disable a plugin while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return false; return false;
} }

View File

@ -33,8 +33,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1); exit(1);
} }
/** /**
* Change profile settings * Change profile settings
* *
@ -46,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ProfilesettingsAction extends SettingsAction class ProfilesettingsAction extends SettingsAction
{ {
/** /**
@ -127,15 +124,15 @@ class ProfilesettingsAction extends SettingsAction
// TRANS: Tooltip for field label in form for profile settings. Plural // TRANS: Tooltip for field label in form for profile settings. Plural
// TRANS: is decided by the number of characters available for the // TRANS: is decided by the number of characters available for the
// TRANS: biography (%d). // TRANS: biography (%d).
$bioInstr = sprintf(_m('Describe yourself and your interests in %d character', $bioInstr = sprintf(_m('Describe yourself and your interests in %d character.',
'Describe yourself and your interests in %d characters', 'Describe yourself and your interests in %d characters.',
$maxBio), $maxBio),
$maxBio); $maxBio);
} else { } else {
// TRANS: Tooltip for field label in form for profile settings. // TRANS: Tooltip for field label in form for profile settings.
$bioInstr = _('Describe yourself and your interests'); $bioInstr = _('Describe yourself and your interests.');
} }
// TRANS: Text area label in form for profile settings where users can provide. // TRANS: Text area label in form for profile settings where users can provide
// TRANS: their biography. // TRANS: their biography.
$this->textarea('bio', _('Bio'), $this->textarea('bio', _('Bio'),
($this->arg('bio')) ? $this->arg('bio') : $profile->bio, ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
@ -146,7 +143,7 @@ class ProfilesettingsAction extends SettingsAction
$this->input('location', _('Location'), $this->input('location', _('Location'),
($this->arg('location')) ? $this->arg('location') : $profile->location, ($this->arg('location')) ? $this->arg('location') : $profile->location,
// TRANS: Tooltip for field label in form for profile settings. // TRANS: Tooltip for field label in form for profile settings.
_('Where you are, like "City, State (or Region), Country"')); _('Where you are, like "City, State (or Region), Country".'));
$this->elementEnd('li'); $this->elementEnd('li');
if (common_config('location', 'share') == 'user') { if (common_config('location', 'share') == 'user') {
$this->elementStart('li'); $this->elementStart('li');
@ -192,7 +189,27 @@ class ProfilesettingsAction extends SettingsAction
($this->arg('autosubscribe')) ? ($this->arg('autosubscribe')) ?
$this->boolean('autosubscribe') : $user->autosubscribe); $this->boolean('autosubscribe') : $user->autosubscribe);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li');
$this->dropdown('subscribe_policy',
// TRANS: Dropdown field label on profile settings, for what policies to apply when someone else tries to subscribe to your updates.
_('Subscription policy'),
// TRANS: Dropdown field option for following policy.
array(User::SUBSCRIBE_POLICY_OPEN => _('Let anyone follow me'),
// TRANS: Dropdown field option for following policy.
User::SUBSCRIBE_POLICY_MODERATE => _('Ask me first')),
// TRANS: Dropdown field title on group edit form.
_('Whether other users need your permission to follow your updates.'),
false,
(empty($user->subscribe_policy)) ? User::SUBSCRIBE_POLICY_OPEN : $user->subscribe_policy);
$this->elementEnd('li');
} }
$this->elementStart('li');
$this->checkbox('private_stream',
// TRANS: Checkbox label in profile settings.
_('Make updates visible only to my followers'),
($this->arg('private_stream')) ?
$this->boolean('private_stream') : $user->private_stream);
$this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
// TRANS: Button to save input in profile settings. // TRANS: Button to save input in profile settings.
$this->submit('save', _m('BUTTON','Save')); $this->submit('save', _m('BUTTON','Save'));
@ -234,6 +251,8 @@ class ProfilesettingsAction extends SettingsAction
$bio = $this->trimmed('bio'); $bio = $this->trimmed('bio');
$location = $this->trimmed('location'); $location = $this->trimmed('location');
$autosubscribe = $this->boolean('autosubscribe'); $autosubscribe = $this->boolean('autosubscribe');
$subscribe_policy = $this->trimmed('subscribe_policy');
$private_stream = $this->boolean('private_stream');
$language = $this->trimmed('language'); $language = $this->trimmed('language');
$timezone = $this->trimmed('timezone'); $timezone = $this->trimmed('timezone');
$tagstring = $this->trimmed('tags'); $tagstring = $this->trimmed('tags');
@ -333,11 +352,15 @@ class ProfilesettingsAction extends SettingsAction
} }
// XXX: XOR // XXX: XOR
if ($user->autosubscribe ^ $autosubscribe) { if (($user->autosubscribe ^ $autosubscribe) ||
($user->private_stream ^ $private_stream) ||
($user->subscribe_policy != $subscribe_policy)) {
$original = clone($user); $original = clone($user);
$user->autosubscribe = $autosubscribe; $user->autosubscribe = $autosubscribe;
$user->private_stream = $private_stream;
$user->subscribe_policy = $subscribe_policy;
$result = $user->update($original); $result = $user->update($original);
@ -345,7 +368,7 @@ class ProfilesettingsAction extends SettingsAction
common_log_db_error($user, 'UPDATE', __FILE__); common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown when user profile settings could not be updated to // TRANS: Server error thrown when user profile settings could not be updated to
// TRANS: automatically subscribe to any subscriber. // TRANS: automatically subscribe to any subscriber.
$this->serverError(_('Could not update user for autosubscribe.')); $this->serverError(_('Could not update user for autosubscribe or subscribe_policy.'));
return; return;
} }
} }

View File

@ -100,7 +100,7 @@ class PublictagcloudAction extends Action
function showContent() function showContent()
{ {
# This should probably be cached rather than recalculated // This should probably be cached rather than recalculated
$tags = new Notice_tag(); $tags = new Notice_tag();
#Need to clear the selection and then only re-add the field #Need to clear the selection and then only re-add the field

View File

@ -19,7 +19,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
# You have 24 hours to claim your password // You have 24 hours to claim your password
define('MAX_RECOVERY_TIME', 24 * 60 * 60); define('MAX_RECOVERY_TIME', 24 * 60 * 60);
@ -81,7 +81,7 @@ class RecoverpasswordAction extends Action
$touched = strtotime($confirm->modified); $touched = strtotime($confirm->modified);
$email = $confirm->address; $email = $confirm->address;
# Burn this code // Burn this code
$result = $confirm->delete(); $result = $confirm->delete();
@ -92,8 +92,8 @@ class RecoverpasswordAction extends Action
return; return;
} }
# These should be reaped, but for now we just check mod time // These should be reaped, but for now we just check mod time
# Note: it's still deleted; let's avoid a second attempt! // Note: it's still deleted; let's avoid a second attempt!
if ((time() - $touched) > MAX_RECOVERY_TIME) { if ((time() - $touched) > MAX_RECOVERY_TIME) {
common_log(LOG_WARNING, common_log(LOG_WARNING,
@ -105,8 +105,8 @@ class RecoverpasswordAction extends Action
return; return;
} }
# If we used an outstanding confirmation to send the email, // If we used an outstanding confirmation to send the email,
# it's been confirmed at this point. // it's been confirmed at this point.
if (!$user->email) { if (!$user->email) {
$orig = clone($user); $orig = clone($user);
@ -120,7 +120,7 @@ class RecoverpasswordAction extends Action
} }
} }
# Success! // Success!
$this->setTempUser($user); $this->setTempUser($user);
$this->showPasswordForm(); $this->showPasswordForm();
@ -162,8 +162,8 @@ class RecoverpasswordAction extends Action
' the email address you have stored' . ' the email address you have stored' .
' in your account.')); ' in your account.'));
} else if ($this->mode == 'reset') { } else if ($this->mode == 'reset') {
// TRANS: Page notice for password change page.
$this->element('p', null, $this->element('p', null,
// TRANS: Page notice for password change page.
_('You have been identified. Enter a' . _('You have been identified. Enter a' .
' new password below.')); ' new password below.'));
} }
@ -289,7 +289,7 @@ class RecoverpasswordAction extends Action
} }
} }
# See if it's an unconfirmed email address // See if it's an unconfirmed email address
if (!$user) { if (!$user) {
// Warning: it may actually be legit to have multiple folks // Warning: it may actually be legit to have multiple folks
@ -314,7 +314,7 @@ class RecoverpasswordAction extends Action
return; return;
} }
# Try to get an unconfirmed email address if they used a user name // Try to get an unconfirmed email address if they used a user name
if (!$user->email && !$confirm_email) { if (!$user->email && !$confirm_email) {
$confirm_email = new Confirm_address(); $confirm_email = new Confirm_address();
@ -332,7 +332,7 @@ class RecoverpasswordAction extends Action
return; return;
} }
# Success! We have a valid user and a confirmed or unconfirmed email address // Success! We have a valid user and a confirmed or unconfirmed email address
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->code = common_confirmation_code(128); $confirm->code = common_confirmation_code(128);
@ -380,7 +380,7 @@ class RecoverpasswordAction extends Action
function resetPassword() function resetPassword()
{ {
# CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Form validation error message. // TRANS: Form validation error message.
@ -410,7 +410,7 @@ class RecoverpasswordAction extends Action
return; return;
} }
# OK, we're ready to go // OK, we're ready to go
$original = clone($user); $original = clone($user);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2010, StatusNet, Inc. * Copyright (C) 2010, StatusNet, Inc.
* *
* Redirect to the given URL * Redirect to the given URL
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -59,21 +59,23 @@ class RedirecturlAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function prepare($argarray) function prepare($argarray)
{ {
parent::prepare($argarray); parent::prepare($argarray);
$this->id = $this->trimmed('id'); $this->id = $this->trimmed('id');
if (empty($this->id)) { if (empty($this->id)) {
throw new ClientException(_('No id parameter')); // TRANS: Client exception thrown when no ID parameter was provided.
throw new ClientException(_('No id parameter.'));
} }
$this->file = File::staticGet('id', $this->id); $this->file = File::staticGet('id', $this->id);
if (empty($this->file)) { if (empty($this->file)) {
throw new ClientException(sprintf(_('No such file "%d"'), // TRANS: Client exception thrown when an invalid ID parameter was provided for a file.
// TRANS: %d is the provided ID for which the file is not present (number).
throw new ClientException(sprintf(_('No such file "%d".'),
$this->id), $this->id),
404); 404);
} }
@ -88,7 +90,6 @@ class RedirecturlAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
common_redirect($this->file->url, 307); common_redirect($this->file->url, 307);
@ -104,7 +105,6 @@ class RedirecturlAction extends Action
* *
* @return boolean is read only action? * @return boolean is read only action?
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
return true; return true;
@ -117,7 +117,6 @@ class RedirecturlAction extends Action
* *
* @return string last modified http header * @return string last modified http header
*/ */
function lastModified() function lastModified()
{ {
// For comparison with If-Last-Modified // For comparison with If-Last-Modified
@ -133,7 +132,6 @@ class RedirecturlAction extends Action
* *
* @return string etag http header * @return string etag http header
*/ */
function etag() function etag()
{ {
return 'W/"' . implode(':', array($this->arg('action'), return 'W/"' . implode(':', array($this->arg('action'),

View File

@ -77,6 +77,7 @@ class RegisterAction extends Action
} }
if (common_config('site', 'inviteonly') && empty($this->code)) { if (common_config('site', 'inviteonly') && empty($this->code)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.')); $this->clientError(_('Sorry, only invited people can register.'));
return false; return false;
} }
@ -84,6 +85,7 @@ class RegisterAction extends Action
if (!empty($this->code)) { if (!empty($this->code)) {
$this->invite = Invitation::staticGet('code', $this->code); $this->invite = Invitation::staticGet('code', $this->code);
if (empty($this->invite)) { if (empty($this->invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation.
$this->clientError(_('Sorry, invalid invitation code.')); $this->clientError(_('Sorry, invalid invitation code.'));
return false; return false;
} }
@ -103,9 +105,11 @@ class RegisterAction extends Action
function title() function title()
{ {
if ($this->registered) { if ($this->registered) {
// TRANS: Title for registration page after a succesful registration.
return _('Registration successful'); return _('Registration successful');
} else { } else {
return _('Register'); // TRANS: Title for registration page.
return _m('TITLE','Register');
} }
} }
@ -125,8 +129,10 @@ class RegisterAction extends Action
parent::handle($args); parent::handle($args);
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
// TRANS: Client error displayed when trying to register to a closed site.
$this->clientError(_('Registration not allowed.')); $this->clientError(_('Registration not allowed.'));
} else if (common_logged_in()) { } else if (common_logged_in()) {
// TRANS: Client error displayed when trying to register while already logged in.
$this->clientError(_('Already logged in.')); $this->clientError(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->tryRegister(); $this->tryRegister();
@ -154,6 +160,7 @@ class RegisterAction extends Action
if (Event::handle('StartRegistrationTry', array($this))) { if (Event::handle('StartRegistrationTry', array($this))) {
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
@ -178,6 +185,7 @@ class RegisterAction extends Action
} }
if (common_config('site', 'inviteonly') && !($code && $invite)) { if (common_config('site', 'inviteonly') && !($code && $invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.')); $this->clientError(_('Sorry, only invited people can register.'));
return; return;
} }
@ -191,39 +199,51 @@ class RegisterAction extends Action
$email = common_canonical_email($email); $email = common_canonical_email($email);
if (!$this->boolean('license')) { if (!$this->boolean('license')) {
$this->showForm(_('You cannot register if you don\'t '. // TRANS: Form validation error displayed when trying to register without agreeing to the site license.
$this->showForm(_('You cannot register if you do not '.
'agree to the license.')); 'agree to the license.'));
} else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) { } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
// TRANS: Form validation error displayed when trying to register without a valid e-mail address.
$this->showForm(_('Not a valid email address.')); $this->showForm(_('Not a valid email address.'));
} else if ($this->nicknameExists($nickname)) { } else if ($this->nicknameExists($nickname)) {
// TRANS: Form validation error displayed when trying to register with an existing nickname.
$this->showForm(_('Nickname already in use. Try another one.')); $this->showForm(_('Nickname already in use. Try another one.'));
} else if (!User::allowed_nickname($nickname)) { } else if (!User::allowed_nickname($nickname)) {
// TRANS: Form validation error displayed when trying to register with an invalid nickname.
$this->showForm(_('Not a valid nickname.')); $this->showForm(_('Not a valid nickname.'));
} else if ($this->emailExists($email)) { } else if ($this->emailExists($email)) {
// TRANS: Form validation error displayed when trying to register with an already registered e-mail address.
$this->showForm(_('Email address already exists.')); $this->showForm(_('Email address already exists.'));
} else if (!is_null($homepage) && (strlen($homepage) > 0) && } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage, !Validate::uri($homepage,
array('allowed_schemes' => array('allowed_schemes' =>
array('http', 'https')))) { array('http', 'https')))) {
// TRANS: Form validation error displayed when trying to register with an invalid homepage URL.
$this->showForm(_('Homepage is not a valid URL.')); $this->showForm(_('Homepage is not a valid URL.'));
return; return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) { } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Form validation error displayed when trying to register with a too long full name.
$this->showForm(_('Full name is too long (maximum 255 characters).')); $this->showForm(_('Full name is too long (maximum 255 characters).'));
return; return;
} else if (Profile::bioTooLong($bio)) { } else if (Profile::bioTooLong($bio)) {
// TRANS: Form validation error on registration page when providing too long a bio text.
// TRANS: %d is the maximum number of characters for bio; used for plural.
$this->showForm(sprintf(_m('Bio is too long (maximum %d character).', $this->showForm(sprintf(_m('Bio is too long (maximum %d character).',
'Bio is too long (maximum %d characters).', 'Bio is too long (maximum %d characters).',
Profile::maxBio()), Profile::maxBio()),
Profile::maxBio())); Profile::maxBio()));
return; return;
} else if (!is_null($location) && mb_strlen($location) > 255) { } else if (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Form validation error displayed when trying to register with a too long location.
$this->showForm(_('Location is too long (maximum 255 characters).')); $this->showForm(_('Location is too long (maximum 255 characters).'));
return; return;
} else if (strlen($password) < 6) { } else if (strlen($password) < 6) {
// TRANS: Form validation error displayed when trying to register with too short a password.
$this->showForm(_('Password must be 6 or more characters.')); $this->showForm(_('Password must be 6 or more characters.'));
return; return;
} else if ($password != $confirm) { } else if ($password != $confirm) {
$this->showForm(_('Passwords don\'t match.')); // TRANS: Form validation error displayed when trying to register with non-matching passwords.
$this->showForm(_('Passwords do not match.'));
} else if ($user = User::register(array('nickname' => $nickname, } else if ($user = User::register(array('nickname' => $nickname,
'password' => $password, 'password' => $password,
'email' => $email, 'email' => $email,
@ -233,11 +253,13 @@ class RegisterAction extends Action
'location' => $location, 'location' => $location,
'code' => $code))) { 'code' => $code))) {
if (!$user) { if (!$user) {
// TRANS: Form validation error displayed when trying to register with an invalid username or password.
$this->showForm(_('Invalid username or password.')); $this->showForm(_('Invalid username or password.'));
return; return;
} }
// success! // success!
if (!common_set_user($user)) { if (!common_set_user($user)) {
// TRANS: Server error displayed when saving fails during user registration.
$this->serverError(_('Error setting user.')); $this->serverError(_('Error setting user.'));
return; return;
} }
@ -255,6 +277,7 @@ class RegisterAction extends Action
$this->showSuccess(); $this->showSuccess();
} else { } else {
// TRANS: Form validation error displayed when trying to register with an invalid username or password.
$this->showForm(_('Invalid username or password.')); $this->showForm(_('Invalid username or password.'));
} }
} }
@ -330,6 +353,7 @@ class RegisterAction extends Action
$this->element('p', 'error', $this->error); $this->element('p', 'error', $this->error);
} else { } else {
$instr = $instr =
// TRANS: Page notice on registration page.
common_markup_to_html(_('With this form you can create '. common_markup_to_html(_('With this form you can create '.
'a new account. ' . 'a new account. ' .
'You can then post notices and '. 'You can then post notices and '.
@ -389,6 +413,7 @@ class RegisterAction extends Action
} }
if (common_config('site', 'inviteonly') && !($code && $invite)) { if (common_config('site', 'inviteonly') && !($code && $invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.')); $this->clientError(_('Sorry, only invited people can register.'));
return; return;
} }
@ -398,6 +423,7 @@ class RegisterAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => common_local_url('register'))); 'action' => common_local_url('register')));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
// TRANS: Fieldset legend on accout registration page.
$this->element('legend', null, 'Account settings'); $this->element('legend', null, 'Account settings');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
@ -408,66 +434,86 @@ class RegisterAction extends Action
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
if (Event::handle('StartRegistrationFormData', array($this))) { if (Event::handle('StartRegistrationFormData', array($this))) {
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page.
$this->input('nickname', _('Nickname'), $this->trimmed('nickname'), $this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
// TRANS: Field title on account registration page.
_('1-64 lowercase letters or numbers, no punctuation or spaces.')); _('1-64 lowercase letters or numbers, no punctuation or spaces.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page.
$this->password('password', _('Password'), $this->password('password', _('Password'),
// TRANS: Field title on account registration page.
_('6 or more characters.')); _('6 or more characters.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->password('confirm', _('Confirm'), // TRANS: Field label on account registration page. In this field the password has to be entered a second time.
_('Same as password above.')); $this->password('confirm', _m('PASSWORD','Confirm'),
// TRANS: Field title on account registration page.
_('Same as password above.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
if ($this->invite && $this->invite->address_type == 'email') { if ($this->invite && $this->invite->address_type == 'email') {
$this->input('email', _('Email'), $this->invite->address, // TRANS: Field label on account registration page.
$this->input('email', _m('LABEL','Email'), $this->invite->address,
// TRANS: Field title on account registration page.
_('Used only for updates, announcements, '. _('Used only for updates, announcements, '.
'and password recovery.')); 'and password recovery.'));
} else { } else {
$this->input('email', _('Email'), $this->trimmed('email'), // TRANS: Field label on account registration page.
$this->input('email', _m('LABEL','Email'), $this->trimmed('email'),
// TRANS: Field title on account registration page.
_('Used only for updates, announcements, '. _('Used only for updates, announcements, '.
'and password recovery.')); 'and password recovery.'));
} }
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page.
$this->input('fullname', _('Full name'), $this->input('fullname', _('Full name'),
$this->trimmed('fullname'), $this->trimmed('fullname'),
_('Longer name, preferably your "real" name.')); // TRANS: Field title on account registration page.
_('Longer name, preferably your "real" name.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page.
$this->input('homepage', _('Homepage'), $this->input('homepage', _('Homepage'),
$this->trimmed('homepage'), $this->trimmed('homepage'),
// TRANS: Field title on account registration page.
_('URL of your homepage, blog, '. _('URL of your homepage, blog, '.
'or profile on another site.')); 'or profile on another site.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$maxBio = Profile::maxBio(); $maxBio = Profile::maxBio();
if ($maxBio > 0) { if ($maxBio > 0) {
// TRANS: Tooltip for field label in form for profile settings. Plural // TRANS: Text area title in form for account registration. Plural
// TRANS: is decided by the number of characters available for the // TRANS: is decided by the number of characters available for the
// TRANS: biography (%d). // TRANS: biography (%d).
$bioInstr = sprintf(_m('Describe yourself and your interests in %d character', $bioInstr = sprintf(_m('Describe yourself and your interests in %d character.',
'Describe yourself and your interests in %d characters', 'Describe yourself and your interests in %d characters.',
$maxBio), $maxBio),
$maxBio); $maxBio);
} else { } else {
$bioInstr = _('Describe yourself and your interests'); // TRANS: Text area title on account registration page.
$bioInstr = _('Describe yourself and your interests.');
} }
// TRANS: Text area label on account registration page.
$this->textarea('bio', _('Bio'), $this->textarea('bio', _('Bio'),
$this->trimmed('bio'), $this->trimmed('bio'),
$bioInstr); $bioInstr);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page.
$this->input('location', _('Location'), $this->input('location', _('Location'),
$this->trimmed('location'), $this->trimmed('location'),
// TRANS: Field title on account registration page.
_('Where you are, like "City, '. _('Where you are, like "City, '.
'State (or Region), Country".')); 'State (or Region), Country".'));
$this->elementEnd('li'); $this->elementEnd('li');
Event::handle('EndRegistrationFormData', array($this)); Event::handle('EndRegistrationFormData', array($this));
$this->elementStart('li', array('id' => 'settings_rememberme')); $this->elementStart('li', array('id' => 'settings_rememberme'));
// TRANS: Checkbox label on account registration page.
$this->checkbox('rememberme', _('Remember me'), $this->checkbox('rememberme', _('Remember me'),
$this->boolean('rememberme'), $this->boolean('rememberme'),
// TRANS: Checkbox title on account registration page.
_('Automatically login in the future; '. _('Automatically login in the future; '.
'not for shared computers!')); 'not for shared computers!'));
$this->elementEnd('li'); $this->elementEnd('li');
@ -487,7 +533,8 @@ class RegisterAction extends Action
$this->elementEnd('li'); $this->elementEnd('li');
} }
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('submit', _('Register')); // TRANS: Button text to register a user on account registration page.
$this->submit('submit', _m('BUTTON','Register'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
} }
@ -497,9 +544,9 @@ class RegisterAction extends Action
$out = ''; $out = '';
switch (common_config('license', 'type')) { switch (common_config('license', 'type')) {
case 'private': case 'private':
// TRANS: Copyright checkbox label in registration dialog, for private sites.
// TRANS: %1$s is the StatusNet sitename.
$out .= htmlspecialchars(sprintf( $out .= htmlspecialchars(sprintf(
// TRANS: Copyright checkbox label in registration dialog, for private sites.
// TRANS: %1$s is the StatusNet sitename.
_('I understand that content and data of %1$s are private and confidential.'), _('I understand that content and data of %1$s are private and confidential.'),
common_config('site', 'name'))); common_config('site', 'name')));
// fall through // fall through
@ -508,8 +555,9 @@ class RegisterAction extends Action
$out .= ' '; $out .= ' ';
} }
if (common_config('license', 'owner')) { if (common_config('license', 'owner')) {
// TRANS: Copyright checkbox label in registration dialog, for all rights reserved with a specified copyright owner.
$out .= htmlspecialchars(sprintf( $out .= htmlspecialchars(sprintf(
// TRANS: Copyright checkbox label in registration dialog, for all rights reserved with a specified copyright owner.
// TRANS: %1$s is the license owner.
_('My text and files are copyright by %1$s.'), _('My text and files are copyright by %1$s.'),
common_config('license', 'owner'))); common_config('license', 'owner')));
} else { } else {
@ -563,6 +611,10 @@ class RegisterAction extends Action
array('nickname' => $nickname)); array('nickname' => $nickname));
$this->elementStart('div', 'success'); $this->elementStart('div', 'success');
// TRANS: Text displayed after successful account registration.
// TRANS: %1$s is the registered nickname, %2$s is the profile URL.
// TRANS: This message contains Markdown links in the form [link text](link)
// TRANS: and variables in the form %%%%variable%%%%. Please mind the syntax.
$instr = sprintf(_('Congratulations, %1$s! And welcome to %%%%site.name%%%%. '. $instr = sprintf(_('Congratulations, %1$s! And welcome to %%%%site.name%%%%. '.
'From here, you may want to...'. "\n\n" . 'From here, you may want to...'. "\n\n" .
'* Go to [your profile](%2$s) '. '* Go to [your profile](%2$s) '.
@ -587,6 +639,7 @@ class RegisterAction extends Action
$have_email = $this->trimmed('email'); $have_email = $this->trimmed('email');
if ($have_email) { if ($have_email) {
// TRANS: Instruction text on how to deal with the e-mail address confirmation e-mail.
$emailinstr = _('(You should receive a message by email '. $emailinstr = _('(You should receive a message by email '.
'momentarily, with ' . 'momentarily, with ' .
'instructions on how to confirm '. 'instructions on how to confirm '.

View File

@ -55,6 +55,7 @@ class RemotesubscribeAction extends Action
parent::prepare($args); parent::prepare($args);
if (common_logged_in()) { if (common_logged_in()) {
// TRANS: Client error displayed when using remote subscribe for a local entity.
$this->clientError(_('You can use the local subscription!')); $this->clientError(_('You can use the local subscription!'));
return false; return false;
} }
@ -73,6 +74,7 @@ class RemotesubscribeAction extends Action
/* Use a session token for CSRF protection. */ /* Use a session token for CSRF protection. */
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
@ -94,6 +96,8 @@ class RemotesubscribeAction extends Action
if ($this->err) { if ($this->err) {
$this->element('div', 'error', $this->err); $this->element('div', 'error', $this->err);
} else { } else {
// TRANS: Page notice for remote subscribe. This message contains Markdown links.
// TRANS: Ensure to keep the correct markup of [link description](link).
$inst = _('To subscribe, you can [login](%%action.login%%),' . $inst = _('To subscribe, you can [login](%%action.login%%),' .
' or [register](%%action.register%%) a new ' . ' or [register](%%action.register%%) a new ' .
' account. If you already have an account ' . ' account. If you already have an account ' .
@ -108,6 +112,7 @@ class RemotesubscribeAction extends Action
function title() function title()
{ {
// TRANS: Page title for Remote subscribe.
return _('Remote subscribe'); return _('Remote subscribe');
} }
@ -120,20 +125,26 @@ class RemotesubscribeAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => common_local_url('remotesubscribe'))); 'action' => common_local_url('remotesubscribe')));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
// TRANS: Field legend on page for remote subscribe.
$this->element('legend', _('Subscribe to a remote user')); $this->element('legend', _('Subscribe to a remote user'));
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on page for remote subscribe.
$this->input('nickname', _('User nickname'), $this->nickname, $this->input('nickname', _('User nickname'), $this->nickname,
// TRANS: Field title on page for remote subscribe.
_('Nickname of the user you want to follow.')); _('Nickname of the user you want to follow.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on page for remote subscribe.
$this->input('profile_url', _('Profile URL'), $this->profile_url, $this->input('profile_url', _('Profile URL'), $this->profile_url,
// TRANS: Field title on page for remote subscribe.
_('URL of your profile on another compatible microblogging service.')); _('URL of your profile on another compatible microblogging service.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('submit', _('Subscribe')); // TRANS: Button text on page for remote subscribe.
$this->submit('submit', _m('BUTTON','Subscribe'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
} }
@ -141,6 +152,7 @@ class RemotesubscribeAction extends Action
function remoteSubscription() function remoteSubscription()
{ {
if (!$this->nickname) { if (!$this->nickname) {
// TRANS: Form validation error on page for remote subscribe when no user was provided.
$this->showForm(_('No such user.')); $this->showForm(_('No such user.'));
return; return;
} }
@ -150,11 +162,13 @@ class RemotesubscribeAction extends Action
$this->profile_url = $this->trimmed('profile_url'); $this->profile_url = $this->trimmed('profile_url');
if (!$this->profile_url) { if (!$this->profile_url) {
// TRANS: Form validation error on page for remote subscribe when no user profile was found.
$this->showForm(_('No such user.')); $this->showForm(_('No such user.'));
return; return;
} }
if (!common_valid_http_url($this->profile_url)) { if (!common_valid_http_url($this->profile_url)) {
// TRANS: Form validation error on page for remote subscribe when an invalid profile URL was provided.
$this->showForm(_('Invalid profile URL (bad format).')); $this->showForm(_('Invalid profile URL (bad format).'));
return; return;
} }
@ -164,6 +178,8 @@ class RemotesubscribeAction extends Action
common_root_url(), common_root_url(),
omb_oauth_datastore()); omb_oauth_datastore());
} catch (OMB_InvalidYadisException $e) { } catch (OMB_InvalidYadisException $e) {
// TRANS: Form validation error on page for remote subscribe when no the provided profile URL
// TRANS: does not contain expected data.
$this->showForm(_('Not a valid profile URL (no YADIS document or ' . $this->showForm(_('Not a valid profile URL (no YADIS document or ' .
'invalid XRDS defined).')); 'invalid XRDS defined).'));
return; return;
@ -172,6 +188,7 @@ class RemotesubscribeAction extends Action
if ($service->getServiceURI(OAUTH_ENDPOINT_REQUEST) == if ($service->getServiceURI(OAUTH_ENDPOINT_REQUEST) ==
common_local_url('requesttoken') || common_local_url('requesttoken') ||
User::staticGet('uri', $service->getRemoteUserURI())) { User::staticGet('uri', $service->getRemoteUserURI())) {
// TRANS: Form validation error on page for remote subscribe.
$this->showForm(_('That is a local profile! Login to subscribe.')); $this->showForm(_('That is a local profile! Login to subscribe.'));
return; return;
} }
@ -179,6 +196,7 @@ class RemotesubscribeAction extends Action
try { try {
$service->requestToken(); $service->requestToken();
} catch (OMB_RemoteServiceException $e) { } catch (OMB_RemoteServiceException $e) {
// TRANS: Form validation error on page for remote subscribe when the remote service is not providing a request token.
$this->showForm(_('Could not get a request token.')); $this->showForm(_('Could not get a request token.'));
return; return;
} }
@ -187,6 +205,7 @@ class RemotesubscribeAction extends Action
$profile = $user->getProfile(); $profile = $user->getProfile();
if (!$profile) { if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__); common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Server error displayed on page for remote subscribe when user does not have a matching profile.
$this->serverError(_('User without matching profile.')); $this->serverError(_('User without matching profile.'));
return; return;
} }

View File

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Repeat action. * Repeat action.
* *
@ -53,6 +52,7 @@ class RepeatAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client error displayed when trying to repeat a notice while not logged in.
$this->clientError(_('Only logged-in users can repeat notices.')); $this->clientError(_('Only logged-in users can repeat notices.'));
return false; return false;
} }
@ -60,6 +60,7 @@ class RepeatAction extends Action
$id = $this->trimmed('notice'); $id = $this->trimmed('notice');
if (empty($id)) { if (empty($id)) {
// TRANS: Client error displayed when trying to repeat a notice while not providing a notice ID.
$this->clientError(_('No notice specified.')); $this->clientError(_('No notice specified.'));
return false; return false;
} }
@ -67,29 +68,19 @@ class RepeatAction extends Action
$this->notice = Notice::staticGet('id', $id); $this->notice = Notice::staticGet('id', $id);
if (empty($this->notice)) { if (empty($this->notice)) {
// TRANS: Client error displayed when trying to repeat a non-existing notice.
$this->clientError(_('No notice specified.')); $this->clientError(_('No notice specified.'));
return false; return false;
} }
if ($this->user->id == $this->notice->profile_id) {
$this->clientError(_('You cannot repeat your own notice.'));
return false;
}
$token = $this->trimmed('token-'.$id); $token = $this->trimmed('token-'.$id);
if (empty($token) || $token != common_session_token()) { if (empty($token) || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. Try again, please.')); $this->clientError(_('There was a problem with your session token. Try again, please.'));
return false; return false;
} }
$profile = $this->user->getProfile();
if ($profile->hasRepeated($id)) {
$this->clientError(_('You already repeated that notice.'));
return false;
}
return true; return true;
} }
@ -104,21 +95,21 @@ class RepeatAction extends Action
{ {
$repeat = $this->notice->repeat($this->user->id, 'web'); $repeat = $this->notice->repeat($this->user->id, 'web');
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8'); $this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Title after repeating a notice.
$this->element('title', null, _('Repeated')); $this->element('title', null, _('Repeated'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
$this->element('p', array('id' => 'repeat_response', $this->element('p', array('id' => 'repeat_response',
'class' => 'repeated'), 'class' => 'repeated'),
// TRANS: Confirmation text after repeating a notice.
_('Repeated!')); _('Repeated!'));
$this->elementEnd('body'); $this->elementEnd('body');
$this->elementEnd('html'); $this->elementEnd('html');
} else { } else {
// FIXME! // @todo FIXME!
} }
} }
} }

View File

@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/feedlist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class RepliesAction extends OwnerDesignAction class RepliesAction extends OwnerDesignAction
{ {
var $page = null; var $page = null;
@ -60,7 +59,6 @@ class RepliesAction extends OwnerDesignAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
@ -70,6 +68,7 @@ class RepliesAction extends OwnerDesignAction
$this->user = User::staticGet('nickname', $nickname); $this->user = User::staticGet('nickname', $nickname);
if (!$this->user) { if (!$this->user) {
// TRANS: Client error displayed when trying to reply to a non-exsting user.
$this->clientError(_('No such user.')); $this->clientError(_('No such user.'));
return false; return false;
} }
@ -77,6 +76,7 @@ class RepliesAction extends OwnerDesignAction
$profile = $this->user->getProfile(); $profile = $this->user->getProfile();
if (!$profile) { if (!$profile) {
// TRANS: Server error displayed when trying to reply to a user without a profile.
$this->serverError(_('User has no profile.')); $this->serverError(_('User has no profile.'));
return false; return false;
} }
@ -105,7 +105,6 @@ class RepliesAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function handle($args) function handle($args)
{ {
parent::handle($args); parent::handle($args);
@ -119,12 +118,15 @@ class RepliesAction extends OwnerDesignAction
* *
* @return string title of page * @return string title of page
*/ */
function title() function title()
{ {
if ($this->page == 1) { if ($this->page == 1) {
// TRANS: Title for first page of replies for a user.
// TRANS: %s is a user nickname.
return sprintf(_("Replies to %s"), $this->user->nickname); return sprintf(_("Replies to %s"), $this->user->nickname);
} else { } else {
// TRANS: Title for all but the first page of replies for a user.
// TRANS: %1$s is a user nickname, %2$d is a page number.
return sprintf(_('Replies to %1$s, page %2$d'), return sprintf(_('Replies to %1$s, page %2$d'),
$this->user->nickname, $this->user->nickname,
$this->page); $this->page);
@ -136,12 +138,13 @@ class RepliesAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function getFeeds() function getFeeds()
{ {
return array(new Feed(Feed::RSS1, return array(new Feed(Feed::RSS1,
common_local_url('repliesrss', common_local_url('repliesrss',
array('nickname' => $this->user->nickname)), array('nickname' => $this->user->nickname)),
// TRANS: Link for feed with replies for a user.
// TRANS: %s is a user nickname.
sprintf(_('Replies feed for %s (RSS 1.0)'), sprintf(_('Replies feed for %s (RSS 1.0)'),
$this->user->nickname)), $this->user->nickname)),
new Feed(Feed::RSS2, new Feed(Feed::RSS2,
@ -149,6 +152,8 @@ class RepliesAction extends OwnerDesignAction
array( array(
'id' => $this->user->nickname, 'id' => $this->user->nickname,
'format' => 'rss')), 'format' => 'rss')),
// TRANS: Link for feed with replies for a user.
// TRANS: %s is a user nickname.
sprintf(_('Replies feed for %s (RSS 2.0)'), sprintf(_('Replies feed for %s (RSS 2.0)'),
$this->user->nickname)), $this->user->nickname)),
new Feed(Feed::ATOM, new Feed(Feed::ATOM,
@ -156,6 +161,8 @@ class RepliesAction extends OwnerDesignAction
array( array(
'id' => $this->user->nickname, 'id' => $this->user->nickname,
'format' => 'atom')), 'format' => 'atom')),
// TRANS: Link for feed with replies for a user.
// TRANS: %s is a user nickname.
sprintf(_('Replies feed for %s (Atom)'), sprintf(_('Replies feed for %s (Atom)'),
$this->user->nickname))); $this->user->nickname)));
} }
@ -167,7 +174,6 @@ class RepliesAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
$nl = new NoticeList($this->notice, $this); $nl = new NoticeList($this->notice, $this);
@ -184,17 +190,27 @@ class RepliesAction extends OwnerDesignAction
function showEmptyListMessage() function showEmptyListMessage()
{ {
$message = sprintf(_('This is the timeline showing replies to %1$s but %2$s hasn\'t received a notice to them yet.'), $this->user->nickname, $this->user->nickname) . ' '; // TRANS: Empty list message for page with replies for a user.
// TRANS: %1$s and %s$s are the user nickname.
$message = sprintf(_('This is the timeline showing replies to %1$s but %2$s hasn\'t received a notice to them yet.'),
$this->user->nickname,
$this->user->nickname) . ' ';
if (common_logged_in()) { if (common_logged_in()) {
$current_user = common_current_user(); $current_user = common_current_user();
if ($this->user->id === $current_user->id) { if ($this->user->id === $current_user->id) {
// TRANS: Empty list message for page with replies for a user for the logged in user.
// TRANS: This message contains a Markdown link in the form [link text](link).
$message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).'); $message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).');
} else { } else {
// TRANS: Empty list message for page with replies for a user for all logged in users but the user themselves.
// TRANS: %1$s, %2$s and %3$s are a user nickname. This message contains a Markdown link in the form [link text](link).
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname); $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
} }
} }
else { else {
// TRANS: Empty list message for page with replies for a user for not logged in users.
// TRANS: %1$s is a user nickname. This message contains a Markdown link in the form [link text](link).
$message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname); $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname);
} }

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/ * @link http://status.net/
*/ */
class RevokeRoleAction extends ProfileFormAction class RevokeRoleAction extends ProfileFormAction
{ {
/** /**
@ -50,19 +49,20 @@ class RevokeRoleAction extends ProfileFormAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare($args)
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
return false; return false;
} }
$this->role = $this->arg('role'); $this->role = $this->arg('role');
if (!Profile_role::isValid($this->role)) { if (!Profile_role::isValid($this->role)) {
// TRANS: Client error displayed when trying to revoke an invalid role.
$this->clientError(_('Invalid role.')); $this->clientError(_('Invalid role.'));
return false; return false;
} }
if (!Profile_role::isSettable($this->role)) { if (!Profile_role::isSettable($this->role)) {
// TRANS: Client error displayed when trying to revoke a reserved role.
$this->clientError(_('This role is reserved and cannot be set.')); $this->clientError(_('This role is reserved and cannot be set.'));
return false; return false;
} }
@ -72,6 +72,7 @@ class RevokeRoleAction extends ProfileFormAction
assert(!empty($cur)); // checked by parent assert(!empty($cur)); // checked by parent
if (!$cur->hasRight(Right::REVOKEROLE)) { if (!$cur->hasRight(Right::REVOKEROLE)) {
// TRANS: Client error displayed when trying to revoke a role without having the right to do that.
$this->clientError(_('You cannot revoke user roles on this site.')); $this->clientError(_('You cannot revoke user roles on this site.'));
return false; return false;
} }
@ -79,7 +80,8 @@ class RevokeRoleAction extends ProfileFormAction
assert(!empty($this->profile)); // checked by parent assert(!empty($this->profile)); // checked by parent
if (!$this->profile->hasRole($this->role)) { if (!$this->profile->hasRole($this->role)) {
$this->clientError(_("User doesn't have this role.")); // TRANS: Client error displayed when trying to revoke a role that is not set.
$this->clientError(_('User does not have this role.'));
return false; return false;
} }
@ -91,7 +93,6 @@ class RevokeRoleAction extends ProfileFormAction
* *
* @return void * @return void
*/ */
function handlePost() function handlePost()
{ {
$this->profile->revokeRole($this->role); $this->profile->revokeRole($this->role);

View File

@ -110,6 +110,7 @@ class RsdAction extends Action
$this->user = User::staticGet('nickname', $nickname); $this->user = User::staticGet('nickname', $nickname);
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client error.
$this->clientError(_('No such user.'), 404); $this->clientError(_('No such user.'), 404);
return false; return false;
} }
@ -139,6 +140,7 @@ class RsdAction extends Action
$this->elementStart('rsd', array('version' => '1.0', $this->elementStart('rsd', array('version' => '1.0',
'xmlns' => $rsdNS)); 'xmlns' => $rsdNS));
$this->elementStart('service'); $this->elementStart('service');
// TRANS: Engine name for RSD.
$this->element('engineName', null, _('StatusNet')); $this->element('engineName', null, _('StatusNet'));
$this->element('engineLink', null, 'http://status.net/'); $this->element('engineLink', null, 'http://status.net/');
$this->elementStart('apis'); $this->elementStart('apis');

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/ * @link http://status.net/
*/ */
class SandboxAction extends ProfileFormAction class SandboxAction extends ProfileFormAction
{ {
/** /**
@ -50,7 +49,6 @@ class SandboxAction extends ProfileFormAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare($args)
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
@ -62,6 +60,7 @@ class SandboxAction extends ProfileFormAction
assert(!empty($cur)); // checked by parent assert(!empty($cur)); // checked by parent
if (!$cur->hasRight(Right::SANDBOXUSER)) { if (!$cur->hasRight(Right::SANDBOXUSER)) {
// TRANS: Client error displayed trying to sandbox users on a site where the feature is not enabled.
$this->clientError(_('You cannot sandbox users on this site.')); $this->clientError(_('You cannot sandbox users on this site.'));
return false; return false;
} }
@ -69,6 +68,7 @@ class SandboxAction extends ProfileFormAction
assert(!empty($this->profile)); // checked by parent assert(!empty($this->profile)); // checked by parent
if ($this->profile->isSandboxed()) { if ($this->profile->isSandboxed()) {
// TRANS: Client error displayed trying to sandbox an already sandboxed user.
$this->clientError(_('User is already sandboxed.')); $this->clientError(_('User is already sandboxed.'));
return false; return false;
} }
@ -81,7 +81,6 @@ class SandboxAction extends ProfileFormAction
* *
* @return void * @return void
*/ */
function handlePost() function handlePost()
{ {
$this->profile->sandbox(); $this->profile->sandbox();

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class SessionsadminpanelAction extends AdminPanelAction class SessionsadminpanelAction extends AdminPanelAction
{ {
/** /**
@ -48,10 +47,10 @@ class SessionsadminpanelAction extends AdminPanelAction
* *
* @return string page title * @return string page title
*/ */
function title() function title()
{ {
return _('Sessions'); // TRANS: Title for the sessions administration panel.
return _m('TITLE','Sessions');
} }
/** /**
@ -59,9 +58,9 @@ class SessionsadminpanelAction extends AdminPanelAction
* *
* @return string instructions * @return string instructions
*/ */
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions for the sessions administration panel.
return _('Session settings for this StatusNet site'); return _('Session settings for this StatusNet site');
} }
@ -70,7 +69,6 @@ class SessionsadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function showForm() function showForm()
{ {
$form = new SessionsAdminPanelForm($this); $form = new SessionsAdminPanelForm($this);
@ -83,7 +81,6 @@ class SessionsadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function saveSettings() function saveSettings()
{ {
static $booleans = array('sessions' => array('handle', 'debug')); static $booleans = array('sessions' => array('handle', 'debug'));
@ -123,6 +120,7 @@ class SessionsadminpanelAction extends AdminPanelAction
} }
} }
// @todo FIXME: Class documentation missing.
class SessionsAdminPanelForm extends AdminForm class SessionsAdminPanelForm extends AdminForm
{ {
/** /**
@ -130,7 +128,6 @@ class SessionsAdminPanelForm extends AdminForm
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'sessionsadminpanel'; return 'sessionsadminpanel';
@ -141,7 +138,6 @@ class SessionsAdminPanelForm extends AdminForm
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'form_settings'; return 'form_settings';
@ -152,7 +148,6 @@ class SessionsAdminPanelForm extends AdminForm
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('sessionsadminpanel'); return common_local_url('sessionsadminpanel');
@ -163,24 +158,31 @@ class SessionsAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart('fieldset', array('id' => 'settings_user_sessions')); $this->out->elementStart('fieldset', array('id' => 'settings_user_sessions'));
$this->out->element('legend', null, _('Sessions')); // TRANS: Fieldset legend on the sessions administration panel.
$this->out->element('legend', null, _m('LEGEND','Sessions'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
// TRANS: Checkbox title on the sessions administration panel.
// TRANS: Indicates if StatusNet should handle session administration.
$this->out->checkbox('handle', _('Handle sessions'), $this->out->checkbox('handle', _('Handle sessions'),
(bool) $this->value('handle', 'sessions'), (bool) $this->value('handle', 'sessions'),
_('Whether to handle sessions ourselves.')); // TRANS: Checkbox title on the sessions administration panel.
// TRANS: Indicates if StatusNet should handle session administration.
_('Handle sessions ourselves.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
// TRANS: Checkbox label on the sessions administration panel.
// TRANS: Indicates if StatusNet should write session debugging output.
$this->out->checkbox('debug', _('Session debugging'), $this->out->checkbox('debug', _('Session debugging'),
(bool) $this->value('debug', 'sessions'), (bool) $this->value('debug', 'sessions'),
_('Turn on debugging output for sessions.')); // TRANS: Checkbox title on the sessions administration panel.
_('Enable debugging output for sessions.'));
$this->unli(); $this->unli();
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
@ -193,9 +195,14 @@ class SessionsAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings')); $this->out->submit('submit',
// TRANS: Submit button text on the sessions administration panel.
_m('BUTTON','Save'),
'submit',
null,
// TRANS: Title for submit button on the sessions administration panel.
_('Save session settings'));
} }
} }

View File

@ -75,11 +75,13 @@ class ShowApplicationAction extends OwnerDesignAction
$this->owner = User::staticGet($this->application->owner); $this->owner = User::staticGet($this->application->owner);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to display an OAuth application while not logged in.
$this->clientError(_('You must be logged in to view an application.')); $this->clientError(_('You must be logged in to view an application.'));
return false; return false;
} }
if (empty($this->application)) { if (empty($this->application)) {
// TRANS: Client error displayed trying to display a non-existing OAuth application.
$this->clientError(_('No such application.'), 404); $this->clientError(_('No such application.'), 404);
return false; return false;
} }
@ -87,6 +89,7 @@ class ShowApplicationAction extends OwnerDesignAction
$cur = common_current_user(); $cur = common_current_user();
if ($cur->id != $this->owner->id) { if ($cur->id != $this->owner->id) {
// TRANS: Client error displayed trying to display an OAuth application for which the logged in user is not the owner.
$this->clientError(_('You are not the owner of this application.'), 401); $this->clientError(_('You are not the owner of this application.'), 401);
return false; return false;
} }
@ -110,6 +113,7 @@ class ShowApplicationAction extends OwnerDesignAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token.')); $this->clientError(_('There was a problem with your session token.'));
return; return;
} }
@ -148,6 +152,7 @@ class ShowApplicationAction extends OwnerDesignAction
$consumer = $this->application->getConsumer(); $consumer = $this->application->getConsumer();
$this->elementStart('div', 'entity_profile vcard'); $this->elementStart('div', 'entity_profile vcard');
// TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application profile')); $this->element('h2', null, _('Application profile'));
if (!empty($this->application->icon)) { if (!empty($this->application->icon)) {
$this->element('img', array('src' => $this->application->icon, $this->element('img', array('src' => $this->application->icon,
@ -176,7 +181,12 @@ class ShowApplicationAction extends OwnerDesignAction
$userCnt = $appUsers->count(); $userCnt = $appUsers->count();
$this->raw(sprintf( $this->raw(sprintf(
_('Created by %1$s - %2$s access by default - %3$d users'), // TRANS: Information output on an OAuth application page.
// TRANS: %1$s is the application creator, %2$s is "read-only" or "read-write",
// TRANS: %3$d is the number of users using the OAuth application.
_m('Created by %1$s - %2$s access by default - %3$d user',
'Created by %1$s - %2$s access by default - %3$d users',
$userCnt),
$profile->getBestName(), $profile->getBestName(),
$defaultAccess, $defaultAccess,
$userCnt $userCnt
@ -186,13 +196,15 @@ class ShowApplicationAction extends OwnerDesignAction
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementStart('div', 'entity_actions'); $this->elementStart('div', 'entity_actions');
// TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application actions')); $this->element('h2', null, _('Application actions'));
$this->elementStart('ul'); $this->elementStart('ul');
$this->elementStart('li', 'entity_edit'); $this->elementStart('li', 'entity_edit');
$this->element('a', $this->element('a',
array('href' => common_local_url('editapplication', array('href' => common_local_url('editapplication',
array('id' => $this->application->id))), array('id' => $this->application->id))),
'Edit'); // TRANS: Link text to edit application on the OAuth application page.
_m('EDITAPP','Edit'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li', 'entity_reset_keysecret'); $this->elementStart('li', 'entity_reset_keysecret');
@ -209,6 +221,8 @@ class ShowApplicationAction extends OwnerDesignAction
'id' => 'reset', 'id' => 'reset',
'name' => 'reset', 'name' => 'reset',
'class' => 'submit', 'class' => 'submit',
// TRANS: Button text on the OAuth application page.
// TRANS: Resets the OAuth consumer key and secret.
'value' => _('Reset key & secret'), 'value' => _('Reset key & secret'),
'onClick' => 'return confirmReset()')); 'onClick' => 'return confirmReset()'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -225,7 +239,8 @@ class ShowApplicationAction extends OwnerDesignAction
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->submit('delete', _('Delete')); // TRANS: Submit button text the OAuth application page to delete an application.
$this->submit('delete', _m('BUTTON','Delete'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementEnd('li'); $this->elementEnd('li');
@ -234,6 +249,7 @@ class ShowApplicationAction extends OwnerDesignAction
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementStart('div', 'entity_data'); $this->elementStart('div', 'entity_data');
// TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application info')); $this->element('h2', null, _('Application info'));
$this->element('div', $this->element('div',
'entity_consumer_key', 'entity_consumer_key',
@ -252,7 +268,8 @@ class ShowApplicationAction extends OwnerDesignAction
$this->element('div', 'entity_authorize_url', common_local_url('ApiOauthAuthorize')); $this->element('div', 'entity_authorize_url', common_local_url('ApiOauthAuthorize'));
$this->element('p', 'note', $this->element('p', 'note',
_('Note: We support HMAC-SHA1 signatures. We do not support the plaintext signature method.')); // TRANS: Note on the OAuth application page about signature support.
_('Note: HMAC-SHA1 signatures are supported. The plaintext signature method is not supported.'));
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementStart('p', array('id' => 'application_action')); $this->elementStart('p', array('id' => 'application_action'));
@ -272,6 +289,7 @@ class ShowApplicationAction extends OwnerDesignAction
{ {
parent::showScripts(); parent::showScripts();
// TRANS: Text in confirmation dialog to reset consumer key and secret for an OAuth application.
$msg = _('Are you sure you want to reset your consumer key and secret?'); $msg = _('Are you sure you want to reset your consumer key and secret?');
$js = 'function confirmReset() { '; $js = 'function confirmReset() { ';

View File

@ -324,6 +324,8 @@ class ShowgroupAction extends GroupDesignAction
$this->element('h2', null, _('Statistics')); $this->element('h2', null, _('Statistics'));
$this->elementStart('dl'); $this->elementStart('dl');
// TRANS: Label for group creation date.
$this->element('dt', null, _m('LABEL','Created')); $this->element('dt', null, _m('LABEL','Created'));
$this->element('dd', 'entity_created', date('j M Y', $this->element('dd', 'entity_created', date('j M Y',
strtotime($this->group->created))); strtotime($this->group->created)));
@ -363,6 +365,18 @@ class ShowgroupAction extends GroupDesignAction
$this->raw(common_markup_to_html($m)); $this->raw(common_markup_to_html($m));
$this->elementEnd('div'); $this->elementEnd('div');
} }
function noticeFormOptions()
{
$options = parent::noticeFormOptions();
$cur = common_current_user();
if (!empty($cur) && $cur->isMember($this->group)) {
$options['to_group'] = $this->group;
}
return $options;
}
} }
class GroupAdminSection extends ProfileSection class GroupAdminSection extends ProfileSection
@ -382,8 +396,8 @@ class GroupAdminSection extends ProfileSection
function title() function title()
{ {
// TRANS: Header for list of group administrators on a group page (h2). // TRANS: Title for list of group administrators on a group page.
return _('Admins'); return _m('TITLE','Admins');
} }
function divId() function divId()

View File

@ -44,25 +44,21 @@ require_once INSTALLDIR.'/lib/feedlist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ShownoticeAction extends OwnerDesignAction class ShownoticeAction extends OwnerDesignAction
{ {
/** /**
* Notice object to show * Notice object to show
*/ */
var $notice = null; var $notice = null;
/** /**
* Profile of the notice object * Profile of the notice object
*/ */
var $profile = null; var $profile = null;
/** /**
* Avatar of the profile of the notice object * Avatar of the profile of the notice object
*/ */
var $avatar = null; var $avatar = null;
/** /**
@ -74,7 +70,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return success flag * @return success flag
*/ */
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
@ -82,24 +77,25 @@ class ShownoticeAction extends OwnerDesignAction
StatusNet::setApi(true); StatusNet::setApi(true);
} }
$id = $this->arg('notice'); $this->notice = $this->getNotice();
$this->notice = Notice::staticGet($id); $cur = common_current_user();
if (empty($this->notice)) { if (!empty($cur)) {
// Did we used to have it, and it got deleted? $curProfile = $cur->getProfile();
$deleted = Deleted_notice::staticGet($id); } else {
if (!empty($deleted)) { $curProfile = null;
$this->clientError(_('Notice deleted.'), 410); }
} else {
$this->clientError(_('No such notice.'), 404); if (!$this->notice->inScope($curProfile)) {
} // TRANS: Client exception thrown when trying a view a notice the user has no access to.
return false; throw new ClientException(_('Not available.'), 403);
} }
$this->profile = $this->notice->getProfile(); $this->profile = $this->notice->getProfile();
if (empty($this->profile)) { if (empty($this->profile)) {
// TRANS: Server error displayed trying to show a notice without a connected profile.
$this->serverError(_('Notice has no profile.'), 500); $this->serverError(_('Notice has no profile.'), 500);
return false; return false;
} }
@ -111,12 +107,38 @@ class ShownoticeAction extends OwnerDesignAction
return true; return true;
} }
/**
* Fetch the notice to show. This may be overridden by child classes to
* customize what we fetch without duplicating all of the prepare() method.
*
* @return Notice
*/
function getNotice()
{
$id = $this->arg('notice');
$notice = Notice::staticGet('id', $id);
if (empty($notice)) {
// Did we used to have it, and it got deleted?
$deleted = Deleted_notice::staticGet($id);
if (!empty($deleted)) {
// TRANS: Client error displayed trying to show a deleted notice.
$this->clientError(_('Notice deleted.'), 410);
} else {
// TRANS: Client error displayed trying to show a non-existing notice.
$this->clientError(_('No such notice.'), 404);
}
return false;
}
return $notice;
}
/** /**
* Is this action read-only? * Is this action read-only?
* *
* @return boolean true * @return boolean true
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
return true; return true;
@ -130,7 +152,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return int last-modified date as unix timestamp * @return int last-modified date as unix timestamp
*/ */
function lastModified() function lastModified()
{ {
return max(strtotime($this->notice->modified), return max(strtotime($this->notice->modified),
@ -147,7 +168,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return string etag * @return string etag
*/ */
function etag() function etag()
{ {
$avtime = ($this->avatar) ? $avtime = ($this->avatar) ?
@ -167,11 +187,12 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return string title of the page * @return string title of the page
*/ */
function title() function title()
{ {
$base = $this->profile->getFancyName(); $base = $this->profile->getFancyName();
// TRANS: Title of the page that shows a notice.
// TRANS: %1$s is a user name, %2$s is the notice creation date/time.
return sprintf(_('%1$s\'s status on %2$s'), return sprintf(_('%1$s\'s status on %2$s'),
$base, $base,
common_exact_date($this->notice->created)); common_exact_date($this->notice->created));
@ -186,7 +207,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function handle($args) function handle($args)
{ {
parent::handle($args); parent::handle($args);
@ -218,7 +238,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function showLocalNavBlock() function showLocalNavBlock()
{ {
} }
@ -230,7 +249,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
$this->elementStart('ol', array('class' => 'notices xoxo')); $this->elementStart('ol', array('class' => 'notices xoxo'));
@ -245,7 +263,8 @@ class ShownoticeAction extends OwnerDesignAction
$this->xw->startDocument('1.0', 'UTF-8'); $this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html'); $this->elementStart('html');
$this->elementStart('head'); $this->elementStart('head');
$this->element('title', null, _('Notice')); // TRANS: Title for page that shows a notice.
$this->element('title', null, _m('TITLE','Notice'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
$nli = new NoticeListItem($this->notice, $this); $nli = new NoticeListItem($this->notice, $this);
@ -259,7 +278,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function showPageNoticeBlock() function showPageNoticeBlock()
{ {
} }
@ -269,7 +287,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function showAside() { function showAside() {
} }
@ -280,7 +297,6 @@ class ShownoticeAction extends OwnerDesignAction
* *
* @return void * @return void
*/ */
function extraHead() function extraHead()
{ {
$user = User::staticGet($this->profile->id); $user = User::staticGet($this->profile->id);
@ -323,16 +339,16 @@ class ShownoticeAction extends OwnerDesignAction
} }
} }
// @todo FIXME: Class documentation missing.
class SingleNoticeItem extends DoFollowListItem class SingleNoticeItem extends DoFollowListItem
{ {
/** /**
* recipe function for displaying a single notice. * Recipe function for displaying a single notice.
* *
* We overload to show attachments. * We overload to show attachments.
* *
* @return void * @return void
*/ */
function show() function show()
{ {
$this->showStart(); $this->showStart();
@ -363,7 +379,6 @@ class SingleNoticeItem extends DoFollowListItem
* *
* @return void * @return void
*/ */
function showAvatar() function showAvatar()
{ {
$avatar_size = AVATAR_PROFILE_SIZE; $avatar_size = AVATAR_PROFILE_SIZE;

View File

@ -65,12 +65,13 @@ class ShowstreamAction extends ProfileAction
$base = $this->profile->getFancyName(); $base = $this->profile->getFancyName();
if (!empty($this->tag)) { if (!empty($this->tag)) {
if ($this->page == 1) { if ($this->page == 1) {
// TRANS: Page title showing tagged notices in one user's stream. %1$s is the username, %2$s is the hash tag. // TRANS: Page title showing tagged notices in one user's stream.
return sprintf(_('%1$s tagged %2$s'), $base, $this->tag); // TRANS: %1$s is the username, %2$s is the hash tag.
return sprintf(_('Notices by %1$s tagged %2$s'), $base, $this->tag);
} else { } else {
// TRANS: Page title showing tagged notices in one user's stream. // TRANS: Page title showing tagged notices in one user's stream.
// TRANS: %1$s is the username, %2$s is the hash tag, %3$d is the page number. // TRANS: %1$s is the username, %2$s is the hash tag, %3$d is the page number.
return sprintf(_('%1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page); return sprintf(_('Notices by %1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page);
} }
} else { } else {
if ($this->page == 1) { if ($this->page == 1) {
@ -78,7 +79,7 @@ class ShowstreamAction extends ProfileAction
} else { } else {
// TRANS: Extended page title showing tagged notices in one user's stream. // TRANS: Extended page title showing tagged notices in one user's stream.
// TRANS: %1$s is the username, %2$d is the page number. // TRANS: %1$s is the username, %2$d is the page number.
return sprintf(_('%1$s, page %2$d'), return sprintf(_('Notices by %1$s, page %2$d'),
$base, $base,
$this->page); $this->page);
} }
@ -153,6 +154,8 @@ class ShowstreamAction extends ProfileAction
array( array(
'id' => $this->user->id, 'id' => $this->user->id,
'format' => 'atom')), 'format' => 'atom')),
// TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname.
sprintf(_('Notice feed for %s (Atom)'), sprintf(_('Notice feed for %s (Atom)'),
$this->user->nickname)), $this->user->nickname)),
new Feed(Feed::FOAF, new Feed(Feed::FOAF,
@ -275,6 +278,18 @@ class ShowstreamAction extends ProfileAction
$cloud = new PersonalTagCloudSection($this, $this->user); $cloud = new PersonalTagCloudSection($this, $this->user);
$cloud->show(); $cloud->show();
} }
function noticeFormOptions()
{
$options = parent::noticeFormOptions();
$cur = common_current_user();
if (empty($cur) || $cur->id != $this->profile->id) {
$options['to_profile'] = $this->profile;
}
return $options;
}
} }
// We don't show the author for a profile, since we already know who it is! // We don't show the author for a profile, since we already know who it is!

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/ * @link http://status.net/
*/ */
class SilenceAction extends ProfileFormAction class SilenceAction extends ProfileFormAction
{ {
/** /**
@ -50,7 +49,6 @@ class SilenceAction extends ProfileFormAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare($args)
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
@ -62,6 +60,7 @@ class SilenceAction extends ProfileFormAction
assert(!empty($cur)); // checked by parent assert(!empty($cur)); // checked by parent
if (!$cur->hasRight(Right::SILENCEUSER)) { if (!$cur->hasRight(Right::SILENCEUSER)) {
// TRANS: Client error displayed trying to silence a user on a site where the feature is not enabled.
$this->clientError(_('You cannot silence users on this site.')); $this->clientError(_('You cannot silence users on this site.'));
return false; return false;
} }
@ -69,6 +68,7 @@ class SilenceAction extends ProfileFormAction
assert(!empty($this->profile)); // checked by parent assert(!empty($this->profile)); // checked by parent
if ($this->profile->isSilenced()) { if ($this->profile->isSilenced()) {
// TRANS: Client error displayed trying to silence an already silenced user.
$this->clientError(_('User is already silenced.')); $this->clientError(_('User is already silenced.'));
return false; return false;
} }
@ -81,7 +81,6 @@ class SilenceAction extends ProfileFormAction
* *
* @return void * @return void
*/ */
function handlePost() function handlePost()
{ {
$this->profile->silence(); $this->profile->silence();

View File

@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class SiteadminpanelAction extends AdminPanelAction class SiteadminpanelAction extends AdminPanelAction
{ {
/** /**
@ -52,10 +51,10 @@ class SiteadminpanelAction extends AdminPanelAction
* *
* @return string page title * @return string page title
*/ */
function title() function title()
{ {
return _('Site'); // TRANS: Title for site administration panel.
return _m('TITLE','Site');
} }
/** /**
@ -63,9 +62,9 @@ class SiteadminpanelAction extends AdminPanelAction
* *
* @return string instructions * @return string instructions
*/ */
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions for site administration panel.
return _('Basic settings for this StatusNet site'); return _('Basic settings for this StatusNet site');
} }
@ -74,7 +73,6 @@ class SiteadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function showForm() function showForm()
{ {
$form = new SiteAdminPanelForm($this); $form = new SiteAdminPanelForm($this);
@ -87,7 +85,6 @@ class SiteadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function saveSettings() function saveSettings()
{ {
static $settings = array( static $settings = array(
@ -130,6 +127,7 @@ class SiteadminpanelAction extends AdminPanelAction
// Validate site name // Validate site name
if (empty($values['site']['name'])) { if (empty($values['site']['name'])) {
// TRANS: Client error displayed trying to save an empty site name.
$this->clientError(_('Site name must have non-zero length.')); $this->clientError(_('Site name must have non-zero length.'));
} }
@ -138,9 +136,11 @@ class SiteadminpanelAction extends AdminPanelAction
$values['site']['email'] = common_canonical_email($values['site']['email']); $values['site']['email'] = common_canonical_email($values['site']['email']);
if (empty($values['site']['email'])) { if (empty($values['site']['email'])) {
// TRANS: Client error displayed trying to save site settings without a contact address.
$this->clientError(_('You must have a valid contact email address.')); $this->clientError(_('You must have a valid contact email address.'));
} }
if (!Validate::email($values['site']['email'], common_config('email', 'check_domain'))) { if (!Validate::email($values['site']['email'], common_config('email', 'check_domain'))) {
// TRANS: Client error displayed trying to save site settings without a valid contact address.
$this->clientError(_('Not a valid email address.')); $this->clientError(_('Not a valid email address.'));
} }
@ -148,6 +148,7 @@ class SiteadminpanelAction extends AdminPanelAction
if (is_null($values['site']['timezone']) || if (is_null($values['site']['timezone']) ||
!in_array($values['site']['timezone'], DateTimeZone::listIdentifiers())) { !in_array($values['site']['timezone'], DateTimeZone::listIdentifiers())) {
// TRANS: Client error displayed trying to save site settings without a timezone.
$this->clientError(_('Timezone not selected.')); $this->clientError(_('Timezone not selected.'));
return; return;
} }
@ -156,24 +157,28 @@ class SiteadminpanelAction extends AdminPanelAction
if (!is_null($values['site']['language']) && if (!is_null($values['site']['language']) &&
!in_array($values['site']['language'], array_keys(get_nice_language_list()))) { !in_array($values['site']['language'], array_keys(get_nice_language_list()))) {
// TRANS: Client error displayed trying to save site settings with an invalid language code.
// TRANS: %s is the invalid language code.
$this->clientError(sprintf(_('Unknown language "%s".'), $values['site']['language'])); $this->clientError(sprintf(_('Unknown language "%s".'), $values['site']['language']));
} }
// Validate text limit // Validate text limit
if (!Validate::number($values['site']['textlimit'], array('min' => 0))) { if (!Validate::number($values['site']['textlimit'], array('min' => 0))) {
$this->clientError(_("Minimum text limit is 0 (unlimited).")); // TRANS: Client error displayed trying to save site settings with a text limit below 0.
$this->clientError(_('Minimum text limit is 0 (unlimited).'));
} }
// Validate dupe limit // Validate dupe limit
if (!Validate::number($values['site']['dupelimit'], array('min' => 1))) { if (!Validate::number($values['site']['dupelimit'], array('min' => 1))) {
// TRANS: Client error displayed trying to save site settings with a text limit below 1.
$this->clientError(_("Dupe limit must be one or more seconds.")); $this->clientError(_("Dupe limit must be one or more seconds."));
} }
} }
} }
// @todo FIXME: Class documentation missing.
class SiteAdminPanelForm extends AdminForm class SiteAdminPanelForm extends AdminForm
{ {
/** /**
@ -181,7 +186,6 @@ class SiteAdminPanelForm extends AdminForm
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_site_admin_panel'; return 'form_site_admin_panel';
@ -192,7 +196,6 @@ class SiteAdminPanelForm extends AdminForm
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'form_settings'; return 'form_settings';
@ -203,7 +206,6 @@ class SiteAdminPanelForm extends AdminForm
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('siteadminpanel'); return common_local_url('siteadminpanel');
@ -214,35 +216,44 @@ class SiteAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart('fieldset', array('id' => 'settings_admin_general')); $this->out->elementStart('fieldset', array('id' => 'settings_admin_general'));
$this->out->element('legend', null, _('General')); // TRANS: Fieldset legend on site settings panel.
$this->out->element('legend', null, _m('LEGEND','General'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
$this->input('name', _('Site name'), // TRANS: Field label on site settings panel.
_('The name of your site, like "Yourcompany Microblog"')); $this->input('name', _m('LABEL','Site name'),
// TRANS: Field title on site settings panel.
_('The name of your site, like "Yourcompany Microblog".'));
$this->unli(); $this->unli();
$this->li(); $this->li();
// TRANS: Field label on site settings panel.
$this->input('broughtby', _('Brought by'), $this->input('broughtby', _('Brought by'),
_('Text used for credits link in footer of each page')); // TRANS: Field title on site settings panel.
_('Text used for credits link in footer of each page.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
// TRANS: Field label on site settings panel.
$this->input('broughtbyurl', _('Brought by URL'), $this->input('broughtbyurl', _('Brought by URL'),
_('URL used for credits link in footer of each page')); // TRANS: Field title on site settings panel.
_('URL used for credits link in footer of each page.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
// TRANS: Field label on site settings panel.
$this->input('email', _('Email'), $this->input('email', _('Email'),
_('Contact email address for your site')); // TRANS: Field title on site settings panel.
_('Contact email address for your site.'));
$this->unli(); $this->unli();
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
$this->out->elementStart('fieldset', array('id' => 'settings_admin_local')); $this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
$this->out->element('legend', null, _('Local')); // TRANS: Fieldset legend on site settings panel.
$this->out->element('legend', null, _m('LEGEND','Local'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$timezones = array(); $timezones = array();
@ -253,14 +264,20 @@ class SiteAdminPanelForm extends AdminForm
asort($timezones); asort($timezones);
$this->li(); $this->li();
// TRANS: Dropdown label on site settings panel.
$this->out->dropdown('timezone', _('Default timezone'), $this->out->dropdown('timezone', _('Default timezone'),
// TRANS: Dropdown title on site settings panel.
$timezones, _('Default timezone for the site; usually UTC.'), $timezones, _('Default timezone for the site; usually UTC.'),
true, $this->value('timezone')); true, $this->value('timezone'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->dropdown('language', _('Default language'), $this->out->dropdown('language',
get_nice_language_list(), _('Site language when autodetection from browser settings is not available'), // TRANS: Dropdown label on site settings panel.
_('Default language'),
get_nice_language_list(),
// TRANS: Dropdown title on site settings panel.
_('Site language when autodetection from browser settings is not available'),
false, $this->value('language')); false, $this->value('language'));
$this->unli(); $this->unli();
@ -268,14 +285,23 @@ class SiteAdminPanelForm extends AdminForm
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits')); $this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
$this->out->element('legend', null, _('Limits')); // TRANS: Fieldset legend on site settings panel.
$this->out->element('legend', null, _m('LEGEND','Limits'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
$this->input('textlimit', _('Text limit'), _('Maximum number of characters for notices.')); $this->input('textlimit',
// TRANS: Field label on site settings panel.
_('Text limit'),
// TRANS: Field title on site settings panel.
_('Maximum number of characters for notices.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->input('dupelimit', _('Dupe limit'), _('How long users must wait (in seconds) to post the same thing again.')); $this->input('dupelimit',
// TRANS: Field label on site settings panel.
_('Dupe limit'),
// TRANS: Field title on site settings panel.
_('How long users must wait (in seconds) to post the same thing again.'));
$this->unli(); $this->unli();
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
@ -286,9 +312,14 @@ class SiteAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings')); $this->out->submit('submit',
// TRANS: Button text for saving site settings.
_m('BUTTON','Save'),
'submit',
null,
// TRANS: Button title for saving site settings.
_('Save site settings'));
} }
} }

View File

@ -246,6 +246,7 @@ class SmssettingsAction extends SettingsAction
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class SnapshotadminpanelAction extends AdminPanelAction class SnapshotadminpanelAction extends AdminPanelAction
{ {
/** /**
@ -48,10 +47,10 @@ class SnapshotadminpanelAction extends AdminPanelAction
* *
* @return string page title * @return string page title
*/ */
function title() function title()
{ {
return _('Snapshots'); // TRANS: Title for admin panel to configure snapshots.
return _m('TITLE','Snapshots');
} }
/** /**
@ -59,9 +58,9 @@ class SnapshotadminpanelAction extends AdminPanelAction
* *
* @return string instructions * @return string instructions
*/ */
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions for admin panel to configure snapshots.
return _('Manage snapshot configuration'); return _('Manage snapshot configuration');
} }
@ -70,7 +69,6 @@ class SnapshotadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function showForm() function showForm()
{ {
$form = new SnapshotAdminPanelForm($this); $form = new SnapshotAdminPanelForm($this);
@ -83,7 +81,6 @@ class SnapshotadminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function saveSettings() function saveSettings()
{ {
static $settings = array( static $settings = array(
@ -124,12 +121,14 @@ class SnapshotadminpanelAction extends AdminPanelAction
// Validate snapshot run value // Validate snapshot run value
if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) { if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) {
// TRANS: Client error displayed on admin panel for snapshots when providing an invalid run value.
$this->clientError(_('Invalid snapshot run value.')); $this->clientError(_('Invalid snapshot run value.'));
} }
// Validate snapshot frequency value // Validate snapshot frequency value
if (!Validate::number($values['snapshot']['frequency'])) { if (!Validate::number($values['snapshot']['frequency'])) {
// TRANS: Client error displayed on admin panel for snapshots when providing an invalid value for frequency.
$this->clientError(_('Snapshot frequency must be a number.')); $this->clientError(_('Snapshot frequency must be a number.'));
} }
@ -141,11 +140,13 @@ class SnapshotadminpanelAction extends AdminPanelAction
array('allowed_schemes' => array('http', 'https') array('allowed_schemes' => array('http', 'https')
) )
)) { )) {
// TRANS: Client error displayed on admin panel for snapshots when providing an invalid report URL.
$this->clientError(_('Invalid snapshot report URL.')); $this->clientError(_('Invalid snapshot report URL.'));
} }
} }
} }
// @todo FIXME: add documentation
class SnapshotAdminPanelForm extends AdminForm class SnapshotAdminPanelForm extends AdminForm
{ {
/** /**
@ -153,7 +154,6 @@ class SnapshotAdminPanelForm extends AdminForm
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_snapshot_admin_panel'; return 'form_snapshot_admin_panel';
@ -164,7 +164,6 @@ class SnapshotAdminPanelForm extends AdminForm
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'form_settings'; return 'form_settings';
@ -175,7 +174,6 @@ class SnapshotAdminPanelForm extends AdminForm
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('snapshotadminpanel'); return common_local_url('snapshotadminpanel');
@ -186,26 +184,31 @@ class SnapshotAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart( $this->out->elementStart(
'fieldset', 'fieldset',
array('id' => 'settings_admin_snapshots') array('id' => 'settings_admin_snapshots')
); );
$this->out->element('legend', null, _('Snapshots')); // TRANS: Fieldset legend on admin panel for snapshots.
$this->out->element('legend', null, _m('LEGEND','Snapshots'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
$snapshot = array( $snapshot = array(
// TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
'web' => _('Randomly during web hit'), 'web' => _('Randomly during web hit'),
// TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
'cron' => _('In a scheduled job'), 'cron' => _('In a scheduled job'),
// TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
'never' => _('Never') 'never' => _('Never')
); );
$this->out->dropdown( $this->out->dropdown(
'run', 'run',
// TRANS: Dropdown label for snapshot method in admin panel for snapshots.
_('Data snapshots'), _('Data snapshots'),
$snapshot, $snapshot,
_('When to send statistical data to status.net servers'), // TRANS: Dropdown title for snapshot method in admin panel for snapshots.
_('When to send statistical data to status.net servers.'),
false, false,
$this->value('run', 'snapshot') $this->value('run', 'snapshot')
); );
@ -214,8 +217,10 @@ class SnapshotAdminPanelForm extends AdminForm
$this->li(); $this->li();
$this->input( $this->input(
'frequency', 'frequency',
// TRANS: Input field label for snapshot frequency in admin panel for snapshots.
_('Frequency'), _('Frequency'),
_('Snapshots will be sent once every N web hits'), // TRANS: Input field title for snapshot frequency in admin panel for snapshots.
_('Snapshots will be sent once every N web hits.'),
'snapshot' 'snapshot'
); );
$this->unli(); $this->unli();
@ -223,8 +228,10 @@ class SnapshotAdminPanelForm extends AdminForm
$this->li(); $this->li();
$this->input( $this->input(
'reporturl', 'reporturl',
// TRANS: Input field label for snapshot report URL in admin panel for snapshots.
_('Report URL'), _('Report URL'),
_('Snapshots will be sent to this URL'), // TRANS: Input field title for snapshot report URL in admin panel for snapshots.
_('Snapshots will be sent to this URL.'),
'snapshot' 'snapshot'
); );
$this->unli(); $this->unli();
@ -237,15 +244,16 @@ class SnapshotAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
$this->out->submit( $this->out->submit(
'submit', 'submit',
_('Save'), // TRANS: Button text to save snapshot settings.
_m('BUTTON','Save'),
'submit', 'submit',
null, null,
_('Save snapshot settings') // TRANS: Title for button to save snapshot settings.
_('Save snapshot settings.')
); );
} }
} }

View File

@ -29,7 +29,7 @@ class SubeditAction extends Action
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying a change a subscription while not logged in. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.')); $this->clientError(_('Not logged in.'));
return false; return false;
} }
@ -37,6 +37,7 @@ class SubeditAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->clientError(_('There was a problem with your session token. '. $this->clientError(_('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return false; return false;

Some files were not shown because too many files have changed in this diff Show More