Merge branch 'master' of github.com:annando/friendica-addons

This commit is contained in:
Michael 2012-04-11 18:47:45 +02:00
commit 8ec3503936
219 changed files with 2744 additions and 276 deletions

Binary file not shown.

Binary file not shown.

View file

@ -109,7 +109,7 @@ function blockem_prepare_body(&$a,&$b) {
function blockem_display_item(&$a,&$b) { function blockem_display_item(&$a,&$b) {
if(strstr($b['output']['body'],'id="blockem-wrap-')) if(strstr($b['output']['body'],'id="blockem-wrap-'))
$b['output']['thumb'] = $a->get_baseurl() . "/images/default-profile-sm.jpg"; $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg";
} }

Binary file not shown.

BIN
calc.tgz

Binary file not shown.

Binary file not shown.

View file

@ -35,7 +35,7 @@ function communityhome_home(&$a, &$o){
$aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true); $aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
// last 12 users // last 12 users
$aside['$lastusers_title'] = t('Last users'); $aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array(); $aside['$lastusers_items'] = array();
$sql_extra = ""; $sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " ); $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
@ -95,7 +95,7 @@ function communityhome_home(&$a, &$o){
} }
// last 12 photos // last 12 photos
$aside['$photos_title'] = t('Last photos'); $aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = array(); $aside['$photos_items'] = array();
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
@ -130,7 +130,7 @@ function communityhome_home(&$a, &$o){
} }
// last 10 liked items // last 10 liked items
$aside['$like_title'] = t('Last likes'); $aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = array(); $aside['$like_items'] = array();
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`

View file

@ -1,7 +1,3 @@
Thomas Willingham This is a variant of the community home. Instead of displaying the community tab in the front page, we still use home.html, but we also add the latest users to the sidebar.
This isn't even close to being worth a pull request, but some people might find it useful. Simply replace addon/communityhome/communityhome.php with this version then enable community home in your admin panel as usual.
Enable community home in your admin panel, then replace communityhome.php with this one to get a front page like mine (a normal front page, but with latest users shown in the sidebar, which looks bleak when there's nothing in it).
There are more graceful ways of doing this, I used communityhome as I plan to make use of a limited stream and likes in future.

Binary file not shown.

7
convpath/README Executable file
View file

@ -0,0 +1,7 @@
convpath
This addon converts all internal paths according to the current scheme.
That means that if a page is called via https then all internal links are also converted into https.
Same happens when you call your page with http.

55
convpath/convpath.php Normal file
View file

@ -0,0 +1,55 @@
<?php
/**
* Name: Convert Paths
* Description: Converts all internal paths according to the current scheme (http or https)
* Version: 1.0
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*
*/
function convpath_install() {
register_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
register_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
}
function convpath_uninstall() {
unregister_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
unregister_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
}
function convpath_page_header(&$a, &$o){
$o = convpath_convert($o);
}
function convpath_page_end(&$a, &$o){
$o = convpath_convert($o);
$a->page['aside'] = convpath_convert($a->page['aside']);
}
/*
Converts a given path according to the current scheme
*/
function convpath_convert($path) {
global $a;
if ($path == "")
return("");
$ssl = (substr($a->get_baseurl(), 0, 8) == "https://");
if ($ssl) {
$search = "http://".$a->get_hostname();
$replace = "https://".$a->get_hostname();
} else {
$search = "https://".$a->get_hostname();
$replace = "http://".$a->get_hostname();
}
$searcharr = array("src='".$search, 'src="'.$search);
$replacearr = array("src='".$replace, 'src="'.$replace);
$path = str_replace($searcharr, $replacearr, $path);
//$path = str_replace($search, $replace, $path);
return($path);
}

BIN
dwpost.tgz Normal file

Binary file not shown.

15
dwpost/dwpost.css Normal file
View file

@ -0,0 +1,15 @@
#dwpost-enable-label, #dwpost-username-label, #dwpost-password-label, #dwpost-bydefault-label {
float: left;
width: 200px;
margin-top: 10px;
}
#dwpost-checkbox, #dwpost-username, #dwpost-password, #dwpost-bydefault {
float: left;
margin-top: 10px;
}
#dwpost-submit {
margin-top: 15px;
}

227
dwpost/dwpost.php Normal file
View file

@ -0,0 +1,227 @@
<?php
/**
* Name: Dreamwidth Post Connector
* Description: Post to dreamwidth
* Version: 1.0
* Author: Tony Baldwin <https://free-haven.org/profile/tony>
* Author: Michael Johnston
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/
function dwpost_install() {
register_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
register_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send');
register_hook('jot_networks', 'addon/dwpost/dwpost.php', 'dwpost_jot_nets');
register_hook('connector_settings', 'addon/dwpost/dwpost.php', 'dwpost_settings');
register_hook('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post');
}
function dwpost_uninstall() {
unregister_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
unregister_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send');
unregister_hook('jot_networks', 'addon/dwpost/dwpost.php', 'dwpost_jot_nets');
unregister_hook('connector_settings', 'addon/dwpost/dwpost.php', 'dwpost_settings');
unregister_hook('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post');
}
function dwpost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$dw_post = get_pconfig(local_user(),'dwpost','post');
if(intval($dw_post) == 1) {
$dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Dreamwidth') . '</div>';
}
}
function dwpost_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dwpost/dwpost.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'dwpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'dwpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$dw_username = get_pconfig(local_user(), 'dwpost', 'dw_username');
$dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Dreamwidth Post Settings') . '</h3>';
$s .= '<div id="dwpost-enable-wrapper">';
$s .= '<label id="dwpost-enable-label" for="dwpost-checkbox">' . t('Enable dreamwidth Post Plugin') . '</label>';
$s .= '<input id="dwpost-checkbox" type="checkbox" name="dwpost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-username-wrapper">';
$s .= '<label id="dwpost-username-label" for="dwpost-username">' . t('dreamwidth username') . '</label>';
$s .= '<input id="dwpost-username" type="text" name="dw_username" value="' . $dw_username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-password-wrapper">';
$s .= '<label id="dwpost-password-label" for="dwpost-password">' . t('dreamwidth password') . '</label>';
$s .= '<input id="dwpost-password" type="password" name="dw_password" value="' . $dw_password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-bydefault-wrapper">';
$s .= '<label id="dwpost-bydefault-label" for="dwpost-bydefault">' . t('Post to dreamwidth by default') . '</label>';
$s .= '<input id="dwpost-bydefault" type="checkbox" name="dw_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="dwpost-submit" name="dwpost-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}
function dwpost_settings_post(&$a,&$b) {
if(x($_POST,'dwpost-submit')) {
set_pconfig(local_user(),'dwpost','post',intval($_POST['dwpost']));
set_pconfig(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
set_pconfig(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
set_pconfig(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
}
}
function dwpost_post_local(&$a,&$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
return;
if($b['private'] || $b['parent'])
return;
$dw_post = intval(get_pconfig(local_user(),'dwpost','post'));
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default')))
$dw_enable = 1;
if(! $dw_enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'dwpost';
}
function dwpost_send(&$a,&$b) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
if(! strstr($b['postopts'],'dwpost'))
return;
if($b['parent'] != $b['id'])
return;
// dreamwidth post in the LJ user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.
$tz = 'UTC';
$x = q("select timezone from user where uid = %d limit 1",
intval($b['uid'])
);
if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone'];
$dw_username = get_pconfig($b['uid'],'dwpost','dw_username');
$dw_password = get_pconfig($b['uid'],'dwpost','dw_password');
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
if($dw_username && $dw_password && $dw_blog) {
require_once('include/bbcode.php');
require_once('include/datetime.php');
$title = $b['title'];
$post = bbcode($b['body']);
$post = xmlify($post);
$tags = dwpost_get_tags($b['tag']);
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
$year = intval(substr($date,0,4));
$mon = intval(substr($date,5,2));
$day = intval(substr($date,8,2));
$hour = intval(substr($date,11,2));
$min = intval(substr($date,14,2));
$xml = <<< EOT
<?xml version="1.0" encoding="utf-8"?>
<methodCall><methodName>LJ.XMLRPC.postevent</methodName>
<params><param>
<value><struct>
<member><name>year</name><value><int>$year</int></value></member>
<member><name>mon</name><value><int>$mon</int></value></member>
<member><name>day</name><value><int>$day</int></value></member>
<member><name>hour</name><value><int>$hour</int></value></member>
<member><name>min</name><value><int>$min</int></value></member>
<member><name>event</name><value><string>$post</string></value></member>
<member><name>username</name><value><string>$dw_username</string></value></member>
<member><name>password</name><value><string>$dw_password</string></value></member>
<member><name>subject</name><value><string>$title</string></value></member>
<member><name>lineendings</name><value><string>unix</string></value></member>
<member><name>ver</name><value><int>1</int></value></member>
<member><name>props</name>
<value><struct>
<member><name>useragent</name><value><string>Friendica</string></value></member>
<member><name>taglist</name><value><string>$tags</string></value></member>
</struct></value></member>
</struct></value>
</param></params>
</methodCall>
EOT;
logger('dwpost: data: ' . $xml, LOGGER_DATA);
if($dw_blog !== 'test')
$x = post_url($dw_blog,$xml,array("Content-Type: text/xml"));
logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
}
}
function dwpost_get_tags($post)
{
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
$tags = implode(', ',$matches[1]);
return $tags;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,30 +1,41 @@
Installing the Friendica/Facebook connector Installing the Friendica/Facebook connector
1. register an API key for your site from developer.facebook.com 1. Visit https://developers.facebook.com/apps to register an app.
a. We'd be very happy if you include "Friendica" in the application name a) Click "Create a new app"
to increase name recognition. The Friendica icons are also present b) We'd be very happy if you include "Friendica" in the application name
in the images directory and may be uploaded as a Facebook app icon. to increase name recognition.
Use images/friendica-16.jpg for the Icon and images/friendica-128.jpg for the Logo. c) Edit your app settings on the setup page. The Friendica icons are present
b. The url should be your site URL with a trailing slash. in the images directory and may be uploaded as a Facebook app icon. Use
You may use http://portal.friendika.com/privacy as the privacy policy images/friendica-16.jpg for the Icon and images/Friendica-128.jpg for the logo.
URL unless your site has different requirements, and d) In the App Display name enter the name of your app (this should default to the
http://portal.friendika.com as the Terms of Service URL unless name you chose in part a).
you have different requirements. (Friendica is a software application e) Enter YourDomain.com in the App Domain field and hit return.
and does not require Terms of Service, though your installation of it might). f) In "Select how your app connects with Facebook select "Website" and enter the
c. Set the following values in your .htconfig.php file full URL to your Friendica install including HTTPS and a trailing slash.
2. Enable the Facebook plugin by clicking on the icon next to it's name on the plugin
page of your admin panel.
b) return to the Facebook plugin page in your admin panel, and fill in the App-ID
and Application Secret settings you got from Facebook.
c) Click save.
d) Finally, return to the Facebook settings page, and activate real-time updates.
i. If you for any reason prefer to use a configuration file instead of the admin panels,
Activate the plugin by including it in .htconfig.php, e.g.
$a->config['system']['addon'] = 'plugin1,plugin2,facebook';
and set the following values:
$a->config['facebook']['appid'] = 'xxxxxxxxxxx'; $a->config['facebook']['appid'] = 'xxxxxxxxxxx';
$a->config['facebook']['appsecret'] = 'xxxxxxxxxxxxxxx'; $a->config['facebook']['appsecret'] = 'xxxxxxxxxxxxxxx';
Replace with the settings Facebook gives you. Replace with the settings Facebook gives you.
d. Navigate to Set Web->Site URL & Domain -> Website Settings. Set Site URL
to yoursubdomain.yourdomain.com. Set Site Domain to your yourdomain.com.
e. Chose "Website" (the url should be your site URL with a trailing slash) in the 3. To use the Facebook plugin, visit the "connector settings" area of your settings
"Select how your app integrates with Facebook" section. page. Click "Install Facebook Connector".
2. Enable the facebook plugin by including it in .htconfig.php - e.g. 4. This will ask you to login to Facebook and allow the plugin to do it's stuff.
$a->config['system']['addon'] = 'plugin1,plugin2,facebook'; Allow it to do so.
3. Visit the Facebook Settings section of the "Settings->Plugin Settings" page.
and click 'Install Facebook Connector'.
4. This will ask you to login to Facebook and grant permission to the
plugin to do its stuff. Allow it to do so.
5. You're done. To turn it off visit the Plugin Settings page again and 5. You're done. To turn it off visit the Plugin Settings page again and
'Remove Facebook posting'. 'Remove Facebook posting'.

File diff suppressed because it is too large Load diff

181
fromgplus/fromgplus.php Executable file
View file

@ -0,0 +1,181 @@
<?php
/**
* Name: From GPlus
* Description: Imports posts from a Google+ account and repeats them
* Version: 1.0
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
function fromgplus_install() {
register_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
register_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
}
function fromgplus_uninstall() {
unregister_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
unregister_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
}
function fromgplus_addon_settings(&$a,&$s) {
if(! local_user())
return;
$enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$account = get_pconfig(local_user(),'fromgplus','account');
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Google+ Import Settings').'</h3>';
$s .= '<div id="fromgplus-wrapper">';
$s .= '<label id="fromgplus-enable-label" for="fromgplus-enable">'.t('Enable Google+ Import').'</label>';
$s .= '<input id="fromgplus-enable" type="checkbox" name="fromgplus-enable" value="1"'.$enable_checked.' />';
$s .= '<div class="clear"></div>';
$s .= '<label id="fromgplus-label" for="fromgplus-account">'.t('Google Account ID').' </label>';
$s .= '<input id="fromgplus-account" type="text" name="fromgplus-account" value="'.$account.'" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fromgplus-submit" name="fromgplus-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '</div>';
return;
}
function fromgplus_addon_settings_post(&$a,&$b) {
if(! local_user())
return;
if($_POST['fromgplus-submit']) {
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
set_pconfig(local_user(),'fromgplus','enable', $enable);
info( t('Google+ Import Settings saved.') . EOL);
}
}
/*
function html2bbcode($html) {
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
$bbcode = str_replace(array("\n"), array(""), $bbcode);
$bbcode = str_replace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
$bbcode = str_replace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
$bbcode = str_replace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
$bbcode = str_replace(array("<br />"), array("\n"), $bbcode);
$bbcode = trim(strip_tags($bbcode));
return($bbcode);
}
function friendicapost($post) {
global $friendica;
$api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]);
$ret = $api->updateStatus($post);
$api->endSession();
}
function handleattachments($item) {
$post = "";
foreach ($item->object->attachments as $attachment) {
switch($attachment->objectType) {
case "video":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
//if (strpos($attachment->embed->url, "youtube.com"))
// $post .= "[youtube]".$attachment->url."[/youtube]\n";
//else
/// $post .= "[url=".$attachment->url."][img]".$attachment->image->url."[/img][/url]\n";
///$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "article":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "photo":
//$post .= "\n\n[url=".$attachment->fullImage->url."]".
// "[img]".$attachment->fullImage->url."[/img][/url]\n";
$post .= "\n\n[img]".$attachment->fullImage->url."[/img]\n";
if ($attachment->displayName != "")
$post .= html2bbcode($attachment->displayName)."\n";
break;
case "photo-album":
$post .= "\n\n[url=".$attachment->url."]".
"[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
break;
default:
print_r($attachment);
die();
break;
}
}
return($post);
}
$result = file_get_contents("https://www.googleapis.com/plus/v1/people/".$google["id"]."/activities/public?alt=json&pp=1&key=".$google["key"]."&maxResults=".$google["maxfetch"]);
$activities = json_decode($result);
$state = array("lastid"=>'');
if (file_exists($statefile))
$state = unserialize(file_get_contents($statefile));
$lastid = "";
foreach($activities->items as $item) {
if ($item->id == $state["lastid"])
break;
if ($lastid == "")
$lastid = $item->id;
switch($item->object->objectType) {
case "note":
$post = html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= handleattachments($item);
friendicapost($post);
break;
case "activity":
$post = html2bbcode($item->annotation)."\n";
//$post .= html2bbcode("&#x2672; ");
$post .= html2bbcode("&#x267B; ");
$post .= "[url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url]";
$post .= " \n";
//$post .= "[quote]";
$post .= html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= "\n".trim(handleattachments($item));
//$post .= "[/quote]";
friendicapost($post);
break;
default:
print_r($item);
die();
break;
}
}
if ($lastid != "") {
$state['lastid'] = $lastid;
file_put_contents($statefile, serialize($state));
}
*/

128
fromgplus/tofriendica.php Normal file
View file

@ -0,0 +1,128 @@
<?php
require_once("statusnet.lib.php");
include("config.php");
function html2bbcode($html) {
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
$bbcode = str_replace(array("\n"), array(""), $bbcode);
$bbcode = str_replace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
$bbcode = str_replace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
$bbcode = str_replace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
$bbcode = str_replace(array("<br />"), array("\n"), $bbcode);
$bbcode = trim(strip_tags($bbcode));
return($bbcode);
}
function friendicapost($post) {
global $friendica;
$api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]);
$ret = $api->updateStatus($post);
$api->endSession();
}
function handleattachments($item) {
$post = "";
foreach ($item->object->attachments as $attachment) {
switch($attachment->objectType) {
case "video":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
//if (strpos($attachment->embed->url, "youtube.com"))
// $post .= "[youtube]".$attachment->url."[/youtube]\n";
//else
/// $post .= "[url=".$attachment->url."][img]".$attachment->image->url."[/img][/url]\n";
///$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "article":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "photo":
//$post .= "\n\n[url=".$attachment->fullImage->url."]".
// "[img]".$attachment->fullImage->url."[/img][/url]\n";
$post .= "\n\n[img]".$attachment->fullImage->url."[/img]\n";
if ($attachment->displayName != "")
$post .= html2bbcode($attachment->displayName)."\n";
break;
case "photo-album":
$post .= "\n\n[url=".$attachment->url."]".
"[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
break;
default:
print_r($attachment);
die();
break;
}
}
return($post);
}
$result = file_get_contents("https://www.googleapis.com/plus/v1/people/".$google["id"]."/activities/public?alt=json&pp=1&key=".$google["key"]."&maxResults=".$google["maxfetch"]);
$activities = json_decode($result);
$state = array("lastid"=>'');
if (file_exists($statefile))
$state = unserialize(file_get_contents($statefile));
$lastid = "";
foreach($activities->items as $item) {
if ($item->id == $state["lastid"])
break;
if ($lastid == "")
$lastid = $item->id;
switch($item->object->objectType) {
case "note":
$post = html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= handleattachments($item);
friendicapost($post);
break;
case "activity":
$post = html2bbcode($item->annotation)."\n";
//$post .= html2bbcode("&#x2672; ");
$post .= html2bbcode("&#x267B; ");
$post .= "[url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url]";
$post .= " \n";
//$post .= "[quote]";
$post .= html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= "\n".trim(handleattachments($item));
//$post .= "[/quote]";
friendicapost($post);
break;
default:
print_r($item);
die();
break;
}
}
if ($lastid != "") {
$state['lastid'] = $lastid;
file_put_contents($statefile, serialize($state));
}
?>

Binary file not shown.

BIN
gnot.tgz

Binary file not shown.

BIN
ijpost.tgz Normal file

Binary file not shown.

15
ijpost/ijpost.css Normal file
View file

@ -0,0 +1,15 @@
#ijpost-enable-label, #ijpost-username-label, #ijpost-password-label, #ijpost-bydefault-label {
float: left;
width: 200px;
margin-top: 10px;
}
#ijpost-checkbox, #ijpost-username, #ijpost-password, #ijpost-bydefault {
float: left;
margin-top: 10px;
}
#ijpost-submit {
margin-top: 15px;
}

227
ijpost/ijpost.php Normal file
View file

@ -0,0 +1,227 @@
<?php
/**
* Name: Insanejournal Post Connector
* Description: Post to Insanejournal
* Version: 1.0
* Author: Tony Baldwin <https://free-haven.org/profile/tony>
* Author: Michael Johnston
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/
function ijpost_install() {
register_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local');
register_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send');
register_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets');
register_hook('connector_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings');
register_hook('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post');
}
function ijpost_uninstall() {
unregister_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local');
unregister_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send');
unregister_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets');
unregister_hook('connector_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings');
unregister_hook('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post');
}
function ijpost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$ij_post = get_pconfig(local_user(),'ijpost','post');
if(intval($ij_post) == 1) {
$ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default');
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Insanejournal') . '</div>';
}
}
function ijpost_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/ijpost/ijpost.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'ijpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'ijpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$ij_username = get_pconfig(local_user(), 'ijpost', 'ij_username');
$ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('InsaneJournal Post Settings') . '</h3>';
$s .= '<div id="ijpost-enable-wrapper">';
$s .= '<label id="ijpost-enable-label" for="ijpost-checkbox">' . t('Enable InsaneJournal Post Plugin') . '</label>';
$s .= '<input id="ijpost-checkbox" type="checkbox" name="ijpost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-username-wrapper">';
$s .= '<label id="ijpost-username-label" for="ijpost-username">' . t('InsaneJournal username') . '</label>';
$s .= '<input id="ijpost-username" type="text" name="ij_username" value="' . $ij_username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-password-wrapper">';
$s .= '<label id="ijpost-password-label" for="ijpost-password">' . t('InsaneJournal password') . '</label>';
$s .= '<input id="ijpost-password" type="password" name="ij_password" value="' . $ij_password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-bydefault-wrapper">';
$s .= '<label id="ijpost-bydefault-label" for="ijpost-bydefault">' . t('Post to InsaneJournal by default') . '</label>';
$s .= '<input id="ijpost-bydefault" type="checkbox" name="ij_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ijpost-submit" name="ijpost-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}
function ijpost_settings_post(&$a,&$b) {
if(x($_POST,'ijpost-submit')) {
set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost']));
set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault']));
set_pconfig(local_user(),'ijpost','ij_username',trim($_POST['ij_username']));
set_pconfig(local_user(),'ijpost','ij_password',trim($_POST['ij_password']));
}
}
function ijpost_post_local(&$a,&$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
return;
if($b['private'] || $b['parent'])
return;
$ij_post = intval(get_pconfig(local_user(),'ijpost','post'));
$ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default')))
$ij_enable = 1;
if(! $ij_enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'ijpost';
}
function ijpost_send(&$a,&$b) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
if(! strstr($b['postopts'],'ijpost'))
return;
if($b['parent'] != $b['id'])
return;
// insanejournal post in the LJ user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.
$tz = 'UTC';
$x = q("select timezone from user where uid = %d limit 1",
intval($b['uid'])
);
if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone'];
$ij_username = get_pconfig($b['uid'],'ijpost','ij_username');
$ij_password = get_pconfig($b['uid'],'ijpost','ij_password');
$ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
if($ij_username && $ij_password && $ij_blog) {
require_once('include/bbcode.php');
require_once('include/datetime.php');
$title = $b['title'];
$post = bbcode($b['body']);
$post = xmlify($post);
$tags = ijpost_get_tags($b['tag']);
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
$year = intval(substr($date,0,4));
$mon = intval(substr($date,5,2));
$day = intval(substr($date,8,2));
$hour = intval(substr($date,11,2));
$min = intval(substr($date,14,2));
$xml = <<< EOT
<?xml version="1.0" encoding="utf-8"?>
<methodCall><methodName>LJ.XMLRPC.postevent</methodName>
<params><param>
<value><struct>
<member><name>year</name><value><int>$year</int></value></member>
<member><name>mon</name><value><int>$mon</int></value></member>
<member><name>day</name><value><int>$day</int></value></member>
<member><name>hour</name><value><int>$hour</int></value></member>
<member><name>min</name><value><int>$min</int></value></member>
<member><name>event</name><value><string>$post</string></value></member>
<member><name>username</name><value><string>$ij_username</string></value></member>
<member><name>password</name><value><string>$ij_password</string></value></member>
<member><name>subject</name><value><string>$title</string></value></member>
<member><name>lineendings</name><value><string>unix</string></value></member>
<member><name>ver</name><value><int>1</int></value></member>
<member><name>props</name>
<value><struct>
<member><name>useragent</name><value><string>Friendica</string></value></member>
<member><name>taglist</name><value><string>$tags</string></value></member>
</struct></value></member>
</struct></value>
</param></params>
</methodCall>
EOT;
logger('ijpost: data: ' . $xml, LOGGER_DATA);
if($ij_blog !== 'test')
$x = post_url($ij_blog,$xml,array("Content-Type: text/xml"));
logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
}
}
function ijpost_get_tags($post)
{
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
$tags = implode(', ',$matches[1]);
return $tags;
}

Binary file not shown.

View file

@ -1,9 +1,10 @@
Impressum Plugin for Friendica Impressum Plugin for Friendica
Author: Tobias Diekershoff Author: Tobias Diekershoff
http://diekershoff.homeunix.net/friendika/profile/tobias
tobias.diekershoff@gmx.net tobias.diekershoff@gmx.net
License: 3-clause BSD license (same as Friendica) License: 3-clause BSD license
About About
This plugin adds an Impressum block to the /friendica page with informations This plugin adds an Impressum block to the /friendica page with informations
@ -12,16 +13,22 @@ About
In the notes and postal fields you can use HTML tags for formatting. In the notes and postal fields you can use HTML tags for formatting.
Configuration: Configuration:
For configuration you can set the following variables in the .htconfig file 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']['owner'] this is the Name of the Operator
* $a->config['impressum']['ownerprofile'] this is an optional Friendica account * $a->config['impressum']['ownerprofile'] this is an optional Friendica account
where the above owner name will link to where the above owner name will link to
* $a->config['impressum']['email'] a contact email address (optional) * $a->config['impressum']['email'] a contact email address (optional)
will be displayed slightly obfuscated will be displayed slightly obfuscated
as name(at)example(dot)com as name(at)example(dot)com
* $a->config['impressum']['postal'] should contain a postal address where * $a->config['impressum']['postal'] should contain a postal address where
you can be reached at (optional) you can be reached at (optional)
* $a->config['impressum']['notes'] additional informations that should * $a->config['impressum']['notes'] additional informations that should
be displayed in the Impressum block be displayed in the Impressum block
* $a->config['impressum']['footer_text'] Text that will be displayed at
the bottom of the pages.

View file

@ -3,4 +3,5 @@
{{ inc field_input.tpl with $field=$postal }}{{ endinc }} {{ inc field_input.tpl with $field=$postal }}{{ endinc }}
{{ inc field_input.tpl with $field=$notes }}{{ endinc }} {{ inc field_input.tpl with $field=$notes }}{{ endinc }}
{{ inc field_input.tpl with $field=$email }}{{ endinc }} {{ inc field_input.tpl with $field=$email }}{{ endinc }}
{{ inc field_input.tpl with $field=$footer_text }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div> <div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

4
impressum/impressum.css Normal file
View file

@ -0,0 +1,4 @@
#impressum_footer {
padding-top: 15px;
font-size: 0.8em;
}

View file

@ -2,18 +2,20 @@
/** /**
* 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.0 * Version: 1.1
* Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias>
* License: 3-clause BSD license * License: 3-clause BSD license
*/ */
function impressum_install() { function impressum_install() {
register_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); register_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
register_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("installed impressum plugin"); logger("installed impressum plugin");
} }
function impressum_uninstall() { function impressum_uninstall() {
unregister_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); unregister_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
unregister_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("uninstalled impressum plugin"); logger("uninstalled impressum plugin");
} }
function obfuscate_email ($s) { function obfuscate_email ($s) {
@ -21,6 +23,13 @@ function obfuscate_email ($s) {
$s = str_replace('.','(dot)',$s); $s = str_replace('.','(dot)',$s);
return $s; return $s;
} }
function impressum_footer($a, &$b) {
$text = get_config('impressum','footer_text');
if (! $text == '') {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/impressum/impressum.css" media="all" />';
$b .= '<div id="impressum_footer">'.$text.'</div>';
}
}
function impressum_show($a,&$b) { function impressum_show($a,&$b) {
$b .= '<h3>'.t('Impressum').'</h3>'; $b .= '<h3>'.t('Impressum').'</h3>';
$owner = get_config('impressum', 'owner'); $owner = get_config('impressum', 'owner');
@ -56,21 +65,24 @@ function impressum_plugin_admin_post (&$a) {
$postal = ((x($_POST, 'postal')) ? (trim($_POST['postal'])) : ''); $postal = ((x($_POST, 'postal')) ? (trim($_POST['postal'])) : '');
$notes = ((x($_POST, 'notes')) ? (trim($_POST['notes'])) : ''); $notes = ((x($_POST, 'notes')) ? (trim($_POST['notes'])) : '');
$email = ((x($_POST, 'email')) ? notags(trim($_POST['email'])) : ''); $email = ((x($_POST, 'email')) ? notags(trim($_POST['email'])) : '');
$footer_text = ((x($_POST, 'footer_text')) ? (trim($_POST['footer_text'])) : '');
set_config('impressum','owner',$owner); set_config('impressum','owner',$owner);
set_config('impressum','ownerprofile',$ownerprofile); set_config('impressum','ownerprofile',$ownerprofile);
set_config('impressum','postal',$postal); set_config('impressum','postal',$postal);
set_config('impressum','email',$email); set_config('impressum','email',$email);
set_config('impressum','notes',$notes); set_config('impressum','notes',$notes);
set_config('impressum','footer_text',$footer_text);
info( t('Settings updated.'). EOL ); info( t('Settings updated.'). EOL );
} }
function impressum_plugin_admin (&$a, &$o) { function impressum_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__). "/admin.tpl" ); $t = file_get_contents( dirname(__file__). "/admin.tpl" );
$o = replace_macros($t, array( $o = replace_macros($t, array(
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$owner' => array('owner', t('Site Owner'), get_config('impressum','owner'), ''), '$owner' => array('owner', t('Site Owner'), get_config('impressum','owner'), t('The page operators name.')),
'$ownerprofile' => array('ownerprofile', t('Site Owners Profile'), get_config('impressum','ownerprofile'), ''), '$ownerprofile' => array('ownerprofile', t('Site Owners Profile'), get_config('impressum','ownerprofile'), t('Profile address of the operator.')),
'$postal' => array('postal', t('Postal Address'), get_config('impressum','postal'), ''), '$postal' => array('postal', t('Postal Address'), get_config('impressum','postal'), t('How to contact the operator via snail mail.')),
'$notes' => array('notes', t('Notes'), get_config('impressum','notes'), ''), '$notes' => array('notes', t('Notes'), get_config('impressum','notes'), t('Additional notes that are displayed beneath the contact information.')),
'$email' => array('email', t('Email Address'), get_config('impressum','email'), ''), '$email' => array('email', t('Email Address'), get_config('impressum','email'), t('How to contact the operator via email. (will be displayed obfuscated)')),
'$footer_text' => array('footer_text', t('Footer note'), get_config('impressum','footer_text'), t('Text for the footer.')),
)); ));
} }

BIN
irc.tgz Normal file

Binary file not shown.

72
irc/irc.php Normal file
View file

@ -0,0 +1,72 @@
<?php
/**
* Name: IRC Chat Plugin
* Description: add an Internet Relay Chat chatroom
* Version: 1.0
* Author: tony baldwin <https://free-haven.org/profile/tony>
*/
/* enable in admin->plugins
* you will then have "irc chatroom" listed at yoursite/apps
* and the app will run at yoursite/irc
* documentation at http://tonybaldwin.me/hax/doku.php?id=friendica:irc
*/
function irc_install() {
register_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
}
function irc_uninstall() {
unregister_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
}
function irc_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . t('IRC Chatroom') . '</a></div>';
}
function irc_module() {
return;
}
function irc_content(&$a) {
$baseurl = $a->get_baseurl() . '/addon/irc';
$o = '';
$sitechats = get_config('irc','channels');
if($sitechats)
$chats = explode(',',$sitechats);
else
$chats = array('friendica','chat','chatback','hottub','ircbar','dateroom','teentalk');
$a->page['aside'] .= '<div class="widget"><h3>' . t('Popular Channels') . '</h3><ul>';
foreach($chats as $chat) {
$a->page['aside'] .= '<li><a href="' . $a->get_baseurl() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
}
$a->page['aside'] .= '</ul></div>';
$channels = ((x($_GET,'channels')) ? $_GET['channels'] : 'friendica');
/* add the chatroom frame and some html
* by altering the "channels=friendica" part of the URL, you can add/remove channels.
* At free-haven.org, I have "?channels=friendica,free-haven", for instance, to open #friendica and #free-haven
*/
$o .= <<< EOT
<h2>IRC chat</h2>
<p><a href="http://tldp.org/HOWTO/IRC/beginners.html" target="_blank">A beginner's guide to using IRC. [en]</a></p>
<iframe src="http://webchat.freenode.net?channels=$channels" width="600" height="600"></iframe>
EOT;
return $o;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,6 @@
#ljpost-enable-label, #ljpost-username-label, #ljpost-password-label, #ljpost-bydefault-label { #ljpost-enable-label, #ljpost-username-label, #ljpost-password-label, #ljpost-bydefault-label {
<<<<<<< HEAD
float: left; float: left;
width: 200px; width: 200px;
margin-top: 10px; margin-top: 10px;
@ -14,3 +15,18 @@
margin-top: 15px; margin-top: 15px;
} }
=======
float: left;
width: 200px;
margin-top: 10px;
}
#ljpost-checkbox, #ljpost-username, #ljpost-password, #ljpost-bydefault {
float: left;
margin-top: 10px;
}
#ljpost-submit {
margin-top: 15px;
}
>>>>>>> 99d9fddb6af9e872266666038447771e42ce13b4

View file

@ -4,8 +4,9 @@
* Name: LiveJournal Post Connector * Name: LiveJournal Post Connector
* Description: Post to LiveJournal * Description: Post to LiveJournal
* Version: 1.0 * Version: 1.0
* Author: Tony Baldwin <http://theshi.re/profile/tony> * Author: Tony Baldwin <https://free-haven.org/profile/tony>
* Author: Michael Johnston * Author: Michael Johnston
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/ */
function ljpost_install() { function ljpost_install() {
@ -179,6 +180,7 @@ function ljpost_send(&$a,&$b) {
$title = xmlify($b['title']); $title = xmlify($b['title']);
$post = bbcode($b['body']); $post = bbcode($b['body']);
$post = xmlify($post); $post = xmlify($post);
$tags = ljpost_get_tags($b['tag']);
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
$year = intval(substr($date,0,4)); $year = intval(substr($date,0,4));
@ -204,6 +206,22 @@ function ljpost_send(&$a,&$b) {
<member><name>day</name><value><int>$day</int></value></member> <member><name>day</name><value><int>$day</int></value></member>
<member><name>hour</name><value><int>$hour</int></value></member> <member><name>hour</name><value><int>$hour</int></value></member>
<member><name>min</name><value><int>$min</int></value></member> <member><name>min</name><value><int>$min</int></value></member>
<member><name>usejournal</name><value><string>$lj_username</string></value></member>
<member>
<name>props</name>
<value>
<struct>
<member>
<name>useragent</name>
<value><string>Friendica</string></value>
</member>
<member>
<name>taglist</name>
<value><string>$tags</string></value>
</member>
</struct>
</value>
</member>
</struct> </struct>
</value></param> </value></param>
</params> </params>
@ -214,9 +232,15 @@ EOT;
logger('ljpost: data: ' . $xml, LOGGER_DATA); logger('ljpost: data: ' . $xml, LOGGER_DATA);
if($lj_blog !== 'test') if($lj_blog !== 'test')
$x = post_url($lj_blog,$xml); $x = post_url($lj_blog,$xml,array("Content-Type: text/xml"));
logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
} }
} }
function ljpost_get_tags($post)
{
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
$tags = implode(', ',$matches[1]);
return $tags;
}

Binary file not shown.

BIN
namethingy.tgz Normal file

Binary file not shown.

37
namethingy/namethingy.php Executable file
View file

@ -0,0 +1,37 @@
<?php
/**
*
* Name: NameThingy
* Description: The Ultimate Random Name Generator
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
function namethingy_install() {
register_hook('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu');
}
function namethingy_uninstall() {
unregister_hook('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu');
}
function namethingy_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="namethingy">NameThingy</a></div>';
}
function namethingy_module() {}
function namethingy_content(&$a) {
$baseurl = $a->get_baseurl() . '/addon/namethingy';
$o .= <<< EOT
<iframe src="http://namethingy.com" width="900" height="700" />
EOT;
return $o;
}

BIN
nsfw.tgz

Binary file not shown.

View file

@ -44,13 +44,13 @@ function nsfw_addon_settings(&$a,&$s) {
$words = 'nsfw,'; $words = 'nsfw,';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('"Not Safe For Work" Settings') . '</h3>'; $s .= '<h3>' . t('Not Safe For Work (General Purpose Content Filter) settings') . '</h3>';
$s .= '<div id="nsfw-wrapper">'; $s .= '<div id="nsfw-wrapper">';
$s .= '<p>' . t ('This plugin looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter.') . '</p>';
$s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . t('Enable NSFW filter') . ' </label>'; $s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . t('Enable Content filter') . ' </label>';
$s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />'; $s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated words to treat as NSFW') . ' </label>'; $s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated list of keywords to hide') . ' </label>';
$s .= '<input id="nsfw-words" type="text" name="nsfw-words" value="' . $words .'" />'; $s .= '<input id="nsfw-words" type="text" name="nsfw-words" value="' . $words .'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';

Binary file not shown.

Binary file not shown.

View file

@ -16,11 +16,29 @@ Support the OpenStreetMap community and share the load.
___ Configuration ___ ___ Configuration ___
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 your admin panel.
You can now add a Tile Server and default zoom level in the plugin settings
page of your admin panel.
The Time Server URL points to the tile server you want to use. Use the full URL,
with protocol (http/s) and trailing slash. You can configure the default zoom
level on the map in the Default Zoom box. 1 will show the whole world and 18 is the highest
zoom level available.
___ Alternative Configuration ___
Open the .htconfig.php file and add "openstreetmap" to the list of activated Open the .htconfig.php file and add "openstreetmap" to the list of activated
addons. addons.
$a->config['system']['addon'] = "openstreetmap, ..." $a->config['system']['addon'] = "openstreetmap, ..."
You have to add two configuration variables for the addon: You have to add two configuration variables for the addon:
$a->config['openstreetmap']['tmsserver'] = 'http://www.openstreetmap.org/'; $a->config['openstreetmap']['tmsserver'] = 'http://www.openstreetmap.org/';
$a->config['openstreetmap']['zoom'] = '18'; $a->config['openstreetmap']['zoom'] = '18';

BIN
page.tgz Normal file

Binary file not shown.

60
page/page.php Executable file
View file

@ -0,0 +1,60 @@
<?php
/**
* Name: Page
* Description: Shows lists of community pages (improved performance over 'pages')
* Version: 1.0
* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
function page_install() {
register_hook('page_end', 'addon/page/page.php', 'page_page_end');
}
function page_uninstall() {
unregister_hook('page_end', 'addon/page/page.php', 'page_page_end');
}
function page_getpage($uid) {
$pagelist = array();
$contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d",
intval($uid)
);
$page = array();
// Look if the profile is a community page
foreach($contacts as $contact) {
$page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
}
return($page);
}
function page_page_end($a,&$b) {
// Only move on if if it's the "network" module and there is a logged on user
if (($a->module != "network") OR ($a->user['uid'] == 0))
return;
$page = '<div id="page-sidebar" class="widget">
<div class="title tool">
<h3>'.t("Forums").'</h3></div>
<div id="sidebar-page-list"><ul>';
$contacts = page_getpage($a->user['uid']);
foreach($contacts as $contact) {
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" title="' . $contact['url'] . '" class="label" target="external-link">'.
$contact["name"]."</a></li>";
}
$page .= "</ul></div></div>";
if (sizeof($contacts) > 0)
$a->page['aside'] = $page . $a->page['aside'];
}
?>

Binary file not shown.

View file

@ -10,7 +10,7 @@
*/ */
function pageheader_install() { function pageheader_install() {
register_hook('page_header', 'addon/pageheader/pageheader.php', 'pageheader_fetch'); register_hook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch');
register_hook('plugin_settings', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings'); register_hook('plugin_settings', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings');
register_hook('plugin_settings_post', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings_post'); register_hook('plugin_settings_post', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings_post');
@ -18,10 +18,13 @@ function pageheader_install() {
function pageheader_uninstall() { function pageheader_uninstall() {
unregister_hook('page_header', 'addon/pageheader/pageheader.php', 'pageheader_fetch'); unregister_hook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch');
unregister_hook('plugin_settings', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings'); unregister_hook('plugin_settings', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings');
unregister_hook('plugin_settings_post', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings_post'); unregister_hook('plugin_settings_post', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings_post');
// hook moved, uninstall the old one if still there.
unregister_hook('page_header', 'addon/pageheader/pageheader.php', 'pageheader_fetch');
} }
@ -41,7 +44,7 @@ function pageheader_addon_settings(&$a,&$s) {
$words = get_config('pageheader','text'); $words = get_config('pageheader','text');
if(! $words) if(! $words)
$words = 'pageheader,'; $words = '';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('"pageheader" Settings') . '</h3>'; $s .= '<h3>' . t('"pageheader" Settings') . '</h3>';

BIN
pages.tgz Normal file

Binary file not shown.

BIN
piwik.tgz

Binary file not shown.

View file

@ -1,6 +1,7 @@
## Piwik Plugin ## ## Piwik Plugin ##
by Tobias Diekershoff by Tobias Diekershoff
http://diekershoff.homeunix.net/friendika/profile/tobias
tobias.diekershoff(at)gmx.net 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
@ -19,6 +20,13 @@ styling the opt-out notice.
### Configuration ### ### Configuration ###
The easiest way to configure this addon is by activating the admin panels of
your ~friendica server and then enter the needed details on the config page
for the addon.
If you don't want to use the admin panel, you can configure the addon through
the .htconfig file.
Open the .htconfig.php file and add "piwik" to the list of activated addons. Open the .htconfig.php file and add "piwik" to the list of activated addons.
$a->config['system']['addon'] = "piwik, ..." $a->config['system']['addon'] = "piwik, ..."

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 <https://diekershoff.homeunix.net/friendika/profile/tobias> * Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias>
* Author: Klaus Weidenbach * Author: Klaus Weidenbach
*/ */
@ -49,7 +49,7 @@ function piwik_analytics($a,&$b) {
* associated CSS file. We just have to tell Friendica to get it * associated CSS file. We just have to tell Friendica to get it
* into the page header. * into the page header.
*/ */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/piwik/piwik.css' . '" media="all" />' . "\r\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/piwik/piwik.css' . '" media="all" />';
/* /*
* Get the configuration variables from the .htconfig file. * Get the configuration variables from the .htconfig file.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -46,7 +46,8 @@ function showmore_addon_settings(&$a,&$s) {
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="showmore-submit" name="showmore-submit" class="settings-submit" value="' . t('Submit') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="showmore-submit" name="showmore-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
// $s .= '<div class="showmore-desc">' . t('Use /expression/ to provide regular expressions') . '</div></div>'; // $s .= '<div class="showmore-desc">' . t('Use /expression/ to provide regular expressions') . '</div>';
$s .= '</div>';
return; return;
} }
@ -83,7 +84,7 @@ function showmore_prepare_body(&$a,&$b) {
if($found) { if($found) {
$rnd = random_string(8); $rnd = random_string(8);
$b['html'] = '<span id="showmore-teaser-'.$rnd.'" style="display: block;">'.$shortened." ". $b['html'] = '<span id="showmore-teaser-'.$rnd.'" style="display: block;">'.$shortened." ".
'<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(t('Show More')).'</span></span>'. '<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(t('show more')).'</span></span>'.
'<div id="showmore-'.$rnd.'" style="display: none;">'.$b['html'].'</div>'; '<div id="showmore-'.$rnd.'" style="display: none;">'.$b['html'].'</div>';
} }
} }

BIN
smiley_pack.tgz Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Some files were not shown because too many files have changed in this diff Show more