diff options
author | Paolo T <tuscanhobbit@users.noreply.github.com> | 2014-02-25 16:33:40 +0100 |
---|---|---|
committer | Paolo T <tuscanhobbit@users.noreply.github.com> | 2014-02-25 16:33:40 +0100 |
commit | 0a98f6b878ec89be7282621192d9daf80f125e6c (patch) | |
tree | 718a4771ce1fb86931531226898b0b5d00e4a337 /mod/channel.php | |
parent | 34d30e4d7eb48bd801482531a0d775328bd43ab4 (diff) | |
parent | b1021df485fb6129acda5bba616bac10aea75a45 (diff) | |
download | volse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.tar.gz volse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.tar.bz2 volse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.zip |
Merge pull request #1 from friendica/master
Update this fork
Diffstat (limited to 'mod/channel.php')
-rw-r--r-- | mod/channel.php | 87 |
1 files changed, 60 insertions, 27 deletions
diff --git a/mod/channel.php b/mod/channel.php index 149936dd7..34a1e2dda 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -47,6 +47,8 @@ function channel_content(&$a, $update = 0, $load = false) { $category = $datequery = $datequery2 = ''; + $mid = $_GET['mid']; + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); @@ -132,19 +134,28 @@ function channel_content(&$a, $update = 0, $load = false) { if(($update) && (! $load)) { - - $r = q("SELECT distinct parent AS `item_id` from item - left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d) AND ( item_flags & %d ) - AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) - $sql_extra - ORDER BY created DESC", - intval($a->profile['profile_uid']), - intval(ITEM_WALL), - intval(ITEM_UNSEEN), - intval(ABOOK_FLAG_BLOCKED) - ); + if ($mid) { + $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0 + AND (item_flags & %d) AND (item_flags & %d) $sql_extra limit 1", + dbesc($mid), + intval($a->profile['profile_uid']), + intval(ITEM_WALL), + intval(ITEM_UNSEEN) + ); + } else { + $r = q("SELECT distinct parent AS `item_id` from item + left join abook on item.author_xchan = abook.abook_xchan + WHERE uid = %d AND item_restrict = 0 + AND (item_flags & %d) AND ( item_flags & %d ) + AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + $sql_extra + ORDER BY created DESC", + intval($a->profile['profile_uid']), + intval(ITEM_WALL), + intval(ITEM_UNSEEN), + intval(ABOOK_FLAG_BLOCKED) + ); + } } else { @@ -166,19 +177,31 @@ function channel_content(&$a, $update = 0, $load = false) { $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); if($load || ($_COOKIE['jsAvailable'] != 1)) { - $r = q("SELECT distinct id AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d) and (item_flags & %d) - AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) - $sql_extra $sql_extra2 - ORDER BY created DESC $pager_sql ", - intval($a->profile['profile_uid']), - intval(ITEM_WALL), - intval(ITEM_THREAD_TOP), - intval(ABOOK_FLAG_BLOCKED) - - ); + if ($mid) { + $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0 + AND (item_flags & %d) $sql_extra limit 1", + dbesc($mid), + intval($a->profile['profile_uid']), + intval(ITEM_WALL) + ); + if (! $r) { + notice( t('Permission denied.') . EOL); + } + + } else { + $r = q("SELECT distinct id AS item_id FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE uid = %d AND item_restrict = 0 + AND (item_flags & %d) and (item_flags & %d) + AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + $sql_extra $sql_extra2 + ORDER BY created DESC $pager_sql ", + intval($a->profile['profile_uid']), + intval(ITEM_WALL), + intval(ITEM_THREAD_TOP), + intval(ABOOK_FLAG_BLOCKED) + ); + } } else { $r = array(); @@ -202,6 +225,12 @@ function channel_content(&$a, $update = 0, $load = false) { $items = fetch_post_tags($items, true); $items = conv_sort($items,'created'); + if ($load && $mid && (! count($items))) { + // This will happen if we don't have sufficient permissions + // to view the parent item (or the item itself if it is toplevel) + notice( t('Permission denied.') . EOL); + } + } else { $items = array(); } @@ -233,9 +262,10 @@ function channel_content(&$a, $update = 0, $load = false) { '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), '$search' => '', '$order' => '', + '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$file' => '', '$cats' => (($category) ? $category : ''), - '$mid' => '', + '$mid' => $mid, '$dend' => $datequery, '$dbegin' => $datequery2 )); @@ -266,5 +296,8 @@ function channel_content(&$a, $update = 0, $load = false) { if((! $update) || ($_COOKIE['jsAvailable'] != 1)) $o .= alt_pager($a,count($items)); + if($mid) + $o .= '<div id="content-complete"></div>'; + return $o; } |