why oh why is poco_load not getting called? oh - that's why.

This commit is contained in:
friendica 2013-01-24 14:31:57 -08:00
parent 5da1948ede
commit 4f7f547190
5 changed files with 24 additions and 25 deletions

View File

@ -4282,14 +4282,14 @@ function fetch_post_tags($items) {
function zot_feed($uid,$observer,$mindate) { function zot_feed($uid,$observer_xchan,$mindate) {
$result = array(); $result = array();
$mindate = datetime_convert('UTC','UTC',$mindate); $mindate = datetime_convert('UTC','UTC',$mindate);
if(! $mindate) if(! $mindate)
$mindate = '0000-00-00 00:00:00'; $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; return $result;
} }

View File

@ -115,10 +115,10 @@ function onepoll_run($argv, $argc){
if($contact['xchan_connurl']) { if($contact['xchan_connurl']) {
$r = q("SELECT xlink_id from xlink $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']) intval($contact['xchan_hash'])
); );
if($r) { if(! $r) {
poco_load($contact['xchan_hash'],$contact['xchan_connurl']); poco_load($contact['xchan_hash'],$contact['xchan_connurl']);
} }
} }

View File

@ -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 $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 * @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(); $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. // Next we're going to check for blocked or ignored contacts.
// These take priority over all other settings. // These take priority over all other settings.
if($observer) { if($observer_xchan) {
if(! $abook_checked) { if(! $abook_checked) {
$x = q("select abook_my_perms, abook_flags from abook $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", where abook_channel = %d and abook_xchan = '%s' and not ( abook_flags & %d ) limit 1",
intval($uid), intval($uid),
dbesc($observer), dbesc($observer_xchan),
intval(ABOOK_FLAG_SELF) intval(ABOOK_FLAG_SELF)
); );
$abook_checked = true; $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 // 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; $ret[$perm_name] = true;
continue; 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 // From here on out, we need to know who they are. If we can't figure it
// out, permission is denied. // out, permission is denied.
if(! $observer) { if(! $observer_xchan) {
$ret[$perm_name] = false; $ret[$perm_name] = false;
continue; continue;
} }
@ -145,7 +145,7 @@ function get_all_perms($uid,$observer,$internal_use = true) {
if($r[0][$channel_perm] & PERMS_SITE) { if($r[0][$channel_perm] & PERMS_SITE) {
if(! $onsite_checked) { if(! $onsite_checked) {
$c = q("select channel_hash from channel where channel_hash = '%s' limit 1", $c = q("select channel_hash from channel where channel_hash = '%s' limit 1",
dbesc($observer) dbesc($observer_xchan)
); );
$onsite_checked = true; $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(); $global_perms = get_perms();
@ -210,10 +210,10 @@ function perm_is_allowed($uid,$observer,$permission) {
if(! $r) if(! $r)
return false; 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", $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), intval($uid),
dbesc($observer), dbesc($observer_xchan),
intval(ABOOK_FLAG_SELF) 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; 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 it's an unauthenticated observer, we only need to see if PERMS_PUBLIC is set
if(! $observer) { if(! $observer_xchan) {
return false; return false;
} }
@ -253,7 +253,7 @@ function perm_is_allowed($uid,$observer,$permission) {
if($r[0][$channel_perm] & PERMS_SITE) { if($r[0][$channel_perm] & PERMS_SITE) {
$c = q("select channel_hash from channel where channel_hash = '%s' limit 1", $c = q("select channel_hash from channel where channel_hash = '%s' limit 1",
dbesc($observer) dbesc($observer_xchan)
); );
if($c) if($c)
return true; return true;

View File

@ -22,6 +22,7 @@ function channel_init(&$a) {
// Run profile_load() here to make sure the theme is set before // Run profile_load() here to make sure the theme is set before
// we start loading content // we start loading content
profile_load($a,$which,$profile); profile_load($a,$which,$profile);
} }
@ -81,12 +82,8 @@ function channel_content(&$a, $update = 0, $load = false) {
$groups = array(); $groups = array();
$tab = 'posts';
$o = ''; $o = '';
if($update) { if($update) {
// Ensure we've got a profile owner if updating. // Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update; $a->profile['profile_uid'] = $update;
@ -112,7 +109,6 @@ function channel_content(&$a, $update = 0, $load = false) {
if(! $update) { if(! $update) {
$o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
$o .= common_friends_visitor_widget($a->profile['profile_uid']); $o .= common_friends_visitor_widget($a->profile['profile_uid']);

View File

@ -16,6 +16,9 @@ function zotfeed_init(&$a) {
json_return_and_die($result); json_return_and_die($result);
} }
$observer = $a->get_observer();
$channel_address = ((argc() > 1) ? argv(1) : ''); $channel_address = ((argc() > 1) ? argv(1) : '');
if($channel_address) { if($channel_address) {
$r = q("select channel_id from channel where channel_address = '%s' limit 1", $r = q("select channel_id from channel where channel_address = '%s' limit 1",