diff options
-rw-r--r-- | mod/admin.php | 42 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/php/zen.php | 1 | ||||
-rwxr-xr-x | view/tpl/admin_channels.tpl | 3 |
4 files changed, 41 insertions, 7 deletions
diff --git a/mod/admin.php b/mod/admin.php index a7318894d..d3bbd8d01 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -849,10 +849,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 ) ); @@ -860,6 +862,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){ @@ -901,14 +912,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' ); } @@ -937,6 +963,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; } } @@ -950,7 +981,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')), diff --git a/version.inc b/version.inc index 3f9529176..20fd10ffb 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-05-24.1042 +2015-05-25.1043 diff --git a/view/php/zen.php b/view/php/zen.php index 6fd11127c..5b89e9c32 100644 --- a/view/php/zen.php +++ b/view/php/zen.php @@ -2,6 +2,7 @@ <html> <head> <title><?php if(x($page,'title')) echo $page['title'] ?></title> + <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1"> <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?> </head> <body> diff --git a/view/tpl/admin_channels.tpl b/view/tpl/admin_channels.tpl index a76878438..a3390b179 100755 --- a/view/tpl/admin_channels.tpl +++ b/view/tpl/admin_channels.tpl @@ -35,6 +35,7 @@ <td class="checkbox"><input type="checkbox" class="channels_ckbx" id="id_channel_{{$c.channel_id}}" name="channel[]" value="{{$c.channel_id}}"/></td> <td class="tools"> <a href="{{$baseurl}}/admin/channels/block/{{$c.channel_id}}?t={{$form_security_token}}" class="btn btn-default btn-xs" title='{{if ($c.blocked)}}{{$unblock}}{{else}}{{$block}}{{/if}}'><i class='icon-ban-circle admin-icons {{if ($c.blocked)}}dim{{/if}}'></i></a> + <a href="{{$baseurl}}/admin/channels/code/{{$c.channel_id}}?t={{$form_security_token}}" class="btn btn-default btn-xs" title='{{if ($c.allowcode)}}{{$uncode}}{{else}}{{$code}}{{/if}}'><i class='icon-terminal admin-icons {{if ($c.allowcode)}}dim{{/if}}'></i></a> <a href="{{$baseurl}}/admin/channels/delete/{{$c.channel_id}}?t={{$form_security_token}}" class="btn btn-default btn-xs" title='{{$delete}}' onclick="return confirm_delete('{{$c.channel_name}}')"><i class='icon-trash admin-icons'></i></a> </td> </tr> @@ -42,7 +43,7 @@ </tbody> </table> <div class='selectall'><a href='#' onclick="return selectall('channels_ckbx');">{{$select_all}}</a></div> - <div class="submit"><input type="submit" name="page_channels_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_channels_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div> + <div class="submit"><input type="submit" name="page_channels_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_channels_code" value="{{$code}}/{{$uncode}}" /> <input type="submit" name="page_channels_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div> {{else}} NO CHANNELS?!? {{/if}} |