From 83e3e4e45a1906590a2a629f197800c928ebe169 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 22 Aug 2013 15:35:10 -0700 Subject: this should fix the premium checkbox stickiness issue --- mod/connect.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/connect.php b/mod/connect.php index 1d0a21496..93f994af5 100644 --- a/mod/connect.php +++ b/mod/connect.php @@ -31,21 +31,25 @@ function connect_init(&$a) { function connect_post(&$a) { - $edit = ((local_user() && (local_user() == $a->profile['profile_uid'])) ? true : false); + if(! array_key_exists('channel', $a->data)) + return; + + $edit = ((local_user() && (local_user() == $a->data['channel']['channel_id'])) ? true : false); if($edit) { + $has_premium = (($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); $premium = (($_POST['premium']) ? intval($_POST['premium']) : 0); $text = escape_tags($_POST['text']); - $channel = $a->get_channel(); - if(($channel['channel_pageflags'] & PAGE_PREMIUM) != $premium) { - $r = q("update channel set channel_pageflags = channel_pageflags ^ %d where channel_id = %d limit 1", + if($has_premium != $premium) { + $r = q("update channel set channel_pageflags = ( channel_pageflags ^ %d ) where channel_id = %d limit 1", intval(PAGE_PREMIUM), intval(local_user()) ); - proc_run('php','include/notifier.php','refresh_all',$channel['channel_id']); + proc_run('php','include/notifier.php','refresh_all',$a->data['channel']['channel_id']); } - set_pconfig($channel['channel_id'],'system','selltext',$text); + set_pconfig($a->data['channel']['channel_id'],'system','selltext',$text); + // reload the page completely to get fresh data goaway(z_root() . '/' . $a->query_string); } -- cgit v1.2.3