Merge remote branch 'friendica/master'

This commit is contained in:
fabrixxm 2013-02-27 04:33:53 -05:00
commit 2517e7716e
151 changed files with 6173 additions and 678 deletions

24
.gitignore vendored Normal file
View file

@ -0,0 +1,24 @@
favicon.*
.htconfig.php
\#*
*.log
*.out
*.version*
favicon.*
*~
#ignore reports, should be generted with every build
report/
#ignore config files from eclipse, we don't want IDE files in our repository
.project
.buildpath
.externalToolBuilders
.settings
#ignore OSX .DS_Store files
.DS_Store
/nbproject/private/
#ignore smarty cache
/view/smarty3/compiled/

18
INSTALL.txt Normal file
View file

@ -0,0 +1,18 @@
*********************
* Install Using Git *
*********************
To install all addons using git, cd into your top level Friendica directory and
git clone https://github.com/friendica/friendica-addons.git addon
This will clone the entire repository in a directory called addon. They can now be activated in the plugins section of your admin panel.
********************
* Install Manually *
********************
1. Download the archive (AddonName.tgz) containing the addon you want to install.
2. Unzip the contents of the archive to your harddrive.
3. Upload the extracted directory and all it's contents to /path/to/friendica/addon. You will need to create the addon directory if this is the first addon you have installed.
4. Activate the addon in the plugins section of your admin panel.

BIN
altpager.tgz Normal file

Binary file not shown.

View file

@ -61,6 +61,10 @@ function altpager_settings(&$a,&$s) {
if(! local_user())
return;
$global = get_config("alt_pager", "global");
if($global == 1)
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/altpager/altpager.css' . '" media="all" />' . "\r\n";
@ -87,3 +91,19 @@ function altpager_settings(&$a,&$s) {
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="altpager-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}
function altpager_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/altpager/" );
$o = replace_macros($t, array(
'$submit' => t('Submit'),
'$global' => array('altpagerchoice', t('Global'), 1, t('Force global use of the alternate pager'), get_config('alt_pager', 'global') == 1),
'$individual' => array('altpagerchoice', t('Individual'), 2, t('Each user chooses whether to use the alternate pager'), get_config('alt_pager', 'global') == 0)
));
}
function altpager_plugin_admin_post(&$a){
$choice = ((x($_POST,'altpagerchoice')) ? notags(trim($_POST['altpagerchoice'])) : '');
set_config('alt_pager','global',($choice == 1 ? 1 : 0));
info( t('Settings updated.'). EOL );
}

3
altpager/view/admin.tpl Normal file
View file

@ -0,0 +1,3 @@
{{ inc field_radio.tpl with $field=$global }}{{ endinc }}
{{ inc field_radio.tpl with $field=$individual }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

3
altpager/view/admin.tpl.old Executable file
View file

@ -0,0 +1,3 @@
{{ inc field_radio.tpl with $field=$global }}{{ endinc }}
{{ inc field_radio.tpl with $field=$individual }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

View file

@ -0,0 +1,3 @@
{{include file="field_radio.tpl" field=$global}}
{{include file="field_radio.tpl" field=$individual}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

Binary file not shown.

View file

@ -93,8 +93,9 @@ function blackout_plugin_admin(&$a, &$o) {
if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
$myurl = get_config('blackout','url');
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
$t = file_get_contents( dirname(__file__)."/admin.tpl" );
$o = replace_macros($t, array(
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
$o = replace_macros($t, array(
'$submit' => t('Submit'),
'$rurl' => array("rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"),
'$startdate' => array("startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"),

View file

@ -0,0 +1,11 @@
{{include file="field_input.tpl" field=$startdate}}
{{include file="field_input.tpl" field=$enddate}}
{{include file="field_input.tpl" field=$rurl}}
<div style="border: 2px solid #f00; padding: 10px; margin:
10px;font-size: 1.2em;"><strong>Note</strong>: The redirect will be active from the moment you
press the submit button. Users currently logged in will <strong>not</strong> be
thrown out but can't login again after logging out should the blackout is
still in place.</div>
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

Binary file not shown.

View file

@ -12,4 +12,4 @@ function buglink_install() { register_hook('page_end', 'addon/buglink/buglink.ph
function buglink_uninstall() { unregister_hook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); }
function buglink_active(&$a,&$b) { $b .= '<div style="position: fixed; bottom: 5px; left: 5px;"><a href="http://bugs.friendica.com" title="' . t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . t('Report Bug') . '" /></a></div>'; }
function buglink_active(&$a,&$b) { $b .= '<div style="position: fixed; bottom: 5px; left: 5px;"><a href="http://bugs.friendica.com" target="_blank" title="' . t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . t('Report Bug') . '" /></a></div>'; }

Binary file not shown.

View file

@ -9,3 +9,26 @@ choosed to be in site directory), last ten public photos and last ten
In main content is shown the community stream. This plugin doesn't
honour your community page visibility site setting: the community
stream is shown also if you have choose to not show the community page.
If 'home.html' is found in your friendica root, its content is inserted
before community stream
Each elements can be show or not. At the moment, there is no admin page
for settings, so this settings must be added to yout .htconfig.php
$a->config['communityhome']['showcommunitystream'] = true;
$a->config['communityhome']['showlastlike'] = true;
$a->config['communityhome']['showlastphotos'] = true;
$a->config['communityhome']['showactiveusers'] = true;
$a->config['communityhome']['showlastusers'] = true;
If you don't want to show something, set it to false.
Note:
-----
- Default is "false". With no settings in .htconfig.php, nothing is
shown, except login form and content of 'home.html'
- Active users query can be heavy for db, and on some system don't work

View file

@ -39,4 +39,5 @@ aside .directory-photo-img { max-width: 48px; max-height: 48px; }
aside #likes { margin: 0px; padding: 0px; list-style: none; }
aside #login-extra-links { overflow: auto; width: 100%; padding-top:120px;}
aside #div_id_remember { overflow: auto; width: 100%; padding-top:120px;}
#login_openid input { width: 160px; }

View file

@ -2,7 +2,7 @@
/**
* Name: Community home
* Description: Show last community activity in homepage
* Version: 1.0
* Version: 2.0
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
*/
@ -35,151 +35,166 @@ function communityhome_home(&$a, &$o){
$aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
// last 12 users
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
if (get_config('communityhome','showlastusers')===true){
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
0,
12
);
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
if(count($r)) {
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $profile_link,
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt-text' => $rr['name'],
));
$aside['$lastusers_items'][] = $entry;
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
0,
12
);
# $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
$tpl = get_markup_template( 'directory_item.tpl', 'addon/communityhome/' );
if(count($r)) {
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt_text' => $rr['name'],
));
$aside['$lastusers_items'][] = $entry;
}
}
}
// 12 most active users (by posts and contacts)
// this query don't work on some mysql versions
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
(SELECT COUNT(`id`) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
(SELECT COUNT(`id`) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
(
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL
SELECT `contacts`,`items`,`con`.`uid` FROM `con` LEFT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
) AS `uni`, `user`, `profile`
WHERE `uni`.`uid`=`user`.`uid`
AND `uni`.`uid`=`profile`.`uid` AND `profile`.`publish`=1
GROUP BY `uid`
ORDER BY `items` DESC,`contacts` DESC
LIMIT 0,10");
if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users');
$aside['$activeusers_items'] = array();
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $profile_link,
'$photo' => $rr[$photo],
'$alt-text' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
));
$aside['$activeusers_items'][] = $entry;
if (get_config('communityhome','showactiveusers')===true){
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
(SELECT COUNT(`id`) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
(SELECT COUNT(`id`) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
(
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL
SELECT `contacts`,`items`,`con`.`uid` FROM `con` LEFT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
) AS `uni`, `user`, `profile`
WHERE `uni`.`uid`=`user`.`uid`
AND `uni`.`uid`=`profile`.`uid` AND `profile`.`publish`=1
GROUP BY `uid`
ORDER BY `items` DESC,`contacts` DESC
LIMIT 0,10");
if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users');
$aside['$activeusers_items'] = array();
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],
'$alt_text' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
));
$aside['$activeusers_items'][] = $entry;
}
}
}
// last 12 photos
$aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = array();
$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`
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
`user`
WHERE `user`.`uid` = `photo`.`uid`
AND `user`.`blockwall`=0
ORDER BY `photo`.`edited` DESC
LIMIT 0, 12",
dbesc(t('Contact Photos')),
dbesc(t('Profile Photos'))
);
if (get_config('communityhome','showlastphotos')===true){
$aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = array();
$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`
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
`user`
WHERE `user`.`uid` = `photo`.`uid`
AND `user`.`blockwall`=0
AND `user`.`hidewall` = 0
ORDER BY `photo`.`edited` DESC
LIMIT 0, 12",
dbesc(t('Contact Photos')),
dbesc(t('Profile Photos'))
);
if(count($r)) {
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
foreach($r as $rr) {
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $photo_page,
'$photo' => $photo_url,
'$alt-text' => $rr['username']." : ".$rr['desc'],
));
if(count($r)) {
# $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
$tpl = get_markup_template( 'directory_item.tpl', 'addon/communityhome/' );
foreach($r as $rr) {
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $photo_page,
'$photo' => $photo_url,
'$alt_text' => $rr['username']." : ".$rr['desc'],
));
$aside['$photos_items'][] = $entry;
$aside['$photos_items'][] = $entry;
}
}
}
// last 10 liked items
$aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = array();
$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`
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
GROUP BY `uri`
ORDER BY `T1`.`created` DESC
LIMIT 0,10",
$a->get_baseurl(),$a->get_baseurl()
);
if (get_config('communityhome','showlastlike')===true){
$aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = array();
$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`
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
GROUP BY `uri`
ORDER BY `T1`.`created` DESC
LIMIT 0,10",
$a->get_baseurl(),$a->get_baseurl()
);
foreach ($r as $rr) {
$author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
$objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
//var_dump($rr['verb'],$rr['object-type']); killme();
switch($rr['verb']){
case 'http://activitystrea.ms/schema/1.0/post':
switch ($rr['object-type']){
case 'http://activitystrea.ms/schema/1.0/event':
$post_type = t('event');
break;
default:
foreach ($r as $rr) {
$author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
$objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
//var_dump($rr['verb'],$rr['object-type']); killme();
switch($rr['verb']){
case 'http://activitystrea.ms/schema/1.0/post':
switch ($rr['object-type']){
case 'http://activitystrea.ms/schema/1.0/event':
$post_type = t('event');
break;
default:
$post_type = t('status');
}
break;
default:
if ($rr['resource-id']){
$post_type = t('photo');
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$rr['plink'] = $m[1];
} else {
$post_type = t('status');
}
break;
default:
if ($rr['resource-id']){
$post_type = t('photo');
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$rr['plink'] = $m[1];
} else {
$post_type = t('status');
}
}
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
}
}
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
}
}
$tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
# $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
$tpl = get_markup_template('communityhome.tpl', 'addon/communityhome/');
$a->page['aside'] = replace_macros($tpl, $aside);
$o = '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
$oldset = get_config('system','no_community_page');
set_config('system','no_community_page', false);
$o .= community_content($a,1);
set_config('system','no_community_page', $oldset);
if(file_exists('home.html'))
$o = file_get_contents('home.html');
if (get_config('communityhome','showcommunitystream')===true){
$oldset = get_config('system','no_community_page');
set_config('system','no_community_page', false);
$o .= community_content($a,1);
set_config('system','no_community_page', $oldset);
}
}

