diff options
Diffstat (limited to 'addon/pages')
-rwxr-xr-x | addon/pages/README | 3 | ||||
-rwxr-xr-x | addon/pages/pages.php | 39 |
2 files changed, 42 insertions, 0 deletions
diff --git a/addon/pages/README b/addon/pages/README new file mode 100755 index 000000000..6ec314b70 --- /dev/null +++ b/addon/pages/README @@ -0,0 +1,3 @@ +Pages + +Shows lists of community pages diff --git a/addon/pages/pages.php b/addon/pages/pages.php new file mode 100755 index 000000000..13e6c4b59 --- /dev/null +++ b/addon/pages/pages.php @@ -0,0 +1,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']; + +} + +?> |