X-Git-Url: https://git.mxchange.org/?p=friendica-addons.git;a=blobdiff_plain;f=statusnet%2Fstatusnet.php;h=f92dde76c8e60012311aab25b9320ca3aec392bb;hp=a4b539f4d797ed92d2def54bd085c64b27cd7d23;hb=381e23da12b42f460568e1c503a3d15c22454106;hpb=584f58e5733e62d92c451feb41c420e6c42a0d76 diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index a4b539f4..f92dde76 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -1,7 +1,7 @@ * Author: Michael Vogel @@ -35,7 +35,7 @@ /*** - * We have to alter the TwitterOAuth class a little bit to work with any StatusNet + * We have to alter the TwitterOAuth class a little bit to work with any GNU Social * installation abroad. Basically it's only make the API path variable and be happy. * * Thank you guys for the Twitter compatible API! @@ -119,7 +119,7 @@ function statusnet_install() { register_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets'); register_hook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron'); register_hook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body'); - logger("installed statusnet"); + logger("installed GNU Social"); } @@ -148,20 +148,20 @@ function statusnet_jot_nets(&$a,&$b) { $statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default'); $selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' - . t('Post to StatusNet') . '
'; + . t('Post to GNU Social') . ''; } } function statusnet_settings_post ($a,$post) { if(! local_user()) return; - // don't check statusnet settings if statusnet submit button is not clicked + // don't check GNU Social settings if GNU Social submit button is not clicked if (!x($_POST,'statusnet-submit')) return; if (isset($_POST['statusnet-disconnect'])) { /*** - * if the statusnet-disconnect checkbox is set, clear the statusnet configuration + * if the GNU Social-disconnect checkbox is set, clear the GNU Social configuration */ del_pconfig(local_user(), 'statusnet', 'consumerkey'); del_pconfig(local_user(), 'statusnet', 'consumersecret'); @@ -178,7 +178,7 @@ function statusnet_settings_post ($a,$post) { } else { if (isset($_POST['statusnet-preconf-apiurl'])) { /*** - * If the user used one of the preconfigured StatusNet server credentials + * If the user used one of the preconfigured GNU Social server credentials * use them. All the data are available in the global config. * Check the API Url never the less and blame the admin if it's not working ^^ */ @@ -191,7 +191,7 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey'] ); set_pconfig(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret'] ); set_pconfig(local_user(), 'statusnet', 'baseapi', $asn['apiurl'] ); - set_pconfig(local_user(), 'statusnet', 'application_name', $asn['applicationname'] ); + //set_pconfig(local_user(), 'statusnet', 'application_name', $asn['applicationname'] ); } else { notice( t('Please contact your site administrator.
The provided API URL is not valid.').EOL.$asn['apiurl'].EOL ); } @@ -200,7 +200,7 @@ function statusnet_settings_post ($a,$post) { goaway($a->get_baseurl().'/settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { - // check if we can reach the API of the StatusNet server + // check if we can reach the API of the GNU Social server // we'll check the API Version for that, if we don't get one we'll try to fix the path but will // resign quickly after this one try to fix the path ;-) $apibase = $_POST['statusnet-baseapi']; @@ -210,7 +210,7 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']); set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase ); - set_pconfig(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] ); + //set_pconfig(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] ); } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; @@ -222,18 +222,18 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase ); } else { // still not the correct API base, let's do noting - notice( t('We could not contact the StatusNet API with the Path you entered.').EOL ); + notice( t('We could not contact the GNU Social API with the Path you entered.').EOL ); } } goaway($a->get_baseurl().'/settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { - // if the user supplied us with a PIN from StatusNet, let the magic of OAuth happen + // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen $api = get_pconfig(local_user(), 'statusnet', 'baseapi'); $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' ); $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' ); // the token and secret for which the PIN was generated were hidden in the settings - // form as token and token2, we need a new connection to StatusNet using these token + // form as token and token2, we need a new connection to GNU Social using these token // and secret to request a Access Token with the PIN $connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']); $token = $connection->getAccessToken( $_POST['statusnet-pin'] ); @@ -256,7 +256,7 @@ function statusnet_settings_post ($a,$post) { if (!intval($_POST['statusnet-mirror'])) del_pconfig(local_user(),'statusnet','lastid'); - info( t('StatusNet settings updated.') . EOL); + info( t('GNU Social settings updated.') . EOL); }}}} } function statusnet_settings(&$a,&$s) { @@ -280,19 +280,22 @@ function statusnet_settings(&$a,&$s) { $defchecked = (($defenabled) ? ' checked="checked" ' : ''); $mirrorenabled = get_pconfig(local_user(),'statusnet','mirror_posts'); $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : ''); - $importenabled = get_pconfig(local_user(),'statusnet','import'); - $importchecked = (($importenabled) ? ' checked="checked" ' : ''); + $import = get_pconfig(local_user(),'statusnet','import'); + $importselected = array("", "", ""); + $importselected[$import] = ' selected="selected"'; + //$importenabled = get_pconfig(local_user(),'statusnet','import'); + //$importchecked = (($importenabled) ? ' checked="checked" ' : ''); $create_userenabled = get_pconfig(local_user(),'statusnet','create_user'); $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); $s .= ''; - $s .= '

'. t('StatusNet Import/Export/Mirror').'

'; + $s .= '

'. t('GNU Social Import/Export/Mirror').'

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