View file

@ -1,3 +0,0 @@
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.
Simply replace addon/communityhome/communityhome.php with this version then enable community home in your admin panel as usual.

View file

@ -1,107 +0,0 @@
<?php
/**
* Name: Community home
* Description: Show last community activity in homepage
* Version: 1.0
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
*/
require_once('mod/community.php');
function communityhome_install() {
register_hook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
logger("installed communityhome");
}
function communityhome_uninstall() {
unregister_hook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
logger("removed communityhome");
}
function communityhome_home(&$a, &$o){
// custom css
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
$aside = array(
'$tab_1' => t('Login'),
'$tab_2' => t('OpenID'),
'$noOid' => get_config('system','no_openid'),
);
// login form
$aside['$login_title'] = t('Login');
$aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
// last 12 users
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
0,
12
);
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
if(count($r)) {
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $profile_link,
'$photo' => $rr[$photo],
'$alt-text' => $rr['name'],
));
$aside['$lastusers_items'][] = $entry;
}
}
// 12 most active users (by posts and contacts)
// this query don't work on some mysql versions
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
(SELECT COUNT(`id`) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
(SELECT COUNT(`id`) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
(
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL
SELECT `contacts`,`items`,`con`.`uid` FROM `con` LEFT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
) AS `uni`, `user`, `profile`
WHERE `uni`.`uid`=`user`.`uid`
AND `uni`.`uid`=`profile`.`uid` AND `profile`.`publish`=1
GROUP BY `uid`
ORDER BY `items` DESC,`contacts` DESC
LIMIT 0,10");
if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users');
$aside['$activeusers_items'] = array();
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $profile_link,
'$photo' => $rr[$photo],
'$alt-text' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
));
$aside['$activeusers_items'][] = $entry;
}
}
$tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
$a->page['aside'] = replace_macros($tpl, $aside);
$o = '';
if(file_exists('home.html'))
$o .= file_get_contents('home.html');
}

View file

@ -2,8 +2,8 @@
<div class="directory-item" id="directory-item-$id" >
<div class="directory-photo-wrapper" id="directory-photo-wrapper-$id" >
<div class="directory-photo" id="directory-photo-$id" >
<a href="$profile-link" class="directory-profile-link" id="directory-profile-link-$id" >
<img class="directory-photo-img" src="$photo" alt="$alt-text" title="$alt-text" />
<a href="$profile_link" class="directory-profile-link" id="directory-profile-link-$id" >
<img class="directory-photo-img" src="$photo" alt="$alt_text" title="$alt_text" />
</a>
</div>
</div>

View file

@ -0,0 +1,70 @@
<script>
$(function(){
$("#tab_1 a").click(function(e){
$("#login_standard").show();
$("#login_openid").hide();
$("#tab_1").addClass("active");
$("#tab_2").removeClass("active");
e.preventDefault();
return false;
});
$("#tab_2 a").click(function(e){
$("#login_openid").show();
$("#login_standard").hide();
$("#tab_2").addClass("active");
$("#tab_1").removeClass("active");
e.preventDefault();
return false;
});
});
</script>
{{if $noOid}}
<h3>{{$login_title}}</h3>
{{else}}
<ul class="tabs">
<li id="tab_1" class="tab button active"><a href="#">{{$tab_1}}</a></li>
<li id="tab_2" class="tab button"><a href="#">{{$tab_2}}</a></li>
</ul>
{{/if}}
{{$login_form}}
{{if $lastusers_title}}
<h3>{{$lastusers_title}}</h3>
<div class='items-wrapper'>
{{foreach $lastusers_items as $i}}
{{$i}}
{{/foreach}}
</div>
{{/if}}
{{if $activeusers_title}}
<h3>{{$activeusers_title}}</h3>
<div class='items-wrapper'>
{{foreach $activeusers_items as $i}}
{{$i}}
{{/foreach}}
</div>
{{/if}}
{{if $photos_title}}
<h3>{{$photos_title}}</h3>
<div class='items-wrapper'>
{{foreach $photos_items as $i}}
{{$i}}
{{/foreach}}
</div>
{{/if}}
{{if $like_title}}
<h3>{{$like_title}}</h3>
<ul id='likes'>
{{foreach $like_items as $i}}
<li>{{$i}}</li>
{{/foreach}}
</ul>
{{/if}}

View file

@ -0,0 +1,10 @@
<div class="directory-item" id="directory-item-{{$id}}" >
<div class="directory-photo-wrapper" id="directory-photo-wrapper-{{$id}}" >
<div class="directory-photo" id="directory-photo-{{$id}}" >
<a href="{{$profile}}-link" class="directory-profile-link" id="directory-profile-link-{{$id}}" >
<img class="directory-photo-img" src="{{$photo}}" alt="{{$alt}}-text" title="{{$alt}}-text" />
</a>
</div>
</div>
</div>

Binary file not shown.

BIN
curweather.tgz Normal file

Binary file not shown.

10
curweather/curweather.css Normal file
View file

@ -0,0 +1,10 @@
#curtemp-settings-label, #curtemp-location-label, #curtemp-enable-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#curtemp-network {
float: left;
}

108
curweather/curweather.php Normal file
View file

