diff --git a/irc/README.md b/irc/README.md deleted file mode 100644 index 9d6181d7..00000000 --- a/irc/README.md +++ /dev/null @@ -1,16 +0,0 @@ -IRC App -======= - -This addon will add an app to your page which will allow your users to access -the [IRC](https://en.wikipedia.org/wiki/IRC) at [freenode.net](https://freenode.net) via a webinterface from your node. The chat interface -will be loaded in an iframe from webchat.freenode.net. - -You can specify two sets of channel lists. - -1. a list of channels the interface shall automatically connect to -2. a list of popular channels which will be displayed aside the chat interface. - the channels in this list will be linked so your users can easily join them. - -If you don't specify a list of popular channels, the following will be shown: friendica, chat, chatback, hottub, ircbar, dateroom, debian - -Users can set their own list of channels in the settings. diff --git a/irc/irc.php b/irc/irc.php index b768749f..ef9c3fda 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -1,12 +1,18 @@ -* Author: Tobias Diekershoff */ +/* enable in admin->plugins + * you will then have "irc chatroom" listed at yoursite/apps + * and the app will run at yoursite/irc + * documentation at http://tonybaldwin.me/hax/doku.php?id=friendica:irc + * admin can set popular chans, auto connect chans in settings->plugin settings + */ + function irc_install() { register_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); register_hook('plugin_settings', 'addon/irc/irc.php', 'irc_addon_settings'); @@ -21,50 +27,56 @@ function irc_uninstall() { function irc_addon_settings(&$a,&$s) { - if(! local_user()) + + + if(! is_site_admin()) return; /* Add our stylesheet to the page so we can make our settings look nice */ -// $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; /* setting popular channels, auto connect channels */ - $sitechats = get_pconfig( local_user(), 'irc','sitechats'); /* popular channels */ - $autochans = get_pconfig( local_user(), 'irc','autochans'); /* auto connect chans */ + $sitechats = get_config('irc','sitechats'); /* popular channels */ + $autochans = get_config('irc','autochans'); /* auto connect chans */ - $t = get_markup_template( "settings.tpl", "addon/irc/" ); - $s = replace_macros($t, array( - '$header' => t('IRC Settings'), - '$info' => t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'), - '$submit' => t('Save Settings'), - '$autochans' => array( 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')), - '$sitechats' => array( 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ) - )); + $s .= '
'; + $s .= '

' . t('IRC Settings') . '

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; return; } function irc_addon_settings_post(&$a,&$b) { - if(! local_user()) + if(! is_site_admin()) return; if($_POST['irc-submit']) { - set_pconfig( local_user(), 'irc','autochans',trim($_POST['autochans'])); - set_pconfig( local_user(), 'irc','sitechats',trim($_POST['sitechats'])); - /* upid pop-up thing */ + set_config('irc','autochans',trim($_POST['autochans'])); + set_config('irc','sitechats',trim($_POST['sitechats'])); + /* stupid pop-up thing */ info( t('IRC settings saved.') . EOL); } } function irc_app_menu($a,&$b) { - $b['app_menu'][] = '
' . t('IRC Chatroom') . '
'; +$b['app_menu'][] = '
' . t('IRC Chatroom') . '
'; } function irc_module() { - return; +return; } @@ -74,13 +86,7 @@ function irc_content(&$a) { $o = ''; /* set the list of popular channels */ - if (local_user()) { - $sitechats = get_pconfig( local_user(), 'irc', 'sitechats'); - if (!$sitechats) - $sitechats = get_config('irc', 'sitechats'); - } else { - $sitechats = get_config('irc','sitechats'); - } + $sitechats = get_config('irc','sitechats'); if($sitechats) $chats = explode(',',$sitechats); else @@ -94,13 +100,7 @@ function irc_content(&$a) { $a->page['aside'] .= ''; /* setting the channel(s) to auto connect */ - if (local_user()) { - $autochans = get_pconfig(local_user(), 'irc', 'autochans'); - if (!$autochans) - $autochans = get_config('irc','autochans'); - } else { - $autochans = get_config('irc','autochans'); - } + $autochans = get_config('irc','autochans'); if($autochans) $channels = $autochans; else @@ -110,31 +110,11 @@ function irc_content(&$a) { $o .= <<< EOT

IRC chat

A beginner's guide to using IRC. [en]

- + EOT; return $o; } -function irc_plugin_admin_post (&$a) { - if(! is_site_admin()) - return; - if($_POST['irc-submit']) { - set_config('irc','autochans',trim($_POST['autochans'])); - set_config('irc','sitechats',trim($_POST['sitechats'])); - /* stupid pop-up thing */ - info( t('IRC settings saved.') . EOL); - } -} -function irc_plugin_admin (&$a, &$o) { - $sitechats = get_config('irc','sitechats'); /* popular channels */ - $autochans = get_config('irc','autochans'); /* auto connect chans */ - $t = get_markup_template( "admin.tpl", "addon/irc/" ); - $o = replace_macros($t, array( - '$submit' => t('Save Settings'), - '$autochans' => array( 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')), - '$sitechats' => array( 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ) - )); -} diff --git a/irc/lang/C/messages.po b/irc/lang/C/messages.po index 86c203aa..f21d3eb2 100644 --- a/irc/lang/C/messages.po +++ b/irc/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-08 13:17+0200\n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,49 +17,30 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: irc.php:37 +#: irc.php:44 msgid "IRC Settings" msgstr "" -#: irc.php:38 -msgid "" -"Here you can change the system wide settings for the channels to " -"automatically join and access via the side bar. Note the changes you do " -"here, only effect the channel selection if you are logged in." -msgstr "" - -#: irc.php:39 irc.php:136 -msgid "Save Settings" -msgstr "" - -#: irc.php:40 irc.php:137 +#: irc.php:46 msgid "Channel(s) to auto connect (comma separated)" msgstr "" -#: irc.php:40 irc.php:137 -msgid "" -"List of channels that shall automatically connected to when the app is " -"launched." -msgstr "" - -#: irc.php:41 irc.php:138 +#: irc.php:51 msgid "Popular Channels (comma separated)" msgstr "" -#: irc.php:41 irc.php:138 -msgid "" -"List of popular channels, will be displayed at the side and hotlinked for " -"easy joining." +#: irc.php:55 +msgid "Submit" msgstr "" -#: irc.php:57 irc.php:128 +#: irc.php:69 msgid "IRC settings saved." msgstr "" -#: irc.php:62 +#: irc.php:74 msgid "IRC Chatroom" msgstr "" -#: irc.php:90 +#: irc.php:96 msgid "Popular Channels" msgstr "" diff --git a/irc/templates/admin.tpl b/irc/templates/admin.tpl deleted file mode 100644 index 7a50a6f7..00000000 --- a/irc/templates/admin.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{{include file="field_input.tpl" field=$autochans}} -{{include file="field_input.tpl" field=$sitechats}} -
- diff --git a/irc/templates/settings.tpl b/irc/templates/settings.tpl deleted file mode 100644 index e463a59c..00000000 --- a/irc/templates/settings.tpl +++ /dev/null @@ -1,15 +0,0 @@ - -

{{$header}}

-
- diff --git a/planets/planets.php b/planets/planets.php index d40e6c61..72698cb9 100755 --- a/planets/planets.php +++ b/planets/planets.php @@ -92,7 +92,7 @@ function planets_post_hook($a, &$item) { * */ - $planets = array('Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'); + $planets = array('Alderaan','Tatooine','Dagoba','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'); $planet = array_rand($planets,1); $item['location'] = $planets[$planet]; @@ -146,20 +146,12 @@ function planets_settings(&$a,&$s) { /* Add some HTML to the existing form */ - $s .= ''; - $s .= '

' . t('Planets') . '

'; - $s .= '
'; - $s .= ''; } } 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 ^^ */ @@ -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']; @@ -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) { @@ -291,11 +291,11 @@ function statusnet_settings(&$a,&$s) { $css = (($enabled) ? '' : '-disabled'); $s .= ''; - $s .= '

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

'; + $s .= '

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

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