summaryrefslogtreecommitdiff
path: root/inc/actions.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-08-12 17:47:47 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-08-12 17:47:47 +0200
commita0519fdaeb59bd96d9071681a68c2dc1b646fc68 (patch)
treed0d5cd9802fbaf2e9c4fc91f107489e7cf7b97ad /inc/actions.php
parent84c1127cc070777c8cbcf488f5422bc4b71470a8 (diff)
downloadrpg-a0519fdaeb59bd96d9071681a68c2dc1b646fc68.tar.gz
rpg-a0519fdaeb59bd96d9071681a68c2dc1b646fc68.tar.bz2
fixed subscription management
now adding and removing subscriptions works again
Diffstat (limited to 'inc/actions.php')
-rw-r--r--inc/actions.php19
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';
}