diff options
Diffstat (limited to 'mod/channel.php')
-rw-r--r-- | mod/channel.php | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/mod/channel.php b/mod/channel.php index b06602994..f1b74136e 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -145,7 +145,7 @@ function channel_content(&$a, $update = 0, $load = false) { * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups */ - + $item_normal = item_normal(); $sql_extra = item_permissions_sql($a->profile['profile_uid']); if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid)) @@ -153,7 +153,6 @@ function channel_content(&$a, $update = 0, $load = false) { else $page_mode = 'client'; - $abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " "; $simple_update = (($update) ? " AND item_unseen = 1 " : ''); @@ -165,23 +164,20 @@ function channel_content(&$a, $update = 0, $load = false) { if(($update) && (! $load)) { if ($mid) { - $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0 - AND (item_flags & %d) > 0 $simple_update $sql_extra limit 1", + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal + AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", dbesc($mid . '%'), - intval($a->profile['profile_uid']), - intval(ITEM_WALL) + intval($a->profile['profile_uid']) ); } else { $r = q("SELECT distinct parent AS `item_id`, created from item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) - WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d) > 0 $simple_update - AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + WHERE uid = %d $item_normal + AND item_wall = 1 AND item_unseen = 1 + AND (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra ORDER BY created DESC", - intval($a->profile['profile_uid']), - intval(ITEM_WALL), - intval(ABOOK_FLAG_BLOCKED) + intval($a->profile['profile_uid']) ); $_SESSION['loadtime'] = datetime_convert(); } @@ -209,11 +205,10 @@ function channel_content(&$a, $update = 0, $load = false) { if($load || ($_COOKIE['jsAvailable'] != 1)) { 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)>0 $sql_extra limit 1", + $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal + AND item_wall = 1 $sql_extra limit 1", dbesc($mid), - intval($a->profile['profile_uid']), - intval(ITEM_WALL) + intval($a->profile['profile_uid']) ); if (! $r) { notice( t('Permission denied.') . EOL); @@ -222,15 +217,12 @@ function channel_content(&$a, $update = 0, $load = false) { } else { $r = q("SELECT distinct id AS item_id, created FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d)>0 and (item_flags & %d)>0 - AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + WHERE uid = %d $item_normal + AND item_wall = 1 and item_thread_top = 1 + AND (abook_blocked = 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) + intval($a->profile['profile_uid']) ); } } @@ -245,7 +237,7 @@ function channel_content(&$a, $update = 0, $load = false) { $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` - WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0 + WHERE `item`.`uid` = %d $item_normal AND `item`.`parent` IN ( %s ) $sql_extra ", intval($a->profile['profile_uid']), @@ -267,9 +259,6 @@ function channel_content(&$a, $update = 0, $load = false) { } - - - if((! $update) && (! $load)) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, @@ -338,9 +327,7 @@ function channel_content(&$a, $update = 0, $load = false) { } if($is_owner && $update_unseen) { - $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 - AND (item_flags & %d) > 0 AND uid = %d $update_unseen", - intval(ITEM_WALL), + $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", intval(local_channel()) ); } |