]> git.mxchange.org Git - friendica-addons.git/commitdiff
"page" addon - higher performance version of "pages" addon
authorfriendica <info@friendica.com>
Fri, 23 Mar 2012 08:18:45 +0000 (01:18 -0700)
committerfriendica <info@friendica.com>
Fri, 23 Mar 2012 08:18:45 +0000 (01:18 -0700)
page.tgz [new file with mode: 0644]
page/README [new file with mode: 0755]
page/page.php [new file with mode: 0755]

diff --git a/page.tgz b/page.tgz
new file mode 100644 (file)
index 0000000..c684499
Binary files /dev/null and b/page.tgz differ
diff --git a/page/README b/page/README
new file mode 100755 (executable)
index 0000000..6ec314b
--- /dev/null
@@ -0,0 +1,3 @@
+Pages
+
+Shows lists of community pages
diff --git a/page/page.php b/page/page.php
new file mode 100755 (executable)
index 0000000..3333bb2
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Name: Page
+ * Description: Shows lists of community pages
+ * Version: 1.0
+ * Author: Mike Macgirvin <mike@macgirvin.com>
+ * based on pages plugin by
+ * Author: Michael Vogel <ike@piratenpartei.de>
+ *
+ */
+
+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 = '<div id="page-sidebar" class="widget">
+                       <div class="title tool">
+                       <h3>'.t("Community Pages").'</h3></div>
+                       <div id="sidebar-page-list"><ul>';
+
+       $contacts = page_getpage($a->user['uid']);
+
+       foreach($contacts as $contact) {
+               $page .= '<li class="tool"><a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" class="label" target="external-link">'.
+                               $contact["name"]."</a></li>";
+       }
+       $page .= "</ul></div></div>";
+       if (sizeof($contacts) > 0)
+               $a->page['aside'] = $page . $a->page['aside'];
+}
+?>