From 056c20495937fe45fe0f7204b112dbfe6931a855 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 30 Nov 2009 14:03:11 +0100 Subject: nicer subscription styles Ignore-this: e1b3b815b5ebb0da320bff997c4fed4b darcs-hash:20091130130311-6e07b-03ccfc52abb3dcc0764eed5784d81f8416841328.gz --- inc/actions.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index 900409a90..1fda0584e 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -558,19 +558,21 @@ function act_export($act){ * @author Adrian Lang */ function act_subscription($act){ - if ($_SERVER['REQUEST_METHOD'] !== 'POST') { - // No post to handle, let tpl_subscribe manage the request. - return $act; - } + global $lang; + global $INFO; + global $ID; - // Get and preprocess data. + // get and preprocess data. $params = array(); foreach(array('target', 'style', 'action') as $param) { - if (isset($_POST["subscribe_$param"])) { - $params[$param] = $_POST["subscribe_$param"]; + if (isset($_REQUEST["sub_$param"])) { + $params[$param] = $_REQUEST["sub_$param"]; } } + // any action given? if not just return and show the subscription page + if(!$params['action']) return $act; + // Handle POST data, may throw exception. trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post'); @@ -579,9 +581,6 @@ function act_subscription($act){ $data = $params['data']; $action = $params['action']; - global $lang; - global $INFO; - // Perform action. require_once DOKU_INC . 'inc/subscription.php'; if (!subscription_set($_SERVER['REMOTE_USER'], $target, $style, $data)) { @@ -591,7 +590,6 @@ function act_subscription($act){ } msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']), prettyprint_id($target)), 1); - global $ID; act_redirect($ID, $act); // Assure that we have valid data if act_redirect somehow fails. -- cgit v1.2.3