diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-08-12 17:47:47 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-08-12 17:47:47 +0200 |
commit | a0519fdaeb59bd96d9071681a68c2dc1b646fc68 (patch) | |
tree | d0d5cd9802fbaf2e9c4fc91f107489e7cf7b97ad /inc | |
parent | 84c1127cc070777c8cbcf488f5422bc4b71470a8 (diff) | |
download | rpg-a0519fdaeb59bd96d9071681a68c2dc1b646fc68.tar.gz rpg-a0519fdaeb59bd96d9071681a68c2dc1b646fc68.tar.bz2 |
fixed subscription management
now adding and removing subscriptions works again
Diffstat (limited to 'inc')
-rw-r--r-- | inc/actions.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/inc/actions.php b/inc/actions.php index 62b0e1800..721492bd4 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -700,21 +700,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'; } |