4 * Description: Shows lists of community pages (improved performance over 'pages')
6 * Author: Mike Macgirvin <mike@macgirvin.com>
7 * based on pages plugin by
8 * Author: Michael Vogel <ike@piratenpartei.de>
12 function page_install() {
13 register_hook('page_end', 'addon/page/page.php', 'page_page_end');
16 function page_uninstall() {
17 unregister_hook('page_end', 'addon/page/page.php', 'page_page_end');
21 function page_getpage($uid) {
26 $contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
27 WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
34 // Look if the profile is a community page
35 foreach($contacts as $contact) {
36 $page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
41 function page_page_end($a,&$b) {
42 // Only move on if if it's the "network" module and there is a logged on user
43 if (($a->module != "network") OR ($a->user['uid'] == 0))
46 $page = '<div id="page-sidebar" class="widget">
47 <div class="title tool">
48 <h3>'.t("Forums").'</h3></div>
49 <div id="sidebar-page-list"><ul>';
51 $contacts = page_getpage($a->user['uid']);
53 foreach($contacts as $contact) {
54 $page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" title="' . $contact['url'] . '" class="label" target="external-link">'.
55 $contact["name"]."</a></li>";
57 $page .= "</ul></div></div>";
58 if (sizeof($contacts) > 0)
59 $a->page['aside'] = $page . $a->page['aside'];