diff options
author | redmatrix <git@macgirvin.com> | 2016-02-03 20:24:46 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-02-03 20:24:46 -0800 |
commit | c75f76f740be16f9880650fcff359d7afd85991d (patch) | |
tree | 50e40fcb64de4dfa0c8dfa176c52e7319a1527d0 /mod/admin.php | |
parent | 28386d747115598ccd4851e049084219b2f99fef (diff) | |
download | volse-hubzilla-c75f76f740be16f9880650fcff359d7afd85991d.tar.gz volse-hubzilla-c75f76f740be16f9880650fcff359d7afd85991d.tar.bz2 volse-hubzilla-c75f76f740be16f9880650fcff359d7afd85991d.zip |
heavy lifting on admin security page
Diffstat (limited to 'mod/admin.php')
-rw-r--r-- | mod/admin.php | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/mod/admin.php b/mod/admin.php index 7ca2efa35..bdb4bf861 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -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( |