@ -0,0 +1,108 @@
<?php
/**
* Name: Current Weather
* Description: Shows current weather conditions for user's location on their network page.<br />Find the location code for the station or airport nearest you <a href="http://en.wikipedia.org/wiki/International_Air_Transport_Association_airport_code" target="_blank">here</a>.
* Version: 1.0
* Author: Tony Baldwin <http://friendica.tonybaldwin.info/u/t0ny>
* Author: Fabio Comuni <http://kirkgroup.com/u/fabrixxm>
*
*/
require_once('addon/curweather/getweather.php');
function curweather_install() {
register_hook('network_mod_init', 'addon/curweather/curweather.php', 'curweather_network_mod_init');
register_hook('plugin_settings', 'addon/curweather/curweather.php', 'curweather_plugin_settings');
register_hook('plugin_settings_post', 'addon/curweather/curweather.php', 'curweather_plugin_settings_post');
}
function curweather_uninstall() {
unregister_hook('network_mod_init', 'addon/curweather/curweather.php', 'curweather_network_mod_init');
unregister_hook('plugin_settings', 'addon/curweather/curweather.php', 'curweather_plugin_settings');
unregister_hook('plugin_settings_post', 'addon/curweather/curweather.php', 'curweather_plugin_settings_post');
}
function curweather_network_mod_init(&$fk_app,&$b) {
if(! intval(get_pconfig(local_user(),'curweather','curweather_enable')))
return;
$fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
// the getweather file does all the work here
// the $rpt value is needed for location
// which getweather uses to fetch the weather data for weather and temp
$rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$wxdata = GetWeather::get($rpt);
$temp = $wxdata['TEMPERATURE_STRING'];
$weather = $wxdata['WEATHER'];
$rhumid = $wxdata['RELATIVE_HUMIDITY'];
$pressure = $wxdata['PRESSURE_STRING'];
$wind = $wxdata['WIND_STRING'];
$curweather = '<div id="curweather-network" class="widget">
<div class="title tool">
<h4>'.t("Current Weather").'</h4></div>';
$curweather .= "Weather: $weather<br />
Temperature: $temp<br />
Relative Humidity: $rhumid<br />
Pressure: $pressure<br />
Wind: $wind";
$curweather .= '</div><div class="clear"></div>';
$fk_app->page['aside'] = $curweather.$fk_app->page['aside'];
}
function curweather_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'curweather-settings-submit')))
return;
set_pconfig(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
set_pconfig(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
info( t('Current Weather settings updated.') . EOL);
}
function curweather_plugin_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the curweather so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$enable = intval(get_pconfig(local_user(),'curweather','curweather_enable'));
$enable_checked = (($enable) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Current Weather Settings') . '</h3>';
$s .= '<div id="curweather-settings-wrapper">';
$s .= '<p>Find the location code for the airport/weather station nearest you <a href="http://en.wikipedia.org/wiki/International_Air_Transport_Association_airport_code" target="_blank">here</a>.</p>';
$s .= '<label id="curweather-location-label" for="curweather_loc">' . t('Weather Location: ') . '</label>';
$s .= '<input id="curweather-location" type="text" name="curweather_loc" value="' . $curweather_loc . '"/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="curweather-enable-label" for="curweather_enable">' . t('Enable Current Weather') . '</label>';
$s .= '<input id="curweather-enable" type="checkbox" name="curweather_enable" value="1" ' . $enable_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '</div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="curweather-settings-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}

230
curweather/getweather.php Normal file
View file

@ -0,0 +1,230 @@
<?php
/*
File Name: getweather.php
Author: Gary White
Original version: May 12, 2005
Last modified: August 7, 2008
Copyright (C) 2004-2008 Gary White
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License in the included gpl.txt file for
details.
See http://apptools.com/phptools/xml/weather/ for usage information
See http://weather.gov/data/current_obs/
Also see
http://weather.gov/alerts/
http://weather.gov/forecasts/xml/
Complete list of Weather stations available at
http://weather.gov/data/current_obs/index.xml
*/
class GetWeather {
// Initialize some variables
static $itemdata;
static $itemname;
static $wxdata;
function get($rpt) {
// URL for the XML file
$xmlurl="http://www.weather.gov/data/current_obs/$rpt.xml";
// Base url for the icons
$imgpath="http://weather.gov/weather/images/fcicons";
self::$itemdata="";
self::$itemname="";
self::$wxdata=array();
$icons=self::defineIcons();
$icon="";
$data="";
$report="";
// create a new CURL resource
if($ch = curl_init()) {
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $xmlurl);
curl_setopt($ch, CURLOPT_HEADER, trus);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// grab URL and pass it to the browser
$data=curl_exec($ch);
$r=curl_getinfo($ch); //,CURLINFO_HTTP_CODE);
// close CURL resource, and free up system resources
curl_close($ch);
// Create an XML parser
$xml_parser = xml_parser_create();
// Use case-folding so we are sure to find the tag in $map_array
// This will force all tags to upper case so we don't have to worry
// about matching the case of the original in our tests.
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
// Assign the element starting and ending event handlers
xml_set_element_handler($xml_parser, array(self,"startElement"), array(self,"endElement"));
// Assign a function to handle character data
xml_set_character_data_handler($xml_parser, array(self,"characterData"));
// Parse the file. This will place the data into an associative
// array assigned to the self::$wxdata variable
xml_parse($xml_parser,$data,true);
// Free the parser object
xml_parser_free($xml_parser);
// The OBSERVATION_TIME field of the returned XML will be in the
// format "Last Updated on May 18, 8:53 am CDT"
// We're going to change the format a bit.
// Strip out the "Last Updated on " portion of the date/time
// so we can display that separately in our tabular output
$datetime=str_replace("Last Updated on ","",self::$wxdata['OBSERVATION_TIME']);
// We now have the format as "May 18, 8:53 am CDT"
// Now, get the time zone. It will be everything from
// the last space character to the end of the string.
$z=strrchr($datetime," ");
// Get the current year
$year=date("Y");
// Now, we stuff the year into the string, following the comma.
$datetime=str_replace(",",", $year",$datetime);
// This does leave a small potential issue where, if you get a
// report between midnight and 1 a.m. on January 1, or the server
// is in a significantly different time zone than the report it
// could be as late as 4 a.m. the year will be wrong because the
// report will be from the previous year. I suppose it would be
// possible to correct for that, but for that little bit, I'm
// not going to worry about it.
// Now, strip out the time zone
$datetime=str_replace($z,"",$datetime);
// Format the date and time the way we want it and add
// back the time zone
$datetime=date("l F j, Y g:i A",strtotime($datetime)).$z;
self::$wxdata['OBSERVATION_TIME']=$datetime;
// Get the WEATHER element
$wx=trim(self::$wxdata['WEATHER']);
// Now, get the icon to match the weather
foreach($icons as $k=>$i){
$a=explode(" | ",$i);
if(is_numeric(array_search($wx,$a))){
self::$wxdata['ICON']="$imgpath/$k.jpg";
break;
}
}
// Replace any null elements with "Not available"
foreach(array_keys(self::$wxdata) as $key){
self::$wxdata[$key]=self::$wxdata[$key]=="NULL"?"Not available":self::$wxdata[$key];
}
// If we got humidity
if(is_numeric(self::$wxdata['RELATIVE_HUMIDITY']))
// Append a percent sign
self::$wxdata['RELATIVE_HUMIDITY'].="%";
// Do some formatting to make the output a little friendlier
if(self::$wxdata['VISIBILITY_MI']=="NA")
self::$wxdata['VISIBILITY']="Not available";
if(self::$wxdata['VISIBILITY']!="Not available")
self::$wxdata['VISIBILITY']=(1*self::$wxdata['VISIBILITY_MI'])." miles";
// If we got wind data
if(is_numeric(self::$wxdata['WIND_MPH'])){
// We're going to output wind data as both MPH from a cardinal direction
// and as Knots from a direction in degrees
// Calculate the value for Knots
self::$wxdata['WIND_KNOTS']=self::$wxdata['WIND_MPH']/1.15;
// Format the output
$wind=sprintf("From the %s at %d mph (%03.0f&deg; at %d knots)",self::$wxdata['WIND_DIR'],self::$wxdata['WIND_MPH'],self::$wxdata['WIND_DEGREES'],self::$wxdata['WIND_KNOTS']);
// If we got a value for wind gusts
if(is_numeric(self::$wxdata['WIND_GUST_MPH']) && self::$wxdata['WIND_GUST_MPH']>0){
// add it into the wind string
$wind=str_replace("mph","gusting to ".self::$wxdata['WIND_GUST_MPH']." mph<br>", $wind);
$knots=sprintf("%d",self::$wxdata['WIND_GUST_MPH']/1.15);
$wind=str_replace("knots","gusting to $knots knots",$wind);
}
} else {
// Otherwise, if wind is zero, we'll show "Calm"
$wind=self::$wxdata['WIND_MPH']=="Not available"?"Not available":"Calm";
} // Done with wind
self::$wxdata['WIND_STRING']=$wind;
} // Done getting and formatting the data
return self::$wxdata;
}
function startElement($parser, $name, $attrs) {
self::$itemname=$name;
self::$itemdata="";
}
function endElement($parser, $name) {
self::$wxdata[self::$itemname]=self::$itemdata;
self::$itemdata="";
}
function characterData($parser, $data) {
self::$itemdata.=$data;
}
function defineIcons(){
// See http://weather.gov/data/current_obs/weather.php for source data for this function
$retVal['bkn']="Mostly Cloudy | Mostly Cloudy with Haze | Mostly Cloudy and Breezy";
$retVal['skc']="Fair | Clear | Fair with Haze | Clear with Haze | Fair and Breezy | Clear and Breezy";
$retVal['few']="A Few Clouds | A Few Clouds with Haze | A Few Clouds and Breezy";
$retVal['sct']="Partly Cloudy | Party Cloudy with Haze | Partly Cloudy and Breezy";
$retVal['ovc']="Overcast | Overcast with Haze | Overcast and Breezy";
$retVal['nfg']="Fog/Mist | Fog | Freezing Fog | Shallow Fog | Partial Fog | Patches of Fog | Fog in Vicinity | Freezing Fog in Vicinity | Shallow Fog in Vicinity | Partial Fog in Vicinity | Patches of Fog in Vicinity | Showers in Vicinity Fog | Light Freezing Fog | Heavy Freezing Fog";
$retVal['smoke']="Smoke";
$retVal['fzra']="Freezing Rain | Freezing Drizzle | Light Freezing Rain | Light Freezing Drizzle | Heavy Freezing Rain | Heavy Freezing Drizzle | Freezing Rain in Vicinity | Freezing Drizzle in Vicinity";
$retVal['ip']="Ice Pellets | Light Ice Pellets | Heavy Ice Pellets | Ice Pellets in Vicinity | Showers Ice Pellets | Thunderstorm Ice Pellets | Ice Crystals | Hail | Small Hail/Snow Pellets | Light Small Hail/Snow Pellets | Heavy Small Hail/Snow Pellets | Showers Hail | Hail Showers";
$retVal['mix']="Freezing Rain Snow | Light Freezing Rain Snow | Heavy Freezing Rain Snow | Freezing Drizzle Snow | Light Freezing Drizzle Snow | Heavy Freezing Drizzle Snow | Snow Freezing Rain| Light Snow Freezing Rain | Heavy Snow Freezing Rain | Snow Freezing Drizzle | Light Snow Freezing Drizzle | Heavy Snow Freezing Drizzle";
$retVal['raip']="Rain Ice Pellets | Light Rain Ice Pellets | Heavy Rain Ice Pellets | Drizzle Ice Pellets | Light Drizzle Ice Pellets | Heavy Drizzle Ice Pellets | Ice Pellets Rain | Light Ice Pellets Rain | Heavy Ice Pellets Rain | Ice Pellets Drizzle | Light Ice Pellets Drizzle | Heavy Ice Pellets Drizzle";
$retVal['rasn']="Rain Snow | Light Rain Snow | Heavy Rain Snow | Snow Rain | Light Snow Rain | Heavy Snow Rain | Drizzle Snow | Light Drizzle Snow | Heavy Drizzle Snow | Snow Drizzle | Light Snow Drizzle | Heavy Snow Drizzle";
$retVal['shra']="Rain Showers | Light Rain Showers | Heavy Rain Showers | Rain Showers in Vicinity | Light Showers Rain | Heavy Showers Rain | Showers Rain | Showers Rain in Vicinity | Rain Showers Fog/Mist | Light Rain Showers Fog/Mist | Heavy Rain Showers Fog/Mist | Rain Showers in Vicinity Fog/Mist | Light Showers Rain Fog/Mist | Heavy Showers Rain Fog/Mist | Showers Rain Fog/Mist | Showers Rain in Vicinity Fog/Mist";
$retVal['tsra']="Thunderstorm | Light Thunderstorm Rain | Heavy Thunderstorm Rain | Thunderstorm Rain Fog/Mist | Light Thunderstorm Rain Fog/Mist | Heavy Thunderstorm Rain Fog/Mist | Thunderstorm Showers in Vicinity | | Light Thunderstorm Rain Haze | Heavy Thunderstorm Rain Haze | Thunderstorm Fog | Light Thunderstorm Rain Fog | Heavy Thunderstorm Rain Fog | Thunderstorm Light Rain | Thunderstorm Heavy Rain | Thunderstorm Rain Fog/Mist | Thunderstorm Light Rain Fog/Mist | Thunderstorm Heavy Rain Fog/Mist | Thunderstorm in Vicinity Fog/Mist | Thunderstorm Showers in Vicinity | Thunderstorm in Vicinity | Thunderstorm in Vicinity Haze | Thunderstorm Haze in Vicinity | Thunderstorm Light Rain Haze | Thunderstorm Heavy Rain Haze | Thunderstorm Fog | Thunderstorm Light Rain Fog | Thunderstorm Heavy Rain Fog | Thunderstorm Hail | Light Thunderstorm Rain Hail | Heavy Thunderstorm Rain Hail | Thunderstorm Rain Hail Fog/Mist | Light Thunderstorm Rain Hail Fog/Mist | Heavy Thunderstorm Rain Hail Fog/Mist | Thunderstorm Showers in Vicinity Hail | | Light Thunderstorm Rain Hail Haze | Heavy Thunderstorm Rain Hail Haze | Thunderstorm Hail Fog | Light Thunderstorm Rain Hail Fog | Heavy Thunderstorm Rain Hail Fog | Thunderstorm Light Rain Hail | Thunderstorm Heavy Rain Hail | Thunderstorm Rain Hail Fog/Mist | Thunderstorm Light Rain Hail Fog/Mist | Thunderstorm Heavy Rain Hail Fog/Mist | Thunderstorm in Vicinity Hail Fog/Mist | Thunderstorm Showers in Vicinity Hail | Thunderstorm in Vicinity Hail | Thunderstorm in Vicinity Hail Haze | Thunderstorm Haze in Vicinity Hail | Thunderstorm Light Rain Hail Haze | Thunderstorm Heavy Rain Hail Haze | Thunderstorm Hail Fog | Thunderstorm Light Rain Hail Fog | Thunderstorm Heavy Rain Hail Fog | Thunderstorm Small Hail/Snow Pellets | Thunderstorm Rain Small Hail/Snow Pellets | Light Thunderstorm Rain Small Hail/Snow Pellets | Heavy Thunderstorm Rain Small Hail/Snow Pellets";
$retVal['sn']="Snow | Light Snow | Heavy Snow | Snow Showers | Light Snow Showers | Heavy Snow Showers | Showers Snow | Light Showers Snow | Heavy Showers Snow | Snow Fog/Mist | Light Snow Fog/Mist | Heavy Snow Fog/Mist | Snow Showers Fog/Mist | Light Snow Showers Fog/Mist | Heavy Snow Showers Fog/Mist | Showers Snow Fog/Mist | Light Showers Snow Fog/Mist | Heavy Showers Snow Fog/Mist | Snow Fog | Light Snow Fog | Heavy Snow Fog | Snow Showers Fog | Light Snow Showers Fog | Heavy Snow Showers Fog | Showers Snow Fog | Light Showers Snow Fog | Heavy Showers Snow Fog | Showers in Vicinity Snow | Snow Showers in Vicinity | Snow Showers in Vicinity Fog/Mist | Snow Showers in Vicinity Fog | Low Drifting Snow | Blowing Snow | Snow Low Drifting Snow | Snow Blowing Snow | Light Snow Low Drifting Snow | Light Snow Blowing Snow | Heavy Snow Low Drifting Snow | Heavy Snow Blowing Snow | Thunderstorm Snow | Light Thunderstorm Snow | Heavy Thunderstorm Snow | Snow Grains | Light Snow Grains | Heavy Snow Grains | Heavy Blowing Snow | Blowing Snow in Vicinity";
$retVal['wind']="Windy | Fair and Windy | A Few Clouds and Windy | Partly Cloudy and Windy | Mostly Cloudy and Windy | Overcast and Windy";
$retVal['hi_shwrs']="Showers in Vicinity | Showers in Vicinity Fog/Mist | Showers in Vicinity Fog | Showers in Vicinity Haze";
$retVal['fzrara']="Freezing Rain Rain | Light Freezing Rain Rain | Heavy Freezing Rain Rain | Rain Freezing Rain | Light Rain Freezing Rain | Heavy Rain Freezing Rain | Freezing Drizzle Rain | Light Freezing Drizzle Rain | Heavy Freezing Drizzle Rain | Rain Freezing Drizzle | Light Rain Freezing Drizzle | Heavy Rain Freezing Drizzle";
$retVal['hi_tsra']="Thunderstorm in Vicinity | Thunderstorm in Vicinity Fog/Mist | Thunderstorm in Vicinity Fog | Thunderstorm Haze in Vicinity | Thunderstorm in Vicinity Haze";
$retVal['ra1']="Light Rain | Drizzle | Light Drizzle | Heavy Drizzle | Light Rain Fog/Mist | Drizzle Fog/Mist | Light Drizzle Fog/Mist | Heavy Drizzle Fog/Mist | Light Rain Fog | Drizzle Fog | Light Drizzle Fog | Heavy Drizzle Fog";
$retVal['ra']="Rain | Heavy Rain | Rain Fog/Mist | Heavy Rain Fog/Mist | Rain Fog | Heavy Rain Fog";
$retVal['nsvrtsra']="Funnel Cloud | Funnel Cloud in Vicinity | Tornado/Water Spout";
$retVal['dust']="Dust | Low Drifting Dust | Blowing Dust | Sand | Blowing Sand | Low Drifting Sand | Dust/Sand Whirls | Dust/Sand Whirls in Vicinity | Dust Storm | Heavy Dust Storm | Dust Storm in Vicinity | Sand Storm | Heavy Sand Storm | Sand Storm in Vicinity";
$retVal['mist']="Haze";
return $retVal;
}
// end CLASS
}
?>

5
curweather/test.php Normal file
View file

@ -0,0 +1,5 @@
<?php
require_once 'getweather.php';
$rpt = "KHVN";
$wxdata = GetWeather::get($rpt);
var_dump($rpt, $wxdata);

BIN
dav.tgz Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,7 @@
<?php
/**
* Name: Editplain
* Description: Disable richtext (TinyMCE) editor for status posting
* Description: This addon is deprecated and has been replaced with the "Advanced Features" setting. Admins should remove this addon when their core code is updated to include advanced feature settings.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*

Binary file not shown.

View file

@ -5,7 +5,7 @@
* Name: external cron
* Description: Use external server or service to run poller regularly
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Author: Mike Macgirvin <https://macgirvin.com/profile/mike>
*
* Notes: External service needs to make a web request to http(s)://yoursite/extcron
*/

Binary file not shown.

View file

@ -383,10 +383,12 @@ function fb_get_friends_sync_full($uid, $access_token, $persons) {
if($s) {
$results = json_decode($s);
logger('fb_get_friends: info: ' . print_r($results,true), LOGGER_DATA);
foreach ($results as $contact) {
if ($contact->code != 200) logger('fb_get_friends: not found: ' . print_r($contact,true), LOGGER_DEBUG);
else fb_get_friends_sync_parsecontact($uid, json_decode($contact->body));
}
if(count($results)) {
foreach ($results as $contact) {
if ($contact->code != 200) logger('fb_get_friends: not found: ' . print_r($contact,true), LOGGER_DEBUG);
else fb_get_friends_sync_parsecontact($uid, json_decode($contact->body));
}
}
}
}
}
@ -1242,8 +1244,12 @@ function facebook_post_local(&$a,&$b) {
$fb_enable = (($fb_post && x($_REQUEST,'facebook_enable')) ? intval($_REQUEST['facebook_enable']) : 0);
// if API is used, default to the chosen settings
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default')))
$fb_enable = 1;
// but allow a specific override
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default'))) {
if(! x($_REQUEST,'facebook_enable'))
$fb_enable = 1;
}
if(! $fb_enable)
return;

