diff options
author | friendica <info@friendica.com> | 2012-10-07 21:44:11 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-10-07 21:44:11 -0700 |
commit | 3c04676a32b048677813c1d8a4c525963a7b2f01 (patch) | |
tree | 1b28b9e40d276be6e10198a52524f8568066d798 /include/text.php | |
parent | a56c0425e6f80e77a1e52b13cd5a14cb6e838b9a (diff) | |
download | volse-hubzilla-3c04676a32b048677813c1d8a4c525963a7b2f01.tar.gz volse-hubzilla-3c04676a32b048677813c1d8a4c525963a7b2f01.tar.bz2 volse-hubzilla-3c04676a32b048677813c1d8a4c525963a7b2f01.zip |
get posts to show up
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 33 |
1 files changed, 33 insertions, 0 deletions
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 |