better way to deal with effective_uid

This commit is contained in:
friendica 2014-09-22 22:03:19 -07:00
parent fb05919d90
commit e8854bb19d
3 changed files with 12 additions and 12 deletions

View File

@ -1230,19 +1230,11 @@ function add_children_to_list($children, &$arr) {
}
}
function conv_sort($arr,$order,$uid = 0) {
function conv_sort($arr,$order) {
if((!(is_array($arr) && count($arr))))
return array();
if($uid) {
for($x = 0; $x < count($arr); $x ++) {
$arr[$x]['real_uid'] = $arr[$x]['uid'];
$arr[$x]['uid'] = $uid;
}
}
$parents = array();
$children = array();

View File

@ -1851,9 +1851,17 @@ function ids_to_querystr($arr,$idx = 'id') {
// author_xchan and owner_xchan. If $abook is true also include the abook info.
// This is needed in the API to save extra per item lookups there.
function xchan_query(&$items,$abook = true) {
function xchan_query(&$items,$abook = true,$effective_uid = 0) {
$arr = array();
if($items && count($items)) {
if($effective_uid) {
for($x = 0; $x < count($items); $x ++) {
$items[$x]['real_uid'] = $items[$x]['uid'];
$items[$x]['uid'] = $effective_uid;
}
}
foreach($items as $item) {
if($item['owner_xchan'] && (! in_array($item['owner_xchan'],$arr)))
$arr[] = "'" . dbesc($item['owner_xchan']) . "'";

View File

@ -403,9 +403,9 @@ function network_content(&$a, $update = 0, $load = false) {
dbesc($parents_str)
);
xchan_query($items);
xchan_query($items,true,(($firehose) ? local_user() : 0));
$items = fetch_post_tags($items,true);
$items = conv_sort($items,$ordering,(($firehose) ? local_user() : 0));
$items = conv_sort($items,$ordering);
}
else {
$items = array();