aboutsummaryrefslogtreecommitdiffstats
path: root/addon/pages/pages.php
blob: 13e6c4b5938588ada18717296a410cd610e05d5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
 * Name: Pages
 * Description: Shows lists of community pages
 * Version: 1.0
 * Author: Michael Vogel <ike@piratenpartei.de>
 *
 */

function pages_install() {
	register_hook('page_end', 'addon/pages/pages.php', 'pages_page_end');
}

function pages_uninstall() {
	unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end');
}

function pages_page_end($a,&$b) {
	if (($a->module != "network") OR ($a->user['uid'] == 0))
		return;

	$pages = '<div id="pages-sidebar" class="widget"><h3>'.t("Community").'</h3><ul>';
	$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`Name` FROM `contact`, `user` 
			WHERE `network`= 'dfrn' AND `duplex` 
			AND `contact`.`nick`=`user`.`nickname`
			AND `user`.`page-flags`= %d
			AND `contact`.`uid` = %d",
			intval(PAGE_COMMUNITY),
			intval($a->user['uid']));
	foreach($contacts as $contact) {
		$pages .= '<li class="tool"><a href="'.$contact["url"].'">'.$contact["Name"]."</a></li>";
	}
	$pages .= "</ul>";
	if (sizeof($contacts) > 0)
		$a->page['aside'] = $pages.$a->page['aside'];

}

?>