From f2b60b78b6096447a8aadc3d5075bb916f89880a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 3 Apr 2010 10:26:43 -0700 Subject: Ticket #2272: Block confirmation form should let enter trigger the 'yes' button Setting focus into the form to make it easier to submit by keyboard. Enter or space will now trigger the button right off without having to mouse around to find the button after we've clicked into the conf form, and keyboarders can also get to the 'no' button more easily. --- actions/groupblock.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actions/groupblock.php') diff --git a/actions/groupblock.php b/actions/groupblock.php index ec673358e..88d7634a2 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -214,5 +214,12 @@ class GroupblockAction extends Action 303); } } + + function showScripts() + { + parent::showScripts(); + $this->autofocus('form_action-yes'); + } + } -- cgit v1.2.3-54-g00ecf From 5dbaaed4e68ecae1c78b9493add89df3557c8e98 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 Apr 2010 19:06:55 -0700 Subject: Maintain 'page' parameter for block from subscribers list, block & make-admin from group members list. Refactored some of the returnto handling code. It looks like we have several different ways of handling this in the software, icky! Marked the session-based functions with fixmes (they'll stomp on other forms when multiple tabs/windows are used) and combined some commonish bits of code between ProfileFormAction and the group block & makeadmin actions where they're using hidden form parameters. Extended that to allow passing dynamic parameters (eg 'page') as well as static ones (action, target user/group). --- actions/groupblock.php | 35 ++++++++--------- actions/groupmembers.php | 23 ++++++++++-- actions/makeadmin.php | 29 +++++++------- actions/subscribers.php | 10 +++-- lib/profileformaction.php | 25 +----------- lib/redirectingaction.php | 96 +++++++++++++++++++++++++++++++++++++++++++++++ lib/util.php | 26 +++++++++++++ 7 files changed, 178 insertions(+), 66 deletions(-) create mode 100644 lib/redirectingaction.php (limited to 'actions/groupblock.php') diff --git a/actions/groupblock.php b/actions/groupblock.php index 88d7634a2..fc95c0e66 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -41,7 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @link http://status.net/ */ -class GroupblockAction extends Action +class GroupblockAction extends RedirectingAction { var $profile = null; var $group = null; @@ -117,9 +117,7 @@ class GroupblockAction extends Action parent::handle($args); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($this->arg('no')) { - common_redirect(common_local_url('groupmembers', - array('nickname' => $this->group->nickname)), - 303); + $this->returnToArgs(); } elseif ($this->arg('yes')) { $this->blockProfile(); } elseif ($this->arg('blockto')) { @@ -196,23 +194,20 @@ class GroupblockAction extends Action $this->serverError(_("Database error blocking user from group.")); return false; } + + $this->returnToArgs(); + } - // Now, gotta figure where we go back to - foreach ($this->args as $k => $v) { - if ($k == 'returnto-action') { - $action = $v; - } elseif (substr($k, 0, 9) == 'returnto-') { - $args[substr($k, 9)] = $v; - } - } - - if ($action) { - common_redirect(common_local_url($action, $args), 303); - } else { - common_redirect(common_local_url('groupmembers', - array('nickname' => $this->group->nickname)), - 303); - } + /** + * If we reached this form without returnto arguments, default to + * the top of the group's member list. + * + * @return string URL + */ + function defaultReturnTo() + { + return common_local_url('groupmembers', + array('nickname' => $this->group->nickname)); } function showScripts() diff --git a/actions/groupmembers.php b/actions/groupmembers.php index fb4e46dbc..6d0701239 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -205,8 +205,7 @@ class GroupMemberListItem extends ProfileListItem !$this->profile->isAdmin($this->group)) { $this->out->elementStart('li', 'entity_make_admin'); $maf = new MakeAdminForm($this->out, $this->profile, $this->group, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $maf->show(); $this->out->elementEnd('li'); } @@ -220,8 +219,7 @@ class GroupMemberListItem extends ProfileListItem 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, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $bf->show(); $this->out->elementEnd('li'); } @@ -244,6 +242,23 @@ class GroupMemberListItem extends ProfileListItem $aAttrs['rel'] = 'nofollow'; } } + + /** + * 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; + } } /** diff --git a/actions/makeadmin.php b/actions/makeadmin.php index f19348648..9ccb44230 100644 --- a/actions/makeadmin.php +++ b/actions/makeadmin.php @@ -41,7 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @link http://status.net/ */ -class MakeadminAction extends Action +class MakeadminAction extends RedirectingAction { var $profile = null; var $group = null; @@ -148,20 +148,19 @@ class MakeadminAction extends Action $this->group->getBestName()); } - foreach ($this->args as $k => $v) { - if ($k == 'returnto-action') { - $action = $v; - } else if (substr($k, 0, 9) == 'returnto-') { - $args[substr($k, 9)] = $v; - } - } + $this->returnToArgs(); + } - if ($action) { - common_redirect(common_local_url($action, $args), 303); - } else { - common_redirect(common_local_url('groupmembers', - array('nickname' => $this->group->nickname)), - 303); - } + /** + * If we reached this form without returnto arguments, default to + * the top of the group's member list. + * + * @return string URL + */ + function defaultReturnTo() + { + return common_local_url('groupmembers', + array('nickname' => $this->group->nickname)); } + } diff --git a/actions/subscribers.php b/actions/subscribers.php index 6dda7312d..6fdf43e2c 100644 --- a/actions/subscribers.php +++ b/actions/subscribers.php @@ -157,9 +157,13 @@ class SubscribersListItem extends SubscriptionListItem $user = common_current_user(); if (!empty($user) && $this->owner->id == $user->id) { - $bf = new BlockForm($this->out, $this->profile, - array('action' => 'subscribers', - 'nickname' => $this->owner->nickname)); + $returnto = array('action' => 'subscribers', + 'nickname' => $this->owner->nickname); + $page = $this->out->arg('page'); + if ($page) { + $returnto['param-page'] = $page; + } + $bf = new BlockForm($this->out, $this->profile, $returnto); $bf->show(); } } diff --git a/lib/profileformaction.php b/lib/profileformaction.php index 8a934666e..0ffafe5fb 100644 --- a/lib/profileformaction.php +++ b/lib/profileformaction.php @@ -41,7 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @link http://status.net/ */ -class ProfileFormAction extends Action +class ProfileFormAction extends RedirectingAction { var $profile = null; @@ -101,29 +101,6 @@ class ProfileFormAction extends Action } } - /** - * Return to the calling page based on hidden arguments - * - * @return void - */ - - function returnToArgs() - { - foreach ($this->args as $k => $v) { - if ($k == 'returnto-action') { - $action = $v; - } else if (substr($k, 0, 9) == 'returnto-') { - $args[substr($k, 9)] = $v; - } - } - - if ($action) { - common_redirect(common_local_url($action, $args), 303); - } else { - $this->clientError(_("No return-to arguments.")); - } - } - /** * handle a POST request * diff --git a/lib/redirectingaction.php b/lib/redirectingaction.php new file mode 100644 index 000000000..f11585274 --- /dev/null +++ b/lib/redirectingaction.php @@ -0,0 +1,96 @@ +. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @author Brion Vibber + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * Superclass for actions that redirect to a given return-to page on completion. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @author Brion Vibber + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + */ + + +class RedirectingAction extends Action +{ + + /** + * Redirect browser to the page our hidden parameters requested, + * or if none given, to the url given by $this->defaultReturnTo(). + * + * To be called only after successful processing. + * + * @fixme rename this -- it obscures Action::returnToArgs() which + * returns a list of arguments, and is a bit confusing. + * + * @return void + */ + function returnToArgs() + { + // Now, gotta figure where we go back to + $action = false; + $args = array(); + $params = array(); + foreach ($this->args as $k => $v) { + if ($k == 'returnto-action') { + $action = $v; + } else if (substr($k, 0, 15) == 'returnto-param-') { + $params[substr($k, 15)] = $v; + } elseif (substr($k, 0, 9) == 'returnto-') { + $args[substr($k, 9)] = $v; + } + } + + if ($action) { + common_redirect(common_local_url($action, $args, $params), 303); + } else { + $url = $this->defaultReturnToUrl(); + } + common_redirect($url, 303); + } + + /** + * If we reached this form without returnto arguments, where should + * we go? May be overridden by subclasses to a reasonable destination + * for that action; default implementation throws an exception. + * + * @return string URL + */ + function defaultReturnTo() + { + $this->clientError(_("No return-to arguments.")); + } +} diff --git a/lib/util.php b/lib/util.php index bbc334176..6905df839 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1279,12 +1279,38 @@ function common_mtrand($bytes) return $enc; } +/** + * Record the given URL as the return destination for a future + * form submission, to be read by common_get_returnto(). + * + * @param string $url + * + * @fixme as a session-global setting, this can allow multiple forms + * to conflict and overwrite each others' returnto destinations if + * the user has multiple tabs or windows open. + * + * Should refactor to index with a token or otherwise only pass the + * data along its intended path. + */ function common_set_returnto($url) { common_ensure_session(); $_SESSION['returnto'] = $url; } +/** + * Fetch a return-destination URL previously recorded by + * common_set_returnto(). + * + * @return mixed URL string or null + * + * @fixme as a session-global setting, this can allow multiple forms + * to conflict and overwrite each others' returnto destinations if + * the user has multiple tabs or windows open. + * + * Should refactor to index with a token or otherwise only pass the + * data along its intended path. + */ function common_get_returnto() { common_ensure_session(); -- cgit v1.2.3-54-g00ecf From 69eebc1ec83ae81ddd1c172a3948ec47661cd364 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 11 Apr 2010 21:04:07 +0200 Subject: Add translator documentation for uses of 'Yes' and 'No' in the interface. --- actions/block.php | 16 ++++++++++++++-- actions/deleteapplication.php | 10 +++++++--- actions/deletenotice.php | 16 ++++++++++++++-- actions/deleteuser.php | 16 ++++++++++++++-- actions/groupblock.php | 16 ++++++++++++++-- 5 files changed, 63 insertions(+), 11 deletions(-) (limited to 'actions/groupblock.php') diff --git a/actions/block.php b/actions/block.php index 7f609c253..11565e20c 100644 --- a/actions/block.php +++ b/actions/block.php @@ -140,8 +140,20 @@ class BlockAction extends ProfileFormAction $this->hidden($k, $v); } } - $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user")); - $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Block this user')); + $this->submit('form_action-no', + // TRANS: Button label on the user block form. + _m('BUTTON','No'), + 'submit form_action-primary', + 'no', + // TRANS: Submit button title for 'No' when blocking a 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')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } diff --git a/actions/deleteapplication.php b/actions/deleteapplication.php index 17526e111..806de0be6 100644 --- a/actions/deleteapplication.php +++ b/actions/deleteapplication.php @@ -150,13 +150,17 @@ class DeleteapplicationAction extends Action 'This will clear all data about the application from the '. 'database, including all existing user connections.')); $this->submit('form_action-no', - _('No'), + // TRANS: Button label on the delete application form. + _m('BUTTON','No'), 'submit form_action-primary', 'no', - _("Do not delete this application")); + // TRANS: Submit button title for 'No' when deleting an application. + _('Do not delete this application')); $this->submit('form_action-yes', - _('Yes'), + // TRANS: Button label on the delete application form. + _m('BUTTON','Yes'), 'submit form_action-secondary', + // TRANS: Submit button title for 'Yes' when deleting an application. 'yes', _('Delete this application')); $this->elementEnd('fieldset'); $this->elementEnd('form'); diff --git a/actions/deletenotice.php b/actions/deletenotice.php index 69cb1ebe8..f8010a814 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -142,8 +142,20 @@ class DeletenoticeAction extends Action $this->hidden('token', common_session_token()); $this->hidden('notice', $this->trimmed('notice')); $this->element('p', null, _('Are you sure you want to delete this notice?')); - $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not delete this notice")); - $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this notice')); + $this->submit('form_action-no', + // TRANS: Button label on the delete notice form. + _m('BUTTON','No'), + 'submit form_action-primary', + 'no', + // TRANS: Submit button title for 'No' when deleting a notice. + _("Do not delete this notice")); + $this->submit('form_action-yes', + // TRANS: Button label on the delete notice form. + _m('BUTTON','Yes'), + 'submit form_action-secondary', + 'yes', + // TRANS: Submit button title for 'Yes' when deleting a notice. + _('Delete this notice')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } diff --git a/actions/deleteuser.php b/actions/deleteuser.php index 42ef4b9f5..1c1f19b0e 100644 --- a/actions/deleteuser.php +++ b/actions/deleteuser.php @@ -147,8 +147,20 @@ class DeleteuserAction extends ProfileFormAction } Event::handle('EndDeleteUserForm', array($this, $this->user)); } - $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user")); - $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this user')); + $this->submit('form_action-no', + // TRANS: Button label on the delete user form. + _m('BUTTON','No'), + 'submit form_action-primary', + 'no', + // TRANS: Submit button title for 'No' when deleting a user. + _('Do not block this user')); + $this->submit('form_action-yes', + // TRANS: Button label on the delete user form. + _m('BUTTON','Yes'), + 'submit form_action-secondary', + 'yes', + // TRANS: Submit button title for 'Yes' when deleting a user. + _('Delete this user')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } diff --git a/actions/groupblock.php b/actions/groupblock.php index fc95c0e66..e52db6e11 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -173,8 +173,20 @@ class GroupblockAction extends RedirectingAction $this->hidden($k, $v); } } - $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user from this group")); - $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Block this user from this group')); + $this->submit('form_action-no', + // TRANS: Button label on the form to block a user from a group. + _m('BUTTON','No'), + 'submit form_action-primary', + 'no', + // TRANS: Submit button title for 'No' when blocking a user from a group. + _('Do not block this user from this group')); + $this->submit('form_action-yes', + // TRANS: Button label on the form to block a user from a group. + _m('BUTTON','Yes'), + 'submit form_action-secondary', + 'yes', + // TRANS: Submit button title for 'Yes' when blocking a user from a group. + _('Block this user from this group')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } -- cgit v1.2.3-54-g00ecf From 68305d4b6848cec6afe887ee2a5735515060770e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 20 May 2010 12:46:36 -0700 Subject: Added block link to subscription notification emails; block action can now take a profile ID on the URL; added profile details to block page so there's an indication of who you're blocking before you pull the trigger. Fixed typo in RedirectingAction when no return-to data provided in form submission. RedirectingAction::returnToArgs() has been renamed to returnToPrevious() to avoid conflict with Action::returnToArgs() which returns arguments to be passed to other actions as return-to arguments. All callers should now be updated. More profile settings actions will now redirect through a login form if visited as a GET request, as would be expected from a bookmark, link sent in e-mail etc. --- actions/block.php | 46 ++++++++++++++++++++++++++++++++++++++-- actions/deleteuser.php | 4 ++-- actions/groupblock.php | 4 ++-- lib/mail.php | 10 +++++++-- lib/profileformaction.php | 13 ++++++++++-- lib/redirectingaction.php | 9 ++++---- lib/router.php | 5 +++++ plugins/UserFlag/clearflag.php | 2 +- plugins/UserFlag/flagprofile.php | 2 +- 9 files changed, 79 insertions(+), 16 deletions(-) (limited to 'actions/groupblock.php') diff --git a/actions/block.php b/actions/block.php index 7f609c253..239a50868 100644 --- a/actions/block.php +++ b/actions/block.php @@ -87,13 +87,15 @@ class BlockAction extends ProfileFormAction { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($this->arg('no')) { - $this->returnToArgs(); + $this->returnToPrevious(); } elseif ($this->arg('yes')) { $this->handlePost(); - $this->returnToArgs(); + $this->returnToPrevious(); } else { $this->showPage(); } + } else { + $this->showPage(); } } @@ -118,6 +120,12 @@ class BlockAction extends ProfileFormAction */ function areYouSureForm() { + // @fixme if we ajaxify the confirmation form, skip the preview on ajax hits + $profile = new ArrayWrapper(array($this->profile)); + $preview = new ProfileList($profile, $this); + $preview->show(); + + $id = $this->profile->id; $this->elementStart('form', array('id' => 'block-' . $id, 'method' => 'post', @@ -175,4 +183,38 @@ class BlockAction extends ProfileFormAction $this->autofocus('form_action-yes'); } + /** + * 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. + */ + function checkSessionToken() + { + if ($_SERVER['REQUEST_METHOD'] == 'POST' || + $this->arg('yes') || + $this->arg('no')) { + + return parent::checkSessionToken(); + } + } + + /** + * 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) { + return common_local_url('subscribers', + array('nickname' => $user->nickname)); + } else { + return common_local_url('public'); + } + } } diff --git a/actions/deleteuser.php b/actions/deleteuser.php index 42ef4b9f5..c0a8b20e2 100644 --- a/actions/deleteuser.php +++ b/actions/deleteuser.php @@ -92,10 +92,10 @@ class DeleteuserAction extends ProfileFormAction { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($this->arg('no')) { - $this->returnToArgs(); + $this->returnToPrevious(); } elseif ($this->arg('yes')) { $this->handlePost(); - $this->returnToArgs(); + $this->returnToPrevious(); } else { $this->showPage(); } diff --git a/actions/groupblock.php b/actions/groupblock.php index fc95c0e66..2e06dc324 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -117,7 +117,7 @@ class GroupblockAction extends RedirectingAction parent::handle($args); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($this->arg('no')) { - $this->returnToArgs(); + $this->returnToPrevious(); } elseif ($this->arg('yes')) { $this->blockProfile(); } elseif ($this->arg('blockto')) { @@ -195,7 +195,7 @@ class GroupblockAction extends RedirectingAction return false; } - $this->returnToArgs(); + $this->returnToPrevious(); } /** diff --git a/lib/mail.php b/lib/mail.php index a4065e8d5..ab5742e33 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -245,6 +245,11 @@ function mail_subscribe_notify_profile($listenee, $other) $other->getBestName(), common_config('site', 'name')); + $blocklink = sprintf(_("If you believe this account is being used abusively, " . + "you can block them from your subscribers list and " . + "report as spam to site administrators at %s"), + common_local_url('block', array('profileid' => $other->id))); + // TRANS: Main body of new-subscriber notification e-mail $body = sprintf(_('%1$s is now listening to your notices on %2$s.'."\n\n". "\t".'%3$s'."\n\n". @@ -264,9 +269,10 @@ function mail_subscribe_notify_profile($listenee, $other) ($other->homepage) ? // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Homepage: %s"), $other->homepage) . "\n" : '', - ($other->bio) ? + (($other->bio) ? // TRANS: Profile info line in new-subscriber notification e-mail - sprintf(_("Bio: %s"), $other->bio) . "\n\n" : '', + sprintf(_("Bio: %s"), $other->bio) . "\n" : '') . + "\n\n" . $blocklink . "\n", common_config('site', 'name'), common_local_url('emailsettings')); diff --git a/lib/profileformaction.php b/lib/profileformaction.php index 0ffafe5fb..51c89a922 100644 --- a/lib/profileformaction.php +++ b/lib/profileformaction.php @@ -60,7 +60,16 @@ class ProfileFormAction extends RedirectingAction $this->checkSessionToken(); if (!common_logged_in()) { - $this->clientError(_('Not logged in.')); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $this->clientError(_('Not logged in.')); + } else { + // Redirect to login. + common_set_returnto($this->selfUrl()); + $user = common_current_user(); + if (Event::handle('RedirectToLogin', array($this, $user))) { + common_redirect(common_local_url('login'), 303); + } + } return false; } @@ -97,7 +106,7 @@ class ProfileFormAction extends RedirectingAction if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); - $this->returnToArgs(); + $this->returnToPrevious(); } } diff --git a/lib/redirectingaction.php b/lib/redirectingaction.php index f11585274..3a358f891 100644 --- a/lib/redirectingaction.php +++ b/lib/redirectingaction.php @@ -53,12 +53,13 @@ class RedirectingAction extends Action * * To be called only after successful processing. * - * @fixme rename this -- it obscures Action::returnToArgs() which - * returns a list of arguments, and is a bit confusing. + * Note: this was named returnToArgs() up through 0.9.2, which + * caused problems because there's an Action::returnToArgs() + * already which does something different. * * @return void */ - function returnToArgs() + function returnToPrevious() { // Now, gotta figure where we go back to $action = false; @@ -77,7 +78,7 @@ class RedirectingAction extends Action if ($action) { common_redirect(common_local_url($action, $args, $params), 303); } else { - $url = $this->defaultReturnToUrl(); + $url = $this->defaultReturnTo(); } common_redirect($url, 303); } diff --git a/lib/router.php b/lib/router.php index a9d07276f..afe44f92a 100644 --- a/lib/router.php +++ b/lib/router.php @@ -136,6 +136,11 @@ class Router $m->connect('main/'.$a, array('action' => $a)); } + // Also need a block variant accepting ID on URL for mail links + $m->connect('main/block/:profileid', + array('action' => 'block'), + array('profileid' => '[0-9]+')); + $m->connect('main/sup/:seconds', array('action' => 'sup'), array('seconds' => '[0-9]+')); diff --git a/plugins/UserFlag/clearflag.php b/plugins/UserFlag/clearflag.php index bd6732e2d..f032527ed 100644 --- a/plugins/UserFlag/clearflag.php +++ b/plugins/UserFlag/clearflag.php @@ -81,7 +81,7 @@ class ClearflagAction extends ProfileFormAction if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); if (!$this->boolean('ajax')) { - $this->returnToArgs(); + $this->returnToPrevious(); } } } diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php index 2d0f0abb9..018c1e8ac 100644 --- a/plugins/UserFlag/flagprofile.php +++ b/plugins/UserFlag/flagprofile.php @@ -87,7 +87,7 @@ class FlagprofileAction extends ProfileFormAction if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); if (!$this->boolean('ajax')) { - $this->returnToArgs(); + $this->returnToPrevious(); } } } -- cgit v1.2.3-54-g00ecf