* update/add translator documentation.
* fix L10n issues. * update comments and tag missing documentation on some classes. * remove superfluous whitespace *
This commit is contained in:
parent
3fc323f8f9
commit
8f776ec12d
@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/omb.php';
|
|||||||
*/
|
*/
|
||||||
class FinishremotesubscribeAction extends Action
|
class FinishremotesubscribeAction extends Action
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class handler.
|
* Class handler.
|
||||||
*
|
*
|
||||||
@ -56,7 +55,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
@ -66,6 +65,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
$service = unserialize($_SESSION['oauth_authorization_request']);
|
$service = unserialize($_SESSION['oauth_authorization_request']);
|
||||||
|
|
||||||
if (!$service) {
|
if (!$service) {
|
||||||
|
// TRANS: Client error displayed when subscribing to a remote profile and an unexpected response is received.
|
||||||
$this->clientError(_('Not expecting this response!'));
|
$this->clientError(_('Not expecting this response!'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -77,6 +77,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
$user = User::staticGet('uri', $service->getListeneeURI());
|
$user = User::staticGet('uri', $service->getListeneeURI());
|
||||||
|
|
||||||
if (!$user) {
|
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.'));
|
$this->clientError(_('User being listened to does not exist.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -84,6 +85,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
$other = User::staticGet('uri', $service->getListenerURI());
|
$other = User::staticGet('uri', $service->getListenerURI());
|
||||||
|
|
||||||
if ($other) {
|
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!'));
|
$this->clientError(_('You can use the local subscription!'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -96,6 +98,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
$profile = Profile::staticGet($remote->id);
|
$profile = Profile::staticGet($remote->id);
|
||||||
|
|
||||||
if ($user->hasBlocked($profile)) {
|
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.'));
|
$this->clientError(_('That user has blocked you from subscribing.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -107,14 +110,17 @@ class FinishremotesubscribeAction extends Action
|
|||||||
} catch (OAuthException $e) {
|
} catch (OAuthException $e) {
|
||||||
if ($e->getMessage() == 'The authorized token does not equal the ' .
|
if ($e->getMessage() == 'The authorized token does not equal the ' .
|
||||||
'submitted token.') {
|
'submitted token.') {
|
||||||
|
// TRANS: Client error displayed when subscribing to a remote profile without providing an authorised token.
|
||||||
$this->clientError(_('You are not authorized.'));
|
$this->clientError(_('You are not authorized.'));
|
||||||
return;
|
return;
|
||||||
} else {
|
} 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 ' .
|
$this->clientError(_('Could not convert request token to ' .
|
||||||
'access token.'));
|
'access token.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (OMB_RemoteServiceException $e) {
|
} 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 ' .
|
$this->clientError(_('Remote service uses unknown version of ' .
|
||||||
'OMB protocol.'));
|
'OMB protocol.'));
|
||||||
return;
|
return;
|
||||||
@ -135,6 +141,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
$service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE);
|
$service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE);
|
||||||
|
|
||||||
if (!$remote->update($orig_remote)) {
|
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.'));
|
$this->serverError(_('Error updating remote profile.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ define('LISTENER', 1);
|
|||||||
define('LISTENEE', -1);
|
define('LISTENEE', -1);
|
||||||
define('BOTH', 0);
|
define('BOTH', 0);
|
||||||
|
|
||||||
|
// @todo XXX: Documentation missing.
|
||||||
class FoafAction extends Action
|
class FoafAction extends Action
|
||||||
{
|
{
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
@ -37,6 +38,7 @@ class FoafAction extends Action
|
|||||||
$nickname_arg = $this->arg('nickname');
|
$nickname_arg = $this->arg('nickname');
|
||||||
|
|
||||||
if (empty($nickname_arg)) {
|
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);
|
$this->clientError(_('No such user.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -55,6 +57,7 @@ class FoafAction extends Action
|
|||||||
$this->user = User::staticGet('nickname', $this->nickname);
|
$this->user = User::staticGet('nickname', $this->nickname);
|
||||||
|
|
||||||
if (!$this->user) {
|
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);
|
$this->clientError(_('No such user.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -62,6 +65,7 @@ class FoafAction extends Action
|
|||||||
$this->profile = $this->user->getProfile();
|
$this->profile = $this->user->getProfile();
|
||||||
|
|
||||||
if (!$this->profile) {
|
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);
|
$this->serverError(_('User has no profile.'), 500);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -110,7 +114,7 @@ class FoafAction extends Action
|
|||||||
if ($this->profile->bio) {
|
if ($this->profile->bio) {
|
||||||
$this->element('bio:olb', null, $this->profile->bio);
|
$this->element('bio:olb', null, $this->profile->bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
$location = $this->profile->getLocation();
|
$location = $this->profile->getLocation();
|
||||||
if ($location) {
|
if ($location) {
|
||||||
$attr = array();
|
$attr = array();
|
||||||
@ -118,7 +122,7 @@ class FoafAction extends Action
|
|||||||
$attr['rdf:about'] = $location->getRdfURL();
|
$attr['rdf:about'] = $location->getRdfURL();
|
||||||
}
|
}
|
||||||
$location_name = $location->getName();
|
$location_name = $location->getName();
|
||||||
|
|
||||||
$this->elementStart('based_near');
|
$this->elementStart('based_near');
|
||||||
$this->elementStart('geo:SpatialThing', $attr);
|
$this->elementStart('geo:SpatialThing', $attr);
|
||||||
if ($location_name) {
|
if ($location_name) {
|
||||||
@ -193,7 +197,7 @@ class FoafAction extends Action
|
|||||||
$this->element('knows', array('rdf:resource' => $uri));
|
$this->element('knows', array('rdf:resource' => $uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd('Agent');
|
$this->elementEnd('Agent');
|
||||||
|
|
||||||
|
|
||||||
@ -239,18 +243,17 @@ class FoafAction extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Output FOAF <account> bit for the given profile.
|
* Output FOAF <account> bit for the given profile.
|
||||||
*
|
*
|
||||||
* @param Profile $profile
|
* @param Profile $profile
|
||||||
* @param mixed $service Root URL of this StatusNet instance for a local
|
* @param mixed $service Root URL of this StatusNet instance for a local
|
||||||
* user, otherwise null.
|
* user, otherwise null.
|
||||||
* @param mixed $useruri URI string for the referenced profile..
|
* @param mixed $useruri URI string for the referenced profile..
|
||||||
* @param boolean $fetchSubscriptions Should we load and list all their subscriptions?
|
* @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.
|
* @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
|
* @return array if $fetchSubscribers is set, return a list of info on those
|
||||||
* subscriptions.
|
* subscriptions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
|
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
|
||||||
{
|
{
|
||||||
$attr = array();
|
$attr = array();
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
|
// @todo XXX: Documentation missing.
|
||||||
class FoafGroupAction extends Action
|
class FoafGroupAction extends Action
|
||||||
{
|
{
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
@ -41,6 +42,7 @@ class FoafGroupAction extends Action
|
|||||||
$nickname_arg = $this->arg('nickname');
|
$nickname_arg = $this->arg('nickname');
|
||||||
|
|
||||||
if (empty($nickname_arg)) {
|
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);
|
$this->clientError(_('No such group.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -59,6 +61,7 @@ class FoafGroupAction extends Action
|
|||||||
$local = Local_group::staticGet('nickname', $this->nickname);
|
$local = Local_group::staticGet('nickname', $this->nickname);
|
||||||
|
|
||||||
if (!$local) {
|
if (!$local) {
|
||||||
|
// TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group.
|
||||||
$this->clientError(_('No such group.'), 404);
|
$this->clientError(_('No such group.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -66,6 +69,7 @@ class FoafGroupAction extends Action
|
|||||||
$this->group = User_group::staticGet('id', $local->group_id);
|
$this->group = User_group::staticGet('id', $local->group_id);
|
||||||
|
|
||||||
if (!$this->group) {
|
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);
|
$this->clientError(_('No such group.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class GeocodeAction extends Action
|
|||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
@ -89,7 +89,6 @@ class GeocodeAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,13 +47,11 @@ require_once 'MIME/Type.php';
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GetfileAction extends Action
|
class GetfileAction extends Action
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Path of file to return
|
* Path of file to return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $path = null;
|
var $path = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +61,6 @@ class GetfileAction extends Action
|
|||||||
*
|
*
|
||||||
* @return success flag
|
* @return success flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
@ -76,10 +73,12 @@ class GetfileAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($path) or !file_exists($path)) {
|
if (empty($path) or !file_exists($path)) {
|
||||||
|
// TRANS: Client error displayed when requesting a non-existent file.
|
||||||
$this->clientError(_('No such file.'), 404);
|
$this->clientError(_('No such file.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_readable($path)) {
|
if (!is_readable($path)) {
|
||||||
|
// TRANS: Client error displayed when requesting a file without having read access to it.
|
||||||
$this->clientError(_('Cannot read file.'), 403);
|
$this->clientError(_('Cannot read file.'), 403);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -93,7 +92,6 @@ class GetfileAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -104,7 +102,6 @@ class GetfileAction extends Action
|
|||||||
*
|
*
|
||||||
* @return int last-modified date as unix timestamp
|
* @return int last-modified date as unix timestamp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (common_config('site', 'use_x_sendfile')) {
|
if (common_config('site', 'use_x_sendfile')) {
|
||||||
@ -122,7 +119,6 @@ class GetfileAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string etag http header
|
* @return string etag http header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (common_config('site', 'use_x_sendfile')) {
|
if (common_config('site', 'use_x_sendfile')) {
|
||||||
@ -151,7 +147,6 @@ class GetfileAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
// undo headers set by PHP sessions
|
// undo headers set by PHP sessions
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
*
|
*
|
||||||
* Action class to sandbox an abusive user
|
* Action class to grant user roles.
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
@ -32,7 +32,7 @@ if (!defined('STATUSNET')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sandbox a user.
|
* Assign role to user.
|
||||||
*
|
*
|
||||||
* @category Action
|
* @category Action
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
@ -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 GrantRoleAction extends ProfileFormAction
|
class GrantRoleAction extends ProfileFormAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -50,19 +49,20 @@ class GrantRoleAction 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 assign an invalid role to a user.
|
||||||
$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 assign an reserved role to a user.
|
||||||
$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 GrantRoleAction extends ProfileFormAction
|
|||||||
assert(!empty($cur)); // checked by parent
|
assert(!empty($cur)); // checked by parent
|
||||||
|
|
||||||
if (!$cur->hasRight(Right::GRANTROLE)) {
|
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.'));
|
$this->clientError(_('You cannot grant user roles on this site.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -79,6 +80,7 @@ class GrantRoleAction 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)) {
|
||||||
|
// 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.'));
|
$this->clientError(_('User already has this role.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -91,7 +93,6 @@ class GrantRoleAction extends ProfileFormAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handlePost()
|
function handlePost()
|
||||||
{
|
{
|
||||||
$this->profile->grantRole($this->role);
|
$this->profile->grantRole($this->role);
|
||||||
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
* @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 GroupblockAction extends RedirectingAction
|
class GroupblockAction extends RedirectingAction
|
||||||
{
|
{
|
||||||
var $profile = null;
|
var $profile = null;
|
||||||
@ -53,11 +52,11 @@ class GroupblockAction extends RedirectingAction
|
|||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
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.
|
||||||
$this->clientError(_('Not logged in.'));
|
$this->clientError(_('Not logged in.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -68,35 +67,42 @@ class GroupblockAction extends RedirectingAction
|
|||||||
}
|
}
|
||||||
$id = $this->trimmed('blockto');
|
$id = $this->trimmed('blockto');
|
||||||
if (empty($id)) {
|
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.'));
|
$this->clientError(_('No profile specified.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->profile = Profile::staticGet('id', $id);
|
$this->profile = Profile::staticGet('id', $id);
|
||||||
if (empty($this->profile)) {
|
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.'));
|
$this->clientError(_('No profile with that ID.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$group_id = $this->trimmed('blockgroup');
|
$group_id = $this->trimmed('blockgroup');
|
||||||
if (empty($group_id)) {
|
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.'));
|
$this->clientError(_('No group specified.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->group = User_group::staticGet('id', $group_id);
|
$this->group = User_group::staticGet('id', $group_id);
|
||||||
if (empty($this->group)) {
|
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.'));
|
$this->clientError(_('No such group.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
if (!$user->isAdmin($this->group)) {
|
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);
|
$this->clientError(_('Only an admin can block group members.'), 401);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Group_block::isBlocked($this->group, $this->profile)) {
|
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.'));
|
$this->clientError(_('User is already blocked from group.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// XXX: could have proactive blocks, but we don't have UI for it.
|
// XXX: could have proactive blocks, but we don't have UI for it.
|
||||||
if (!$this->profile->isMember($this->group)) {
|
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.'));
|
$this->clientError(_('User is not a member of group.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -131,6 +137,7 @@ class GroupblockAction extends RedirectingAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
function title() {
|
function title() {
|
||||||
|
// TRANS: Title for block user from group page.
|
||||||
return _('Block user from group');
|
return _('Block user from group');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +152,6 @@ class GroupblockAction extends RedirectingAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function areYouSureForm()
|
function areYouSureForm()
|
||||||
{
|
{
|
||||||
$id = $this->profile->id;
|
$id = $this->profile->id;
|
||||||
@ -155,8 +161,11 @@ class GroupblockAction extends RedirectingAction
|
|||||||
'action' => common_local_url('groupblock')));
|
'action' => common_local_url('groupblock')));
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
// TRANS: Fieldset legend for block user from group form.
|
||||||
$this->element('legend', _('Block user'));
|
$this->element('legend', _('Block user'));
|
||||||
$this->element('p', null,
|
$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"? '.
|
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 '.
|
'They will be removed from the group, unable to post, and '.
|
||||||
'unable to subscribe to the group in the future.'),
|
'unable to subscribe to the group in the future.'),
|
||||||
@ -196,24 +205,24 @@ class GroupblockAction extends RedirectingAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function blockProfile()
|
function blockProfile()
|
||||||
{
|
{
|
||||||
$block = Group_block::blockProfile($this->group, $this->profile,
|
$block = Group_block::blockProfile($this->group, $this->profile,
|
||||||
common_current_user());
|
common_current_user());
|
||||||
|
|
||||||
if (empty($block)) {
|
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."));
|
$this->serverError(_("Database error blocking user from group."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->returnToPrevious();
|
$this->returnToPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we reached this form without returnto arguments, default to
|
* If we reached this form without returnto arguments, default to
|
||||||
* the top of the group's member list.
|
* the top of the group's member list.
|
||||||
*
|
*
|
||||||
* @return string URL
|
* @return string URL
|
||||||
*/
|
*/
|
||||||
function defaultReturnTo()
|
function defaultReturnTo()
|
||||||
@ -227,6 +236,4 @@ class GroupblockAction extends RedirectingAction
|
|||||||
parent::showScripts();
|
parent::showScripts();
|
||||||
$this->autofocus('form_action-yes');
|
$this->autofocus('form_action-yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,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 GroupbyidAction extends Action
|
class GroupbyidAction extends Action
|
||||||
{
|
{
|
||||||
/** group we're viewing. */
|
/** group we're viewing. */
|
||||||
@ -58,7 +57,6 @@ class GroupbyidAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -71,6 +69,7 @@ class GroupbyidAction extends Action
|
|||||||
$id = $this->arg('id');
|
$id = $this->arg('id');
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
|
// TRANS: Client error displayed referring to a group's permalink without providing a group ID.
|
||||||
$this->clientError(_('No ID.'));
|
$this->clientError(_('No ID.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -80,6 +79,7 @@ class GroupbyidAction extends Action
|
|||||||
$this->group = User_group::staticGet('id', $id);
|
$this->group = User_group::staticGet('id', $id);
|
||||||
|
|
||||||
if (!$this->group) {
|
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);
|
$this->clientError(_('No such group.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -95,9 +95,8 @@ class GroupbyidAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
common_redirect($this->group->homeUrl(), 303);
|
common_redirect($this->group->homeUrl(), 303);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
*
|
*
|
||||||
* Change user password
|
* Saves a design for a given group.
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/designsettings.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 GroupDesignSettingsAction extends DesignSettingsAction
|
class GroupDesignSettingsAction extends DesignSettingsAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
@ -59,12 +58,12 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
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.'));
|
$this->clientError(_('You must be logged in to edit a group.'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -81,6 +80,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$nickname) {
|
if (!$nickname) {
|
||||||
|
// TRANS: Client error displayed trying to change group design settings without providing a group nickname.
|
||||||
$this->clientError(_('No nickname.'), 404);
|
$this->clientError(_('No nickname.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -97,6 +97,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->group) {
|
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);
|
$this->clientError(_('No such group.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -104,6 +105,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
if (!$cur->isAdmin($this->group)) {
|
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);
|
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -122,7 +124,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return Design a design object to use
|
* @return Design a design object to use
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getDesign()
|
function getDesign()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -141,6 +142,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title group design settings page.
|
||||||
return _('Group design');
|
return _('Group design');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,9 +151,9 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return instructions for use
|
* @return instructions for use
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Instructions for group design settings page.
|
||||||
return _('Customize the way your group looks ' .
|
return _('Customize the way your group looks ' .
|
||||||
'with a background image and a colour palette of your choice.');
|
'with a background image and a colour palette of your choice.');
|
||||||
}
|
}
|
||||||
@ -161,7 +163,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$nav = new GroupNav($this, $this->group);
|
$nav = new GroupNav($this, $this->group);
|
||||||
@ -173,7 +174,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return Design
|
* @return Design
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getWorkingDesign()
|
function getWorkingDesign()
|
||||||
{
|
{
|
||||||
$design = null;
|
$design = null;
|
||||||
@ -192,7 +192,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
$design = $this->getWorkingDesign();
|
$design = $this->getWorkingDesign();
|
||||||
@ -209,17 +208,14 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveDesign()
|
function saveDesign()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||||
|
|
||||||
} catch (WebColorException $e) {
|
} catch (WebColorException $e) {
|
||||||
$this->showForm($e->getMessage());
|
$this->showForm($e->getMessage());
|
||||||
return;
|
return;
|
||||||
@ -246,7 +242,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
$design = $this->group->getDesign();
|
$design = $this->group->getDesign();
|
||||||
|
|
||||||
if (!empty($design)) {
|
if (!empty($design)) {
|
||||||
|
|
||||||
// update design
|
// update design
|
||||||
|
|
||||||
$original = clone($design);
|
$original = clone($design);
|
||||||
@ -263,12 +258,11 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->group->query('BEGIN');
|
$this->group->query('BEGIN');
|
||||||
|
|
||||||
// save new design
|
// save new design
|
||||||
@ -287,6 +281,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
common_log_db_error($id, 'INSERT', __FILE__);
|
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.'));
|
$this->showForm(_('Unable to save your design settings.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -297,18 +292,18 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
|||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
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->showForm(_('Unable to save your design settings.'));
|
||||||
$this->group->query('ROLLBACK');
|
$this->group->query('ROLLBACK');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group->query('COMMIT');
|
$this->group->query('COMMIT');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->saveBackgroundImage($design);
|
$this->saveBackgroundImage($design);
|
||||||
|
|
||||||
|
// TRANS: Form text to confirm saved group design settings.
|
||||||
$this->showForm(_('Design preferences saved.'), true);
|
$this->showForm(_('Design preferences saved.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
/**
|
/**
|
||||||
* Prepare to run
|
* Prepare to run
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
@ -83,7 +82,7 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$nickname) {
|
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);
|
$this->clientError(_('No nickname.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -247,7 +246,6 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCropForm()
|
function showCropForm()
|
||||||
@ -304,7 +302,6 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -438,7 +435,6 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showStylesheets()
|
function showStylesheets()
|
||||||
{
|
{
|
||||||
parent::showStylesheets();
|
parent::showStylesheets();
|
||||||
@ -450,7 +446,6 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showScripts()
|
function showScripts()
|
||||||
{
|
{
|
||||||
parent::showScripts();
|
parent::showScripts();
|
||||||
|
Loading…
Reference in New Issue
Block a user