* fix L10n issues.
* update comments and tag missing documentation on some classes.
* remove superfluous whitespace
*
*/
class FinishremotesubscribeAction extends Action
{
-
/**
* Class handler.
*
*
* @return nothing
*
- **/
+ */
function handle($args)
{
parent::handle($args);
$service = unserialize($_SESSION['oauth_authorization_request']);
if (!$service) {
+ // TRANS: Client error displayed when subscribing to a remote profile and an unexpected response is received.
$this->clientError(_('Not expecting this response!'));
return;
}
$user = User::staticGet('uri', $service->getListeneeURI());
if (!$user) {
+ // TRANS: Client error displayed when subscribing to a remote profile that does not exist.
$this->clientError(_('User being listened to does not exist.'));
return;
}
$other = User::staticGet('uri', $service->getListenerURI());
if ($other) {
+ // TRANS: Client error displayed when subscribing to a remote profile that is a local profile.
$this->clientError(_('You can use the local subscription!'));
return;
}
$profile = Profile::staticGet($remote->id);
if ($user->hasBlocked($profile)) {
+ // TRANS: Client error displayed when subscribing to a remote profile that is blocked form subscribing to.
$this->clientError(_('That user has blocked you from subscribing.'));
return;
}
} catch (OAuthException $e) {
if ($e->getMessage() == 'The authorized token does not equal the ' .
'submitted token.') {
+ // TRANS: Client error displayed when subscribing to a remote profile without providing an authorised token.
$this->clientError(_('You are not authorized.'));
return;
} else {
+ // TRANS: Client error displayed when subscribing to a remote profile and conversion of the request token to access token fails.
$this->clientError(_('Could not convert request token to ' .
'access token.'));
return;
}
} catch (OMB_RemoteServiceException $e) {
+ // TRANS: Client error displayed when subscribing to a remote profile fails because of an unsupported version of the OMB protocol.
$this->clientError(_('Remote service uses unknown version of ' .
'OMB protocol.'));
return;
$service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE);
if (!$remote->update($orig_remote)) {
+ // TRANS: Server error displayed when subscribing to a remote profile fails because the remote profile could not be updated.
$this->serverError(_('Error updating remote profile.'));
return;
}
define('LISTENEE', -1);
define('BOTH', 0);
+// @todo XXX: Documentation missing.
class FoafAction extends Action
{
function isReadOnly($args)
$nickname_arg = $this->arg('nickname');
if (empty($nickname_arg)) {
+ // TRANS: Client error displayed when requesting Friends of a Friend feed without providing a user nickname.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->user = User::staticGet('nickname', $this->nickname);
if (!$this->user) {
+ // TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user.
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
if (!$this->profile) {
+ // TRANS: Server error displayed when requesting Friends of a Friend feed for a user for which the profile could not be found.
$this->serverError(_('User has no profile.'), 500);
return false;
}
if ($this->profile->bio) {
$this->element('bio:olb', null, $this->profile->bio);
}
-
+
$location = $this->profile->getLocation();
if ($location) {
$attr = array();
$attr['rdf:about'] = $location->getRdfURL();
}
$location_name = $location->getName();
-
+
$this->elementStart('based_near');
$this->elementStart('geo:SpatialThing', $attr);
if ($location_name) {
$this->element('knows', array('rdf:resource' => $uri));
}
}
-
+
$this->elementEnd('Agent');
/**
* Output FOAF <account> bit for the given profile.
- *
+ *
* @param Profile $profile
* @param mixed $service Root URL of this StatusNet instance for a local
* user, otherwise null.
* @param mixed $useruri URI string for the referenced profile..
* @param boolean $fetchSubscriptions Should we load and list all their subscriptions?
* @param boolean $isSubscriber if not fetching subs, we can still mark the user as following the current page.
- *
+ *
* @return array if $fetchSubscribers is set, return a list of info on those
* subscriptions.
*/
-
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
{
$attr = array();
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+// @todo XXX: Documentation missing.
class FoafGroupAction extends Action
{
function isReadOnly($args)
$nickname_arg = $this->arg('nickname');
if (empty($nickname_arg)) {
+ // TRANS: Client error displayed when requesting Friends of a Friend feed without providing a group nickname.
$this->clientError(_('No such group.'), 404);
return false;
}
$local = Local_group::staticGet('nickname', $this->nickname);
if (!$local) {
+ // TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local 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 requesting Friends of a Friend feed for a nickname that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}
*
* @return nothing
*
- **/
+ */
function handle($args)
{
header('Content-Type: application/json; charset=utf-8');
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class GetfileAction extends Action
{
/**
* Path of file to return
*/
-
var $path = null;
/**
*
* @return success flag
*/
-
function prepare($args)
{
parent::prepare($args);
}
if (empty($path) or !file_exists($path)) {
+ // TRANS: Client error displayed when requesting a non-existent file.
$this->clientError(_('No such file.'), 404);
return false;
}
if (!is_readable($path)) {
+ // TRANS: Client error displayed when requesting a file without having read access to it.
$this->clientError(_('Cannot read file.'), 403);
return false;
}
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return int last-modified date as unix timestamp
*/
-
function lastModified()
{
if (common_config('site', 'use_x_sendfile')) {
*
* @return string etag http header
*/
-
function etag()
{
if (common_config('site', 'use_x_sendfile')) {
*
* @return void
*/
-
function handle($args)
{
// undo headers set by PHP sessions
/**
* StatusNet, the distributed open-source microblogging tool
*
- * Action class to sandbox an abusive user
+ * Action class to grant user roles.
*
* PHP version 5
*
}
/**
- * Sandbox a user.
+ * Assign role to user.
*
* @category Action
* @package StatusNet
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class GrantRoleAction extends ProfileFormAction
{
/**
*
* @return boolean success flag
*/
-
function prepare($args)
{
if (!parent::prepare($args)) {
return false;
}
-
+
$this->role = $this->arg('role');
if (!Profile_role::isValid($this->role)) {
+ // TRANS: Client error displayed when trying to assign an invalid role to a user.
$this->clientError(_('Invalid role.'));
return false;
}
if (!Profile_role::isSettable($this->role)) {
+ // TRANS: Client error displayed when trying to assign an reserved role to a user.
$this->clientError(_('This role is reserved and cannot be set.'));
return false;
}
assert(!empty($cur)); // checked by parent
if (!$cur->hasRight(Right::GRANTROLE)) {
+ // TRANS: Client error displayed when trying to assign a role to a user while not being allowed to set roles.
$this->clientError(_('You cannot grant user roles on this site.'));
return false;
}
assert(!empty($this->profile)); // checked by parent
if ($this->profile->hasRole($this->role)) {
+ // TRANS: Client error displayed when trying to assign a role to a user that already has that role.
$this->clientError(_('User already has this role.'));
return false;
}
*
* @return void
*/
-
function handlePost()
{
$this->profile->grantRole($this->role);
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class GroupblockAction extends RedirectingAction
{
var $profile = null;
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
+ // TRANS: Client error displayed trying to block a user from a group while not logged in.
$this->clientError(_('Not logged in.'));
return false;
}
}
$id = $this->trimmed('blockto');
if (empty($id)) {
+ // TRANS: Client error displayed trying to block a user from a group while not specifying a to be blocked user profile.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::staticGet('id', $id);
if (empty($this->profile)) {
+ // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
$this->clientError(_('No profile with that ID.'));
return false;
}
$group_id = $this->trimmed('blockgroup');
if (empty($group_id)) {
+ // TRANS: Client error displayed trying to block a user from a group while not specifying a group to block a profile from.
$this->clientError(_('No group specified.'));
return false;
}
$this->group = User_group::staticGet('id', $group_id);
if (empty($this->group)) {
+ // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
$this->clientError(_('No such group.'));
return false;
}
$user = common_current_user();
if (!$user->isAdmin($this->group)) {
+ // TRANS: Client error displayed trying to block a user from a group while not being an admin user.
$this->clientError(_('Only an admin can block group members.'), 401);
return false;
}
if (Group_block::isBlocked($this->group, $this->profile)) {
+ // TRANS: Client error displayed trying to block a user from a group while user is already blocked from the given group.
$this->clientError(_('User is already blocked from group.'));
return false;
}
// XXX: could have proactive blocks, but we don't have UI for it.
if (!$this->profile->isMember($this->group)) {
+ // TRANS: Client error displayed trying to block a user from a group while user is not a member of given group.
$this->clientError(_('User is not a member of group.'));
return false;
}
}
function title() {
+ // TRANS: Title for block user from group page.
return _('Block user from group');
}
*
* @return void
*/
-
function areYouSureForm()
{
$id = $this->profile->id;
'action' => common_local_url('groupblock')));
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
+ // TRANS: Fieldset legend for block user from group form.
$this->element('legend', _('Block user'));
$this->element('p', null,
+ // TRANS: Explanatory text for block user from group form before setting the block.
+ // TRANS: %1$s is that to be blocked user, %2$s is the group the user will be blocked from.
sprintf(_('Are you sure you want to block user "%1$s" from the group "%2$s"? '.
'They will be removed from the group, unable to post, and '.
'unable to subscribe to the group in the future.'),
*
* @return void
*/
-
function blockProfile()
{
$block = Group_block::blockProfile($this->group, $this->profile,
common_current_user());
if (empty($block)) {
+ // TRANS: Server error displayed when trying to block a user from a group fails because of an application error.
$this->serverError(_("Database error blocking user from group."));
return false;
}
-
+
$this->returnToPrevious();
}
/**
* If we reached this form without returnto arguments, default to
* the top of the group's member list.
- *
+ *
* @return string URL
*/
function defaultReturnTo()
parent::showScripts();
$this->autofocus('form_action-yes');
}
-
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class GroupbyidAction extends Action
{
/** group we're viewing. */
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
$id = $this->arg('id');
if (!$id) {
+ // TRANS: Client error displayed referring to a group's permalink without providing a group ID.
$this->clientError(_('No ID.'));
return false;
}
$this->group = User_group::staticGet('id', $id);
if (!$this->group) {
+ // TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
$this->clientError(_('No such group.'), 404);
return false;
}
*
* @return void
*/
-
function handle($args)
{
common_redirect($this->group->homeUrl(), 303);
}
-}
\ No newline at end of file
+}
/**
* StatusNet, the distributed open-source microblogging tool
*
- * Change user password
+ * Saves a design for a given group.
*
* PHP version 5
*
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class GroupDesignSettingsAction extends DesignSettingsAction
{
var $group = null;
*
* @return boolean true
*/
-
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
+ // TRANS: Client error displayed trying to change group design settings while not logged in.
$this->clientError(_('You must be logged in to edit a group.'));
return false;
}
}
if (!$nickname) {
+ // TRANS: Client error displayed trying to change group design settings without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
}
if (!$this->group) {
+ // TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
if (!$cur->isAdmin($this->group)) {
+ // TRANS: Client error displayed trying to change group design settings without being a (group) admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
*
* @return Design a design object to use
*/
-
function getDesign()
{
function title()
{
+ // TRANS: Title group design settings page.
return _('Group design');
}
*
* @return instructions for use
*/
-
function getInstructions()
{
+ // TRANS: Instructions for group design settings page.
return _('Customize the way your group looks ' .
'with a background image and a colour palette of your choice.');
}
*
* @return nothing
*/
-
function showLocalNav()
{
$nav = new GroupNav($this, $this->group);
*
* @return Design
*/
-
function getWorkingDesign()
{
$design = null;
*
* @return void
*/
-
function showContent()
{
$design = $this->getWorkingDesign();
*
* @return void
*/
-
function saveDesign()
{
try {
-
$bgcolor = new WebColor($this->trimmed('design_background'));
$ccolor = new WebColor($this->trimmed('design_content'));
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
$tcolor = new WebColor($this->trimmed('design_text'));
$lcolor = new WebColor($this->trimmed('design_links'));
-
} catch (WebColorException $e) {
$this->showForm($e->getMessage());
return;
$design = $this->group->getDesign();
if (!empty($design)) {
-
// update design
$original = clone($design);
if ($result === false) {
common_log_db_error($design, 'UPDATE', __FILE__);
- $this->showForm(_('Could not update your design.'));
+ // TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
+ $this->showForm(_('Unable to update your design settings.'));
return;
}
-
} else {
-
$this->group->query('BEGIN');
// save new design
if (empty($id)) {
common_log_db_error($id, 'INSERT', __FILE__);
+ // TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
$this->showForm(_('Unable to save your design settings.'));
return;
}
if (empty($result)) {
common_log_db_error($original, 'UPDATE', __FILE__);
+ // TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
$this->showForm(_('Unable to save your design settings.'));
$this->group->query('ROLLBACK');
return;
}
$this->group->query('COMMIT');
-
}
$this->saveBackgroundImage($design);
+ // TRANS: Form text to confirm saved group design settings.
$this->showForm(_('Design preferences saved.'), true);
}
-
}
/**
* Prepare to run
*/
-
function prepare($args)
{
parent::prepare($args);
}
if (!$nickname) {
- // TRANS: Client error displayed when trying to change group logo settings without having a nickname.
+ // TRANS: Client error displayed when trying to change group logo settings without providing a nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
$this->elementEnd('fieldset');
$this->elementEnd('form');
-
}
function showCropForm()
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
-
}
/**
*
* @return void
*/
-
function showStylesheets()
{
parent::showStylesheets();
*
* @return void
*/
-
function showScripts()
{
parent::showScripts();