diff options
author | Michael Vogel <icarus@dabo.de> | 2012-03-11 19:41:29 +0100 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-03-11 19:41:29 +0100 |
commit | 739309abd0cb103fe5a4d5081a7252b5698ab787 (patch) | |
tree | 38a2ce4ad75d3ad8d8a430acbb6cd338a49b4a43 /addon | |
parent | 9f76d96d46356b18325ca49c383f94a1958fefd3 (diff) | |
download | volse-hubzilla-739309abd0cb103fe5a4d5081a7252b5698ab787.tar.gz volse-hubzilla-739309abd0cb103fe5a4d5081a7252b5698ab787.tar.bz2 volse-hubzilla-739309abd0cb103fe5a4d5081a7252b5698ab787.zip |
Corrected some git problems
Diffstat (limited to 'addon')
-rwxr-xr-x | addon/pages/README | 3 | ||||
-rwxr-xr-x | addon/pages/pages.php | 86 |
2 files changed, 0 insertions, 89 deletions
diff --git a/addon/pages/README b/addon/pages/README deleted file mode 100755 index 6ec314b70..000000000 --- a/addon/pages/README +++ /dev/null @@ -1,3 +0,0 @@ -Pages - -Shows lists of community pages diff --git a/addon/pages/pages.php b/addon/pages/pages.php deleted file mode 100755 index 9e90cc24d..000000000 --- a/addon/pages/pages.php +++ /dev/null @@ -1,86 +0,0 @@ -<?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_iscommunity($url, &$pagelist) { - // check every week for the status - should be enough - if ($pagelist[$url]["checked"]<time()-86400*7) { - // When too old or not found fetch the status from the profile - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, 2); - - $page = curl_exec($ch); - - curl_close($ch); - - $iscommunity = (strpos($page, '<meta name="friendika.community" content="true" />') != 0); - - $pagelist[$url] = array("community" => $iscommunity, "checked" => time()); - } else // Fetch from cache - $iscommunity = $pagelist[$url]["community"]; - return($iscommunity); -} - -function pages_getpages($uid) { - - // Fetch cached pagelist from configuration - $pagelist = get_pconfig($uid,'pages','pagelist'); - - if (sizeof($pagelist) == 0) - $pagelist = array(); - - $contacts = q("SELECT `id`, `url`, `Name` FROM `contact` - WHERE `network`= 'dfrn' AND `uid` = %d", - intval($uid)); - - $pages = array(); - - // Look if the profile is a community page - foreach($contacts as $contact) { - if (pages_iscommunity($contact["url"], $pagelist)) - $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"], "id"=>$contact["id"]); - } - - // Write back cached pagelist - set_pconfig($uid,'pages','pagelist', $pagelist); - return($pages); -} - -function pages_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; - - $pages = '<div id="pages-sidebar" class="widget"> - <div class="title tool"> - <h3>'.t("Community").'</h3></div> - <div id="sidebar-pages-list"><ul>'; - - $contacts = pages_getpages($a->user['uid']); - - foreach($contacts as $contact) { - $pages .= '<li class="tool"><a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" class="label" target="external-link">'. - $contact["Name"]."</a></li>"; - } - $pages .= "</ul></div></div>"; - if (sizeof($contacts) > 0) - $a->page['aside'] = $pages.$a->page['aside']; -} -?> |