heavy lifting on admin security page
This commit is contained in:
parent
28386d7471
commit
c75f76f740
@ -1269,6 +1269,7 @@ function widget_admin($arr) {
|
||||
'site' => array(z_root() . '/admin/site/', t('Site'), 'site'),
|
||||
'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'),
|
||||
'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'),
|
||||
'security' => array(z_root() . '/admin/security/', t('Security'), 'security'),
|
||||
'features' => array(z_root() . '/admin/features/', t('Features'), 'features'),
|
||||
'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'),
|
||||
'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'),
|
||||
|
@ -542,9 +542,47 @@ function admin_page_hubloc_post(&$a){
|
||||
goaway($a->get_baseurl(true) . '/admin/hubloc' );
|
||||
}
|
||||
|
||||
function trim_array_elems($arr) {
|
||||
$narr = array();
|
||||
|
||||
if($arr && is_array($arr)) {
|
||||
for($x = 0; $x < count($arr); $x ++) {
|
||||
$y = trim($arr[$x]);
|
||||
if($y)
|
||||
$narr[] = $y;
|
||||
}
|
||||
}
|
||||
return $narr;
|
||||
}
|
||||
|
||||
function admin_page_security_post(&$a){
|
||||
check_form_security_token_redirectOnErr('/admin/security', 'admin_security');
|
||||
|
||||
logger('post: ' . print_r($_POST,true));
|
||||
|
||||
$block_public = ((x($_POST,'block_public')) ? True : False);
|
||||
set_config('system','block_public',$block_public);
|
||||
|
||||
$ws = trim_array_elems(explode("\n",$_POST['whitelisted_sites']));
|
||||
set_config('system','whitelisted_sites',$ws);
|
||||
|
||||
$bs = trim_array_elems(explode("\n",$_POST['blacklisted_sites']));
|
||||
set_config('system','blacklisted_sites',$bs);
|
||||
|
||||
$wc = trim_array_elems(explode("\n",$_POST['whitelisted_channels']));
|
||||
set_config('system','whitelisted_channels',$wc);
|
||||
|
||||
$bc = trim_array_elems(explode("\n",$_POST['blacklisted_channels']));
|
||||
set_config('system','blacklisted_channels',$bc);
|
||||
|
||||
$embed_coop = ((x($_POST,'embed_coop')) ? True : False);
|
||||
set_config('system','embed_coop',$embed_coop);
|
||||
|
||||
$we = trim_array_elems(explode("\n",$_POST['embed_allow']));
|
||||
set_config('system','embed_allow',$we);
|
||||
|
||||
$be = trim_array_elems(explode("\n",$_POST['embed_deny']));
|
||||
set_config('system','embed_deny',$be);
|
||||
|
||||
goaway(z_root() . '/admin/security');
|
||||
}
|
||||
@ -666,7 +704,7 @@ function admin_page_security(&$a) {
|
||||
$embed_coop = intval(get_config('system','embed_coop'));
|
||||
|
||||
if((! $whiteembeds) && (! $blackembeds) && (! $embed_coop))
|
||||
$blackembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com";
|
||||
$whiteembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com\nwikipedia.com";
|
||||
|
||||
$t = get_markup_template('admin_security.tpl');
|
||||
return replace_macros($t, array(
|
||||
|
19
util/config
19
util/config
@ -8,12 +8,14 @@ require_once('include/cli_startup.php');
|
||||
cli_startup();
|
||||
|
||||
if($argc > 3) {
|
||||
|
||||
|
||||
set_config($argv[1],$argv[2],$argv[3]);
|
||||
echo "config[{$argv[1]}][{$argv[2]}] = " . get_config($argv[1],$argv[2]) . "\n";
|
||||
echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
|
||||
}
|
||||
|
||||
if($argc == 3) {
|
||||
echo "config[{$argv[1]}][{$argv[2]}] = " . get_config($argv[1],$argv[2]) . "\n";
|
||||
echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
|
||||
}
|
||||
|
||||
if($argc == 2) {
|
||||
@ -27,8 +29,19 @@ if($argc == 1) {
|
||||
$r = q("select * from config where 1");
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
echo "config[{$rr['cat']}][{$rr['k']}] = " . $rr['v'] . "\n";
|
||||
echo "config[{$rr['cat']}][{$rr['k']}] = " . printable_config($rr['v']) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function printable_config($x) {
|
||||
$s = '';
|
||||
if(is_array($x)) {
|
||||
foreach($x as $v) {
|
||||
$s .= $v . "\n";
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
else
|
||||
return $x;
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
<li><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
|
||||
<li><a href='{{$admin.users.0}}'>{{$admin.users.1}}<span id='pending-update' title='{{$h_pending}}'></span></a></li>
|
||||
<li><a href='{{$admin.channels.0}}'>{{$admin.channels.1}}</a></li>
|
||||
<li><a href='{{$admin.security.0}}'>{{$admin.security.1}}</a></li>
|
||||
<li><a href='{{$admin.queue.0}}'>{{$admin.queue.1}}</a></li>
|
||||
<li><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
|
||||
<li><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
<form action="{{$baseurl}}/admin/security" method="post">
|
||||
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
|
||||
|
||||
{{include file="field_checkbox.tpl" field=$block_public}}
|
||||
|
||||
|
Reference in New Issue
Block a user