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",
33 // Look if the profile is a community page
34 foreach($contacts as $contact) {
35 $page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
40 function page_page_end($a,&$b) {
41 // Only move on if if it's the "network" module and there is a logged on user
42 if (($a->module != "network") OR ($a->user['uid'] == 0))
45 $page = '<div id="page-sidebar" class="widget">
46 <div class="title tool">
47 <h3>'.t("Community Pages").'</h3></div>
48 <div id="sidebar-page-list"><ul>';
50 $contacts = page_getpage($a->user['uid']);
52 foreach($contacts as $contact) {
53 $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">'.
54 $contact["name"]."</a></li>";
56 $page .= "</ul></div></div>";
57 if (sizeof($contacts) > 0)
58 $a->page['aside'] = $page . $a->page['aside'];