diff --git a/facebook/facebook.php b/facebook/facebook.php index 35338fa1..b2f21b93 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1176,12 +1176,17 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['private'] = 1; $datarray['allow_cid'] = '<' . $uid . '>'; } - + + if(trim($datarray['body']) == '') { + logger('facebook: empty body'); + continue; + } + $top_item = item_store($datarray); $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($top_item), intval($uid) - ); + ); if(count($r)) { $orig_post = $r[0]; logger('fb: new top level item posted'); diff --git a/pages.tgz b/pages.tgz new file mode 100644 index 00000000..7be170af Binary files /dev/null and b/pages.tgz differ diff --git a/pages/README b/pages/README new file mode 100755 index 00000000..6ec314b7 --- /dev/null +++ b/pages/README @@ -0,0 +1,3 @@ +Pages + +Shows lists of community pages diff --git a/pages/pages.php b/pages/pages.php new file mode 100755 index 00000000..bc56d2e4 --- /dev/null +++ b/pages/pages.php @@ -0,0 +1,88 @@ + + * + */ + +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"]') != 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 = '
+
+

'.t("Community").'

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