From: friendica Date: Tue, 25 Sep 2012 00:21:30 +0000 (-0700) Subject: fromapp force setting X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8f94568ada11948c5f69dbb7da721e27d82b69ab;p=friendica-addons.git fromapp force setting --- diff --git a/fromapp.tgz b/fromapp.tgz index dbe45ebe..30d84e90 100644 Binary files a/fromapp.tgz and b/fromapp.tgz differ diff --git a/fromapp/fromapp.css b/fromapp/fromapp.css index 90aeec49..422624a1 100644 --- a/fromapp/fromapp.css +++ b/fromapp/fromapp.css @@ -1,13 +1,13 @@ -#fromapp-label { +#fromapp-label, #fromapp-force-label { float: left; width: 200px; margin-bottom: 25px; } -#fromapp { +#fromapp-input, #fromapp-force { float: left; } diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 51c95906..9a9fa12b 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -32,7 +32,9 @@ function fromapp_settings_post($a,$post) { if(! local_user() || (! x($_POST,'fromapp-submit'))) return; - set_pconfig(local_user(),'fromapp','app',$_POST['fromapp']); + set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']); + set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force'])); + info( t('Fromapp settings updated.') . EOL); } @@ -50,14 +52,24 @@ function fromapp_settings(&$a,&$s) { $fromapp = get_pconfig(local_user(),'fromapp','app'); if($fromapp === false) $fromapp = ''; + + $force = intval(get_pconfig(local_user(),'fromapp','force')); + + $force_enabled = (($force) ? ' checked="checked" ' : ''); + /* Add some HTML to the existing form */ $s .= '
'; $s .= '

' . t('FromApp Settings') . '

'; $s .= '
'; - $s .= ''; - $s .= ''; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= ''; + $s .= ''; + $s .= '
'; /* provide a submit button */ @@ -74,10 +86,14 @@ function fromapp_post_hook(&$a,&$item) { return; $app = get_pconfig(local_user(), 'fromapp', 'app'); + $force = intval(get_pconfig(local_user(), 'fromapp','force')); if(($app === false) || (! strlen($app))) return; + if(strlen(trim($item['app'])) && (! $force)) + return; + $apps = explode(',',$app); $item['app'] = trim($apps[mt_rand(0,count($apps)-1)]); return;