BIN
fbpost.tgz Normal file

Binary file not shown.

18
fbpost/README.md Normal file
View file

@ -0,0 +1,18 @@
Installing the Friendica/Facebook connector
Detailed instructions how to use this plugin can be found at
the [How to: Friendica's Facebook Connector](https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector) page.
Vidoes and embeds will not be posted if there is no other content. Links
and images will be converted to a format suitable for the Facebook API and
long posts truncated - with a link to view the full post.
Facebook contacts will not be able to view private photos, as they are not able to
authenticate to your site to establish identity. We will address this
in a future release.
This addon will only post your entries to your Facebook account but won't fetch
content from there.
Info: please make sure that you understand all aspects due to Friendica's
default licence which is: [MIT License](https://github.com/friendica/friendica/blob/master/LICENSE)

13
fbpost/fbpost.css Normal file
View file

@ -0,0 +1,13 @@
#fbpost-enable-wrapper {
margin-top: 20px;
}
#fbpost-disable-wrapper {
margin-top: 20px;
}
#fbpost-post-default-form input {
margin-top: 20px;
margin-right: 20px;
}

1201
fbpost/fbpost.php Normal file

File diff suppressed because it is too large Load diff

BIN
fortunate.tgz Normal file

Binary file not shown.

7
fortunate/README Normal file
View file

@ -0,0 +1,7 @@
This addon requires a fortune server. You may use the DB supplied here to create one.
gunzip the fortunate.sql.gz and import into your database.
Copy cookie.php to the top level Friendica directory.
Edit fortunate.php and change FORTUNATE_SERVER definition to your hostname. Change the http in that file to https if your server doesn't support http.
Many additional options are available if you examine cookie.php - a clever developer can provide a settings page to tailor this to one's liking. Also several languages are supported, and it would be convenient to set this to the current Friendica language if that is amongst those supported.

349
fortunate/cookie.php Normal file
View file

@ -0,0 +1,349 @@
<?php
set_time_limit(0);
error_reporting(0);
require(".htconfig.php");
$db = @new mysqli($db_host,$db_user,$db_pass,$db_data);
header( "Content-type: text/html; charset=utf-8");
header( "Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
header( "Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
header( "Cache-Control: post-check=0, pre-check=0", FALSE );
header( "Pragma: no-cache" ); // HTTP/1.0
$lang = 'en';
$offensive = $_GET['off'];
if($offensive == 'o')
$adult = 2;
elseif($offensive == 'a')
$adult = 1;
else
$adult = 0;
$length = (($_GET['length']) ? intval($_GET['length']) : 0);
$numlines = ((intval($_GET['numlines'])) ? intval($_GET['numlines']) : 0);
$cat = (($_GET['cat'] == '1') ? 1 : 0);
$equal = (($_GET['equal'] == '1') ? 1 : 0);
$stats = (($_GET['stats'] == '1') ? 1 : 0);
if(strlen($_GET['lang']))
$lang = @$db->real_escape_string($_GET['lang']);
if(strlen($_GET['pattern']))
$pattern = @$db->real_escape_string(urldecode($_GET['pattern']));
if(strlen($_GET['regex']))
$regex = @$db->real_escape_string(urldecode($_GET['regex']));
if(strlen($_GET['db']))
$table = @$db->real_escape_string(urldecode($_GET['db']));
else
$table = '';
if($length < 0)
$length = 0;
if($numlines < 0)
$numlines = 0;
function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
global $db;
$rnd = mt_rand();
$r = array();
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
if($adult == 2)
$adultsql = " AND offensive = 1 ";
elseif($adult == 1)
$adultsql = "";
else
$adultsql = " AND offensive = 0 ";
if($numlines)
$lengthsql .=
" AND (LENGTH(`text`) - LENGTH(REPLACE(`text`,\"\n\",\"\"))) <= $numlines ";
$langsql = " AND lang = '$lang' ";
$patsql = '';
if(strlen($pattern))
$patsql = " AND MATCH text AGAINST ('$pattern' IN BOOLEAN MODE) ";
$regexsql = '';
if(strlen($regex))
$regexsql = " AND text REGEXP '$regex' ";
$eqsql = '';
if($equal) {
$catsavail = array();
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$regexsql ");
if($res->num_rows) {
while($x = $res->fetch_array(MYSQL_ASSOC))
$catsavail[] = $x['category'];
$eqsql = " AND `category` = '"
. $catsavail[mt_rand(0,$res->num_rows - 1)] . "' ";
}
}
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$regexsql
$eqsql
ORDER BY RAND($rnd)
LIMIT $limit");
if($result->num_rows) {
while($x = $result->fetch_array(MYSQL_ASSOC))
$r[] = fortune_to_html($x['text'])
.(($cat) ? "<br />[{$x['category']}]<br />" : "");
}
return $r;
}
function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
global $db;
$rnd = mt_rand();
$r = array();
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
if($adult == 2)
$adultsql = " AND offensive = 1 ";
elseif($adult == 1)
$adultsql = "";
else
$adultsql = " AND offensive = 0 ";
if($numlines)
$lengthsql .=
" AND (LENGTH(`text`) - LENGTH(REPLACE(`text`,\"\n\",\"\"))) <= $numlines ";
$langsql = " AND lang = '$lang' ";
$patsql = '';
if(strlen($pattern))
$patsql = " AND MATCH text AGAINST ('$pattern' IN BOOLEAN MODE) ";
$regexsql = '';
if(strlen($regex))
$regexsql = " AND text REGEXP '$regex' ";
$eqsql = '';
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$regexsql
$eqsql");
echo '<br />' . $result->num_rows . ' matching quotations.<br />';
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$regexsql ");
if($res->num_rows) {
echo '<br />Matching Databases:<br />';
while($x = $res->fetch_array(MYSQL_ASSOC))
echo $x['category'].'<br />';
}
else
echo '<br />No matching databases using those search parameters - please refine your options.<br />';
}
function fortune_to_html($s) {
// First pass - escape all the HTML entities, and while we're at it
// get rid of any MS-DOS end-of-line characters and expand tabs to
// 8 non-breaking spaces, and translate linefeeds to <br />.
// We also get rid of ^G which used to sound the terminal beep or bell
// on ASCII terminals and were humourous in some fortunes.
// We could map these to autoplay a short sound file but browser support
// is still sketchy and then there's the issue of where to locate the
// URL, and a lot of people find autoplay sounds downright annoying.
// So for now, just remove them.
$s = str_replace(
array("&",
"<",
">",
'"',
"\007",
"\t",
"\r",
"\n"),
array("&amp;",
"&lt;",
"&gt;",
"&quot;",
"",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
"",
"<br />"),
$s);
// Replace pseudo diacritics
// These were used to produce accented characters. For instance an accented
// e would have been encoded by '^He - the backspace moving the cursor
// backward so both the single quote and the e would appear in the same
// character position. Umlauts were quite clever - they used a double quote
// as the accent mark over a normal character.
$s = preg_replace("/'\010([a-zA-Z])/","&\\1acute;",$s);
$s = preg_replace("/\&quot;\010([a-zA-Z])/","&\\1uml;",$s);
$s = preg_replace("/\`\010([a-zA-Z])/","&\\1grave;",$s);
$s = preg_replace("/\^\010([a-zA-Z])/","&\\1circ;",$s);
$s = preg_replace("/\~\010([a-zA-Z])/","&\\1tilde;",$s);
// Ignore multiple underlines for the same character. These were
// most useful when sent to a line printer back in the day as it
// would type over the same character a number of times making it
// much darker (e.g. bold). I think there are only one or two
// instances of this in the current (2008) fortune cookie database.
$s = preg_replace("/(_\010)+/","_\010",$s);
// Map the characters which sit underneath a backspace.
// If you can come up with a regex to do all of the following
// madness - be my guest.
// It's not as simple as you think. We need to take something
// that has been backspaced over an arbitrary number of times
// and wrap a forward looking matching number of characters in
// HTML, whilst deciding if it's intended as an underline or
// strikeout sequence.
// Essentially we produce a string of '1' and '0' characters
// the same length as the source text.
// Any position which is marked '1' has been backspaced over.
$cursor = 0;
$dst = $s;
$bs_found = false;
for($x = 0; $x < strlen($s); $x ++) {
if($s[$x] == "\010" && $cursor) {
$bs_found = true;
$cursor --;
$dst[$cursor] = '1';
$dst[$x] = '0';
$continue;
}
else {
if($bs_found) {
$bs_found = false;
$cursor = $x;
}
$dst[$cursor] = '0';
$cursor ++;
}
}
$out = '';
$strike = false;
$bold = false;
// Underline sequence, convert to bold to avoid confusion with links.
// These were generally used for emphasis so it's a reasonable choice.
// Please note that this logic will fail if there is an underline sequence
// and also a strikeout sequence in the same fortune.
if(strstr($s,"_\010")) {
$len = 0;
for($x = 0; $x < strlen($s); $x ++) {
if($dst[$x] == '1') {
$len ++;
$bold = true;
}
else {
if($bold) {
$out .= '<strong>';
while($s[$x] == "\010")
$x ++;
$out .= substr($s,$x,$len);
$out .= '</strong>';
$x = $x + $len - 1;
$len = 0;
$bold = false;
}
else
$out .= $s[$x];
}
}
}
// These aren't seen very often these days - simulation of
// backspace/replace. You could occasionally see the original text
// on slower terminals before it got replaced. Once modems reached
// 4800/9600 baud in the late 70's and early 80's the effect was
// mostly lost - but if you find a really old fortune file you might
// encounter a few of these.
else {
for($x = 0; $x < strlen($s); $x ++) {
if($dst[$x] == '1') {
if($strike)
$out .= $s[$x];
else
$out .= '<strike>'.$s[$x];
$strike = true;
}
else {
if($strike)
$out .= '</strike>';
$strike = false;
$out .= $s[$x];
}
}
}
// Many of the underline sequences are also wrapped in asterisks,
// which was yet another way of marking ASCII as 'bold'.
// So if it's an underline sequence, and there are asterisks
// on both ends, strip the asterisks as we've already emboldened the text.
$out = preg_replace('/\*(<strong>[^<]*<\/strong>)\*/',"\\1",$out);
// Finally, remove the backspace characters which we don't need anymore.
return str_replace("\010","",$out);
}
$result1 = do_query($table,$length,$numlines,$adult,$cat,1,$lang,$pattern,$regex,$equal);
if(count($result1))
echo $result1[0];
if($stats)
do_stats($table,$length,$numlines,$adult,$cat,1,$lang,$pattern,$regex,$equal);

