diff options
author | Brion Vibber <brion@pobox.com> | 2010-04-08 19:06:55 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-04-08 19:06:55 -0700 |
commit | 5dbaaed4e68ecae1c78b9493add89df3557c8e98 (patch) | |
tree | 7435597d838585df16a8a11c59622654bb201b46 /lib/util.php | |
parent | 4b2dfabff886c7f2e61eef43c7c9de092661d73a (diff) |
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).
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 26 |
1 files changed, 26 insertions, 0 deletions
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(); |