From: friendica Date: Fri, 23 Mar 2012 08:18:45 +0000 (-0700) Subject: "page" addon - higher performance version of "pages" addon X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=580bc49308415953be355f59a2e59b4dc95b1bc0;p=friendica-addons.git "page" addon - higher performance version of "pages" addon --- diff --git a/page.tgz b/page.tgz new file mode 100644 index 00000000..c684499b Binary files /dev/null and b/page.tgz differ diff --git a/page/README b/page/README new file mode 100755 index 00000000..6ec314b7 --- /dev/null +++ b/page/README @@ -0,0 +1,3 @@ +Pages + +Shows lists of community pages diff --git a/page/page.php b/page/page.php new file mode 100755 index 00000000..3333bb24 --- /dev/null +++ b/page/page.php @@ -0,0 +1,60 @@ + + * based on pages plugin by + * Author: Michael Vogel + * + */ + +function page_install() { + register_hook('page_end', 'addon/page/page.php', 'page_page_end'); +} + +function page_uninstall() { + unregister_hook('page_end', 'addon/page/page.php', 'page_page_end'); +} + + +function page_getpage($uid) { + + + $pagelist = array(); + + $contacts = q("SELECT `id`, `url`, `name` FROM `contact` + WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d", + intval($uid) + ); + + $page = array(); + + // Look if the profile is a community page + foreach($contacts as $contact) { + $page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"]); + } + return($page); +} + +function page_page_end($a,&$b) { + // Only move on if if it's the "network" module and there is a logged on user + if (($a->module != "network") OR ($a->user['uid'] == 0)) + return; + + $page = '
+
+

'.t("Community Pages").'

+
"; + if (sizeof($contacts) > 0) + $a->page['aside'] = $page . $a->page['aside']; +} +?>