aboutsummaryrefslogtreecommitdiffstats
path: root/mod/channel.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/channel.php')
-rw-r--r--mod/channel.php43
1 files changed, 17 insertions, 26 deletions
diff --git a/mod/channel.php b/mod/channel.php
index b06602994..d1064e939 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))
@@ -165,23 +165,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 +206,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 +218,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 +238,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']),
@@ -338,9 +331,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())
);
}