aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-06 21:03:33 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-06 21:03:33 -0700
commit25b599a4bd831f175572c2388754e8734a255d77 (patch)
tree16559183d5d004c430dd8d83171bb9348e784021 /mod
parent75b8bfc07a2431a6d4d5f2f72864d6cd3aa33cf6 (diff)
downloadvolse-hubzilla-25b599a4bd831f175572c2388754e8734a255d77.tar.gz
volse-hubzilla-25b599a4bd831f175572c2388754e8734a255d77.tar.bz2
volse-hubzilla-25b599a4bd831f175572c2388754e8734a255d77.zip
convert ITEM_WALL from bitfield to standalone
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php19
-rw-r--r--mod/connedit.php3
-rw-r--r--mod/home.php2
-rw-r--r--mod/item.php13
-rwxr-xr-xmod/like.php10
-rw-r--r--mod/manage.php4
-rwxr-xr-xmod/mood.php3
-rw-r--r--mod/p.php5
-rw-r--r--mod/ping.php7
-rwxr-xr-xmod/poke.php3
-rwxr-xr-xmod/subthread.php4
-rw-r--r--mod/tagger.php3
-rw-r--r--mod/thing.php3
13 files changed, 38 insertions, 41 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 022def2a8..f33ba8072 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -166,21 +166,19 @@ 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",
+ AND item_wall = 1 $simple_update $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 item_wall = 1 $simple_update
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(ABOOK_FLAG_BLOCKED)
);
$_SESSION['loadtime'] = datetime_convert();
@@ -210,10 +208,9 @@ 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",
+ 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);
@@ -223,12 +220,11 @@ function channel_content(&$a, $update = 0, $load = false) {
$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 item_wall = 1 and (item_flags & %d)>0
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)
);
@@ -339,8 +335,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),
+ AND item_wall = 1 AND uid = %d $update_unseen",
intval(local_channel())
);
}
diff --git a/mod/connedit.php b/mod/connedit.php
index 8ae1707ae..b346f3de0 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -240,7 +240,8 @@ function connedit_post(&$a) {
&& (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) {
$xarr = array();
$xarr['verb'] = ACTIVITY_FRIEND;
- $xarr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
+ $xarr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
+ $xarr['item_wall'] = 1;
$xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash'];
$xarr['allow_cid'] = $channel['channel_allow_cid'];
$xarr['allow_gid'] = $channel['channel_allow_gid'];
diff --git a/mod/home.php b/mod/home.php
index 5cd2fd6de..85c89a623 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -190,7 +190,7 @@ function home_content(&$a, $update = 0, $load = false) {
if(get_config('system','site_firehose')) {
require_once('include/security.php');
- $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and (item_flags & " . intval(ITEM_WALL) . " ) > 0 ";
+ $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {
$sys = get_sys_channel();
diff --git a/mod/item.php b/mod/item.php
index 37c4bb24f..4777dd5c0 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -295,7 +295,7 @@ function item_post(&$a) {
// For comments, We need to additionally look at the parent and see if it's a wall post that originated locally.
if($observer['xchan_name'] != $owner_xchan['xchan_name']) {
- if($parent_item && ($parent_item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) {
+ if($parent_item && ($parent_item['item_flags'] & ITEM_ORIGIN) && intval($parent_item['item_wall'])) {
$walltowall_comment = true;
$walltowall = true;
}
@@ -658,9 +658,10 @@ function item_post(&$a) {
}
$item_unseen = 1;
-
+ $item_wall = 0;
+
if($post_type === 'wall' || $post_type === 'wall-comment')
- $item_flags = $item_flags | ITEM_WALL;
+ $item_wall = 1;
if($origin)
$item_flags = $item_flags | ITEM_ORIGIN;
@@ -731,6 +732,7 @@ function item_post(&$a) {
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
$datarray['item_private'] = $private;
+ $datarray['item_wall'] = $item_wall;
$datarray['attach'] = $attachments;
$datarray['thr_parent'] = $thr_parent;
$datarray['postopts'] = $postopts;
@@ -823,7 +825,7 @@ function item_post(&$a) {
// only send comment notification if this is a wall-to-wall comment,
// otherwise it will happen during delivery
- if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($parent_item['item_flags'] & ITEM_WALL)) {
+ if(($datarray['owner_xchan'] != $datarray['author_xchan']) && intval($parent_item['item_wall'])) {
notification(array(
'type' => NOTIFY_COMMENT,
'from_xchan' => $datarray['author_xchan'],
@@ -1085,8 +1087,7 @@ function item_check_service_class($channel_id,$iswebpage) {
);
}
else {
- $r = q("select count(id) as total from item where parent = id and item_restrict = 0 and (item_flags & %d) > 0 and uid = %d ",
- intval(ITEM_WALL),
+ $r = q("select count(id) as total from item where parent = id and item_restrict = 0 and item_wall = 1 and uid = %d ",
intval($channel_id)
);
}
diff --git a/mod/like.php b/mod/like.php
index fdfa2d3b7..54039f2cf 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -337,10 +337,11 @@ function like_content(&$a) {
}
$mid = item_message_id();
+ $item_wall = 0;
if($extended_like) {
- $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN|ITEM_WALL;
-
+ $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN;
+ $item_wall = 1;
}
else {
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
@@ -376,8 +377,8 @@ function like_content(&$a) {
$post_type = 'comment';
$item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
- if($item['item_flags'] & ITEM_WALL)
- $item_flags |= ITEM_WALL;
+ if(intval($item['item_wall']))
+ $item_wall = 1;
// if this was a linked photo and was hidden, unhide it.
@@ -437,6 +438,7 @@ function like_content(&$a) {
$arr['aid'] = (($extended_like) ? $ch[0]['channel_account_id'] : $owner_aid);
$arr['uid'] = $owner_uid;
$arr['item_flags'] = $item_flags;
+ $arr['item_wall'] = $item_wall;
$arr['parent_mid'] = (($extended_like) ? $mid : $item['mid']);
$arr['owner_xchan'] = (($extended_like) ? $ch[0]['xchan_hash'] : $thread_owner['xchan_hash']);
$arr['author_xchan'] = $observer['xchan_hash'];
diff --git a/mod/manage.php b/mod/manage.php
index 3712be6f1..de5f9c8ad 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -56,14 +56,14 @@ function manage_content(&$a) {
$channels[$x]['default_links'] = '1';
- $c = q("SELECT id, item_restrict, item_flags FROM item
+ $c = q("SELECT id, item_restrict, item_flags, item_wall FROM item
WHERE item_restrict = 0 and item_unseen = 1 and uid = %d",
intval($channels[$x]['channel_id'])
);
if($c) {
foreach ($c as $it) {
- if($it['item_flags'] & ITEM_WALL)
+ if(intval($it['item_wall']))
$channels[$x]['home'] ++;
else
$channels[$x]['network'] ++;
diff --git a/mod/mood.php b/mod/mood.php
index 7663b2632..4bb291182 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -61,7 +61,7 @@ function mood_init(&$a) {
$mid = item_message_id();
$action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
- $item_flags = ITEM_WALL|ITEM_ORIGIN;
+ $item_flags = ITEM_ORIGIN;
if(! $parent_mid)
$item_flags |= ITEM_THREAD_TOP;
@@ -72,6 +72,7 @@ function mood_init(&$a) {
$arr['mid'] = $mid;
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
$arr['item_flags'] = $item_flags;
+ $arr['item_wall'] = 1;
$arr['author_xchan'] = $poster['xchan_hash'];
$arr['owner_xchan'] = (($parent_mid) ? $r[0]['owner_xchan'] : $poster['xchan_hash']);
$arr['title'] = '';
diff --git a/mod/p.php b/mod/p.php
index 1a9555d20..f467ae5a5 100644
--- a/mod/p.php
+++ b/mod/p.php
@@ -11,9 +11,8 @@ function p_init(&$a) {
$mid = str_replace('.xml','',argv(1));
- $r = q("select * from item where mid = '%s' and (item_flags & %d)>0 and item_private = 0 limit 1",
- dbesc($mid),
- intval(ITEM_WALL)
+ $r = q("select * from item where mid = '%s' and item_wall = 1 and item_private = 0 limit 1",
+ dbesc($mid)
);
diff --git a/mod/ping.php b/mod/ping.php
index b676726fe..181e4f80a 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -156,8 +156,7 @@ function ping_init(&$a) {
);
break;
case 'home':
- $r = q("update item set item_unseen = 0 where item_unseen = 1 and (item_flags & %d) > 0 and uid = %d",
- intval(ITEM_WALL),
+ $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d",
intval(local_channel())
);
break;
@@ -282,7 +281,7 @@ function ping_init(&$a) {
if($r) {
xchan_query($r);
foreach($r as $item) {
- if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_WALL)))
+ if((argv(1) === 'home') && (! intval($item['item_wall'])))
continue;
$result[] = format_notification($item);
}
@@ -390,7 +389,7 @@ function ping_init(&$a) {
call_hooks('network_ping', $arr);
foreach ($r as $it) {
- if($it['item_flags'] & ITEM_WALL)
+ if(intval($it['item_wall']))
$result['home'] ++;
else
$result['network'] ++;
diff --git a/mod/poke.php b/mod/poke.php
index 6257a2821..517387453 100755
--- a/mod/poke.php
+++ b/mod/poke.php
@@ -87,10 +87,11 @@ function poke_init(&$a) {
$arr = array();
- $arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN;
+ $arr['item_flags'] = ITEM_ORIGIN;
if($parent_item)
$arr['item_flags'] |= ITEM_THREAD_TOP;
+ $arr['item_wall'] = 1;
$arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']);
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
$arr['title'] = '';
diff --git a/mod/subthread.php b/mod/subthread.php
index eeb8f131d..bdb582a57 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -103,9 +103,6 @@ function subthread_content(&$a) {
$bodyverb = t('%1$s is following %2$s\'s %3$s');
$item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
- if($item['item_flags'] & ITEM_WALL)
- $item_flags |= ITEM_WALL;
-
$arr = array();
@@ -113,6 +110,7 @@ function subthread_content(&$a) {
$arr['aid'] = $owner_aid;
$arr['uid'] = $owner_uid;
$arr['item_flags'] = $item_flags;
+ $arr['item_wall'] = $item['item_wall'];
$arr['parent'] = $item['id'];
$arr['parent_mid'] = $item['mid'];
$arr['thr_parent'] = $item['mid'];
diff --git a/mod/tagger.php b/mod/tagger.php
index aafad58cf..c32b55548 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -109,8 +109,7 @@ function tagger_content(&$a) {
$arr['item_flags'] = ITEM_ORIGIN;
- if($item['item_flags'] & ITEM_WALL)
- $arr['item_flags'] |= ITEM_WALL;
+ $arr['item_wall'] = $item['item_wall'];
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
$alink = '[zrl=' . $item['xchan_url'] . ']' . $item['xchan_name'] . '[/zrl]';
diff --git a/mod/thing.php b/mod/thing.php
index c6b70fbb4..92fc82e53 100644
--- a/mod/thing.php
+++ b/mod/thing.php
@@ -177,7 +177,8 @@ function thing_init(&$a) {
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['author_xchan'] = $channel['channel_hash'];
- $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
+ $arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
+ $arr['item_wall'] = 1;
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
$plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';