get posts to show up

This commit is contained in:
friendica
2012-10-07 21:44:11 -07:00
parent a56c0425e6
commit 3c04676a32
4 changed files with 60 additions and 10 deletions

View File

@@ -1687,4 +1687,37 @@ function ids_to_querystr($arr,$idx = 'id') {
foreach($arr as $x)
$t[] = $x[$idx];
return(implode(',', $t));
}
function xchan_query(&$items) {
$arr = array();
if($items && count($items)) {
foreach($items as $item) {
if($item['owner_xchan'] && (! in_array($item['owner_xchan'],$arr)))
$arr[] = "'" . dbesc($item['owner_xchan']) . "'";
if($item['author_xchan'] && (! in_array($item['author_xchan'],$arr)))
$arr[] = "'" . dbesc($item['author_xchan']) . "'";
}
}
if(count($arr)) {
$chans = q("select * from xchan where xchan_hash in (" . implode(',', $arr) . ")");
}
if($items && count($items) && $chans && count($chans)) {
for($x = 0; $x < count($items); $x ++) {
$items[$x]['owner'] = find_xchan_in_array($items[$x]['owner_xchan'],$chans);
$items[$x]['author'] = find_xchan_in_array($items[$x]['author_xchan'],$chans);
}
}
}
function find_xchan_in_array($xchan,$arr) {
if(count($arr)) {
foreach($arr as $x) {
if($x['xchan_hash'] === $xchan) {
return $x;
}
}
}
return array();
}