item flag fixes discovered after a few merges

This commit is contained in:
redmatrix 2015-06-23 19:45:39 -07:00
parent 833098e346
commit cb76fb8b9b
9 changed files with 12 additions and 33 deletions

View file

@ -260,11 +260,7 @@ function reflect_comment_store($channel,$post,$comment,$user) {
$arr['edited'] = $comment['created'];
$arr['author_xchan'] = $hash;
$arr['owner_xchan'] = $channel['channel_hash'];
<<<<<<< HEAD
$arr['item_origin'] = 1;
=======
$arr['item_flags'] = ITEM_ORIGIN;
>>>>>>> master
$arr['item_wall'] = 1;
$arr['verb'] = ACTIVITY_POST;
$arr['comment_policy'] = 'contacts';

View file

@ -1547,8 +1547,8 @@ require_once('include/items.php');
}
$item = q("SELECT * FROM item WHERE id = %d AND uid = %d",
intval($itemid),
intval(api_user())
intval($itemid),
intval(api_user())
);
if (! $item)
@ -1556,19 +1556,16 @@ require_once('include/items.php');
switch($action){
case "create":
$flags = $item[0]['item_flags'] | ITEM_STARRED;
$flags = $item[0]['item_starred'] = 1;
break;
case "destroy":
$flags = $item[0]['item_flags'] | (~ ITEM_STARRED);
$flags = $item[0]['item_starred'] = 0;
break;
default:
return false;
}
$r = q("UPDATE item SET item_flags = %d where id = %d and uid = %d",
$r = q("UPDATE item SET item_starred = %d where id = %d and uid = %d",
intval($flags),
intval($itemid),
intval(api_user())
@ -1577,8 +1574,8 @@ require_once('include/items.php');
return false;
$item = q("SELECT * FROM item WHERE id = %d AND uid = %d",
intval($itemid),
intval(api_user())
intval($itemid),
intval(api_user())
);
xchan_query($item,true);

View file

@ -2456,7 +2456,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
}
*/
if($item['item_flags'] & ITEM_CONSENSUS) {
if(intval($item['item_consensus'])) {
$poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array(
'$guid_q' => random_string(),
'$question' => t('Please choose'),

View file

@ -3225,17 +3225,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
$title = $item['title'];
$body = $item['body'];
if(! $private) {
if($flag_bits & ITEM_OBSCURED) {
$key = get_config('system','prvkey');
if($title)
$title = crypto_unencapsulate(json_decode($title,true),$key);
if($body)
$body = crypto_unencapsulate(json_decode($body,true),$key);
$item_obscured = 0;
}
}
$r = q("update item set item_uplink = %d, item_nocomment = %d, item_obscured = %d, item_flags = %d, owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s', item_wall = %d, item_origin = %d where id = %d",
intval($item_uplink),

View file

@ -1373,8 +1373,7 @@ function public_recips($msg) {
if($msg['message']['message_top']) {
$z = q("select owner_xchan as hash from item where parent_mid = '%s' ",
dbesc($msg['message']['message_top']),
intval(ITEM_UPLINK)
dbesc($msg['message']['message_top'])
);
if($z)
$r = array_merge($r,$z);

View file

@ -33,8 +33,7 @@ function branchtopic_init(&$a) {
intval(local_channel())
);
$x = q("update item set parent = id, route = '', item_flags = (item_flags | %d) where id = %d",
intval(ITEM_THREAD_TOP),
$x = q("update item set parent = id, route = '', item_thread_top = 1 where id = %d",
intval($item_id)
);

View file

@ -126,7 +126,7 @@ function editpost_content(&$a) {
'$noloc' => t('Clear browser location'),
'$voting' => t('Toggle voting'),
'$feature_voting' => $voting,
'$consensus' => (($itm[0]['item_flags'] & ITEM_CONSENSUS) ? 1 : 0),
'$consensus' => intval($itm[0]['item_consensus']),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$ptyp' => $itm[0]['type'],

View file

@ -71,7 +71,7 @@ function public_content(&$a, $update = 0, $load = false) {
require_once('include/security.php');
if(get_config('system','site_firehose')) {
$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();

View file

@ -172,7 +172,6 @@ function search_content(&$a,$update = 0, $load = false) {
$item_normal
$sql_extra
$suffix $pager_sql",
intval(ITEM_OBSCURED),
dbesc($sys['xchan_hash'])
);
}