diff options
author | zotlabs <mike@macgirvin.com> | 2018-02-05 15:58:28 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-02-05 15:58:28 -0800 |
commit | b41c5f349715abc6ca7db563e3938336bc75974e (patch) | |
tree | 31a1ee5a74227c30239bb9d2a10341bbacb8ecec /Zotlabs/Module/Network.php | |
parent | 05de59d4ad174cb106c3a5b5890732af51730384 (diff) | |
parent | 930e1fdbdc798868760f8a4e03f32fc3f42e8bc9 (diff) | |
download | volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.gz volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.bz2 volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.zip |
Merge branch 'master' into z6
Diffstat (limited to 'Zotlabs/Module/Network.php')
-rw-r--r-- | Zotlabs/Module/Network.php | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 551303984..70e0048fb 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -209,8 +209,11 @@ class Network extends \Zotlabs\Web\Controller { : ''); $sql_nets = ''; + + $distinct = ''; + $item_thread_top = ' AND item_thread_top = 1 '; - $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) "; + $sql_extra = $sql_options; if($group) { $contact_str = ''; @@ -226,7 +229,8 @@ class Network extends \Zotlabs\Web\Controller { $contact_str = ' 0 '; info( t('Privacy group is empty')); } - + $distinct = ' distinct '; + $item_thread_top = ''; $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) "; $x = group_rec_byhash(local_channel(), $group_hash); @@ -250,6 +254,8 @@ class Network extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) { + $distinct = ' distinct '; + $item_thread_top = ''; $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) "; $title = replace_macros(get_markup_template("section_title.tpl"),array( '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>' @@ -264,13 +270,15 @@ class Network extends \Zotlabs\Web\Controller { } } elseif($xchan) { - $r = q("select * from xchan where xchan_hash = '%s'", - dbesc($xchan) - ); - if($r) { - $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) "; - $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>' + $r = q("select * from xchan where xchan_hash = '%s'", + dbesc($xchan) + ); + if($r) { + $distinct = ' distinct '; + $item_thread_top = ''; + $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) "; + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>' )); $o = $tabs; $o .= $title; @@ -373,6 +381,8 @@ class Network extends \Zotlabs\Web\Controller { } if($conv) { + $distinct = ' distinct '; + $item_thread_top = ''; $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ", dbesc(protect_sprintf($channel['channel_hash'])) ); @@ -448,7 +458,7 @@ class Network extends \Zotlabs\Web\Controller { if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order - $items = q("SELECT item.*, item.id AS item_id, received FROM item + $items = q("SELECT item.*, item.id AS item_id, received FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query WHERE true $uids $item_normal @@ -477,11 +487,11 @@ class Network extends \Zotlabs\Web\Controller { if($load) { // Fetch a page full of parent items for this page - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + $r = q("SELECT $distinct item.parent AS item_id FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query - WHERE true $uids $item_normal - AND item.parent = item.id + WHERE true $uids $item_thread_top $item_normal + AND item.mid = item.parent_mid and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets $net_query2 |