diff options
author | Klap-in <klapinklapin@gmail.com> | 2013-01-26 21:03:14 +0100 |
---|---|---|
committer | Klap-in <klapinklapin@gmail.com> | 2013-01-26 21:03:14 +0100 |
commit | 3a2c510523e4ea91ab270c3075349f319e4bc95e (patch) | |
tree | 7fe2d24e5f4450cf78e9291e8a2899665274c636 /inc/actions.php | |
parent | 5fd9b829e7d9947de0eeead685e0a0cf707eff88 (diff) | |
parent | 1a40fc9935bd06a440a844e081e4bfce5fce2932 (diff) | |
download | rpg-3a2c510523e4ea91ab270c3075349f319e4bc95e.tar.gz rpg-3a2c510523e4ea91ab270c3075349f319e4bc95e.tar.bz2 |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'inc/actions.php')
-rw-r--r-- | inc/actions.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/inc/actions.php b/inc/actions.php index f65b47451..4083b0454 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -711,21 +711,28 @@ function act_subscription($act){ $target = $params['target']; $style = $params['style']; - $data = $params['data']; $action = $params['action']; // Perform action. - if (!subscription_set($_SERVER['REMOTE_USER'], $target, $style, $data)) { + $sub = new Subscription(); + if($action == 'unsubscribe'){ + $ok = $sub->remove($target, $_SERVER['REMOTE_USER'], $style); + }else{ + $ok = $sub->add($target, $_SERVER['REMOTE_USER'], $style); + } + + if($ok) { + msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']), + prettyprint_id($target)), 1); + act_redirect($ID, $act); + } else { throw new Exception(sprintf($lang["subscr_{$action}_error"], hsc($INFO['userinfo']['name']), prettyprint_id($target))); } - msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']), - prettyprint_id($target)), 1); - act_redirect($ID, $act); // Assure that we have valid data if act_redirect somehow fails. - $INFO['subscribed'] = get_info_subscribed(); + $INFO['subscribed'] = $sub->user_subscription(); return 'show'; } @@ -777,8 +784,7 @@ function subscription_handle_post(&$params) { $style = null; } - $data = in_array($style, array('list', 'digest')) ? time() : null; - $params = compact('target', 'style', 'data', 'action'); + $params = compact('target', 'style', 'action'); } //Setup VIM: ex: et ts=2 : |