7
fortunate/fortunate.css Normal file
View file

@ -0,0 +1,7 @@
.fortunate {
margin-top: 25px;
margin-left: 100px;
margin-bottom: 25px;
color: #000088;
font-size: 14px;
}

35
fortunate/fortunate.php Normal file
View file

@ -0,0 +1,35 @@
<?php
/**
* Name: Fortunate
* Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
// IMPORTANT: SET THIS to your fortunate server
define ('FORTUNATE_SERVER', 'hostname.com');
function fortunate_install() {
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
if(FORTUNATE_SERVER == 'hostname.com' && is_site_admin()) {
notice('Fortunate plugin requires configuration. See README');
}
}
function fortunate_uninstall() {
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_fetch(&$a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
if(FORTUNATE_SERVER != 'hostname.com') {
$s = fetch_url('http://' . FORTUNATE_SERVER . '/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
$b .= '<div class="fortunate">' . $s . '</div>';
}
}

BIN
fortunate/fortunemod.sql.gz Normal file

Binary file not shown.

BIN
forumdirectory.tgz Normal file

Binary file not shown.

View file

@ -0,0 +1,67 @@
section .forumdirectory-item dl {
height: auto;
overflow: auto;
}
section .forumdirectory-item dt {
float: left;
margin-left: 0px;
text-align: right;
color: #999;
}
section .forumdirectory-item dd {
float: left;
margin-left: 5px;
}
.forumdirectory-profile-wrapper {
float: left;
/*max-height: 178px; */
overflow: hidden;
width: 500px;
margin: 0px 20px;
}
.forumdirectory-copy-wrapper {
float: left;
overflow: hidden;
}
.forumdirectory-item {
float: left;
width: 800px;
/* height: 200px; */
box-shadow: 8px 8px 4px #000;
margin-top: 30px;
border: solid 1px #222;
}
section .forumdirectory-photo-wrapper {
float: left;
height: 200px;
width: 165px;
}
.forumcontact-name {
font-size: 18px;
font-weight: bold;
margin-bottom: -3px;
text-align: left;
}
.page-type {
font-size: 10px;
font-style: italic;
}
.directory-detailscolumn-wrapper {
float: left;
width: 305px;
margin-right: 10px;
}
.directory-profile-wrapper dl {
margin-top: 3px;
margin-bottom: 3px;
}
.directory-profile-title {
font-weight: bold;
margin-bottom: 3px;
font-size: 14px;
}

View file

@ -0,0 +1,204 @@
<?php
/**
* Name: Forum Directory
* Description: Add a directory of forums hosted on your server, with verbose descriptions.
* Version: 1.0
* Author: Thomas Willingham <https://beardyunixer.com/profile/beardyunixer>
*/
function forumdirectory_install() {
register_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
}
function forumdirectory_uninstall() {
unregister_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
}
function forumdirectory_module() {
return;
}
function forumdirectory_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . t('Forum Directory') . '</a></div>';
}
function forumdirectory_init(&$a) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/forumdirectory/forumdirectory.css" media="all" />';
$a->set_pager_itemspage(60);
if(local_user()) {
require_once('include/contact_widgets.php');
$a->page['aside'] .= findpeople_widget();
}
else
unset($_SESSION['theme']);
}
function forumdirectory_post(&$a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
function forumdirectory_content(&$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
$o = '';
nav_set_selected('directory');
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
$tpl = get_markup_template('directory_header.tpl');
$globaldir = '';
$gdirpath = dirname(get_config('system','directory_submit_url'));
if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
. zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
}
$admin = '';
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => $globaldir,
'$desc' => t('Find on this site'),
'$admin' => $admin,
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'),
'$submit' => t('Find')
));
if($search)
$search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra ");
if(count($r))
$a->set_pager_total($r[0]['total']);
$order = " ORDER BY `name` ASC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra $order LIMIT %d , %d ",
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
if(count($r)) {
if(in_array('small', $a->argv))
$photo = 'thumb';
else
$photo = 'photo';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
$details = '';
if(strlen($rr['locality']))
$details .= $rr['locality'];
if(strlen($rr['region'])) {
if(strlen($rr['locality']))
$details .= ', ';
$details .= $rr['region'];
}
if(strlen($rr['country-name'])) {
if(strlen($details))
$details .= ', ';
$details .= $rr['country-name'];
}
if(strlen($rr['dob'])) {
if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
$details .= '<br />' . t('Age: ') . $years ;
}
if(strlen($rr['gender']))
$details .= '<br />' . t('Gender: ') . $rr['gender'];
if($rr['page-flags'] == PAGE_NORMAL)
$page_type = "Personal Profile";
if($rr['page-flags'] == PAGE_SOAPBOX)
$page_type = "Fan Page";
if($rr['page-flags'] == PAGE_COMMUNITY)
$page_type = "Community Forum";
if($rr['page-flags'] == PAGE_FREELOVE)
$page_type = "Open Forum";
if($rr['page-flags'] == PAGE_PRVGROUP)
$page_type = "Private Group";
$profile = $rr;
if((x($profile,'address') == 1)
|| (x($profile,'locality') == 1)
|| (x($profile,'region') == 1)
|| (x($profile,'postal-code') == 1)
|| (x($profile,'country-name') == 1))
$location = t('Location:');
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
$about = ((x($profile,'about') == 1) ? t('About:') : False);
# $tpl = file_get_contents( dirname(__file__).'/forumdirectory_item.tpl');
$tpl = get_markup_template( 'forumdirectory_item.tpl', 'addon/forumdirectory/' );
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt_text' => $rr['name'],
'$name' => $rr['name'],
'$details' => $pdesc . $details,
'$page_type' => $page_type,
'$profile' => $profile,
'$location' => template_escape($location),
'$gender' => $gender,
'$pdesc' => $pdesc,
'$marital' => $marital,
'$homepage' => $homepage,
'$about' => $about,
));
$arr = array('contact' => $rr, 'entry' => $entry);
unset($profile);
unset($location);
$o .= $entry;
}
$o .= "<div class=\"directory-end\" ></div>\r\n";
$o .= paginate($a);
}
else
info( t("No entries \x28some entries may be hidden\x29.") . EOL);
return $o;
}

View file

@ -0,0 +1,42 @@
<div class="forumdirectory-item" id="forumdirectory-item-$id" >
<div class="forumdirectory-photo-wrapper" id="forumdirectory-photo-wrapper-$id" >
<div class="forumdirectory-photo" id="forumdirectory-photo-$id" >
<a href="$profile_link" class="forumdirectory-profile-link" id="forumdirectory-profile-link-$id" >
<img class="forumdirectory-photo-img photo" src="$photo" alt="$alt_text" title="$alt_text" />
</a>
</div>
</div>
<div class="forumdirectory-profile-wrapper" id="forumdirectory-profile-wrapper-$id" >
<div class="contact-name" id="forumdirectory-name-$id">$name</div>
<div class="page-type">$page_type</div>
{{ if $pdesc }}<div class="forumdirectory-profile-title">$profile.pdesc</div>{{ endif }}
<div class="forumdirectory-detailcolumns-wrapper" id="forumdirectory-detailcolumns-wrapper-$id">
<div class="forumdirectory-detailscolumn-wrapper" id="forumdirectory-detailscolumn1-wrapper-$id">
{{ if $location }}
<dl class="location"><dt class="location-label">$location</dt>
<dd class="adr">
{{ if $profile.address }}<div class="street-address">$profile.address</div>{{ endif }}
<span class="city-state-zip">
<span class="locality">$profile.locality</span>{{ if $profile.locality }}, {{ endif }}
<span class="region">$profile.region</span>
<span class="postal-code">$profile.postal-code</span>
</span>
{{ if $profile.country-name }}<span class="country-name">$profile.country-name</span>{{ endif }}
</dd>
</dl>
{{ endif }}
{{ if $gender }}<dl class="mf"><dt class="gender-label">$gender</dt> <dd class="x-gender">$profile.gender</dd></dl>{{ endif }}
</div>
<div class="forumdirectory-detailscolumn-wrapper" id="forumdirectory-detailscolumn2-wrapper-$id">
{{ if $marital }}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>$marital</dt><dd class="marital-text">$profile.marital</dd></dl>{{ endif }}
{{ if $homepage }}<dl class="homepage"><dt class="homepage-label">$homepage</dt><dd class="homepage-url"><a href="$profile.homepage" target="external-link">$profile.homepage</a></dd></dl>{{ endif }}
</div>
</div>
<div class="forumdirectory-copy-wrapper" id="forumdirectory-copy-wrapper-$id" >
{{ if $about }}<dl class="forumdirectory-copy"><dt class="forumdirectory-copy-label">$about</dt><dd class="forumdirectory-copy-data">$profile.about</dd></dl>{{ endif }}
</div>
</div>
</div>

