This commit is contained in:
friendica 2013-06-26 03:39:46 -07:00
commit bb0ac84cc4
40 changed files with 1091 additions and 392 deletions

19
blackout/LICENSE Normal file
View file

@ -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.

View file

@ -1,11 +1,12 @@
Name: blackout blackout addon
Description: Blackout your ~friendica node during a given period ==============
License: MIT * Description: Blackout your ~friendica node during a given period
Version: 1.0 * License: [MIT](http://opensource.org/licenses/MIT)
Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/~tobias> * Version: 1.0
* Author: Tobias Diekershoff
About About
===== -----
This plugin will allow you to enter a date/time period during which 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 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. database directly.
Requirements Requirements
============ -------------
THIS ADDON REQUIRES PHP VERSION 5.3 OR HIGHER. **THIS ADDON REQUIRES PHP VERSION 5.3 OR HIGHER.**
License License
======= -------
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -4,7 +4,7 @@
* Description: Blackout your ~friendica node during a given period, requires PHP >= 5.3 * Description: Blackout your ~friendica node during a given period, requires PHP >= 5.3
* License: MIT * License: MIT
* Version: 1.0 * Version: 1.0
* Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/~tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/~tobias>
* *
* About * About
* ===== * =====

BIN
cal.tgz Normal file

Binary file not shown.

19
cal/LICENSE Normal file
View file

@ -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.

29
cal/README.md Normal file
View file

@ -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.

192
cal/cal.php Normal file
View file

@ -0,0 +1,192 @@
<?php
/********************************************************************
* Name: Calendar Export
* Description: This addon exports the public events of your users as calendar files
* Version: 0.1
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* 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 .= "<h3>".t('Event Export')."</h3><p>".t('You can download public events from: ').$a->get_baseurl()."/cal/username/export/ical</p>";
} 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/<em>format</em>';
$s .= '<h3>'.t('Export Events').'</h3>';
$s .= '<p>'.t('If this is enabled, your public events will be available at').' <strong>'.$url.'</strong></p>';
$s .= '<p>'.t('Currently supported formats are ical and csv.').'</p>';
$s .= '<div id="cal-enable-wrapper">';
$s .= '<label id="cal-enable-label" for="cal-checkbox">'. t('Enable calendar export') .'</label>';
$s .= '<input id="cal-checkbox" type="checkbox" name="cal-enable" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="cal-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '</div><div class="clear"></div>';
}
?>

54
cal/lang/C/messages.po Normal file
View file

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

12
cal/lang/C/strings.php Normal file
View file

@ -0,0 +1,12 @@
<?php
;
$a->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"] = "";

11
cal/lang/de/strings.php Normal file
View file

@ -0,0 +1,11 @@
<?php
;
$a->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";

View file

@ -212,7 +212,7 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
return($cleaned); return($cleaned);
} }
function fromgplus_handleattachments($item) { function fromgplus_handleattachments($item, $displaytext) {
$post = ""; $post = "";
$quote = ""; $quote = "";
@ -251,7 +251,7 @@ function fromgplus_handleattachments($item) {
elseif ($images["full"] != "") elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\n"; $post .= "\n[img]".$images["full"]."[/img]\n";
if ($attachment->displayName != "") if (($attachment->displayName != "") AND ($attachment->displayName != $displaytext))
$post .= fromgplus_html2bbcode($attachment->displayName)."\n"; $post .= fromgplus_html2bbcode($attachment->displayName)."\n";
break; break;
@ -319,7 +319,7 @@ function fromgplus_fetch($a, $uid) {
$post = fromgplus_html2bbcode($item->object->content); $post = fromgplus_html2bbcode($item->object->content);
if (is_array($item->object->attachments)) if (is_array($item->object->attachments))
$post .= fromgplus_handleattachments($item); $post .= fromgplus_handleattachments($item, $item->object->content);
// geocode, placeName // geocode, placeName
if (isset($item->address)) if (isset($item->address))
@ -346,7 +346,7 @@ function fromgplus_fetch($a, $uid) {
$post .= fromgplus_html2bbcode($item->object->content); $post .= fromgplus_html2bbcode($item->object->content);
if (is_array($item->object->attachments)) if (is_array($item->object->attachments))
$post .= "\n".trim(fromgplus_handleattachments($item)); $post .= "\n".trim(fromgplus_handleattachments($item, $item->object->content));
$post .= "[/share]"; $post .= "[/share]";
} else { } else {
@ -355,7 +355,7 @@ function fromgplus_fetch($a, $uid) {
$post .= fromgplus_html2bbcode($item->object->content); $post .= fromgplus_html2bbcode($item->object->content);
if (is_array($item->object->attachments)) 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)) if (isset($item->address))

View file

@ -2,7 +2,7 @@
/** /**
* Name: G+ Post * 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 * Version: 0.1
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/ */
@ -51,6 +51,9 @@ function gpluspost_settings(&$a,&$s) {
$noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention'); $noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention');
$noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : ''); $noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : '');
$skip_enabled = get_pconfig(local_user(),'gpluspost','skip_without_link');
$skip_checked = (($skip_enabled) ? ' checked="checked" ' : '');
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Google+ Post Settings') . '</h3>'; $s .= '<h3>' . t('Google+ Post Settings') . '</h3>';
$s .= '<div id="gpluspost-enable-wrapper">'; $s .= '<div id="gpluspost-enable-wrapper">';
@ -68,6 +71,11 @@ function gpluspost_settings(&$a,&$s) {
$s .= '<input id="gpluspost-noloopprevention" type="checkbox" name="gpluspost_noloopprevention" value="1" ' . $noloop_checked . '/>'; $s .= '<input id="gpluspost-noloopprevention" type="checkbox" name="gpluspost_noloopprevention" value="1" ' . $noloop_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="gpluspost-skipwithoutlink-wrapper">';
$s .= '<label id="gpluspost-skipwithoutlink-label" for="gpluspost-skipwithoutlink">' . t('Skip messages without links') . '</label>';
$s .= '<input id="gpluspost-skipwithoutlink" type="checkbox" name="gpluspost_skipwithoutlink" value="1" ' . $skip_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="gpluspost-submit" name="gpluspost-submit" class="settings-submit" value="' . t('Submit') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="gpluspost-submit" name="gpluspost-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
@ -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',intval($_POST['gpluspost']));
set_pconfig(local_user(),'gpluspost','post_by_default',intval($_POST['gpluspost_bydefault'])); 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','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/bbcode.php');
require_once("include/html2plain.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)); $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) { foreach ($items AS $item) {
@ -349,7 +358,9 @@ function gpluspost_feeditem($pid, $uid) {
else if ($image != "") else if ($image != "")
$msglink = $image; $msglink = $image;
if ($msglink == "") if (($msglink == "") AND $skipwithoutlink)
continue;
else if ($msglink == "")
$msglink = $item["plink"]; $msglink = $item["plink"];
// Fetching the title - or the first line // Fetching the title - or the first line

Binary file not shown.

24
impressum/LICENSE Normal file
View file

@ -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 <organization> 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 <COPYRIGHT HOLDER> 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.

View file

@ -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.

38
impressum/README.md Executable file
View file

@ -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.

View file

@ -2,8 +2,8 @@
/** /**
* Name: Impressum * Name: Impressum
* Description: Plugin to add contact information to the about page (/friendica) * Description: Plugin to add contact information to the about page (/friendica)
* Version: 1.2 * Version: 1.3
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* License: 3-clause BSD license * License: 3-clause BSD license
*/ */
@ -20,6 +20,14 @@ function impressum_uninstall() {
unregister_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); unregister_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("uninstalled impressum plugin"); logger("uninstalled impressum plugin");
} }
function impressum_module() {
}
function impressum_content() {
$a = get_app();
goaway($a->get_baseurl().'/friendica/');
}
function obfuscate_email ($s) { function obfuscate_email ($s) {
$s = str_replace('@','(at)',$s); $s = str_replace('@','(at)',$s);
$s = str_replace('.','(dot)',$s); $s = str_replace('.','(dot)',$s);

View file

@ -122,6 +122,22 @@ function jappixmini_plugin_admin(&$a, &$o) {
$o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>'; $o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>';
$o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"'.$bosh_proxy.' /><br />'; $o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"'.$bosh_proxy.' /><br />';
// bosh address
$bosh_address = get_config("jappixmini", "bosh_address");
$o .= '<p><label for="jappixmini-address">Adress of the default BOSH proxy. If enabled it overrides the user settings:</label><br />';
$o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="'.$bosh_address.'" /></p>';
// default server address
$default_server = get_config("jappixmini", "default_server");
$o .= '<p><label for="jappixmini-server">Adress of the default jabber server:</label><br />';
$o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$default_server.'" /></p>';
// default user name to friendica nickname
$default_user = intval(get_config("jappixmini", "default_user"));
$default_user = intval($default_user) ? ' checked="checked"' : '';
$o .= '<label for="jappixmini-user">Set the default username to the nickname:</label>';
$o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"'.$default_user.' /><br />';
// info text field // info text field
$info_text = get_config("jappixmini", "infotext"); $info_text = get_config("jappixmini", "infotext");
$o .= '<p><label for="jappixmini-infotext">Info text to help users with configuration (important if you want to provide your own BOSH host!):</label><br />'; $o .= '<p><label for="jappixmini-infotext">Info text to help users with configuration (important if you want to provide your own BOSH host!):</label><br />';
@ -137,8 +153,14 @@ function jappixmini_plugin_admin_post(&$a) {
if ($submit) { if ($submit) {
$info_text = $_REQUEST['jappixmini-infotext']; $info_text = $_REQUEST['jappixmini-infotext'];
$bosh_proxy = intval($_REQUEST['jappixmini-proxy']); $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", "infotext", $info_text);
set_config("jappixmini", "bosh_proxy", $bosh_proxy); 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'); $dontinsertchat = get_pconfig(local_user(),'jappixmini','dontinsertchat');
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : ''); $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 = get_pconfig(local_user(),'jappixmini','username');
$username = htmlentities($username); $username = htmlentities($username);
$server = get_pconfig(local_user(),'jappixmini','server'); $server = get_pconfig(local_user(),'jappixmini','server');
@ -239,6 +266,12 @@ function jappixmini_settings(&$a, &$s) {
$encrypt_checked = $encrypt ? ' checked="checked"' : ''; $encrypt_checked = $encrypt ? ' checked="checked"' : '';
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"'; $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 = get_config("jappixmini", "infotext");
$info_text = htmlentities($info_text); $info_text = htmlentities($info_text);
$info_text = str_replace("\n", "<br />", $info_text); $info_text = str_replace("\n", "<br />", $info_text);
@ -278,9 +311,12 @@ function jappixmini_settings(&$a, &$s) {
$s .= ' <input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$server.'" />'; $s .= ' <input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$server.'" />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-bosh">'.t('Jabber BOSH host').'</label>'; if (defaultbosh == "") {
$s .= ' <input id="jappixmini-bosh" type="text" name="jappixmini-bosh" value="'.$bosh.'" />'; $s .= '<label for="jappixmini-bosh">'.t('Jabber BOSH host').'</label>';
$s .= '<br />'; $s .= ' <input id="jappixmini-bosh" type="text" name="jappixmini-bosh" value="'.$bosh.'" />';
$s .= '<br />';
}
$s .= '<label for="jappixmini-password">'.t('Jabber password').'</label>'; $s .= '<label for="jappixmini-password">'.t('Jabber password').'</label>';
$s .= ' <input type="hidden" id="jappixmini-password" name="jappixmini-encrypted-password" value="'.$password.'" />'; $s .= ' <input type="hidden" id="jappixmini-password" name="jappixmini-encrypted-password" value="'.$password.'" />';

View file

@ -40,7 +40,7 @@ function jappixmini_addon_get_client_secret(callback) {
var div = document.getElementById("#jappixmini-password-query-div"); var div = document.getElementById("#jappixmini-password-query-div");
if (!div) { if (!div) {
div = $('<div id="jappixmini-password-query-div" style="position:fixed;padding:1em;background-color:#F00;color:#fff;top:50px;left:50px;">Retype your Friendica password for chatting:<br></div>'); div = $('<div id="jappixmini-password-query-div" style="position:fixed;padding:1em;background-color:#F00;color:#fff;top:50px;left:650px;">Retype your Friendica password for chatting:<br></div>');
var input = $('<input type="password" id="jappixmini-password-query-input">') var input = $('<input type="password" id="jappixmini-password-query-input">')
div.append(input); div.append(input);

24
mathjax/LICENSE Normal file
View file

@ -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 <organization> 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 <COPYRIGHT HOLDER> 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.

View file

@ -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

43
mathjax/README.md Normal file
View file

@ -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

View file

@ -4,7 +4,7 @@
* Name: MathJax * Name: MathJax
* Description: Addon for Friendika to include MathJax (LaTeX math syntax) * Description: Addon for Friendika to include MathJax (LaTeX math syntax)
* Version: 1.0 * Version: 1.0
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* License: 3-clause BSD license * License: 3-clause BSD license
*/ */
@ -72,6 +72,7 @@ function mathjax_plugin_admin (&$a, &$o) {
} }
$o = replace_macros( $t, array( $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.')), '$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.')),
)); ));
} }

24
piwik/LICENSE Normal file
View file

@ -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 <organization> 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 <COPYRIGHT HOLDER> 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.

View file

@ -1,24 +1,24 @@
## Piwik Plugin ## Piwik Plugin
============
by Tobias Diekershoff by Tobias Diekershoff and Klaus Weidenbach
http://diekershoff.homeunix.net/friendika/profile/tobias
tobias.diekershoff(at)gmx.net
This addon allows you to embed the code necessary for the FLOSS webanalytics This addon allows you to embed the code necessary for the FLOSS webanalytics
tool Piwik into the Friendica pages. 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. 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. styling the opt-out notice.
### Configuration ### Configuration
-------------
The easiest way to configure this addon is by activating the admin panels of 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 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']['optout'] = true;
$a->config['piwik']['async'] = false; $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. 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 * Change the *sideid* parameter to whatever ID you want to use for tracking your
Friendica installation. The *optout* parameter (true|false) defines whether or Friendica installation.
* The *optout* parameter (true|false) defines whether or
not a short notice about the utilization of Piwik will be displayed on every 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 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 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. _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: Currently the optional notice states the following:
This website is tracked using the Piwik analytics tool. If you do not want > 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 > that your visits are logged this way you can set a cookie to prevent Piwik
from tracking further visits of the site (opt-out). > from tracking further visits of the site (opt-out).
The *async* parameter (true|false) defines whether or not to use asynchronous License
tracking so pages load (or appear to load) faster. =======
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

View file

@ -3,7 +3,7 @@
* Name: Piwik Analytics * Name: Piwik Analytics
* Description: Piwik Analytics Plugin for Friendica * Description: Piwik Analytics Plugin for Friendica
* Version: 1.1 * Version: 1.1
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* Author: Klaus Weidenbach * Author: Klaus Weidenbach
*/ */
@ -26,8 +26,6 @@
* installation has. Alter the baseurl to fit your needs, don't care * 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 * about http/https but beware to put the trailing / at the end of your
* setting. * setting.
*
* Documentation see http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Piwik_Plugin
*/ */
function piwik_install() { function piwik_install() {

5
pumpio/README Normal file
View file

@ -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.

View file

@ -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; float: left;
width: 200px; width: 200px;
margin-top: 10px; 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; float: left;
margin-top: 10px; margin-top: 10px;
} }

View file

@ -198,47 +198,59 @@ function pumpio_settings(&$a,&$s) {
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Pump.io Post Settings') . '</h3>'; $s .= '<h3>' . t('Pump.io Post Settings') . '</h3>';
$s .= '<div id="pumpio-servername-wrapper">';
$s .= '<label id="pumpio-servername-label" for="pumpio-servername">'.t('pump.io servername (without "http://" or "https://" )').'</label>';
$s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-username-wrapper">'; $s .= '<div id="pumpio-username-wrapper">';
$s .= '<label id="pumpio-username-label" for="pumpio-username">'.t('pump.io username (without the servername)').'</label>'; $s .= '<label id="pumpio-username-label" for="pumpio-username">'.t('pump.io username (without the servername)').'</label>';
$s .= '<input id="pumpio-username" type="text" name="pumpio_user" value="'.$username.'" />'; $s .= '<input id="pumpio-username" type="text" name="pumpio_user" value="'.$username.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-servername-wrapper">';
$s .= '<label id="pumpio-servername-label" for="pumpio-servername">'.t('pump.io servername (without "http://" or "https://" )').'</label>';
$s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />';
$s .= '</div><div class="clear"></div>';
if (($username != '') AND ($servername != '')) { if (($username != '') AND ($servername != '')) {
$s .= '<div id="pumpio-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("(Re-)Authenticate your pump.io connection").'</a>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-enable-wrapper">';
$s .= '<label id="pumpio-enable-label" for="pumpio-checkbox">' . t('Enable pump.io Post Plugin') . '</label>';
$s .= '<input id="pumpio-checkbox" type="checkbox" name="pumpio" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-bydefault-wrapper">';
$s .= '<label id="pumpio-bydefault-label" for="pumpio-bydefault">' . t('Post to pump.io by default') . '</label>';
$s .= '<input id="pumpio-bydefault" type="checkbox" name="pumpio_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-public-wrapper">';
$s .= '<label id="pumpio-public-label" for="pumpio-public">' . t('Should posts be public?') . '</label>';
$s .= '<input id="pumpio-public" type="checkbox" name="pumpio_public" value="1" ' . $public_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-mirror-wrapper">';
$s .= '<label id="pumpio-mirror-label" for="pumpio-mirror">' . t('Mirror all public posts') . '</label>';
$s .= '<input id="pumpio-mirror" type="checkbox" name="pumpio_mirror" value="1" ' . $mirror_checked . '/>';
$s .= '</div><div class="clear"></div>';
$oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token"); $oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token");
$oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret"); $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret");
$s .= '<div id="pumpio-password-wrapper">'; $s .= '<div id="pumpio-password-wrapper">';
if (($oauth_token == "") OR ($oauth_token_secret == "")) if (($oauth_token == "") OR ($oauth_token_secret == "")) {
$s .= t("You are not authenticated to pumpio"); $s .= '<div id="pumpio-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("Authenticate your pump.io connection").'</a>';
$s .= '</div><div class="clear"></div>';
//$s .= t("You are not authenticated to pumpio");
} else {
$s .= '<div id="pumpio-enable-wrapper">';
$s .= '<label id="pumpio-enable-label" for="pumpio-checkbox">' . t('Enable pump.io Post Plugin') . '</label>';
$s .= '<input id="pumpio-checkbox" type="checkbox" name="pumpio" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-bydefault-wrapper">';
$s .= '<label id="pumpio-bydefault-label" for="pumpio-bydefault">' . t('Post to pump.io by default') . '</label>';
$s .= '<input id="pumpio-bydefault" type="checkbox" name="pumpio_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-public-wrapper">';
$s .= '<label id="pumpio-public-label" for="pumpio-public">' . t('Should posts be public?') . '</label>';
$s .= '<input id="pumpio-public" type="checkbox" name="pumpio_public" value="1" ' . $public_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-mirror-wrapper">';
$s .= '<label id="pumpio-mirror-label" for="pumpio-mirror">' . t('Mirror all public posts') . '</label>';
$s .= '<input id="pumpio-mirror" type="checkbox" name="pumpio_mirror" value="1" ' . $mirror_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-delete-wrapper">';
$s .= '<label id="pumpio-delete-label" for="pumpio-delete">' . t('Check to delete this preset') . '</label>';
$s .= '<input id="pumpio-delete" type="checkbox" name="pumpio_delete" value="1" />';
$s .= '</div><div class="clear"></div>';
//$s .= '<div id="pumpio-authenticate-wrapper">';
//$s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("Reauthenticate your pump.io connection").'</a>';
//$s .= '</div><div class="clear"></div>';
}
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
} }
@ -253,28 +265,37 @@ function pumpio_settings(&$a,&$s) {
function pumpio_settings_post(&$a,&$b) { function pumpio_settings_post(&$a,&$b) {
if(x($_POST,'pumpio-submit')) { if(x($_POST,'pumpio-submit')) {
// filtering the username if it is filled wrong if(x($_POST,'pumpio_delete')) {
$user = $_POST['pumpio_user']; set_pconfig(local_user(),'pumpio','consumer_key','');
if (strstr($user, "@")) { set_pconfig(local_user(),'pumpio','consumer_secret','');
$pos = strpos($user, "@"); set_pconfig(local_user(),'pumpio','host','');
if ($pos > 0) set_pconfig(local_user(),'pumpio','oauth_token','');
$user = substr($user, 0, $pos); 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) { function pumpio_post_local(&$a,&$b) {

Binary file not shown.

24
statusnet/LICENSE Normal file
View file

@ -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 <organization> 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 <COPYRIGHT HOLDER> 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.

View file

@ -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.

147
statusnet/README.md Normal file
View file

@ -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

View file

@ -3,26 +3,36 @@
* Name: StatusNet Connector * Name: StatusNet Connector
* Description: Relay public postings to a connected StatusNet account * Description: Relay public postings to a connected StatusNet account
* Version: 1.0.5 * Version: 1.0.5
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*
* 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 <organization> 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 <COPYRIGHT HOLDER> 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 * 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){ foreach($_POST['sitename'] as $id=>$sitename){
$sitename=trim($sitename); $sitename=trim($sitename);
$apiurl=trim($_POST['apiurl'][$id]); $apiurl=trim($_POST['apiurl'][$id]);
if (! (substr($apiurl, -1)=='/'))
$apiurl=$apiurl.'/';
$secret=trim($_POST['secret'][$id]); $secret=trim($_POST['secret'][$id]);
$key=trim($_POST['key'][$id]); $key=trim($_POST['key'][$id]);
$applicationname = ((x($_POST, 'applicationname')) ? notags(trim($_POST['applicationname'][$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){ foreach($sites as $id=>$s){
$sitesform[] = Array( $sitesform[] = Array(
'sitename' => Array("sitename[$id]", "Site name", $s['sitename'], ""), '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'], ""), 'secret' => Array("secret[$id]", "Secret", $s['consumersecret'], ""),
'key' => Array("key[$id]", "Key", $s['consumerkey'], ""), 'key' => Array("key[$id]", "Key", $s['consumerkey'], ""),
'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""), 'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
@ -760,7 +772,7 @@ function statusnet_plugin_admin(&$a, &$o){
$id++; $id++;
$sitesform[] = Array( $sitesform[] = Array(
'sitename' => Array("sitename[$id]", t("Site name"), "", ""), '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"), "", ""), 'secret' => Array("secret[$id]", t("Consumer Secret"), "", ""),
'key' => Array("key[$id]", t("Consumer Key"), "", ""), 'key' => Array("key[$id]", t("Consumer Key"), "", ""),
'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""), 'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""),

24
twitter/LICENSE Normal file
View file

@ -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 <organization> 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 <COPYRIGHT HOLDER> 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.

View file

@ -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.

140
twitter/README.md Normal file
View file

@ -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

View file

@ -3,11 +3,36 @@
* Name: Twitter Connector * Name: Twitter Connector
* Description: Relay public postings to a connected Twitter account * Description: Relay public postings to a connected Twitter account
* Version: 1.0.4 * Version: 1.0.4
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*
* 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 <organization> 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 <COPYRIGHT HOLDER> 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 /* Twitter Plugin for Friendica
* *
* Author: Tobias Diekershoff * Author: Tobias Diekershoff
@ -33,8 +58,6 @@
* from "Settings -> Plugin Settings". * from "Settings -> Plugin Settings".
* *
* Requirements: PHP5, curl [Slinky library] * Requirements: PHP5, curl [Slinky library]
*
* Documentation: http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Twitter_Plugin
*/ */
define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes 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/bbcode.php");
require_once("include/html2plain.php"); require_once("include/html2plain.php");
$max_char = 130; $max_char = 140;
// Looking for the first image // Looking for the first image
$image = ''; $image = '';
@ -389,15 +412,20 @@ function twitter_shortenmsg($b) {
if (($msglink == "") and strlen($msg) > $max_char) if (($msglink == "") and strlen($msg) > $max_char)
$msglink = $b["plink"]; $msglink = $b["plink"];
// If the message is short enough then don't modify it. (if the link exists in the original message) // If the message is short enough then don't modify it.
if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == ""))) 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)); return(trim($origmsg));
if (strlen($msglink) > 20) if (strlen($msglink) > 20)
$msglink = short_link($msglink); $msglink = short_link($msglink);
if (strlen(trim($msg." ".$msglink)) > $max_char) { if (strlen(trim($msg." ".$msglink)) > ($max_char - 3)) {
$msg = substr($msg, 0, $max_char - (strlen($msglink))); $msg = substr($msg, 0, ($max_char - 3) - (strlen($msglink)));
$lastchar = substr($msg, -1); $lastchar = substr($msg, -1);
$msg = substr($msg, 0, -1); $msg = substr($msg, 0, -1);
$pos = strrpos($msg, "\n"); $pos = strrpos($msg, "\n");

View file

@ -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 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 a new video and audio conferencing tool that is browser to browser
communication, no need to download specific software for just conferencing. 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 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 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 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 you choose one or the other, whereas chrome/chromium asks for both in one
question). question).
@ -20,3 +20,5 @@ question).
If the test is successful then proceed with copying the webrtc instance you 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 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. opent he app it will load the webrtc instance for you to use.
[1]: https://en.wikipedia.org/wiki/WebRTC

View file

@ -3,8 +3,8 @@
* Name: WebRTC Application * Name: WebRTC Application
* Description: add a webrtc instance for video/audio * Description: add a webrtc instance for video/audio
* Version: 1.0 * Version: 1.0
* Author: stephen mahood <https://friends.mayfirst.org/profile/marxistvegan> * Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
* Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendica/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
*/ */
function webrtc_install() { function webrtc_install() {