From: friendica Date: Sat, 4 Feb 2012 11:56:55 +0000 (-0800) Subject: provide ability to disable n-s-f-w filter as a personal preference X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca6e43ef495f360541ca78d3637697c6c87e6646;p=friendica-addons.git provide ability to disable n-s-f-w filter as a personal preference --- diff --git a/nsfw.tgz b/nsfw.tgz index 4e465f68..8a1e3a3c 100755 Binary files a/nsfw.tgz and b/nsfw.tgz differ diff --git a/nsfw/nsfw.css b/nsfw/nsfw.css index 57bb570e..a8c1bfe8 100755 --- a/nsfw/nsfw.css +++ b/nsfw/nsfw.css @@ -1,11 +1,11 @@ -#nsfw-label { +#nsfw-label, #nsfw-enable-label { float: left; width: 300px; margin-top: 10px; } -#nsfw-words { +#nsfw-words, #nsfw-enable { float: left; margin-top: 10px; } diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index fdfd5a27..a5b3ede1 100755 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -38,7 +38,7 @@ function nsfw_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - + $enable_checked = (intval(get_pconfig(local_user(),'nsfw','disable')) ? '' : ' checked="checked" '); $words = get_pconfig(local_user(),'nsfw','words'); if(! $words) $words = 'nsfw,'; @@ -46,6 +46,10 @@ function nsfw_addon_settings(&$a,&$s) { $s .= '
'; $s .= '

' . t('"Not Safe For Work" Settings') . '

'; $s .= '
'; + + $s .= ''; + $s .= ''; + $s .= '
'; $s .= ''; $s .= ''; $s .= '
'; @@ -64,6 +68,9 @@ function nsfw_addon_settings_post(&$a,&$b) { if($_POST['nsfw-submit']) { set_pconfig(local_user(),'nsfw','words',trim($_POST['nsfw-words'])); + $enable = ((x($_POST,'nsfw-enable')) ? intval($_POST['nsfw-enable']) : 0); + $disable = 1-$enable; + set_pconfig(local_user(),'nsfw','disable', $disable); info( t('NSFW Settings saved.') . EOL); } } @@ -71,6 +78,9 @@ function nsfw_addon_settings_post(&$a,&$b) { function nsfw_prepare_body(&$a,&$b) { $words = null; + if(get_pconfig(local_user(),'nsfw','disable')) + return; + if(local_user()) { $words = get_pconfig(local_user(),'nsfw','words'); }