diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-25 16:56:28 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-25 16:56:28 -0700 |
commit | 23abfb0a5b5933f32a5f94869abdab75f4f0ace8 (patch) | |
tree | fda3b467d483b6d5ce5574602096495caaafb504 /mod/admin.php | |
parent | 1828771557be409aea396751628966b02f3e2872 (diff) | |
download | volse-hubzilla-23abfb0a5b5933f32a5f94869abdab75f4f0ace8.tar.gz volse-hubzilla-23abfb0a5b5933f32a5f94869abdab75f4f0ace8.tar.bz2 volse-hubzilla-23abfb0a5b5933f32a5f94869abdab75f4f0ace8.zip |
add toggle for ALLOWCODE to admin/channel and also fix the ability to toggle the censor flag from that page.
Diffstat (limited to 'mod/admin.php')
-rw-r--r-- | mod/admin.php | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/mod/admin.php b/mod/admin.php index 7b6a8b723..54ee04776 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -847,10 +847,12 @@ function admin_page_channels_post(&$a) { $channels = ( x($_POST, 'channel') ? $_POST['channel'] : Array() ); check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels'); + + $xor = db_getfunc('^'); if (x($_POST,'page_channels_block')){ foreach($channels as $uid){ - q("UPDATE channel SET channel_pageflags = ( channel_pageflags & ~%d ) where channel_id = %d", + q("UPDATE channel SET channel_pageflags = ( channel_pageflags $xor %d ) where channel_id = %d", intval(PAGE_CENSORED), intval( $uid ) ); @@ -858,6 +860,15 @@ function admin_page_channels_post(&$a) { } notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) ); } + if (x($_POST,'page_channels_code')){ + foreach($channels as $uid){ + q("UPDATE channel SET channel_pageflags = ( channel_pageflags $xor %d ) where channel_id = %d", + intval(PAGE_ALLOWCODE), + intval( $uid ) + ); + } + notice( sprintf( tt("%s channel code allowed/disallowed", "%s channels code allowed/disallowed", count($channels)), count($channels)) ); + } if (x($_POST,'page_channels_delete')){ require_once("include/Contact.php"); foreach($channels as $uid){ @@ -899,14 +910,29 @@ function admin_page_channels(&$a){ case "block":{ check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't'); - q("UPDATE channel SET channel_pageflags = ( channel_pageflags & ~%d ) where channel_id = %d", - intval(PAGE_CENSORED), + $pflags = $channel[0]['channel_pageflags'] ^ PAGE_CENSORED; + q("UPDATE channel SET channel_pageflags = %d where channel_id = %d", + intval($pflags), intval( $uid ) ); proc_run('php','include/directory.php',$uid,'nopush'); - notice( sprintf( (($channel[0]['channel_pageflags'] & PAGE_CENSORED) ? t("Channel '%s' uncensored"): t("Channel '%s' censored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL); + notice( sprintf( (($pflags & PAGE_CENSORED) ? t("Channel '%s' censored"): t("Channel '%s' uncensored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL); + }; break; + + case "code":{ + check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't'); + $pflags = $channel[0]['channel_pageflags'] ^ PAGE_ALLOWCODE; + q("UPDATE channel SET channel_pageflags = %d where channel_id = %d", + intval($pflags), + intval( $uid ) + ); + + notice( sprintf( (($pflags & PAGE_ALLOWCODE) ? t("Channel '%s' code allowed"): t("Channel '%s' code disallowed")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL); }; break; + + default: + break; } goaway($a->get_baseurl(true) . '/admin/channels' ); } @@ -935,6 +961,11 @@ function admin_page_channels(&$a){ $channels[$x]['blocked'] = true; else $channels[$x]['blocked'] = false; + + if($channels[$x]['channel_pageflags'] & PAGE_ALLOWCODE) + $channels[$x]['allowcode'] = true; + else + $channels[$x]['allowcode'] = false; } } @@ -948,7 +979,8 @@ function admin_page_channels(&$a){ '$delete' => t('Delete'), '$block' => t('Censor'), '$unblock' => t('Uncensor'), - + '$code' => t('Allow Code'), + '$uncode' => t('Disallow Code'), '$h_channels' => t('Channel'), '$th_channels' => array( t('UID'), t('Name'), t('Address')), |