From 3c04676a32b048677813c1d8a4c525963a7b2f01 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 7 Oct 2012 21:44:11 -0700 Subject: get posts to show up --- include/text.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index a68782f2a..464396d62 100644 --- a/include/text.php +++ b/include/text.php @@ -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(); } \ No newline at end of file -- cgit v1.2.3