diff --git a/blackout/LICENSE b/blackout/LICENSE new file mode 100644 index 00000000..8a66fbdf --- /dev/null +++ b/blackout/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Tobias Diekershoff + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/blackout/README b/blackout/README.md similarity index 85% rename from blackout/README rename to blackout/README.md index 0580d527..1974ef7b 100644 --- a/blackout/README +++ b/blackout/README.md @@ -1,11 +1,12 @@ -Name: blackout -Description: Blackout your ~friendica node during a given period -License: MIT -Version: 1.0 -Author: Tobias Diekershoff +blackout addon +============== +* Description: Blackout your ~friendica node during a given period +* License: [MIT](http://opensource.org/licenses/MIT) +* Version: 1.0 +* Author: Tobias Diekershoff About -===== +----- This plugin will allow you to enter a date/time period during which all your ~friendica visitors from the web will be redirected to a page @@ -21,12 +22,12 @@ the entered time periode and fix typos without having to hack the database directly. Requirements -============ +------------- -THIS ADDON REQUIRES PHP VERSION 5.3 OR HIGHER. +**THIS ADDON REQUIRES PHP VERSION 5.3 OR HIGHER.** License -======= +------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/blackout/blackout.php b/blackout/blackout.php index 83495611..e629b7a3 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -4,7 +4,7 @@ * Description: Blackout your ~friendica node during a given period, requires PHP >= 5.3 * License: MIT * Version: 1.0 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * * About * ===== diff --git a/cal.tgz b/cal.tgz new file mode 100644 index 00000000..2c080ac5 Binary files /dev/null and b/cal.tgz differ diff --git a/cal/LICENSE b/cal/LICENSE new file mode 100644 index 00000000..2c696e9a --- /dev/null +++ b/cal/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Tobias Diekershoff + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/cal/README.md b/cal/README.md new file mode 100644 index 00000000..cb7501cd --- /dev/null +++ b/cal/README.md @@ -0,0 +1,29 @@ +Calendar Export +=============== + +This addon makes it possible to export the events posted by your users, +so they can be imported into other calendar applications. + +Exporting a calendar is an _opt-in_ feature which has to be activated by each +of the users in the _addon settings_. As the admin you can only provide the +service but should not force it upon your users. + +The calendars are exported at + + http://example.com/cal/username/export/format + +currently the following formats are supported + +* ical +* csv. + +Author +------ + +This addon is developed by [Tobias Diekershoff](https://f.diekershoff.de/profile/tobias). + +License +------- + +This addon is licensed under the [MIT](http://opensource.org/licenses/MIT) +license, see also the LICENSE file in the addon directory. diff --git a/cal/cal.php b/cal/cal.php new file mode 100644 index 00000000..8841be43 --- /dev/null +++ b/cal/cal.php @@ -0,0 +1,192 @@ + + * License: MIT + * ******************************************************************/ + + +function cal_install() +{ + register_hook('plugin_settings', 'addon/cal/cal.php', 'cal_addon_settings'); + register_hook('plugin_settings_post', 'addon/cal/cal.php', 'cal_addon_settings_post'); +} +function cal_uninstall() +{ + unregister_hook('plugin_settings', 'addon/cal/cal.php', 'cal_addon_settings'); + unregister_hook('plugin_settings_post', 'addon/cal/cal.php', 'cal_addon_settings_post'); +} +function cal_module() +{ +} +/* pathes + * /cal/$user/export/$format + * currently supported formats are ical (iCalendar) and CSV + */ +function cal_content() +{ + $a = get_app(); + $o = ""; + if ($a->argc == 1) { + $o .= "

".t('Event Export')."

".t('You can download public events from: ').$a->get_baseurl()."/cal/username/export/ical

"; + } elseif ($a->argc==4) { + // get the parameters from the request we just received + $username = $a->argv[1]; + $do = $a->argv[2]; + $format = $a->argv[3]; + // check that there is a user matching the requested profile + $r = q("SELECT uid FROM user WHERE nickname='".$username."' LIMIT 1;"); + if (count($r)) + { + $uid = $r[0]['uid']; + } else { + killme(); + } + // if we shall do anything other then export, end here + if (! $do == 'export' ) + killme(); + // check if the user allows us to share the profile + $enable = get_pconfig( $uid, 'cal', 'enable'); + if (! $enable == 1) { + info(t('The user does not export the calendar.')); + return; + } + // we are allowed to show events + // get the timezone the user is in + $r = q("SELECT timezone FROM user WHERE uid=".$uid." LIMIT 1;"); + if (count($r)) + $timezone = $r[0]['timezone']; + // does the user who requests happen to be the owner of the events + // requested? then show all of your events, otherwise only those that + // don't have limitations set in allow_cid and allow_gid + if (local_user() == $uid) { + $r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location` FROM `event` WHERE `uid`=".$uid." and `cid`=0;"); + } else { + $r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location` FROM `event` WHERE `allow_cid`='' and `allow_gid`='' and `uid`='".$uid."' and `cid`='0';"); + } + // we have the events that are available for the requestor + // now format the output according to the requested format + $res = cal_format_output($r, $format, $timezone); + if (! $res=='') + info($res); + } else { + // wrong number of parameters + killme(); + } + return $o; +} + +function cal_format_output ($r, $f, $tz) +{ + $res = t('This calendar format is not supported'); + switch ($f) + { + // format the exported data as a CSV file + case "csv": + header("Content-type: text/csv"); + $o = '"Subject", "Start Date", "Start Time", "Description", "End Date", "End Time", "Location"' . PHP_EOL; + foreach ($r as $rr) { +// TODO the time / date entries don't include any information about the +// timezone the event is scheduled in :-/ + $tmp1 = strtotime($rr['start']); + $tmp2 = strtotime($rr['finish']); + $time_format = "%H:%M:%S"; + $date_format = "%Y-%m-%d"; + $o .= '"'.$rr['summary'].'", "'.strftime($date_format, $tmp1) . + '", "'.strftime($time_format, $tmp1).'", "'.$rr['desc'] . + '", "'.strftime($date_format, $tmp2) . + '", "'.strftime($time_format, $tmp2) . + '", "'.$rr['location'].'"' . PHP_EOL; + } + echo $o; + killme(); + + case "ical": + header("Content-type: text/ics"); + $o = 'BEGIN:VCALENDAR'. PHP_EOL + . 'VERSION:2.0' . PHP_EOL + . 'PRODID:-//friendica calendar export//0.1//EN' . PHP_EOL; +// TODO include timezone informations in cases were the time is not in UTC +// see http://tools.ietf.org/html/rfc2445#section-4.8.3 +// . 'BEGIN:VTIMEZONE' . PHP_EOL +// . 'TZID:' . $tz . PHP_EOL +// . 'END:VTIMEZONE' . PHP_EOL; +// TODO instead of PHP_EOL CRLF should be used for long entries +// but test your solution against http://icalvalid.cloudapp.net/ +// also long lines SHOULD be split at 75 characters length + foreach ($r as $rr) { + if ($rr['adjust'] == 1) { + $UTC = 'Z'; + } else { + $UTC = ''; + } + $o .= 'BEGIN:VEVENT' . PHP_EOL; + if ($rr[start]) { + $tmp = strtotime($rr['start']); + $dtformat = "%Y%m%dT%H%M%S".$UTC; + $o .= 'DTSTART:'.strftime($dtformat, $tmp).PHP_EOL; + } + if ($rr['finish']) { + $tmp = strtotime($rr['finish']); + $dtformat = "%Y%m%dT%H%M%S".$UTC; + $o .= 'DTEND:'.strftime($dtformat, $tmp).PHP_EOL; + } + if ($rr['summary']) + $tmp = $rr['summary']; + $tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp); + $tmp = addcslashes($tmp, ',;'); + $o .= 'SUMMARY:' . $tmp . PHP_EOL; + if ($rr['desc']) + $tmp = $rr['desc']; + $tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp); + $tmp = addcslashes($tmp, ',;'); + $o .= 'DESCRIPTION:' . $tmp . PHP_EOL; + if ($rr['location']) { + $tmp = $rr['location']; + $tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp); + $tmp = addcslashes($tmp, ',;'); + $o .= 'LOCATION:' . $tmp . PHP_EOL; + } + $o .= 'END:VEVENT' . PHP_EOL; + } + $o .= 'END:VCALENDAR' . PHP_EOL; + echo $o; + killme(); + } + return $res; +} + +function cal_addon_settings_post ( &$a, &$b ) +{ + if (! local_user()) + return; + + if (!x($_POST,'cal-submit')) + return; + + set_pconfig(local_user(),'cal','enable',intval($_POST['cal-enable'])); +} +function cal_addon_settings ( &$a, &$s ) +{ + if (! local_user()) + return; + + $enabled = get_pconfig(local_user(), 'cal', 'enable'); + $checked = (($enabled) ? ' checked="checked" ' : ''); + $url = $a->get_baseurl().'/cal/'.$a->user['nickname'].'/export/format'; + + $s .= '

'.t('Export Events').'

'; + $s .= '

'.t('If this is enabled, your public events will be available at').' '.$url.'

'; + $s .= '

'.t('Currently supported formats are ical and csv.').'

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + $s .= '
'; + $s .= '
'; + +} + +?> diff --git a/cal/lang/C/messages.po b/cal/lang/C/messages.po new file mode 100644 index 00000000..db7ae28b --- /dev/null +++ b/cal/lang/C/messages.po @@ -0,0 +1,54 @@ +# ADDON cal +# Copyright (C) +# This file is distributed under the same license as the Friendica cal addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-06-19 13:20+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cal.php:33 +msgid "Event Export" +msgstr "" + +#: cal.php:33 +msgid "You can download public events from: " +msgstr "" + +#: cal.php:53 +msgid "The user does not export the calendar." +msgstr "" + +#: cal.php:83 +msgid "This calendar format is not supported" +msgstr "" + +#: cal.php:174 +msgid "Export Events" +msgstr "" + +#: cal.php:175 +msgid "If this is enabled, your public events will be available at" +msgstr "" + +#: cal.php:176 +msgid "Currently supported formats are ical and csv." +msgstr "" + +#: cal.php:178 +msgid "Enable calendar export" +msgstr "" + +#: cal.php:181 +msgid "Submit" +msgstr "" diff --git a/cal/lang/C/strings.php b/cal/lang/C/strings.php new file mode 100644 index 00000000..a72dc119 --- /dev/null +++ b/cal/lang/C/strings.php @@ -0,0 +1,12 @@ +strings["Event Export"] = ""; +$a->strings["You can download public events from: "] = ""; +$a->strings["The user does not export the calendar."] = ""; +$a->strings["This calendar format is not supported"] = ""; +$a->strings["Export Events"] = ""; +$a->strings["If this is enabled, your public events will be available at"] = ""; +$a->strings["Currently supported formats are ical and csv."] = ""; +$a->strings["Enable calendar export"] = ""; +$a->strings["Submit"] = ""; diff --git a/cal/lang/de/strings.php b/cal/lang/de/strings.php new file mode 100644 index 00000000..968a0a8a --- /dev/null +++ b/cal/lang/de/strings.php @@ -0,0 +1,11 @@ +strings["Event Export"] = "Export von Veranstaltungen"; +$a->strings["You can download public events from: "] = "Öffentliche Veranstaltungen können unter folgender Adresse geladen werden: "; +$a->strings["The user does not export the calendar."] = "Dieser Nutzer exportiert keine Veranstaltungen."; +$a->strings["This calendar format is not supported"] = "Dieses Kalenderformat wird nicht unterstützt "; +$a->strings["Export Events"] = "Export von Veranstaltungen"; +$a->strings["If this is enabled, your public events will be available at"] = "Ist dieses Addon aktiviert werden deine öffentlichen Veranstaltungen exportiert. Die Adresse zum Download lautet"; +$a->strings["Currently supported formats are ical and csv."] = "Derzeit werden die Formate ical und csv unterstützt."; +$a->strings["Enable calendar export"] = "Aktiviere den Kalenderexport"; diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 05cc8ec2..5d0e86c3 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -212,7 +212,7 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) { return($cleaned); } -function fromgplus_handleattachments($item) { +function fromgplus_handleattachments($item, $displaytext) { $post = ""; $quote = ""; @@ -251,7 +251,7 @@ function fromgplus_handleattachments($item) { elseif ($images["full"] != "") $post .= "\n[img]".$images["full"]."[/img]\n"; - if ($attachment->displayName != "") + if (($attachment->displayName != "") AND ($attachment->displayName != $displaytext)) $post .= fromgplus_html2bbcode($attachment->displayName)."\n"; break; @@ -319,7 +319,7 @@ function fromgplus_fetch($a, $uid) { $post = fromgplus_html2bbcode($item->object->content); if (is_array($item->object->attachments)) - $post .= fromgplus_handleattachments($item); + $post .= fromgplus_handleattachments($item, $item->object->content); // geocode, placeName if (isset($item->address)) @@ -346,7 +346,7 @@ function fromgplus_fetch($a, $uid) { $post .= fromgplus_html2bbcode($item->object->content); if (is_array($item->object->attachments)) - $post .= "\n".trim(fromgplus_handleattachments($item)); + $post .= "\n".trim(fromgplus_handleattachments($item, $item->object->content)); $post .= "[/share]"; } else { @@ -355,7 +355,7 @@ function fromgplus_fetch($a, $uid) { $post .= fromgplus_html2bbcode($item->object->content); if (is_array($item->object->attachments)) - $post .= "\n".trim(fromgplus_handleattachments($item)); + $post .= "\n".trim(fromgplus_handleattachments($item, $item->object->content)); } if (isset($item->address)) diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php index db240aa3..dae59efe 100644 --- a/gpluspost/gpluspost.php +++ b/gpluspost/gpluspost.php @@ -2,7 +2,7 @@ /** * Name: G+ Post - * Description: Posts to a Google+ page with the help of Seesmic + * Description: Posts to a Google+ page with the help of Hootsuite * Version: 0.1 * Author: Michael Vogel */ @@ -51,6 +51,9 @@ function gpluspost_settings(&$a,&$s) { $noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention'); $noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : ''); + $skip_enabled = get_pconfig(local_user(),'gpluspost','skip_without_link'); + $skip_checked = (($skip_enabled) ? ' checked="checked" ' : ''); + $s .= '
'; $s .= '

' . t('Google+ Post Settings') . '

'; $s .= '
'; @@ -68,6 +71,11 @@ function gpluspost_settings(&$a,&$s) { $s .= ''; $s .= '
'; + $s .= '
'; + /* provide a submit button */ $s .= '
'; @@ -81,6 +89,7 @@ function gpluspost_settings_post(&$a,&$b) { set_pconfig(local_user(),'gpluspost','post',intval($_POST['gpluspost'])); set_pconfig(local_user(),'gpluspost','post_by_default',intval($_POST['gpluspost_bydefault'])); set_pconfig(local_user(),'gpluspost','no_loop_prevention',intval($_POST['gpluspost_noloopprevention'])); + set_pconfig(local_user(),'gpluspost','skip_without_link',intval($_POST['gpluspost_skipwithoutlink'])); } } @@ -286,7 +295,7 @@ function gpluspost_feeditem($pid, $uid) { require_once('include/bbcode.php'); require_once("include/html2plain.php"); - $max_char = 140; + $skipwithoutlink = get_pconfig($uid,'gpluspost','skip_without_link'); $items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid)); foreach ($items AS $item) { @@ -349,7 +358,9 @@ function gpluspost_feeditem($pid, $uid) { else if ($image != "") $msglink = $image; - if ($msglink == "") + if (($msglink == "") AND $skipwithoutlink) + continue; + else if ($msglink == "") $msglink = $item["plink"]; // Fetching the title - or the first line diff --git a/impressum.tgz b/impressum.tgz index c483e085..d1c70af7 100755 Binary files a/impressum.tgz and b/impressum.tgz differ diff --git a/impressum/LICENSE b/impressum/LICENSE new file mode 100644 index 00000000..6e29fda4 --- /dev/null +++ b/impressum/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011-2013 Tobias Diekershoff +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/impressum/README b/impressum/README deleted file mode 100755 index fcf29aaf..00000000 --- a/impressum/README +++ /dev/null @@ -1,34 +0,0 @@ -Impressum Plugin for Friendica - -Author: Tobias Diekershoff - http://diekershoff.homeunix.net/friendika/profile/tobias - tobias.diekershoff@gmx.net - -License: 3-clause BSD license - -About - This plugin adds an Impressum block to the /friendica page with informations - about the page operator/owner and how to contact you in case of any questions. - - In the notes and postal fields you can use HTML tags for formatting. - -Configuration: - Simply fill in the fields in the impressium settings page in the plugins area - of your admin panel. - -If you for any reason prefer to use a configuration file instead, you can set the -following variables in the .htconfig file - - * $a->config['impressum']['owner'] this is the Name of the Operator - * $a->config['impressum']['ownerprofile'] this is an optional Friendica account - where the above owner name will link to - * $a->config['impressum']['email'] a contact email address (optional) - will be displayed slightly obfuscated - as name(at)example(dot)com - - * $a->config['impressum']['postal'] should contain a postal address where - you can be reached at (optional) - * $a->config['impressum']['notes'] additional informations that should - be displayed in the Impressum block - * $a->config['impressum']['footer_text'] Text that will be displayed at - the bottom of the pages. diff --git a/impressum/README.md b/impressum/README.md new file mode 100755 index 00000000..cf420ba1 --- /dev/null +++ b/impressum/README.md @@ -0,0 +1,38 @@ +Impressum Plugin for Friendica +============================== + +* Author: Tobias Diekershoff +* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license + (see the LICENSE file in the addon directory) + +About +----- +This plugin adds an Impressum (contact) block to the /friendica page with +informations about the page operator/owner and how to contact you in case of +any questions. + +In the notes and postal fields you can use bbcode tags for formatting, like in +normal friendica postings.. + +Configuration +------------- +Simply fill in the fields in the impressium settings page in the plugins +area of your admin panel. For email adresses the "@" symbol will be obfuscated +in the source of the page to make in harder for harvesting tools. + +Manual Configuration +-------------------- +If you for any reason prefer to use a configuration file instead, you can set the following variables in the .htconfig file + + $a->config['impressum']['owner'] this is the Name of the Operator + $a->config['impressum']['ownerprofile'] this is an optional Friendica account + where the above owner name will link to + $a->config['impressum']['email'] a contact email address (optional) + will be displayed slightly obfuscated + as name(at)example(dot)com + $a->config['impressum']['postal'] should contain a postal address where + you can be reached at (optional) + $a->config['impressum']['notes'] additional informations that should + be displayed in the Impressum block + $a->config['impressum']['footer_text'] Text that will be displayed at + the bottom of the pages. diff --git a/impressum/impressum.php b/impressum/impressum.php index 3c1106c9..6714dfc1 100755 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -2,8 +2,8 @@ /** * Name: Impressum * Description: Plugin to add contact information to the about page (/friendica) - * Version: 1.2 - * Author: Tobias Diekershoff + * Version: 1.3 + * Author: Tobias Diekershoff * License: 3-clause BSD license */ @@ -20,6 +20,14 @@ function impressum_uninstall() { unregister_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); logger("uninstalled impressum plugin"); } + +function impressum_module() { +} +function impressum_content() { + $a = get_app(); + goaway($a->get_baseurl().'/friendica/'); +} + function obfuscate_email ($s) { $s = str_replace('@','(at)',$s); $s = str_replace('.','(dot)',$s); diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 69c58e94..aac5c548 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -122,6 +122,22 @@ function jappixmini_plugin_admin(&$a, &$o) { $o .= ''; $o .= '
'; + // bosh address + $bosh_address = get_config("jappixmini", "bosh_address"); + $o .= '


'; + $o .= '

'; + + // default server address + $default_server = get_config("jappixmini", "default_server"); + $o .= '


'; + $o .= '

'; + + // default user name to friendica nickname + $default_user = intval(get_config("jappixmini", "default_user")); + $default_user = intval($default_user) ? ' checked="checked"' : ''; + $o .= ''; + $o .= '
'; + // info text field $info_text = get_config("jappixmini", "infotext"); $o .= '


'; @@ -137,8 +153,14 @@ function jappixmini_plugin_admin_post(&$a) { if ($submit) { $info_text = $_REQUEST['jappixmini-infotext']; $bosh_proxy = intval($_REQUEST['jappixmini-proxy']); + $default_user = intval($_REQUEST['jappixmini-defaultuser']); + $bosh_address = $_REQUEST['jappixmini-address']; + $default_server = $_REQUEST['jappixmini-server']; set_config("jappixmini", "infotext", $info_text); set_config("jappixmini", "bosh_proxy", $bosh_proxy); + set_config("jappixmini", "bosh_address", $bosh_address); + set_config("jappixmini", "default_server", $default_server); + set_config("jappixmini", "default_user", $default_user); } } @@ -224,6 +246,11 @@ function jappixmini_settings(&$a, &$s) { $dontinsertchat = get_pconfig(local_user(),'jappixmini','dontinsertchat'); $insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : ''); + $defaultbosh = get_config("jappixmini", "bosh_address"); + + if ($defaultbosh != "") + set_pconfig(local_user(),'jappixmini','bosh', $defaultbosh); + $username = get_pconfig(local_user(),'jappixmini','username'); $username = htmlentities($username); $server = get_pconfig(local_user(),'jappixmini','server'); @@ -239,6 +266,12 @@ function jappixmini_settings(&$a, &$s) { $encrypt_checked = $encrypt ? ' checked="checked"' : ''; $encrypt_disabled = $encrypt ? '' : ' disabled="disabled"'; + if ($server == "") + $server = get_config("jappixmini", "default_server"); + + if (($username == "") and get_config("jappixmini", "default_user")) + $username = $a->user["nickname"]; + $info_text = get_config("jappixmini", "infotext"); $info_text = htmlentities($info_text); $info_text = str_replace("\n", "
", $info_text); @@ -278,9 +311,12 @@ function jappixmini_settings(&$a, &$s) { $s .= ' '; $s .= '
'; - $s .= ''; - $s .= ' '; - $s .= '
'; + if (defaultbosh == "") { + $s .= ''; + $s .= ' '; + $s .= '
'; + } + $s .= ''; $s .= ' '; diff --git a/jappixmini/lib.js b/jappixmini/lib.js index a777a7fd..ed52f597 100644 --- a/jappixmini/lib.js +++ b/jappixmini/lib.js @@ -40,7 +40,7 @@ function jappixmini_addon_get_client_secret(callback) { var div = document.getElementById("#jappixmini-password-query-div"); if (!div) { - div = $('

Retype your Friendica password for chatting:
'); + div = $('
Retype your Friendica password for chatting:
'); var input = $('') div.append(input); diff --git a/mathjax/LICENSE b/mathjax/LICENSE new file mode 100644 index 00000000..6e29fda4 --- /dev/null +++ b/mathjax/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011-2013 Tobias Diekershoff +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/mathjax/README b/mathjax/README deleted file mode 100644 index 023e1c89..00000000 --- a/mathjax/README +++ /dev/null @@ -1,31 +0,0 @@ -Addon for Friendika to include MathJax (LaTeX math syntax) - -This addon lets your users use LaTeX to type mathematical formulas -within their posts. MathJax takes care about the best method for the -browser to display the formula and provides compatibility to 99% -of the modern browsers. - -You can either use the MathJax CDN online, thus loading the required javascript -libraries from the MathJax cloud, or use a local installation of MathJax. -Please see the plugin settings in the admin panel for configuration possibles. -If you don't set up a local MathJax instance, leave the configuration untouched -it will fall back to the MathJax cloud as default value. - -If you don't use the admin panel add mathjax to the list of active addons - -$a->config['system']['addon'] = [..., mathjax, ...] - -To select the source of the included javascript libraries add a line - -$a->config['mathjax']['baseurl'] = 'the URL to your MathJax installation'; - -to your .htconfig.php file. If this line is not there, the addon assumes that -you want to use the MathJax cloud (CDN). - -Please note that your usage of the CDN is governed by the "MathJax CDN Terms of -Service" see http://www.mathjax.org/download/mathjax-cdn-terms-of-service/ - -Author: Tobias Diekershoff - http://diekershoff.homeunix.net/friendika/profile/tobias - email: tobias.diekershoff@gmx.net - diff --git a/mathjax/README.md b/mathjax/README.md new file mode 100644 index 00000000..9647a986 --- /dev/null +++ b/mathjax/README.md @@ -0,0 +1,43 @@ +MathJax Addon +============= + +* Author: Tobias Diekershoff +* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license + (see the LICENSE file in the addon directory) + +About +----- + +This addon for friendica includes the [MathJax][1] CDN to enable rendering of +[LaTeX][2] formulae in your friendica postings. + +Configuration +------------- +All you need to do is provide friendica with the base URL of MathJax. This can +be either the URL of the CDN of MathJax or your own installation. + +In case you want to use the CDN you can try the following URL as a quick start + + http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML + +In case you don't want or can use the admin panel of firneidca you can activate +the addon by adding _mathjax_ to the + + $a->config['system']['addon'] + +list in your .htconfig.php file and then providing the base URL after that + + $a->config['mathjax']['baseurl'] = 'the URL to your MathJax installation'; + +Usage +===== + +Once the addon is configured you can use LaTeX syntax in your postings to share +formulae with your contacts. But remember that the formulae are rendered in the +browser of the user thus your contacts need to activate this addon as well. If +they don't they will only see the LaTeX syntax in your texts. + +Just enclose your equations in $$...$$ pairs like e.g. $$f_c(x)=ax+b$$. + +[1]: http://www.mathjax.org/ +[2]: https://en.wikipedia.org/wiki/LaTeX diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index e57d69bf..d97e9649 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -4,7 +4,7 @@ * Name: MathJax * Description: Addon for Friendika to include MathJax (LaTeX math syntax) * Version: 1.0 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * License: 3-clause BSD license */ @@ -72,6 +72,7 @@ function mathjax_plugin_admin (&$a, &$o) { } $o = replace_macros( $t, array( + '$submit' => t('Submit'), '$baseurl' => array('baseurl', t('MathJax Base URL'), get_config('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')), )); } diff --git a/piwik/LICENSE b/piwik/LICENSE new file mode 100644 index 00000000..5e752877 --- /dev/null +++ b/piwik/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011-2013 Tobias Diekershoff, Klaus Weidenbach +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/piwik/README b/piwik/README.md similarity index 58% rename from piwik/README rename to piwik/README.md index c648a4d1..0ac2ff72 100755 --- a/piwik/README +++ b/piwik/README.md @@ -1,24 +1,24 @@ -## Piwik Plugin ## +Piwik Plugin +============ -by Tobias Diekershoff - http://diekershoff.homeunix.net/friendika/profile/tobias - tobias.diekershoff(at)gmx.net +by Tobias Diekershoff and Klaus Weidenbach This addon allows you to embed the code necessary for the FLOSS webanalytics tool Piwik into the Friendica pages. -[Online version of this Document](http://ur1.ca/35m2x) - -### Requirements ### +Requirements +------------ To use this plugin you need a [piwik](http://piwik.org/) installation. -### Where to find ### +Where to find +------------- -In the Friendica git repository `/addon/piwik/piwik.php` and a CSS file for +In the Friendica addon git repository `/piwik/piwik.php` and a CSS file for styling the opt-out notice. -### Configuration ### +Configuration +------------- The easiest way to configure this addon is by activating the admin panels of your ~friendica server and then enter the needed details on the config page @@ -38,20 +38,31 @@ You have to add 4 more configuration variables for the addon: $a->config['piwik']['optout'] = true; $a->config['piwik']['async'] = false; -The *baseurl* points to your Piwik installation. Use the absolute path, +Configuration fields +--------------------- + +* The *baseurl* points to your Piwik installation. Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL. -Change the *sideid* parameter to whatever ID you want to use for tracking your -Friendica installation. The *optout* parameter (true|false) defines whether or +* Change the *sideid* parameter to whatever ID you want to use for tracking your +Friendica installation. +* The *optout* parameter (true|false) defines whether or not a short notice about the utilization of Piwik will be displayed on every page of your Friendica site (at the bottom of the page with some spacing to the other content). Part of the note is a link that allows the visitor to set an _opt-out_ cookie which will prevent visits from that user be tracked by piwik. +* The *async* parameter (true|false) defines whether or not to use asynchronous +tracking so pages load (or appear to load) faster. Currently the optional notice states the following: - This website is tracked using the Piwik analytics tool. If you do not want - that your visits are logged this way you can set a cookie to prevent Piwik - from tracking further visits of the site (opt-out). +> This website is tracked using the Piwik analytics tool. If you do not want +> that your visits are logged this way you can set a cookie to prevent Piwik +> from tracking further visits of the site (opt-out). -The *async* parameter (true|false) defines whether or not to use asynchronous -tracking so pages load (or appear to load) faster. +License +======= + +The _Piwik addon_ is licensed under the [3-clause BSD license][3] see the +LICENSE file in the addons directory. + +[3]: http://opensource.org/licenses/BSD-3-Clause diff --git a/piwik/piwik.php b/piwik/piwik.php index 3501b2c8..a2086bdc 100755 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -3,7 +3,7 @@ * Name: Piwik Analytics * Description: Piwik Analytics Plugin for Friendica * Version: 1.1 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * Author: Klaus Weidenbach */ @@ -26,8 +26,6 @@ * installation has. Alter the baseurl to fit your needs, don't care * about http/https but beware to put the trailing / at the end of your * setting. - * - * Documentation see http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Piwik_Plugin */ function piwik_install() { diff --git a/pumpio/README b/pumpio/README new file mode 100644 index 00000000..f658d52c --- /dev/null +++ b/pumpio/README @@ -0,0 +1,5 @@ +To let the connector work properly you should define an application name in the .htconfig: + +$a->config['pumpio']['application_name'] = "Name of you site"; + +This name appears at pump.io and is mportant for not mirroring back posts that came from friendica. diff --git a/pumpio/pumpio.css b/pumpio/pumpio.css index eba380e4..020f3697 100755 --- a/pumpio/pumpio.css +++ b/pumpio/pumpio.css @@ -1,11 +1,11 @@ -#pumpio-mirror-label,#pumpio-public-label, #pumpio-enable-label, #pumpio-username-label, #pumpio-servername-label, #pumpio-bydefault-label { +#pumpio-mirror-label,#pumpio-public-label, #pumpio-enable-label, #pumpio-username-label, #pumpio-servername-label, #pumpio-bydefault-label, #pumpio-delete-label { float: left; width: 200px; margin-top: 10px; } -#pumpio-mirror,#pumpio-public, #pumpio-checkbox, #pumpio-username, #pumpio-servername, #pumpio-bydefault { +#pumpio-mirror,#pumpio-public, #pumpio-checkbox, #pumpio-username, #pumpio-servername, #pumpio-bydefault, #pumpio-delete { float: left; margin-top: 10px; } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index b7634bcb..da723eca 100755 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -198,47 +198,59 @@ function pumpio_settings(&$a,&$s) { $s .= '
'; $s .= '

' . t('Pump.io Post Settings') . '

'; - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - $s .= '
'; $s .= ''; $s .= ''; $s .= '
'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + if (($username != '') AND ($servername != '')) { - $s .= '
'; - - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; $oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token"); $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret"); $s .= '
'; - if (($oauth_token == "") OR ($oauth_token_secret == "")) - $s .= t("You are not authenticated to pumpio"); + if (($oauth_token == "") OR ($oauth_token_secret == "")) { + $s .= '
'; + + //$s .= t("You are not authenticated to pumpio"); + } else { + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + //$s .= '
'; + + } $s .= '
'; } @@ -253,28 +265,37 @@ function pumpio_settings(&$a,&$s) { function pumpio_settings_post(&$a,&$b) { if(x($_POST,'pumpio-submit')) { - // filtering the username if it is filled wrong - $user = $_POST['pumpio_user']; - if (strstr($user, "@")) { - $pos = strpos($user, "@"); - if ($pos > 0) - $user = substr($user, 0, $pos); + if(x($_POST,'pumpio_delete')) { + set_pconfig(local_user(),'pumpio','consumer_key',''); + set_pconfig(local_user(),'pumpio','consumer_secret',''); + set_pconfig(local_user(),'pumpio','host',''); + set_pconfig(local_user(),'pumpio','oauth_token',''); + set_pconfig(local_user(),'pumpio','oauth_token_secret',''); + set_pconfig(local_user(),'pumpio','post',false); + set_pconfig(local_user(),'pumpio','post_by_default',false); + set_pconfig(local_user(),'pumpio','user',''); + } else { + // filtering the username if it is filled wrong + $user = $_POST['pumpio_user']; + if (strstr($user, "@")) { + $pos = strpos($user, "@"); + if ($pos > 0) + $user = substr($user, 0, $pos); + } + + // Filtering the hostname if someone is entering it with "http" + $host = $_POST['pumpio_host']; + $host = trim($host); + $host = str_replace(array("https://", "http://"), array("", ""), $host); + + set_pconfig(local_user(),'pumpio','post',intval($_POST['pumpio'])); + set_pconfig(local_user(),'pumpio','host',$host); + set_pconfig(local_user(),'pumpio','user',$user); + set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']); + set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']); + set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault'])); } - - // Filtering the hostname if someone is entering it with "http" - $host = $_POST['pumpio_host']; - $host = trim($host); - $host = str_replace(array("https://", "http://"), array("", ""), $host); - - set_pconfig(local_user(),'pumpio','post',intval($_POST['pumpio'])); - set_pconfig(local_user(),'pumpio','host',$host); - set_pconfig(local_user(),'pumpio','user',$user); - set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']); - set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']); - set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault'])); - } - } function pumpio_post_local(&$a,&$b) { diff --git a/statusnet.tgz b/statusnet.tgz index e92174ac..dce1dd52 100755 Binary files a/statusnet.tgz and b/statusnet.tgz differ diff --git a/statusnet/LICENSE b/statusnet/LICENSE new file mode 100644 index 00000000..062cc888 --- /dev/null +++ b/statusnet/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011-2013 Tobias Diekershoff, Michael Vogel +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/statusnet/README b/statusnet/README deleted file mode 100755 index df0412d0..00000000 --- a/statusnet/README +++ /dev/null @@ -1,102 +0,0 @@ -____ StatusNet Plugin ____ -by Tobias Diekershoff - http://diekershoff.homeunix.net/friendika/profile/tobias - tobias.diekershoff(at)gmx.net - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! This addon is currently under development. If you have any problem !! -!! with it, please contact the Author. !! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -With this addon to Friendica you can give your user the possibility to post -their public messages to any StatusNet instance (like identi.ca for example). -The messages will be strapped their rich context and shortened to to the character -limit of the StatusNet instance in question if necessary. If shortening of the -message was performed a link will be added to the notice pointing to the -original message on your server. - -There is a similar plugin to forward public messages to Twitter: Twitter Plugin. - -Online version of this document: http://ur1.ca/35mpb - -___ Requirements ___ - -Due to the distributed nature of the StatusNet network, each user who wishes to -forward public messages to a StatusNet account has to get the OAuth credentials -for themselves, which makes this addon a little bit more user unfriendly than -the Twitter Plugin is. Nothing too geeky though! - -The inclusion of a shorturl for the original posting in cases when the message -was longer than the maximal allowed notice length requires it, that you have -PHP5+ and curl on your server. -Where to find - -In the Friendica git repository /addon/statusnet/, this directory contains all -required PHP files (including the Twitter OAuth library [1] by Abraham Williams, -MIT licensed and the Slinky library [2] by Beau Lebens, BSD license), a CSS file -for styling of the user configuration and an image to Sign in with StatusNet. - -[1] https://github.com/abraham/twitteroauth -[2] http://dentedreality.com.au/projects/slinky - -___ Configuration ___ - -__ Global Configuration __ - -If you have configured an admin account, you can configure this plugin from -the admin panel. First activate it from the plugin section of the panel. -Afterwards you will have a separate configuration page for the plugin, where -you can provide a set of globally available OAuth credentials for different -StatusNet pages which will be available for all users of your server. - -If you don't use the admin panel, you can configure the relay using the -.htconfig.php file of your friendica installation. To activate the relay add -it's name to the list of activated addons. - - $a->config['system']['addon'] = "statusnet, ..." - -If you want to provide preconfigured StatusNet instances for your user add the -credentials for them by adding - -$a->config['statusnet']['sites'] = array ( - array ('sitename' => 'identi.ca', 'apiurl' => 'https://identi.ca/api/', - 'consumersecret' => 'OAuth Consumer Secret here', 'consumerkey' => 'OAuth - Consumer Key here'), - array ('sitename' => 'Some other Server', 'apiurl' => - 'http://status.example.com/api/', 'consumersecret' => 'OAuth - Consumer Secret here', 'consumerkey' => 'OAuth Consumer Key here') -); - -to the config file. - -Regardless of providing global OAuth credentials for your users or not, they -can always add their own OAuth-Key and -Secret thus enable the relay for any -StatusNet instance they may have an account at. - -__ User Configuration __ - -When the addon is activated the user has to aquire three things in order to -connect to the StatusNet account of choice. - * the base URL for the StatusNet API, for identi.ca this is - https://identi.ca/api/ - * OAuth Consumer key & secret - -To get the OAuth Consumer key pair the user has to (a) ask her Friendica admin -if a pair already exists or (b) has to register the Friendica server as a -client application on the StatusNet server. This can be done from the account -settings under "Connect -> Connections -> Register an OAuth client application --> Register a new application". - -During the registration of the OAuth client remember the following: - * there is no callback url - * register a desktop client - * with read & write access - * the Source URL should be the URL of your Friendica server - -After the required credentials for the application are stored in the -configuration you have to actually connect your Friendica account with -StatusNet. To do so follow the Sign in with StatusNet button, allow the access -and copy the security code into the plugin configuration. Friendica will then -try to acquire the final OAuth credentials from the API, if successful the -plugin settings will allow you to select to post your public messages to your -StatusNet account. diff --git a/statusnet/README.md b/statusnet/README.md new file mode 100644 index 00000000..99f3a73a --- /dev/null +++ b/statusnet/README.md @@ -0,0 +1,147 @@ +StatusNet Connector +=================== +Main authors Tobias Diekershoff and Michael Vogel. + +With this addon to friendica you can give your user the possibility to post +their public messages to any StatusNet instance. The messages will be strapped +their rich context and shortened to to the character limit of the StatusNet +instance in question if necessary. If shortening of the message was performed a +link will be added to the notice pointing to the original message on your +server. + +Requirements +------------ + +Due to the distributed nature of the StatusNet network, each user who wishes to +forward public messages to a StatusNet account has to get the OAuth credentials +for themselves, which makes this addon a little bit more user unfriendly than +the Twitter Plugin is. Nothing too geeky though! + +The inclusion of a shorturl for the original posting in cases when the message +was longer than the maximal allowed notice length requires it, that you have +PHP5+ and curl on your server. +Where to find + +In the friendica addon git repository /statusnet/, this directory contains all +required PHP files (including the [Twitter OAuth library] [1] by Abraham Williams, +MIT licensed and the [Slinky library] [2] by Beau Lebens, BSD license), a CSS file +for styling of the user configuration and an image to Sign in with StatusNet. + +[1]:https://github.com/abraham/twitteroauth +[2]:http://dentedreality.com.au/projects/slinky + +Configuration +============= + +Global Configuration +-------------------- + +**If you have configured an admin account, you can configure this plugin from +the admin panel.** First activate it from the plugin section of the panel. +Afterwards you will have a separate configuration page for the plugin, where +you can provide a set of globally available OAuth credentials for different +StatusNet pages which will be available for all users of your server. + +If you don't use the admin panel, you can configure the relay using the +.htconfig.php file of your friendica installation. To activate the relay add +it's name to the list of activated addons. + + $a->config['system']['addon'] = "statusnet, ..." + +If you want to provide preconfigured StatusNet instances for your user add the +credentials for them by adding + + $a->config['statusnet']['sites'] = array ( + array ('sitename' => 'identi.ca', 'apiurl' => 'https://identi.ca/api/', + 'consumersecret' => 'OAuth Consumer Secret here', 'consumerkey' => 'OAuth + Consumer Key here'), + array ('sitename' => 'Some other Server', 'apiurl' => + 'http://status.example.com/api/', 'consumersecret' => 'OAuth + Consumer Secret here', 'consumerkey' => 'OAuth Consumer Key here') + ); + +to the config file. + +Regardless of providing global OAuth credentials for your users or not, they +can always add their own OAuth-Key and -Secret thus enable the relay for any +StatusNet instance they may have an account at. + +User Configuration +------------------ + +When the addon is activated the user has to acquire three things in order to +connect to the StatusNet account of choice. + +* the base URL for the StatusNet API, for identi.ca this was https://identi.ca/api/ +* OAuth Consumer key & secret + +To get the OAuth Consumer key pair the user has to (a) ask her Friendica admin +if a pair already exists or (b) has to register the Friendica server as a +client application on the StatusNet server. This can be done from the account +settings under "Connect -> Connections -> Register an OAuth client application +-> Register a new application". + +During the registration of the OAuth client remember the following: + +* there is no callback URL +* register a desktop client +* with read & write access +* the Source URL should be the URL of your friendica server + +After the required credentials for the application are stored in the +configuration you have to actually connect your friendica account with +StatusNet. To do so follow the Sign in with StatusNet button, allow the access +and copy the security code into the plugin configuration. Friendica will then +try to acquire the final OAuth credentials from the API, if successful the +plugin settings will allow you to select to post your public messages to your +StatusNet account. + +Mirroring of Public Postings +---------------------------- + +To avoid endless loops of public postings that are send to StatusNet and then +mirrored back into your friendica stream you have to set the _name of the +application you registered there_ of your friendica node is using to post to +StatusNet in the .htconfig.php file. + + $a->config['statusnet']['application_name'] = "yourname here"; + +Connector Options for the User +============================== + +* **Allow posting to StatusNet** If you want your _public postings_ being + optionally posted to your associated StatusNet account as well, you need to + check this box. +* **Send public postings to StatusNet by default** if you want to have _all_ + your public postings being send to your StatusNet account you need to check + this button as well. Otherwise you have to enable the relay of your postings + in the ACL dialog (click the lock button) before posting an entry. +* **Mirror all posts from statusnet that are no replies or repeated messages** + if you want your postings from StatusNet also appear in your friendica + postings, check this box. Replies to other people postings, repostings and your own + postings that were send from friendica wont be mirrored into your friendica + stream. +* **Shortening method that optimizes the post** by default friendica checks how + many characters your StatusNet instance allows you to use for a posting and + if a posting is longer then this amount of characters it will shorten the + message posted on StatusNet and add a short link back to the original + posting. Optionally you can check this box to have the shortening of the + message use an optimization algorithm. _TODO add infos how this is + optimized_ +* **Send linked #-tags and @-names to StatusNet** if you want your #-tags and + @-mentions linked to the friendica network, check this box. If you want to + have StatusNet handle these things for the relayed end of the posting chain, + uncheck it. +* **Clear OAuth configuration** if you want to remove the currently associated + StatusNet account from your friendica account you have to check this box and + then hit the submit button. The saved settings will be deleted and you have + to reconfigure the StatusNet connector to be able to relay your public + postings to a StatusNet account. + +License +======= + +The _StatusNet Connector_ is licensed under the [3-clause BSD license][3] see the +LICENSE file in the addons directory. + +[3]: http://opensource.org/licenses/BSD-3-Clause diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index ca0b17da..b3450d95 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -3,26 +3,36 @@ * Name: StatusNet Connector * Description: Relay public postings to a connected StatusNet account * Version: 1.0.5 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * Author: Michael Vogel + * + * Copyright (c) 2011-2013 Tobias Diekershoff, Michael Vogel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * * copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ -/* StatusNet Plugin for Friendica - * - * Author: Tobias Diekershoff - * tobias.diekershoff@gmx.net - * - * License:3-clause BSD license - * - * Configuration: - * To activate the plugin itself add it to the $a->config['system']['addon'] - * setting. After this, your user can configure their Twitter account settings - * from "Settings -> Plugin Settings". - * - * Requirements: PHP5, curl [Slinky library] - * - * Documentation: http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/StatusNet_Plugin - */ /*** * We have to alter the TwitterOAuth class a little bit to work with any StatusNet @@ -717,6 +727,8 @@ function statusnet_plugin_admin_post(&$a){ foreach($_POST['sitename'] as $id=>$sitename){ $sitename=trim($sitename); $apiurl=trim($_POST['apiurl'][$id]); + if (! (substr($apiurl, -1)=='/')) + $apiurl=$apiurl.'/'; $secret=trim($_POST['secret'][$id]); $key=trim($_POST['key'][$id]); $applicationname = ((x($_POST, 'applicationname')) ? notags(trim($_POST['applicationname'][$id])):''); @@ -748,7 +760,7 @@ function statusnet_plugin_admin(&$a, &$o){ foreach($sites as $id=>$s){ $sitesform[] = Array( 'sitename' => Array("sitename[$id]", "Site name", $s['sitename'], ""), - 'apiurl' => Array("apiurl[$id]", "Api url", $s['apiurl'], ""), + 'apiurl' => Array("apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29") ), 'secret' => Array("secret[$id]", "Secret", $s['consumersecret'], ""), 'key' => Array("key[$id]", "Key", $s['consumerkey'], ""), 'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""), @@ -760,7 +772,7 @@ function statusnet_plugin_admin(&$a, &$o){ $id++; $sitesform[] = Array( 'sitename' => Array("sitename[$id]", t("Site name"), "", ""), - 'apiurl' => Array("apiurl[$id]", t("API URL"), "", ""), + 'apiurl' => Array("apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29") ), 'secret' => Array("secret[$id]", t("Consumer Secret"), "", ""), 'key' => Array("key[$id]", t("Consumer Key"), "", ""), 'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""), diff --git a/twitter/LICENSE b/twitter/LICENSE new file mode 100644 index 00000000..062cc888 --- /dev/null +++ b/twitter/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011-2013 Tobias Diekershoff, Michael Vogel +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/twitter/README b/twitter/README deleted file mode 100755 index 8041f317..00000000 --- a/twitter/README +++ /dev/null @@ -1,92 +0,0 @@ -____ Twitter Plugin ____ -By Tobias Diekershoff - http://diekershoff.homeunix.net/friendika/profile/tobias - tobias.diekershoff(at)gmx.net - -With this addon to Friendica you can give your user the possibility to post -their *public* messages to Twitter. The messages will be strapped their rich -context and shortened to 140 characters length if necessary. If shortening of -the message was performed a link will be added to the Tweet pointing to the -original message on your server. - -The addon can also mirror a users Tweets into the ~friendica wall. - -There is a similar addon for forwarding public messages to -"StatusNet":http://status.net [[StatusNet Plugin]]. - -Online version of this document: http://ur1.ca/35mml - -___ Requirements ___ - -To use this plugin you have to register an application for your friendica -instance on Twitter with - * read and write access - * don't set a callback URL - * we do not intend to use Twitter for login -The registration can be done at twitter.com/apps and you need a Twitter -account for doing so. - -After you registered the application you get an OAuth consumer key / secret -pair that identifies your app, you will need them for configuration. - -The inclusion of a shorturl for the original posting in cases when the -message was longer than 140 characters requires it, that you have *PHP5+* and -*curl* on your server. - -___ Where to find ___ - -In the Friendica git repository /addon/twitter/, this directory contains -all required PHP files (including the Twitter OAuth library [1] by Abraham -Williams, MIT licensed and the Slinky library [2] by Beau Lebens, BSD license), -a CSS file for styling of the user configuration and an image to _Sign in with -Twitter_. - -[1] https://github.com/abraham/twitteroauth -[2] http://dentedreality.com.au/projects/slinky/ - -___ Configuration ___ - -__ Global Configuration __ - -If you enabled an administrator account, please use the admin panel to configure -the Twitter relay. If you for any reason prefer to use a configuration file instead -of the admin panels, please refer to the Alternative Configuration below. - -Activate the plugin from the plugins section of your admin panel. When you have -done so, add your consumer key and consumer secret in the settings section of the -plugin page. - -When this is done your user can now configure their Twitter connection at -"Settings -> Connector Settings" and enable the forwarding of their *public* -messages to Twitter. - -__ Alternative Configuration __ - -To activate this addon add @twitter@ to the list of active addons in your -.htconfig.php file - -$a->config['system']['addon'] = "twitter, ..." - -Afterwards you need to add your OAuth consumer key / secret pair to it by -adding the following two lines - -$a->config['twitter']['consumerkey'] = 'your consumer KEY here'; -$a->config['twitter']['consumersecret'] = 'your consumer SECRET here'; - - -__ User Configuration __ - -When the OAuth consumer informations are correctly placed into the -configuration file and a user visits the "Plugin Settings" page they can now -connect to Twitter. To do so one has to follow the _Sign in with Twitter_ -button (the page will be opened in a new browser window/tab) and get a PIN from -Twitter. This PIN has to be entered on the settings page. After submitting the -PIN the plugin will get OAuth credentials identifying this user from the -Friendica account. - -If this first step was successful the Twitter configuration will be changed -on the "Plugin Settings" page displaying two check boxes. One to enable/disable -the forwarding of *all public* postings to Twitter and one to clear the -personal configuration from the Twitter credentials. - - diff --git a/twitter/README.md b/twitter/README.md new file mode 100644 index 00000000..13f0152f --- /dev/null +++ b/twitter/README.md @@ -0,0 +1,140 @@ +Twitter Plugin +============== + +Main authors Tobias Diekershoff and Michael Vogel. + +With this addon to friendica you can give your user the possibility to post +their *public* messages to Twitter. The messages will be strapped their rich +context and shortened to 140 characters length if necessary. If shortening of +the message was performed a link will be added to the Tweet pointing to the +original message on your server. + +The addon can also mirror a users Tweets into the ~friendica wall. + +There is a similar addon for forwarding public messages to +[StatusNet](http://status.net). + +Requirements +------------ + +To use this plugin you have to register an application for your friendica +instance on Twitter with +* read and write access +* don't set a callback URL +* we do not intend to use Twitter for login +The registration can be done at twitter.com/apps and you need a Twitter +account for doing so. + +After you registered the application you get an OAuth consumer key / secret +pair that identifies your app, you will need them for configuration. + +The inclusion of a shorturl for the original posting in cases when the +message was longer than 140 characters requires it, that you have *PHP5+* and +*curl* on your server. + +Where to find +------------- + +In the friendica addon git repository /twitter/, this directory contains +all required PHP files (including the [Twitter OAuth library][1] by Abraham +Williams, MIT licensed and the [Slinky library][2] by Beau Lebens, BSD license), +a CSS file for styling of the user configuration and an image to _Sign in with +Twitter_. + +[1]: https://github.com/abraham/twitteroauth +[2]: http://dentedreality.com.au/projects/slinky/ + +Configuration +============= + +Global Configuration +-------------------- + +If you enabled an administrator account, please use the admin panel to configure +the Twitter relay. If you for any reason prefer to use a configuration file instead +of the admin panels, please refer to the Alternative Configuration below. + +Activate the plugin from the plugins section of your admin panel. When you have +done so, add your consumer key and consumer secret in the settings section of the +plugin page. + +When this is done your user can now configure their Twitter connection at +"Settings -> Connector Settings" and enable the forwarding of their *public* +messages to Twitter. + +Alternative Configuration +------------------------- + +To activate this addon add twitter to the list of active addons in your +.htconfig.php file + + $a->config['system']['addon'] = "twitter, ..." + +Afterwards you need to add your OAuth consumer key / secret pair to it by +adding the following two lines + + $a->config['twitter']['consumerkey'] = 'your consumer KEY here'; + $a->config['twitter']['consumersecret'] = 'your consumer SECRET here'; + + +Mirroring of Public Postings +---------------------------- + +To avoid endless loops of public postings that are send to Twitter and then +mirrored back into your friendica stream you have to set the _name of the +application you registered there_ of your friendica node is using to post to +Twitter in the .htconfig.php file. + + $a->config['twitter']['application_name'] = "yourname here"; + +Connector Options for the User +============================== + +When the OAuth consumer informations are correctly placed into the +configuration file and a user visits the "Connector Settings" page they can now +connect to Twitter. To do so one has to follow the _Sign in with Twitter_ +button (the page will be opened in a new browser window/tab) and get a PIN from +Twitter. This PIN has to be entered on the settings page. After submitting the +PIN the plugin will get OAuth credentials identifying this user from the +friendica account. + +After this step was successful the user now has the following config options. + +* **Allow posting to StatusNet** If you want your _public postings_ being + optionally posted to your associated Twitter account as well, you need to + check this box. +* **Send public postings to StatusNet by default** if you want to have _all_ + your public postings being send to your Twitter account you need to check + this button as well. Otherwise you have to enable the relay of your postings + in the ACL dialog (click the lock button) before posting an entry. +* **Mirror all posts from statusnet that are no replies or repeated messages** + if you want your postings from Twitter also appear in your friendica + postings, check this box. Replies to other people postings, repostings and your own + postings that were send from friendica wont be mirrored into your friendica + stream. +* **Shortening method that optimizes the post** by default friendica checks how + many characters your Twitter instance allows you to use for a posting and + if a posting is longer then this amount of characters it will shorten the + message posted on Twitter and add a short link back to the original + posting. Optionally you can check this box to have the shortening of the + message use an optimization algorithm. _TODO add infos how this is + optimized_ +* **Send linked #-tags and @-names to StatusNet** if you want your #-tags and + @-mentions linked to the friendica network, check this box. If you want to + have Twitter handle these things for the relayed end of the posting chain, + uncheck it. +* **Clear OAuth configuration** if you want to remove the currently associated + Twitter account from your friendica account you have to check this box and + then hit the submit button. The saved settings will be deleted and you have + to reconfigure the Twitter connector to be able to relay your public + postings to a Twitter account. + +License +======= + +The _StatusNet Connector_ is licensed under the [3-clause BSD license][3] see the +LICENSE file in the addons directory. + +[3]: http://opensource.org/licenses/BSD-3-Clause + + diff --git a/twitter/twitter.php b/twitter/twitter.php index 21dbc0ba..93270806 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -3,11 +3,36 @@ * Name: Twitter Connector * Description: Relay public postings to a connected Twitter account * Version: 1.0.4 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * Author: Michael Vogel + * + * Copyright (c) 2011-2013 Tobias Diekershoff, Michael Vogel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * * copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ - - + /* Twitter Plugin for Friendica * * Author: Tobias Diekershoff @@ -33,8 +58,6 @@ * from "Settings -> Plugin Settings". * * Requirements: PHP5, curl [Slinky library] - * - * Documentation: http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Twitter_Plugin */ define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes @@ -286,7 +309,7 @@ function twitter_shortenmsg($b) { require_once("include/bbcode.php"); require_once("include/html2plain.php"); - $max_char = 130; + $max_char = 140; // Looking for the first image $image = ''; @@ -389,15 +412,20 @@ function twitter_shortenmsg($b) { if (($msglink == "") and strlen($msg) > $max_char) $msglink = $b["plink"]; - // If the message is short enough then don't modify it. (if the link exists in the original message) - if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == ""))) + // If the message is short enough then don't modify it. + if ((strlen(trim($origmsg)) <= $max_char) AND ($msglink == "")) + return(trim($origmsg)); + + // If the message is short enough and the link exists in the original message don't modify it as well + // -3 because of the bad shortener of twitter + if ((strlen(trim($origmsg)) <= ($max_char - 3)) AND strpos($origmsg, $msglink)) return(trim($origmsg)); if (strlen($msglink) > 20) $msglink = short_link($msglink); - if (strlen(trim($msg." ".$msglink)) > $max_char) { - $msg = substr($msg, 0, $max_char - (strlen($msglink))); + if (strlen(trim($msg." ".$msglink)) > ($max_char - 3)) { + $msg = substr($msg, 0, ($max_char - 3) - (strlen($msglink))); $lastchar = substr($msg, -1); $msg = substr($msg, 0, -1); $pos = strrpos($msg, "\n"); diff --git a/webrtc/README b/webrtc/README.md similarity index 80% rename from webrtc/README rename to webrtc/README.md index 75797f18..d29500a6 100644 --- a/webrtc/README +++ b/webrtc/README.md @@ -1,7 +1,7 @@ -Webrtc Plugin -==================== +WebRTC Plugin +============= -This is a quick and dirty addon to add a webrtc website as an app. As webrtc +This is a quick and dirty addon to add a [webrtc][1] website as an app. As webrtc advances so rapidly there is s a chance this plugin will be obsolete. Webrtc is a new video and audio conferencing tool that is browser to browser communication, no need to download specific software for just conferencing. @@ -12,7 +12,7 @@ between the participants. If you would like to try this plugin please download one of the following either Chrome/Chromium 25 or higher or Firefox 21 or higher. Then test it by -visiting a known webrtc instance (i.e. https://live.mayfirst.org) create a +visiting a known webrtc instance (i.e. [live.mayfirst.org](https://live.mayfirst.org)) create a room, you should be asked to share your camera and microphone (firefox will let you choose one or the other, whereas chrome/chromium asks for both in one question). @@ -20,3 +20,5 @@ question). If the test is successful then proceed with copying the webrtc instance you would like to use and place it in the config window and save. Now when you opent he app it will load the webrtc instance for you to use. + +[1]: https://en.wikipedia.org/wiki/WebRTC diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 7a4e8cf7..e0d33393 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -3,8 +3,8 @@ * Name: WebRTC Application * Description: add a webrtc instance for video/audio * Version: 1.0 - * Author: stephen mahood - * Author: Tobias Diekershoff + * Author: Stephen Mahood + * Author: Tobias Diekershoff */ function webrtc_install() {