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/impressum/impressum.php b/impressum/impressum.php index 3c1106c9..8bcc8b7d 100755 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -3,7 +3,7 @@ * Name: Impressum * Description: Plugin to add contact information to the about page (/friendica) * Version: 1.2 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * License: 3-clause BSD license */ diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index ccc6ca0c..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 */ 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/statusnet.tgz b/statusnet.tgz index e92174ac..dce1dd52 100755 Binary files a/statusnet.tgz and b/statusnet.tgz differ diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 3a5ceb8a..b3450d95 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -3,7 +3,7 @@ * 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 @@ -727,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])):''); @@ -758,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'], ""), @@ -770,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/twitter.php b/twitter/twitter.php index 71fed1aa..93270806 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -3,7 +3,7 @@ * 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 @@ -58,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 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() {