View file

@ -0,0 +1,42 @@
<div class="forumdirectory-item" id="forumdirectory-item-{{$id}}" >
<div class="forumdirectory-photo-wrapper" id="forumdirectory-photo-wrapper-{{$id}}" >
<div class="forumdirectory-photo" id="forumdirectory-photo-{{$id}}" >
<a href="{{$profile_link}}" class="forumdirectory-profile-link" id="forumdirectory-profile-link-{{$id}}" >
<img class="forumdirectory-photo-img photo" src="{{$photo}}" alt="{{$alt_text}}" title="{{$alt_text}}" />
</a>
</div>
</div>
<div class="forumdirectory-profile-wrapper" id="forumdirectory-profile-wrapper-{{$id}}" >
<div class="contact-name" id="forumdirectory-name-{{$id}}">{{$name}}</div>
<div class="page-type">{{$page_type}}</div>
{{if $pdesc}}<div class="forumdirectory-profile-title">{{$profile.pdesc}}</div>{{/if}}
<div class="forumdirectory-detailcolumns-wrapper" id="forumdirectory-detailcolumns-wrapper-{{$id}}">
<div class="forumdirectory-detailscolumn-wrapper" id="forumdirectory-detailscolumn1-wrapper-{{$id}}">
{{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt>
<dd class="adr">
{{if $profile.address}}<div class="street-address">{{$profile.address}}</div>{{/if}}
<span class="city-state-zip">
<span class="locality">{{$profile.locality}}</span>{{if $profile.locality}}, {{/if}}
<span class="region">{{$profile.region}}</span>
<span class="postal-code">{{$profile.postal-code}}</span>
</span>
{{if $profile.country-name}}<span class="country-name">{{$profile.country-name}}</span>{{/if}}
</dd>
</dl>
{{/if}}
{{if $gender}}<dl class="mf"><dt class="gender-label">{{$gender}}</dt> <dd class="x-gender">{{$profile.gender}}</dd></dl>{{/if}}
</div>
<div class="forumdirectory-detailscolumn-wrapper" id="forumdirectory-detailscolumn2-wrapper-{{$id}}">
{{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}}
{{if $homepage}}<dl class="homepage"><dt class="homepage-label">{{$homepage}}</dt><dd class="homepage-url"><a href="{{$profile.homepage}}" target="external-link">{{$profile.homepage}}</a></dd></dl>{{/if}}
</div>
</div>
<div class="forumdirectory-copy-wrapper" id="forumdirectory-copy-wrapper-{{$id}}" >
{{if $about}}<dl class="forumdirectory-copy"><dt class="forumdirectory-copy-label">{{$about}}</dt><dd class="forumdirectory-copy-data">{{$profile.about}}</dd></dl>{{/if}}
</div>
</div>
</div>

BIN
forumlist.tgz Normal file

Binary file not shown.

22
forumlist/forumlist.css Normal file
View file

@ -0,0 +1,22 @@
#hide-forum-list {
opacity: 0.3;
filter:alpha(opacity=30);
}
#hide-forum-list:hover {
opacity: 1.0;
filter:alpha(opacity=100);
}
#forumlist-settings-label, #forumlist-random-label, #forumlist-profile-label, #forumlist-network-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#forumlist-max-forumlists, #forumlist-random, #forumlist-profile, #forumlist-network {
float: left;
}

182
forumlist/forumlist.php Normal file
View file

