diff options
author | friendica <info@friendica.com> | 2012-01-03 17:29:07 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-01-03 17:29:07 -0800 |
commit | 969cd145ce0e717399dbfff6cbc1a45342206e1a (patch) | |
tree | 0cb293580fa177c9fd2c089104b46a9840d34db1 /include/conversation.php | |
parent | c583d1620955b8d170b8cbf7a106cefeecad56c8 (diff) | |
download | volse-hubzilla-969cd145ce0e717399dbfff6cbc1a45342206e1a.tar.gz volse-hubzilla-969cd145ce0e717399dbfff6cbc1a45342206e1a.tar.bz2 volse-hubzilla-969cd145ce0e717399dbfff6cbc1a45342206e1a.zip |
suggestion notifications
Diffstat (limited to 'include/conversation.php')
-rw-r--r-- | include/conversation.php | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/include/conversation.php b/include/conversation.php index 1b1d09d6b..a30a78271 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -902,29 +902,35 @@ function conv_sort($arr,$order) { elseif(stristr($order,'commented')) usort($parents,'sort_thr_commented'); - foreach($parents as $x) - $x['children'] = array(); + if(count($parents)) + foreach($parents as $x) + $x['children'] = array(); foreach($arr as $x) { if($x['id'] != $x['parent']) { $p = find_thread_parent_index($parents,$x); - $parents[$p]['children'][] = $x; + if($p !== false) + $parents[$p]['children'][] = $x; } } - foreach($parents as $k => $v) { - if(count($parents[$k]['children'])) { - $y = $parents[$k]['children']; - usort($y,'sort_thr_created_rev'); - $parents[$k]['children'] = $y; - } + if(count($parents)) { + foreach($parents as $k => $v) { + if(count($parents[$k]['children'])) { + $y = $parents[$k]['children']; + usort($y,'sort_thr_created_rev'); + $parents[$k]['children'] = $y; + } + } } $ret = array(); - foreach($parents as $x) { - $ret[] = $x; - if(count($x['children'])) - foreach($x['children'] as $y) - $ret[] = $y; + if(count($parents)) { + foreach($parents as $x) { + $ret[] = $x; + if(count($x['children'])) + foreach($x['children'] as $y) + $ret[] = $y; + } } return $ret; @@ -947,4 +953,5 @@ function find_thread_parent_index($arr,$x) { foreach($arr as $k => $v) if($v['id'] == $x['parent']) return $k; + return false; }
\ No newline at end of file |