aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-29 14:51:41 -0800
committerfriendica <info@friendica.com>2015-01-29 14:51:41 -0800
commitff68ea608786a698ad46637ef13854ac1b1e6beb (patch)
tree5e9bec7525754dda60c8c08bc00802160efa202c /include
parenta2cdd1499c968c31ae1b95933231f80be5fc639b (diff)
downloadvolse-hubzilla-ff68ea608786a698ad46637ef13854ac1b1e6beb.tar.gz
volse-hubzilla-ff68ea608786a698ad46637ef13854ac1b1e6beb.tar.bz2
volse-hubzilla-ff68ea608786a698ad46637ef13854ac1b1e6beb.zip
more message restrict conversions
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php27
-rw-r--r--include/notifier.php9
-rw-r--r--include/photos.php33
-rw-r--r--include/taxonomy.php2
-rw-r--r--include/text.php4
-rw-r--r--include/widgets.php4
-rw-r--r--include/zot.php10
7 files changed, 44 insertions, 45 deletions
diff --git a/include/items.php b/include/items.php
index 916838f3f..224ad72e4 100755
--- a/include/items.php
+++ b/include/items.php
@@ -841,7 +841,7 @@ function get_item_elements($x) {
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
$arr['item_deleted'] = 1;
if(array_key_exists('flags',$x) && in_array('hidden',$x['flags']))
- $arr['item_restrict'] = ITEM_HIDDEN;
+ $arr['item_hidden'] = 1;
// Here's the deal - the site might be down or whatever but if there's a new person you've never
// seen before sending stuff to your stream, we MUST be able to look them up and import their data from their
@@ -1312,7 +1312,7 @@ function encode_item_flags($item) {
if(intval($item['item_deleted']))
$ret[] = 'deleted';
- if($item['item_restrict'] & ITEM_HIDDEN)
+ if(intval($item['item_hidden']))
$ret[] = 'hidden';
if(intval($item['item_thread_top']))
$ret[] = 'thread_parent';
@@ -1916,11 +1916,11 @@ function item_store($arr,$allow_exec = false) {
// If a page layout is provided, ensure it exists and belongs to us.
if(array_key_exists('layout_mid',$arr) && $arr['layout_mid']) {
- $l = q("select item_restrict from item where mid = '%s' and uid = %d limit 1",
+ $l = q("select item_type from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['layout_mid']),
intval($arr['uid'])
);
- if((! $l) || (! ($l[0]['item_restrict'] & ITEM_PDL)))
+ if((! $l) || (! ($l[0]['item_type'] != ITEM_TYPE_PDL)))
unset($arr['layout_mid']);
}
@@ -3967,8 +3967,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
// hook calls a remote process which loops. We'll delete it properly in a second.
if(($linked_item) && (! $force)) {
- $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ) WHERE id = %d",
- intval(ITEM_HIDDEN),
+ $r = q("UPDATE item SET item_hidden = 1 WHERE id = %d",
intval($item['id'])
);
}
@@ -4041,9 +4040,8 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL,$force = false) {
case DROPITEM_PHASE1:
if($linked_item && ! $force) {
- $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ),
+ $r = q("UPDATE item SET item_hidden = 1,
changed = '%s', edited = '%s' WHERE id = %d",
- intval(ITEM_HIDDEN),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
@@ -4062,9 +4060,8 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL,$force = false) {
case DROPITEM_NORMAL:
default:
if($linked_item && ! $force) {
- $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ),
+ $r = q("UPDATE item SET item_hidden = 1,
changed = '%s', edited = '%s' WHERE id = %d",
- intval(ITEM_HIDDEN),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
@@ -4522,9 +4519,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra .= item_permissions_sql($channel['channel_id']);
if($arr['pages'])
- $item_restrict = " AND (item_restrict & " . ITEM_WEBPAGE . ") ";
+ $item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " ";
else
- $item_restrict = " AND item_restrict = 0 ";
+ $item_restrict = " AND item_type = 0 ";
if($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) {
@@ -4629,11 +4626,11 @@ function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remo
$page_type = '';
- if($webpage & ITEM_WEBPAGE)
+ if($webpage == ITEM_TYPE_WEBPAGE)
$page_type = 'WEBPAGE';
- elseif($webpage & ITEM_BUILDBLOCK)
+ elseif($webpage == ITEM_TYPE_BLOCK)
$page_type = 'BUILDBLOCK';
- elseif($webpage & ITEM_PDL)
+ elseif($webpage == ITEM_TYPE_PDL)
$page_type = 'PDL';
elseif($namespace && $remote_id) {
$page_type = $namespace;
diff --git a/include/notifier.php b/include/notifier.php
index 6a6879ebb..79be25621 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -316,9 +316,12 @@ function notifier_run($argv, $argc){
if(intval($target_item['item_deleted']))
logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG);
- $unforwardable = ITEM_UNPUBLISHED|ITEM_DELAYED_PUBLISH|ITEM_WEBPAGE|ITEM_BUILDBLOCK|ITEM_PDL;
- if($target_item['item_restrict'] & $unforwardable) {
- logger('notifier: target item not forwardable: flags ' . $target_item['item_restrict'], LOGGER_DEBUG);
+ if(intval($target_item['item_type']) != ITEM_TYPE_POST) {
+ logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG);
+ return;
+ }
+ if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed_publish'])) {
+ logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG);
return;
}
diff --git a/include/photos.php b/include/photos.php
index f52b08473..43386d626 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -225,7 +225,7 @@ function photo_upload($channel, $observer, $args) {
// Create item container
- $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
+ $item_hidden = (($visible) ? 0 : 1 );
$title = '';
$mid = item_message_id();
@@ -235,8 +235,7 @@ function photo_upload($channel, $observer, $args) {
$arr['uid'] = $channel_id;
$arr['mid'] = $mid;
$arr['parent_mid'] = $mid;
- $arr['item_flags'] = $item_flags;
- $arr['item_restrict'] = $item_restrict;
+ $arr['item_hidden'] = $item_hidden;
$arr['resource_type'] = 'photo';
$arr['resource_id'] = $photo_hash;
$arr['owner_xchan'] = $channel['channel_hash'];
@@ -446,7 +445,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
// Create item container
- $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
+ $item_hidden = (($visible) ? 0 : 1 );
$title = '';
$mid = item_message_id();
@@ -460,20 +459,20 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
$arr['item_wall'] = 1;
$arr['item_origin'] = 1;
$arr['item_thread_top'] = 1;
- $arr['item_restrict'] = $item_restrict;
- $arr['resource_type'] = 'photo';
- $arr['resource_id'] = $photo['resource_id'];
- $arr['owner_xchan'] = $channel['channel_hash'];
- $arr['author_xchan'] = $creator_hash;
-
- $arr['allow_cid'] = $photo['allow_cid'];
- $arr['allow_gid'] = $photo['allow_gid'];
- $arr['deny_cid'] = $photo['deny_cid'];
- $arr['deny_gid'] = $photo['deny_gid'];
-
- $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
+ $arr['item_hidden'] = $item_hidden;
+ $arr['resource_type'] = 'photo';
+ $arr['resource_id'] = $photo['resource_id'];
+ $arr['owner_xchan'] = $channel['channel_hash'];
+ $arr['author_xchan'] = $creator_hash;
+
+ $arr['allow_cid'] = $photo['allow_cid'];
+ $arr['allow_gid'] = $photo['allow_gid'];
+ $arr['deny_cid'] = $photo['deny_cid'];
+ $arr['deny_gid'] = $photo['deny_gid'];
+
+ $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
- $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
+ $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
. '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/zmg]'
. '[/zrl]';
diff --git a/include/taxonomy.php b/include/taxonomy.php
index a5ccada62..9be04e16c 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -116,7 +116,7 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
where term.uid = %d and term.type = %d
- and otype = %d and item_restrict = %d and item_private = 0
+ and otype = %d and item_type = %d and item_private = 0
$sql_options
group by term order by total desc %s",
intval($uid),
diff --git a/include/text.php b/include/text.php
index 9a13e5e72..3258faeec 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1549,9 +1549,9 @@ function unamp($s) {
}
function layout_select($channel_id, $current = '') {
- $r = q("select mid,sid from item left join item_id on iid = item.id where service = 'PDL' and item.uid = item_id.uid and item_id.uid = %d and (item_restrict & %d)>0",
+ $r = q("select mid,sid from item left join item_id on iid = item.id where service = 'PDL' and item.uid = item_id.uid and item_id.uid = %d and item_type = %d ",
intval($channel_id),
- intval(ITEM_PDL)
+ intval(ITEM_TYPE_PDL)
);
if($r) {
$o = t('Select a page layout: ');
diff --git a/include/widgets.php b/include/widgets.php
index d4888789f..c5ccb9216 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -29,7 +29,7 @@ function widget_tagcloud($args) {
$type = TERM_CATEGORY;
// FIXME there exists no $authors variable
- $r = tagadelic($uid, $count, $authors, $flags, ITEM_WEBPAGE, $type);
+ $r = tagadelic($uid, $count, $authors, $flags, ITEM_TYPE_WEBPAGE, $type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
@@ -688,7 +688,7 @@ function widget_item($arr) {
require_once('include/security.php');
$sql_extra = item_permissions_sql($uid);
- $r = q("select * from item where mid = '%s' and uid = %d and item_restrict = " . intval(ITEM_WEBPAGE) . " $sql_extra limit 1",
+ $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
dbesc($arr['mid']),
intval($uid)
);
diff --git a/include/zot.php b/include/zot.php
index 7bdde836f..2bc54e6f3 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1532,7 +1532,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
}
}
- if($arr['item_restrict'] & ITEM_DELETED) {
+ if(intval($arr['item_deleted'])) {
// remove_community_tag is a no-op if this isn't a community tag activity
remove_community_tag($sender,$arr,$channel['channel_id']);
@@ -1549,14 +1549,14 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
continue;
}
- $r = q("select id, edited, item_restrict, item_flags, mid, parent_mid from item where mid = '%s' and uid = %d limit 1",
+ $r = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['mid']),
intval($channel['channel_id'])
);
if($r) {
// We already have this post.
$item_id = $r[0]['id'];
- if($r[0]['item_restrict'] & ITEM_DELETED) {
+ if(intval($r[0]['item_deleted'])) {
// It was deleted locally.
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
continue;
@@ -1686,7 +1686,7 @@ function delete_imported_item($sender,$item,$uid) {
logger('delete_imported_item invoked',LOGGER_DEBUG);
- $r = q("select id, item_restrict from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
+ $r = q("select id, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
and mid = '%s' and uid = %d limit 1",
dbesc($sender['hash']),
dbesc($sender['hash']),
@@ -1700,7 +1700,7 @@ function delete_imported_item($sender,$item,$uid) {
return false;
}
- if($r[0]['item_restrict'] & ITEM_DELETED) {
+ if(intval($r[0]['item_deleted'])) {
logger('delete_imported_item: item was already deleted');
return false;
}