diff options
author | Michael Vogel <icarus@dabo.de> | 2012-03-11 14:22:19 +0100 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-03-11 14:22:19 +0100 |
commit | eb3b211461906c405c7d016401cb3cd6d7d03b83 (patch) | |
tree | eca952fcc60c724892717006cab706ac9c9a157a /addon/pages/pages.php | |
parent | 670b571c8ac0532cc80fff6351f91b1b0fa58e0c (diff) | |
download | volse-hubzilla-eb3b211461906c405c7d016401cb3cd6d7d03b83.tar.gz volse-hubzilla-eb3b211461906c405c7d016401cb3cd6d7d03b83.tar.bz2 volse-hubzilla-eb3b211461906c405c7d016401cb3cd6d7d03b83.zip |
New plugin that shows community pages in the sidebar
Diffstat (limited to 'addon/pages/pages.php')
-rwxr-xr-x | addon/pages/pages.php | 39 |
1 files changed, 39 insertions, 0 deletions
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']; + +} + +?> |