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['edited'] = $comment['created'];
$arr['author_xchan'] = $hash; $arr['author_xchan'] = $hash;
$arr['owner_xchan'] = $channel['channel_hash']; $arr['owner_xchan'] = $channel['channel_hash'];
<<<<<<< HEAD
$arr['item_origin'] = 1; $arr['item_origin'] = 1;
=======
$arr['item_flags'] = ITEM_ORIGIN;
>>>>>>> master
$arr['item_wall'] = 1; $arr['item_wall'] = 1;
$arr['verb'] = ACTIVITY_POST; $arr['verb'] = ACTIVITY_POST;
$arr['comment_policy'] = 'contacts'; $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", $item = q("SELECT * FROM item WHERE id = %d AND uid = %d",
intval($itemid), intval($itemid),
intval(api_user()) intval(api_user())
); );
if (! $item) if (! $item)
@ -1556,19 +1556,16 @@ require_once('include/items.php');
switch($action){ switch($action){
case "create": case "create":
$flags = $item[0]['item_starred'] = 1;
$flags = $item[0]['item_flags'] | ITEM_STARRED;
break; break;
case "destroy": case "destroy":
$flags = $item[0]['item_starred'] = 0;
$flags = $item[0]['item_flags'] | (~ ITEM_STARRED);
break; break;
default: default:
return false; 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($flags),
intval($itemid), intval($itemid),
intval(api_user()) intval(api_user())
@ -1577,8 +1574,8 @@ require_once('include/items.php');
return false; return false;
$item = q("SELECT * FROM item WHERE id = %d AND uid = %d", $item = q("SELECT * FROM item WHERE id = %d AND uid = %d",
intval($itemid), intval($itemid),
intval(api_user()) intval(api_user())
); );
xchan_query($item,true); 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( $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array(
'$guid_q' => random_string(), '$guid_q' => random_string(),
'$question' => t('Please choose'), '$question' => t('Please choose'),

View File

@ -3225,17 +3225,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
$title = $item['title']; $title = $item['title'];
$body = $item['body']; $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', $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", 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), intval($item_uplink),

View File

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

View File

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

View File

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

View File

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

View File

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