diff --git a/convpath/convpath.php b/convpath/convpath.php index 8deb46cf..0aaeb5f9 100644 --- a/convpath/convpath.php +++ b/convpath/convpath.php @@ -4,7 +4,7 @@ * Description: Converts all internal paths according to the current scheme (http or https) * Version: 1.0 * Author: Michael Vogel - * + * Status: Unsupported */ function convpath_install() { diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index cb2ee000..51e34e60 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -731,7 +731,7 @@ function pumpio_fetchtimeline(&$a, $uid) { if ($receiver->id == "http://activityschema.org/collection/public") $public = true; - if ($public AND !strstr($post->generator->displayName, $application_name)) { + if ($public AND !stristr($post->generator->displayName, $application_name)) { require_once('include/html2bbcode.php'); $_SESSION["authenticated"] = true; diff --git a/smileybutton/icon.gif b/smileybutton/icon.gif new file mode 100644 index 00000000..6ce09471 Binary files /dev/null and b/smileybutton/icon.gif differ diff --git a/smileybutton/smileybutton.css b/smileybutton/smileybutton.css new file mode 100755 index 00000000..916e0416 --- /dev/null +++ b/smileybutton/smileybutton.css @@ -0,0 +1,21 @@ + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; +} + +#smileybutton-enable-label { + float: left; + width: 200px; + margin-bottom: 25px; +} + +#smileybutton-checkbox { + float: left; +} + + diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index 50a61606..d53794b9 100755 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -2,42 +2,68 @@ /** * Name: Smileybutton * Description: Adds a smileybutton to the Inputbox - * Version: 0.2 - * Author: Johannes Schwab + * Version: 0.1 + * Author: Johannes Schwab */ function smileybutton_install() { - //Register hooks + + /** + * + * Register hooks for jot_tool and plugin_settings + * + */ + register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); + register_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); + register_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); logger("installed smileybutton"); } function smileybutton_uninstall() { - //Delet registered hooks - unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); + /** + * + * Delet registered hooks + * + */ + + unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); + unregister_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); + unregister_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); + logger("removed smileybutton"); } function show_button($a, &$b) { - // Disable if theme is quattro - // TODO add style for quattro - if (current_theme() == 'quattro') - return; - - // Disable for mobile because most mobiles have a smiley key for ther own - if ($a->is_mobile || $a->is_tablet) - return; /** * - * I have copied this from /include/text.php, removed doubles - * and escaped them. + * Check if it is a local user and he has enabled smileybutton + * + */ + + if(! local_user()) { + $nobutton = false; + } else { + $nobutton = get_pconfig(local_user(), 'smileybutton', 'nobutton'); + } + + /** + * + * Prepare the Smilie-Arrays + * + */ + + /** + * + * I have copied this from /include/text.php, removed dobles + * and some escapes. * */ @@ -94,12 +120,22 @@ function show_button($a, &$b) { 'red' ); - // Call hooks to get aditional smileies from other addons + /** + * + * Call hooks to get aditional smileies from other addons + * + */ + $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed call_hooks('smilie', $params); - //Generate html for smiley list - $s = "\n\t"; + /** + * + * Generate html for smileylist + * + */ + + $s = "\t
\n"; for($x = 0; $x < count($params['texts']); $x ++) { $icon = $params['icons'][$x]; $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); @@ -109,58 +145,139 @@ function show_button($a, &$b) { $s .= "\n\t"; } } - $s .= "\t
"; + $s .= "\t\n"; - //Add css to header - $css_file = 'addon/smileybutton/view/'.current_theme().'.css'; - if (! file_exists($css_file)) - $css_file = 'addon/smileybutton/view/default.css'; - $css_url = $a->get_baseurl().'/'.$css_file; + /** + * + * Add css to page + * + */ - $a->page['htmlhead'] .= ''."\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; - - //Get the correct image for the theme - $image = 'addon/smileybutton/view/'.current_theme().'.png'; - if (! file_exists($image)) - $image = 'addon/smileybutton/view/default.png'; - $image_url = $a->get_baseurl().'/'.$image; + /** + * + * Add the button to the Inputbox + * + */ + if (! $nobutton) { + $b = "
\n"; + $b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" onclick=\"toggle_smileybutton()\" alt=\"smiley\">\n"; + $b .= "\t
\n"; + } - //Add the hmtl and script to the page - $b = <<< EOT -
- smiley -
+ + /** + * + * Write the smileies to an (hidden) div + * + */ - + if ($nobutton) { + $b .= "\t
\n"; + } else { + $b .= "\t
\n"; + } + $b .= $s . "\n"; + $b .= "
\n"; - \n"; +} + + + + + +/** + * + * Set the configuration + * + */ + +function smileybutton_settings_post($a,$post) { + if(! local_user()) + return; + if($_POST['smileybutton-submit']) + set_pconfig(local_user(),'smileybutton','nobutton',intval($_POST['smileybutton'])); + +} + + +/** + * + * Add configuration-dialog to form + * + */ + + +function smileybutton_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variable */ + + $nobutton = get_pconfig(local_user(),'smileybutton','nobutton'); + $checked = (($nobutton) ? ' checked="checked" ' : ''); + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

Smileybutton settings

'; + $s .= '
'; + + $s .= 'You can hide the button and show the smilies directly.

'; + + $s .= ''; + $s .= ''; + + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; - function smileybutton_addsmiley(text) { - if(plaintext == "none") { - var v = $("#profile-jot-text").val(); - v = v + text; - $("#profile-jot-text").val(v); - $("#profile-jot-text").focus(); - } else { - var v = tinymce.activeEditor.getContent(); - v = v + text; - tinymce.activeEditor.setContent(v); - tinymce.activeEditor.focus(); - } - } - -EOT; } diff --git a/smileybutton/view/default.css b/smileybutton/view/default.css deleted file mode 100644 index 16120360..00000000 --- a/smileybutton/view/default.css +++ /dev/null @@ -1,13 +0,0 @@ -img.smiley_button { - height: 18px; - width: 18px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; -} diff --git a/smileybutton/view/default.png b/smileybutton/view/default.png deleted file mode 100644 index 6ad02a18..00000000 Binary files a/smileybutton/view/default.png and /dev/null differ diff --git a/smileybutton/view/default.svg b/smileybutton/view/default.svg deleted file mode 100644 index c39e68df..00000000 --- a/smileybutton/view/default.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/smileybutton/view/duepuntozero.css b/smileybutton/view/duepuntozero.css deleted file mode 100644 index 0f4ef4ae..00000000 --- a/smileybutton/view/duepuntozero.css +++ /dev/null @@ -1,21 +0,0 @@ -img.smiley_button { - height: 18px; - width: 18px; - position: relative; - left: 285px; - top: -45px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; - -moz-border-radius: 3px; - border-radius: 3px; - position: relative; - left: 285px; - top: -36px; -} diff --git a/smileybutton/view/duepuntozero.png b/smileybutton/view/duepuntozero.png deleted file mode 100644 index b9ee401d..00000000 Binary files a/smileybutton/view/duepuntozero.png and /dev/null differ diff --git a/smileybutton/view/frost.css b/smileybutton/view/frost.css deleted file mode 100644 index 42e18f05..00000000 --- a/smileybutton/view/frost.css +++ /dev/null @@ -1,21 +0,0 @@ -img.smiley_button { - height: 25; - width: 25px; - position: relative; - left: 335px; - top: -45px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; - -moz-border-radius: 3px; - border-radius: 3px; - position: relative; - left: 285px; - top: -36px; -} diff --git a/smileybutton/view/frost.png b/smileybutton/view/frost.png deleted file mode 100644 index 6ad02a18..00000000 Binary files a/smileybutton/view/frost.png and /dev/null differ diff --git a/smileybutton/view/smoothly.css b/smileybutton/view/smoothly.css deleted file mode 100644 index 14ed961a..00000000 --- a/smileybutton/view/smoothly.css +++ /dev/null @@ -1,21 +0,0 @@ -img.smiley_button { - height: 22px; - width: 22px; - position: relative; - left: -330px; - margin: 4px; - -moz-border-radius: 0px; - border-radius: 0px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; - -moz-border-radius: 5px; - border-radius: 5px; - margin: 5px; -} diff --git a/smileybutton/view/smoothly.png b/smileybutton/view/smoothly.png deleted file mode 100644 index 312a0c33..00000000 Binary files a/smileybutton/view/smoothly.png and /dev/null differ diff --git a/smileybutton/view/smoothly.svg b/smileybutton/view/smoothly.svg deleted file mode 100644 index 8f5d26a2..00000000 --- a/smileybutton/view/smoothly.svg +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/smileybutton/view/vier.css b/smileybutton/view/vier.css deleted file mode 100644 index 4f237800..00000000 --- a/smileybutton/view/vier.css +++ /dev/null @@ -1,15 +0,0 @@ -img.smiley_button { - height: 18px; - width: 18px; - margin-right: 18px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #999999; - margin-left: 10px; -} diff --git a/smileybutton/view/vier.png b/smileybutton/view/vier.png deleted file mode 100644 index 440f6a37..00000000 Binary files a/smileybutton/view/vier.png and /dev/null differ diff --git a/smileybutton/view/vier.svg b/smileybutton/view/vier.svg deleted file mode 100644 index 4b86d960..00000000 --- a/smileybutton/view/vier.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index f4dc7553..6713842e 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -838,7 +838,7 @@ function statusnet_fetchtimeline($a, $uid) { if ($post->in_reply_to_status_id != "") continue; - if (!strpos($post->source, $application_name)) { + if (!stristr($post->source, $application_name)) { $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid; diff --git a/twitter/twitter.php b/twitter/twitter.php index 3919bf8b..f0076703 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -751,7 +751,7 @@ function twitter_fetchtimeline($a, $uid) { if ($first_time) continue; - if (!strpos($post->source, $application_name)) { + if (!stristr($post->source, $application_name)) { $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid;