From 834439b7300584350ac1676f3f43f5511a4b509b Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 23 Feb 2011 18:24:29 -0800 Subject: cleanup plugin and post settings --- addon/statusnet/statusnet.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'addon/statusnet/statusnet.php') diff --git a/addon/statusnet/statusnet.php b/addon/statusnet/statusnet.php index 7928003bc..e595ad7b5 100644 --- a/addon/statusnet/statusnet.php +++ b/addon/statusnet/statusnet.php @@ -63,6 +63,22 @@ function statusnet_uninstall() { unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); } +function statusnet_jot_nets(&$a,&$b) { + if(! local_user()) + return; + + $statusnet_post = get_pconfig(local_user(),'statusnet','post'); + if(intval($statusnet_post) == 1) { + $statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default'); + $selected = ((intval($statusnet_defpost == 1)) ? ' selected="selected" ' : ''); + $b .= '
' + . t('Post to StatusNet') . '
'; + } +} + + + + function statusnet_settings_post ($a,$post) { if(! local_user()) return; @@ -123,7 +139,8 @@ function statusnet_settings(&$a,&$s) { $osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret' ); $enabled = get_pconfig(local_user(), 'statusnet', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $s .= '

'.t('StatusNet Posting Settings').'

'; + $s .= '
'; + $s .= '

'. t('StatusNet Posting Settings').'

'; if ( (!$ckey) && (!$csecret) ) { /*** @@ -185,7 +202,7 @@ function statusnet_settings(&$a,&$s) { $s .= '
'; } } - $s .= '
'; + $s .= '
'; } @@ -210,8 +227,9 @@ function statusnet_post_hook(&$a,&$b) { if($ckey && $csecret && $otoken && $osecret) { $statusnet_post = get_pconfig(local_user(),'statusnet','post'); + $statusnet_enable = (($statusnet_post && x($_POST,'statusnet_enable')) ? intval($_POST['statusnet_enable']) : 0); - if($statusnet_post) { + if($statusnet_enable && $statusnet_post) { require_once('include/bbcode.php'); $dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret); $max_char = $dent->get_maxlength(); // max. length for a dent @@ -241,6 +259,6 @@ function statusnet_post_hook(&$a,&$b) { $dent->post('statuses/update', array('status' => $msg)); } } - } + } } -- cgit v1.2.3