diff options
author | friendica <info@friendica.com> | 2013-08-22 15:35:10 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-08-22 15:35:10 -0700 |
commit | 83e3e4e45a1906590a2a629f197800c928ebe169 (patch) | |
tree | d27b293d3ffdffd78ecf83b1063c5670cdbe4da4 /mod/connect.php | |
parent | 347faa59b6f112ae76122e55f57ee73968479d7a (diff) | |
download | volse-hubzilla-83e3e4e45a1906590a2a629f197800c928ebe169.tar.gz volse-hubzilla-83e3e4e45a1906590a2a629f197800c928ebe169.tar.bz2 volse-hubzilla-83e3e4e45a1906590a2a629f197800c928ebe169.zip |
this should fix the premium checkbox stickiness issue
Diffstat (limited to 'mod/connect.php')
-rw-r--r-- | mod/connect.php | 16 |
1 files changed, 10 insertions, 6 deletions
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); } |