@ -0,0 +1,182 @@
<?php
/**
* Name: ForumList
* Description: Shows list of subscribed community forums on network sidebar
* Version: 1.1
* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
function forumlist_install() {
register_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init');
register_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings');
register_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post');
register_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced');
}
function forumlist_uninstall() {
unregister_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init');
unregister_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings');
unregister_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post');
unregister_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced');
}
function forumlist_getpage($uid,$showhidden = true,$randomise = false, $showprivate = false) {
$forumlist = array();
$order = (($showhidden) ? '' : " and hidden = 0 ");
$order .= (($randomise) ? ' order by rand() ' : ' order by name asc ');
$select = "`forum` = 1";
if ($showprivate) {
$select = "( `forum` = 1 OR `prv` = 1 )";
}
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` from contact
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
and blocked = 0 and hidden = 0 and pending = 0 and archive = 0
$order ",
intval($uid)
);
// Look if the profile is a community page
foreach($contacts as $contact) {
$forumlist[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
}
return($forumlist);
}
function forumlist_network_mod_init($a,$b) {
if(! intval(get_pconfig(local_user(),'forumlist','show_on_network')))
return;
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
$forumlist = '<div id="forumlist-sidebar" class="widget">
<div class="title tool">
<h3>'.t("Forums").'</h3></div>';
$forumlist .= '<div id="hide-forum-list" class="fakelink" onclick="openClose(\'forum-list\');" >'
. t('show/hide') . '</div>'
. '<div id="forum-list" style="display: none;">';
$randomise = intval(get_pconfig(local_user(),'forumlist','randomise'));
$contacts = forumlist_getpage($a->user['uid'],true,$randomise, true);
if(count($contacts)) {
foreach($contacts as $contact) {
$forumlist .= '<div><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="' . $contact['url'] . '" class="label sparkle" target="external-link"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
}
}
else {
$forumlist .= t('No forum subscriptions');
}
$forumlist .= "</div></div>";
if (sizeof($contacts) > 0)
$a->page['aside'] = $forumlist . $a->page['aside'];
}
function forumlist_profile_advanced($a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
$profile = intval(get_pconfig($a->profile['profile_uid'],'forumlist','show_on_profile'));
if(! $profile)
return;
$forumlist = '<div id="forumlist-profile">
<div class="title">'.t("Forums:").'</div>
<div id="profile-forumlist-list">';
// place holder in case somebody wants configurability
$show_total = 9999;
$randomise = true;
$contacts = forumlist_getpage($a->user['uid'],false,$randomise,false);
$total_shown = 0;
$more = false;
foreach($contacts as $contact) {
$forumlist .= micropro($contact,false,'forumlist-profile-advanced');
$total_shown ++;
if($total_shown == $show_total)
break;
}
$forumlist .= '</div></div><div class="clear"></div>';
if(count($contacts) > 0)
$b .= $forumlist;
}
function forumlist_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'forumlist-settings-submit')))
return;
// set_pconfig(local_user(),'forumlist','max_forumlists',intval($_POST['forumlist_max_forumlists']));
set_pconfig(local_user(),'forumlist','randomise',intval($_POST['forumlist_random']));
set_pconfig(local_user(),'forumlist','show_on_profile',intval($_POST['forumlist_profile']));
set_pconfig(local_user(),'forumlist','show_on_network',intval($_POST['forumlist_network']));
info( t('Forumlist settings updated.') . EOL);
}
function forumlist_plugin_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the forumlist so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$randomise = intval(get_pconfig(local_user(),'forumlist','randomise'));
$randomise_checked = (($randomise) ? ' checked="checked" ' : '');
$profile = intval(get_pconfig(local_user(),'forumlist','show_on_profile'));
$profile_checked = (($profile) ? ' checked="checked" ' : '');
$network = intval(get_pconfig(local_user(),'forumlist','show_on_network'));
$network_checked = (($network) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Forumlist Settings') . '</h3>';
$s .= '<div id="forumlist-settings-wrapper">';
$s .= '<label id="forumlist-random-label" for="forumlist-random">' . t('Randomise forum list') . '</label>';
$s .= '<input id="forumlist-random" type="checkbox" name="forumlist_random" value="1" ' . $randomise_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="forumlist-profile-label" for="forumlist-profile">' . t('Show forums on profile page') . '</label>';
$s .= '<input id="forumlist-profile" type="checkbox" name="forumlist_profile" value="1" ' . $profile_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="forumlist-network-label" for="forumlist-network">' . t('Show forums on network page') . '</label>';
$s .= '<input id="forumlist-network" type="checkbox" name="forumlist_network" value="1" ' . $network_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '</div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="forumlist-settings-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}

BIN
fromapp.tgz Normal file

Binary file not shown.

14
fromapp/fromapp.css Normal file
View file

@ -0,0 +1,14 @@
#fromapp-label, #fromapp-force-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#fromapp-input, #fromapp-force {
float: left;
}

101
fromapp/fromapp.php Normal file
View file

@ -0,0 +1,101 @@
<?php
/**
* Name: FromApp
* Description: Change the displayed application you are posting from
* Version: 1.0
* Author: Commander Zot
*
*/
function fromapp_install() {
register_hook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
register_hook('plugin_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
register_hook('plugin_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("installed fromapp");
}
function fromapp_uninstall() {
unregister_hook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
unregister_hook('plugin_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
unregister_hook('plugin_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("removed fromapp");
}
function fromapp_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'fromapp-submit')))
return;
set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']);
set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
info( t('Fromapp settings updated.') . EOL);
}
function fromapp_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/fromapp/fromapp.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$fromapp = get_pconfig(local_user(),'fromapp','app');
if($fromapp === false)
$fromapp = '';
$force = intval(get_pconfig(local_user(),'fromapp','force'));
$force_enabled = (($force) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('FromApp Settings') . '</h3>';
$s .= '<div id="fromapp-wrapper">';
$s .= '<label id="fromapp-label" for="fromapp-input">' . t('The application name you would like to show your posts originating from.') . '</label>';
$s .= '<input id="fromapp-input" type="text" name="fromapp-input" value="' . $fromapp . '" ' . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="fromapp-force-label" for="fromapp-force">' . t('Use this application name even if another application was used.') . '</label>';
$s .= '<input id="fromapp-force" type="checkbox" name="fromapp-force" value="1" ' . $force_enabled . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="fromapp-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}
function fromapp_post_hook(&$a,&$item) {
if(! local_user())
return;
if(local_user() != $item['uid'])
return;
$app = get_pconfig(local_user(), 'fromapp', 'app');
$force = intval(get_pconfig(local_user(), 'fromapp','force'));
if(($app === false) || (! strlen($app)))
return;
if(strlen(trim($item['app'])) && (! $force))
return;
$apps = explode(',',$app);
$item['app'] = trim($apps[mt_rand(0,count($apps)-1)]);
return;
}

BIN
fromgplus.tgz Normal file

Binary file not shown.

View file

@ -1 +1,15 @@
This extension is a preparation of the upcoming import of items via Google+
This extension fetches messages from a Google+ account and reshares it.
You have to place the following config values in your .htconfig.php:
$a->config['fromgplus']['key'] = "your key";
$a->config['fromgplus']['poll_interval'] = 10;
You need an API key for "Simple API Access".
- You go to https://code.google.com/apis/console/
- Then you go to "Services" and activate "Google+ API".
- After that you go to "API Access".
- At the bottom of the page you see "Simple API Access".
The value after "API key:" is the key that you need.

View file

@ -1,20 +1,24 @@
<?php
/**
* Name: From GPlus
* Description: Imports posts from a Google+ account and repeats them - not working by now
* Description: Imports posts from a Google+ account and repeats them
* Version: 0.1
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
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');
register_hook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron');
}
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');
unregister_hook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron');
}
function fromgplus_addon_settings(&$a,&$s) {
@ -55,129 +59,330 @@ function fromgplus_addon_settings_post(&$a,&$b) {
info( t('Google+ Import Settings saved.') . EOL);
}
}
/*
function html2bbcode($html) {
function fromgplus_cron($a,$b) {
$last = get_config('fromgplus','last_poll');
$poll_interval = intval(get_config('fromgplus','poll_interval'));
if(! $poll_interval)
$poll_interval = FROMGPLUS_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
logger('fromgplus: poll intervall not reached');
return;
}
}
logger('fromgplus: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
$account = get_pconfig($rr['uid'],'fromgplus','account');
if ($account) {
logger('fromgplus: fetching for user '.$rr['uid']);
fromgplus_fetch($a, $rr['uid']);
}
}
}
logger('fromgplus: cron_end');
set_config('fromgplus','last_poll', time());
}
function fromgplus_post($a, $uid, $source, $body, $location) {
//$uid = 2;
$body = trim($body);
if (substr($body, 0, 3) == "[b]") {
$pos = strpos($body, "[/b]");
$title = substr($body, 3, $pos-3);
$body = trim(substr($body, $pos+4));
} else
$title = "";
$_SESSION['authenticated'] = true;
$_SESSION['uid'] = $uid;
$_REQUEST['type'] = 'wall';
$_REQUEST['api_source'] = true;
$_REQUEST['profile_uid'] = $uid;
$_REQUEST['source'] = $source;
// $_REQUEST['verb']
// $_REQUEST['parent']
// $_REQUEST['parent_uri']
$_REQUEST['title'] = $title;
$_REQUEST['body'] = $body;
$_REQUEST['location'] = $location;
logger('fromgplus: posting for user '.$uid);
require_once('mod/item.php');
//print_r($_REQUEST);
item_post($a);
}
function fromgplus_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 = str_ireplace(array("\n"), array(""), $bbcode);
$bbcode = str_ireplace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
$bbcode = str_ireplace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
$bbcode = str_ireplace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
$bbcode = str_ireplace(array("<br />"), array("\n"), $bbcode);
$bbcode = str_ireplace(array("<br/>"), array("\n"), $bbcode);
$bbcode = str_ireplace(array("<br>"), array("\n"), $bbcode);
$bbcode = trim(strip_tags($bbcode));
return($bbcode);
}
function friendicapost($post) {
global $friendica;
function fromgplus_parse_query($var)
{
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = parse_url($var, PHP_URL_QUERY);
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
$api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]);
$ret = $api->updateStatus($post);
$api->endSession();
foreach($var as $val) {
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}
function handleattachments($item) {
function fromgplus_cleanupgoogleproxy($fullImage, $image) {
$preview = "/w".$fullImage->width."-h".$fullImage->height."/";
$preview2 = "/w".$fullImage->width."-h".$fullImage->height."-p/";
$fullImage = str_replace(array($preview, $preview2), array("/", "/"), $fullImage->url);
$preview = "/w".$image->width."-h".$image->height."/";
$preview2 = "/w".$image->width."-h".$image->height."-p/";
$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
$cleaned = array();
$queryvar = fromgplus_parse_query($fullImage);
if ($queryvar['url'] != "")
$cleaned["full"] = urldecode($queryvar['url']);
else
$cleaned["full"] = $fullImage;
if (@exif_imagetype($cleaned["full"]) == 0)
$cleaned["full"] = "";
$queryvar = fromgplus_parse_query($image);
if ($queryvar['url'] != "")
$cleaned["preview"] = urldecode($queryvar['url']);
else
$cleaned["preview"] = $image;
if (@exif_imagetype($cleaned["preview"]) == 0)
$cleaned["preview"] = "";
if ($cleaned["full"] == "") {
$cleaned["full"] = $cleaned["preview"];
$cleaned["preview"] = "";
}
if ($cleaned["full"] == $cleaned["preview"])
$cleaned["preview"] = "";
if ($cleaned["full"] == "")
if (@exif_imagetype($fullImage) != 0)
$cleaned["full"] = $fullImage;
if ($cleaned["full"] == "")
if (@exif_imagetype($image) != 0)
$cleaned["full"] = $fullImage;
return($cleaned);
}
function fromgplus_handleattachments($item) {
$post = "";
$quote = "";
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";
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_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";
/*$images = cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["preview"] != "")
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\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]";
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["preview"] != "")
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\n";
//$post .= "[quote]".trim(fromgplus_html2bbcode($attachment->content))."[/quote]";
$quote = trim(fromgplus_html2bbcode($attachment->content));
if ($quote != "")
$quote = "\n[quote]".$quote."[/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";
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["preview"] != "")
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\n";
if ($attachment->displayName != "")
$post .= html2bbcode($attachment->displayName)."\n";
$post .= fromgplus_html2bbcode($attachment->displayName)."\n";
break;
case "photo-album":
$post .= "\n\n[url=".$attachment->url."]".
"[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["preview"] != "")
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\n";
break;
default:
print_r($attachment);
die();
case "album":
foreach($attachment->thumbnails as $thumb) {
$preview = "/w".$thumb->image->width."-h".$thumb->image->height."/";
$preview2 = "/w".$thumb->image->width."-h".$thumb->image->height."-p/";
$image = str_replace(array($preview, $preview2), array("/", "/"), $thumb->image->url);
$post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
}
break;
case "audio":
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
break;
//default:
// die($attachment->objectType);
}
}
return($post);
return($post.$quote);
}
$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);
function fromgplus_fetch($a, $uid) {
$maxfetch = 20;
$state = array("lastid"=>'');
if (file_exists($statefile))
$state = unserialize(file_get_contents($statefile));
$account = get_pconfig($uid,'fromgplus','account');
$key = get_config('fromgplus','key');
$lastid = "";
$result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
//$result = file_get_contents("google.txt");
//file_put_contents("google.txt", $result);
foreach($activities->items as $item) {
if ($item->id == $state["lastid"])
break;
$activities = json_decode($result);
if ($lastid == "")
$lastid = $item->id;
$initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
switch($item->object->objectType) {
case "note":
$post = html2bbcode($item->object->content);
$lastdate = 0;
if (is_array($item->object->attachments))
$post .= handleattachments($item);
friendicapost($post);
break;
if (!is_array($activities->items))
return;
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]";
$reversed = array_reverse($activities->items);
$post .= html2bbcode($item->object->content);
foreach($reversed as $item) {
if (strtotime($item->published) <= $initiallastdate)
continue;
if (is_array($item->object->attachments))
$post .= "\n".trim(handleattachments($item));
if ($lastdate < strtotime($item->published))
$lastdate = strtotime($item->published);
//$post .= "[/quote]";
if ($item->access->description == "Public")
switch($item->object->objectType) {
case "note":
$post = fromgplus_html2bbcode($item->object->content);
friendicapost($post);
break;
if (is_array($item->object->attachments))
$post .= fromgplus_handleattachments($item);
default:
print_r($item);
die();
break;
// geocode, placeName
if (isset($item->address))
$location = $item->address;
else
$location = "";
fromgplus_post($a, $uid, $item->provider->title, $post, $location);
break;
case "activity":
$post = fromgplus_html2bbcode($item->annotation)."\n";
if (intval(get_config('system','new_share'))) {
$post .= "[share author='".str_replace("'", "&#039;",$item->object->actor->displayName).
"' profile='".$item->object->actor->url.
"' avatar='".$item->object->actor->image->url.
"' link='".$item->object->url."']";
$post .= fromgplus_html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= "\n".trim(fromgplus_handleattachments($item));
$post .= "[/share]";
} else {
$post .= fromgplus_html2bbcode("&#x2672;");
$post .= " [url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url] \n";
$post .= fromgplus_html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= "\n".trim(fromgplus_handleattachments($item));
}
if (isset($item->address))
$location = $item->address;
else
$location = "";
fromgplus_post($a, $uid, $item->provider->title, $post, $location);
break;
}
}
if ($lastdate != 0)
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
}
if ($lastid != "") {
$state['lastid'] = $lastid;
file_put_contents($statefile, serialize($state));
/*
// Test
require_once("boot.php");
if(@is_null($a)) {
$a = new App;
}
if(@is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
$test = array();
fromgplus_cron($a, $test);
*/

Binary file not shown.

View file

@ -40,8 +40,8 @@ function geonames_install() {
*
*/
register_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_settings');
register_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_settings_post');
register_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_plugin_admin');
register_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_plugin_admin_post');
logger("installed geonames");
}
@ -58,8 +58,8 @@ function geonames_uninstall() {
*/
unregister_hook('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
unregister_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_settings');
unregister_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_settings_post');
unregister_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_plugin_admin');
unregister_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_plugin_admin_post');
logger("removed geonames");
@ -135,7 +135,7 @@ function geonames_post_hook($a, &$item) {
*
*/
function geonames_settings_post($a,$post) {
function geonames_plugin_admin_post($a,$post) {
if(! local_user() || (! x($_POST,'geonames-submit')))
return;
set_pconfig(local_user(),'geonames','enable',intval($_POST['geonames']));
@ -153,7 +153,7 @@ function geonames_settings_post($a,$post) {
function geonames_settings(&$a,&$s) {
function geonames_plugin_admin(&$a,&$s) {
if(! local_user())
return;

Binary file not shown.

View file

@ -55,7 +55,7 @@ function gravatar_lookup($a, &$b) {
* Display admin settings for this addon
*/
function gravatar_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
$t = get_markup_template( "admin.tpl", "addon/gravatar/" );
$default_avatar = get_config('gravatar', 'default_img');
$rating = get_config('gravatar', 'rating');

View file

@ -0,0 +1,3 @@
{{include file="field_select.tpl" field=$default_avatar}}
{{include file="field_select.tpl" field=$rating}}
<div class="submit"><input type="submit" value="{{$submit}}" /></div>

BIN
group_text.tgz Normal file

Binary file not shown.

View file

@ -43,7 +43,7 @@ function group_text_settings_post($a,$post) {
return;
set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
info( t('Editplain settings updated.') . EOL);
info( t('Group Text settings updated.') . EOL);
}

Binary file not shown.

View file

@ -78,7 +78,7 @@ function impressum_plugin_admin_post (&$a) {
info( t('Settings updated.'). EOL );
}
function impressum_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__). "/admin.tpl" );
$t = get_markup_template( "admin.tpl", "addon/impressum/" );
$o = replace_macros($t, array(
'$submit' => t('Submit'),
'$owner' => array('owner', t('Site Owner'), get_config('impressum','owner'), t('The page operators name.')),

0
impressum/admin.tpl → impressum/view/admin.tpl Executable file → Normal file
View file

View file

@ -0,0 +1,7 @@
{{include file="field_input.tpl" field=$owner}}
{{include file="field_input.tpl" field=$ownerprofile}}
{{include file="field_textarea.tpl" field=$postal}}
{{include file="field_textarea.tpl" field=$notes}}
{{include file="field_input.tpl" field=$email}}
{{include file="field_textarea.tpl" field=$footer_text}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

Binary file not shown.

Binary file not shown.

View file

@ -196,7 +196,13 @@ class qqUploadedFileXhr {
*/
function save() {
$input = fopen("php://input", "r");
$this->pathnm = tempnam(sys_get_temp_dir(),'frn');
$upload_dir = get_config('system','tempdir');
if(! $upload_dir)
$upload_dir = sys_get_temp_dir();
$this->pathnm = tempnam($upload_dir,'frn');
$temp = fopen($this->pathnm,"w");
$realSize = stream_copy_to_stream($input, $temp);

Binary file not shown.

View file

@ -60,7 +60,7 @@ function libravatar_lookup($a, &$b) {
* Display admin settings for this addon
*/
function libravatar_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
$t = get_markup_template( "admin.tpl", "addon/libravatar" );
$default_avatar = get_config('libravatar', 'default_img');

View file

@ -0,0 +1,2 @@
{{include file="field_select.tpl" field=$default_avatar}}
<div class="submit"><input type="submit" value="{{$submit}}" /></div>

Binary file not shown.

View file

@ -1,6 +1,5 @@
#ljpost-enable-label, #ljpost-username-label, #ljpost-password-label, #ljpost-bydefault-label {
<<<<<<< HEAD
float: left;
width: 200px;
margin-top: 10px;
@ -15,18 +14,3 @@
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

BIN
mahjongg.tar Normal file

Binary file not shown.

42
mahjongg/mahjongg.php Executable file
View file

@ -0,0 +1,42 @@
<?php
/**
* Name: Mah Jongg
* Description: Ancient Chinese puzzle game that never gets old.
* Version: 1.0
* Author: Holger Froese
*/
function mahjongg_install() {
register_hook('app_menu', 'addon/mahjongg/mahjongg.php', 'mahjongg_app_menu');
}
function mahjongg_uninstall() {
unregister_hook('app_menu', 'addon/mahjongg/mahjongg.php', 'mahjongg_app_menu');
}
function mahjongg_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="mahjongg">Mahjongg</a></div>';
}
function mahjongg_module() {}
function mahjongg_content(&$a) {
$baseurl = $a->get_baseurl() . '/addon/mahjongg';
$o .= <<< EOT
<br><br>
<p align="left">
<embed src="addon/mahjongg/mahjongg.swf" quality="high" bgcolor="#FFFFFF" width="800" height="600" name="mahjongg" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
<br><br>
<b>Simply locate the matching tiles and find a way to clear them from the board as quickly as possible.
A timer at the top of the screen keeps track of how you are doing.</b><br>
</p>
EOT;
return $o;
}

BIN
mahjongg/mahjongg.swf Executable file

Binary file not shown.

Binary file not shown.

View file

@ -66,11 +66,12 @@ function mathjax_plugin_admin_post (&$a) {
info( t('Settings updated.'). EOL);
}
function mathjax_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
if (get_config('mathjax','baseurl','') == '') {
set_config('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
}
$o = replace_macros( $t, array(
$t = get_markup_template( "admin.tpl", "addon/mathjax/" );
if (get_config('mathjax','baseurl','') == '') {
set_config('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
}
$o = replace_macros( $t, array(
'$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.')),
));
));
}

View file

@ -0,0 +1,2 @@
{{include file="field_input.tpl" field=$baseurl}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

BIN
morepokes.tgz Normal file

Binary file not shown.

View file

@ -19,9 +19,8 @@ function morepokes_poke_verbs($a,&$b) {
$b['bitchslap'] = array('bitchslapped', t('bitchslap'), t('bitchslapped'));
$b['shag'] = array('shag', t('shag'), t('shagged'));
$b['somethingobscenelybiological'] = array('something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to'));
$b['newpokefeature'] = array('pointed out the new poke feature to', t('point out the new poke feature to'), t('pointed out the new poke feature to'));
$b['newpokefeature'] = array('pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to'));
$b['declareundyinglove'] = array('declared undying love for', t('declare undying love for'), t('declared undying love for'));
$b['setfireto'] = array('set fire to', t('set fire to'), t('set fire to'));
$b['patent'] = array('patented', t('patent'), t('patented'));
$b['strokebeard'] = array('stroked their beard at', t('stroke beard'), t('stroked their beard at'));
$b['bemoan'] = array('bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to'));
@ -35,4 +34,4 @@ function morepokes_poke_verbs($a,&$b) {
$b['giggleandfawn'] = array('giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at'));
$b['doubt'] = array('doubted', t('doubt'), t('doubted'));
$b['glare'] = array('glared at', t('glare'), t('glared at'));
;}
;}

BIN
nsfw.tgz

Binary file not shown.

View file

@ -24,6 +24,37 @@ function nsfw_uninstall() {
}
// This function isn't perfect and isn't trying to preserve the html structure - it's just a
// quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up
// inside them quite often. We don't need anything fancy, just pull out the data blob so we can
// check against the rest of the body.
function nsfw_extract_photos($body) {
$new_body = '';
$img_start = strpos($body,'src="data:');
$img_end = (($img_start !== false) ? strpos(substr($body,$img_start),'>') : false);
$cnt = 0;
while($img_end !== false) {
$img_end += $img_start;
$new_body = $new_body . substr($body,0,$img_start);
$cnt ++;
$body = substr($body,0,$img_end);
$img_start = strpos($body,'src="data:');
$img_end = (($img_start !== false) ? strpos(substr($body,$img_start),'>') : false);
}
if(! $cnt)
return $body;
return $new_body;
}
@ -77,6 +108,7 @@ function nsfw_addon_settings_post(&$a,&$b) {
function nsfw_prepare_body(&$a,&$b) {
$words = null;
if(get_pconfig(local_user(),'nsfw','disable'))
return;
@ -93,19 +125,22 @@ function nsfw_prepare_body(&$a,&$b) {
$found = false;
if(count($arr)) {
$body = nsfw_extract_photos($b['html']);
foreach($arr as $word) {
$word = trim($word);
if(! strlen($word)) {
continue;
}
if(strpos($word,'/') === 0) {
if(preg_match($word,$b['html'])) {
if(preg_match($word,$body)) {
$found = true;
break;
}
}
else {
if(stristr($b['html'],$word)) {
if(stristr($body,$word)) {
$found = true;
break;
}
@ -115,6 +150,7 @@ function nsfw_prepare_body(&$a,&$b) {
}
}
}
}
if($found) {
$rnd = random_string(8);

Binary file not shown.

View file

@ -0,0 +1,41 @@
var toolserver = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php';
var startTag = '<iframe class="osmFrame" style="width: 100%; height: 350px; clear: both;" src="'+ toolserver + '?lang=de&amp;uselang=de&amp;params=';
var endTag = '"></iframe>';
jQuery(document).ready(function($) {
$('.wall-item-content-wrapper').each(function(index) {
var link = $(this).find('.wall-item-location .OSMMapLink');
link.toggle(addIframe, removeIframe);
});
});
function addIframe(ev) {
var coordinate = $(ev.target).attr('title');
var newTag = startTag + convertCoordinateString(coordinate) + endTag;
$(ev.target).parents('.wall-item-content-wrapper').append(newTag);
}
function removeIframe(ev) {
$(ev.target).parents('.wall-item-content-wrapper').find('iframe').remove();
}
function convertCoordinateString(coordinate) {
var locstring = coordinate.split(' ');
var northSouth;
var westEast;
if (locstring[0] < 0) {
northSouth = '_S_';
}else{
northSouth = '_N_';
}
if (locstring[1] < 0) {
westEast = '_W';
}else{
westEast = '_E';
}
return Math.abs(locstring[0]) + northSouth + Math.abs(locstring[1]) + westEast;
}

View file

@ -10,24 +10,33 @@
function openstreetmap_install() {
register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
register_hook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
logger("installed openstreetmap");
}
function openstreetmap_uninstall() {
unregister_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
unregister_hook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
logger("removed openstreetmap");
}
function openstreetmap_alterheader($a, &$navHtml) {
$addScriptTag='<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js' . '"></script>' . "\r\n";
$a->page['htmlhead'] .= $addScriptTag;
}
function openstreetmap_location($a, &$item) {
//
if(! (strlen($item['location']) || strlen($item['coord'])))
return;
return;
/*
* Get the configuration variables from the .htconfig file.
*/
*/
$tmsserver = get_config('openstreetmap','tmsserver');
if(! $tmsserver)
$tmsserver = 'http://openstreetmap.org';
@ -38,12 +47,27 @@ function openstreetmap_location($a, &$item) {
$location = '';
$coord = '';
if($item['location'] && !$item['coord'] && true){ //if only a location is given, find the lat-lon
$geo_account='demo';
$s = fetch_url('http://api.geonames.org/search?maxRows=1&fuzzy=0.8&q=' . $item['location'] . '&username=' . $geo_account);
if($s){
$xml = parse_xml_string($s);
if($xml->geoname->lat && $xml->geoname->lng){
$item['coord'] = $xml->geoname->lat . ' ' . $xml->geoname->lng;
}
}
}
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="'.$tmsserver.'?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
if($item['coord']) {
$coords = explode(' ', $item['coord']);
if(count($coords) > 1) {
$coord = '<a target="map" title="' . $item['coord'] . '" href="'.$tmsserver.'?lat=' . urlencode($coords[0]) . '&lon=' . urlencode($coords[1]) . '&zoom='.$zoom.'">' . $item['coord'] . '</a>' ;
$coord = '<a target="map" class="OSMMapLink" title="' . $item['coord'] . '" href="'.$tmsserver.'?lat=' . urlencode($coords[0]) . '&lon=' . urlencode($coords[1]) . '&zoom='.$zoom.'"> Map </a>' ;
}
}
if(strlen($coord)) {
@ -58,7 +82,7 @@ function openstreetmap_location($a, &$item) {
function openstreetmap_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
$t = get_markup_template( "admin.tpl", "addon/openstreetmap/" );
$tmsserver = get_config('openstreetmap','tmsserver');
if(! $tmsserver)
$tmsserver = 'http://openstreetmap.org';
@ -67,9 +91,9 @@ function openstreetmap_plugin_admin (&$a, &$o) {
$zoom = 17;
$o = replace_macros( $t, array(
'$submit' => t('Submit'),
'$tmsserver' => array('tmsserver', t('Tile Server URL'), $tmsserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')),
'$zoom' => array('zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest)')),
'$submit' => t('Submit'),
'$tmsserver' => array('tmsserver', t('Tile Server URL'), $tmsserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')),
'$zoom' => array('zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest)')),
));
}
function openstreetmap_plugin_admin_post (&$a) {

View file

@ -0,0 +1,3 @@
{{include file="field_input.tpl" field=$tmsserver}}
{{include file="field_input.tpl" field=$zoom}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

BIN
page.tgz

Binary file not shown.

View file

@ -1,7 +1,7 @@
<?php
/**
* Name: Page
* Description: Shows list of subscribed community pages/forums on network sidebar
* Description: This addon is now deprecated. Administrators should switch to forumlist instead. Developers should also add any functionality to forumlist instead of here.
* Version: 1.0
* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
@ -38,6 +38,7 @@ function page_getpage($uid,$showhidden = true,$randomise = false) {
$contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact`
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
and blocked = 0 and hidden = 0 and pending = 0 and archive = 0
$order ",
intval($uid)
);

BIN
piwik.tgz

Binary file not shown.

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