* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class BlockAction extends ProfileFormAction
{
var $profile = null;
*
* @return boolean success flag
*/
-
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
assert(!empty($cur)); // checked by parent
if ($cur->hasBlocked($this->profile)) {
+ // TRANS: Client error displayed when blocking a user that has already been blocked.
$this->clientError(_('You already blocked that user.'));
- return false;
}
return true;
/**
* Handle request
*
- * Shows a page with list of favorite notices
- *
* @param array $args $_REQUEST args; handled in prepare()
*
* @return void
*/
-
- function handle($args)
+ function handle(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) {
}
function title() {
+ // TRANS: Title for block user page.
return _('Block user');
}
'action' => common_local_url('block')));
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
+ // TRANS: Legend for block user form.
$this->element('legend', _('Block user'));
$this->element('p', null,
+ // TRANS: Explanation of consequences when blocking a user on the block user page.
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
'submit form_action-primary',
'no',
// TRANS: Submit button title for 'No' when blocking a user.
- _('Do not block this user'));
+ _('Do not block this user.'));
$this->submit('form_action-yes',
// TRANS: Button label on the user block form.
_m('BUTTON','Yes'),
'submit form_action-secondary',
'yes',
// TRANS: Submit button title for 'Yes' when blocking a user.
- _('Block this user'));
+ _('Block this user.'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
}
if (!$result) {
+ // TRANS: Server error displayed when blocking a user fails.
$this->serverError(_('Failed to save block information.'));
- return;
}
}
* Override for form session token checks; on our first hit we're just
* requesting confirmation, which doesn't need a token. We need to be
* able to take regular GET requests from email!
- *
+ *
* @throws ClientException if token is bad on POST request or if we have
* confirmation parameters which could trigger something.
*/
/**
* If we reached this form without returnto arguments, return to the
* current user's subscription list.
- *
+ *
* @return string URL
*/
function defaultReturnTo()
{
$user = common_current_user();
- if ($user) {
+
+ if ($user instanceof User) {
return common_local_url('subscribers',
array('nickname' => $user->nickname));
} else {