From 4f7f547190f5ec2557739aad6b2c09e3f45cdc76 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 14:31:57 -0800 Subject: why oh why is poco_load not getting called? oh - that's why. --- include/items.php | 4 ++-- include/onepoll.php | 4 ++-- include/permissions.php | 32 ++++++++++++++++---------------- mod/channel.php | 6 +----- mod/zotfeed.php | 3 +++ 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/include/items.php b/include/items.php index 4832c2916..04d088d44 100755 --- a/include/items.php +++ b/include/items.php @@ -4282,14 +4282,14 @@ function fetch_post_tags($items) { -function zot_feed($uid,$observer,$mindate) { +function zot_feed($uid,$observer_xchan,$mindate) { $result = array(); $mindate = datetime_convert('UTC','UTC',$mindate); if(! $mindate) $mindate = '0000-00-00 00:00:00'; - if(! perm_is_allowed($uid,$observer,'view_stream')) { + if(! perm_is_allowed($uid,$observer_xchan,'view_stream')) { return $result; } diff --git a/include/onepoll.php b/include/onepoll.php index 019fe8ed3..bb8c91dd7 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -115,10 +115,10 @@ function onepoll_run($argv, $argc){ if($contact['xchan_connurl']) { $r = q("SELECT xlink_id from xlink - where xlink_xchan = '%s' and xlink_updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", + where xlink_xchan = '%s' and xlink_updated > UTC_TIMESTAMP() - INTERVAL 1 DAY limit 1", intval($contact['xchan_hash']) ); - if($r) { + if(! $r) { poco_load($contact['xchan_hash'],$contact['xchan_connurl']); } } diff --git a/include/permissions.php b/include/permissions.php index ab40a7017..55fa626a9 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -35,15 +35,15 @@ function get_perms() { /** - * get_all_perms($uid,$observer) + * get_all_perms($uid,$observer_xchan) * * @param $uid : The channel_id associated with the resource owner - * @param $observer: The xchan_hash representing the observer + * @param $observer_xchan: The xchan_hash representing the observer * * @returns: array of all permissions, key is permission name, value is true or false */ -function get_all_perms($uid,$observer,$internal_use = true) { +function get_all_perms($uid,$observer_xchan,$internal_use = true) { $global_perms = get_perms(); @@ -83,12 +83,12 @@ function get_all_perms($uid,$observer,$internal_use = true) { // Next we're going to check for blocked or ignored contacts. // These take priority over all other settings. - if($observer) { + if($observer_xchan) { if(! $abook_checked) { $x = q("select abook_my_perms, abook_flags from abook where abook_channel = %d and abook_xchan = '%s' and not ( abook_flags & %d ) limit 1", intval($uid), - dbesc($observer), + dbesc($observer_xchan), intval(ABOOK_FLAG_SELF) ); $abook_checked = true; @@ -110,10 +110,10 @@ function get_all_perms($uid,$observer,$internal_use = true) { } } - // Check if this $uid is actually the $observer - if it's your content + // Check if this $uid is actually the $observer_xchan - if it's your content // you always have permission to do anything - if(($observer) && ($r[0]['channel_hash'] === $observer)) { + if(($observer_xchan) && ($r[0]['channel_hash'] === $observer_xchan)) { $ret[$perm_name] = true; continue; } @@ -128,7 +128,7 @@ function get_all_perms($uid,$observer,$internal_use = true) { // From here on out, we need to know who they are. If we can't figure it // out, permission is denied. - if(! $observer) { + if(! $observer_xchan) { $ret[$perm_name] = false; continue; } @@ -145,7 +145,7 @@ function get_all_perms($uid,$observer,$internal_use = true) { if($r[0][$channel_perm] & PERMS_SITE) { if(! $onsite_checked) { $c = q("select channel_hash from channel where channel_hash = '%s' limit 1", - dbesc($observer) + dbesc($observer_xchan) ); $onsite_checked = true; @@ -195,7 +195,7 @@ function get_all_perms($uid,$observer,$internal_use = true) { } -function perm_is_allowed($uid,$observer,$permission) { +function perm_is_allowed($uid,$observer_xchan,$permission) { $global_perms = get_perms(); @@ -210,10 +210,10 @@ function perm_is_allowed($uid,$observer,$permission) { if(! $r) return false; - if($observer) { + if($observer_xchan) { $x = q("select abook_my_perms, abook_flags from abook where abook_channel = %d and abook_xchan = '%s' and not ( abook_flags & %d ) limit 1", intval($uid), - dbesc($observer), + dbesc($observer_xchan), intval(ABOOK_FLAG_SELF) ); @@ -228,9 +228,9 @@ function perm_is_allowed($uid,$observer,$permission) { } - // Check if this $uid is actually the $observer + // Check if this $uid is actually the $observer_xchan - if($r[0]['channel_hash'] === $observer) + if($r[0]['channel_hash'] === $observer_xchan) return true; @@ -239,7 +239,7 @@ function perm_is_allowed($uid,$observer,$permission) { // If it's an unauthenticated observer, we only need to see if PERMS_PUBLIC is set - if(! $observer) { + if(! $observer_xchan) { return false; } @@ -253,7 +253,7 @@ function perm_is_allowed($uid,$observer,$permission) { if($r[0][$channel_perm] & PERMS_SITE) { $c = q("select channel_hash from channel where channel_hash = '%s' limit 1", - dbesc($observer) + dbesc($observer_xchan) ); if($c) return true; diff --git a/mod/channel.php b/mod/channel.php index 4510ad61d..3f92539ae 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -22,6 +22,7 @@ function channel_init(&$a) { // Run profile_load() here to make sure the theme is set before // we start loading content + profile_load($a,$which,$profile); } @@ -81,12 +82,8 @@ function channel_content(&$a, $update = 0, $load = false) { $groups = array(); - - $tab = 'posts'; $o = ''; - - if($update) { // Ensure we've got a profile owner if updating. $a->profile['profile_uid'] = $update; @@ -112,7 +109,6 @@ function channel_content(&$a, $update = 0, $load = false) { if(! $update) { - $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); $o .= common_friends_visitor_widget($a->profile['profile_uid']); diff --git a/mod/zotfeed.php b/mod/zotfeed.php index 6519481d2..76a860139 100644 --- a/mod/zotfeed.php +++ b/mod/zotfeed.php @@ -16,6 +16,9 @@ function zotfeed_init(&$a) { json_return_and_die($result); } + $observer = $a->get_observer(); + + $channel_address = ((argc() > 1) ? argv(1) : ''); if($channel_address) { $r = q("select channel_id from channel where channel_address = '%s' limit 1", -- cgit v1.2.3