From e1388761998f231de0c321e6652f7db9ed567c09 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 28 Oct 2012 22:08:08 -0700 Subject: fix updating of bitwise 'unseen' to account for mysql operator precedence --- include/features.php | 2 +- include/permissions.php | 8 ++++++++ mod/network.php | 6 +++--- mod/ping.php | 2 +- mod/profile.php | 9 ++++++--- view/tpl/wall_thread.tpl | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/features.php b/include/features.php index d74718540..61e4b2acd 100644 --- a/include/features.php +++ b/include/features.php @@ -22,7 +22,7 @@ $arr = array( 'categories' => t('Post Categories'), 'filing' => t('Saved Folders'), 'archives' => t('Search by Date'), - +'dislike' => t('Dislike Posts'), ); diff --git a/include/permissions.php b/include/permissions.php index d48e98c41..e32704883 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -20,6 +20,14 @@ ); +/** + * get_all_perms($uid,$observer) + * + * @param $uid : The channel_id associated with the resource owner + * @param $observer: The xchan_hash representing the observer + * + * @returns: array of all permissions, key is permission name, value is integer 0 or 1 + */ function get_all_perms($uid,$observer) { diff --git a/mod/network.php b/mod/network.php index 8793aa51a..e1629bdd6 100644 --- a/mod/network.php +++ b/mod/network.php @@ -678,10 +678,10 @@ function network_content(&$a, $update = 0, $load = false) { // We aren't going to try and figure out at the item, group, and page // level which items you've seen and which you haven't. If you're looking // at the top level network page just mark everything seen. - + if((! $group) && (! $cid) && (! $star)) { - $r = q("UPDATE `item` SET item_flags = item_flags & (! %d) - WHERE item_flags & %d AND `uid` = %d", + $r = q("UPDATE `item` SET item_flags = ( item_flags ^ %d) + WHERE (item_flags & %d) AND `uid` = %d", intval(ITEM_UNSEEN), intval(ITEM_UNSEEN), intval(local_user()) diff --git a/mod/ping.php b/mod/ping.php index 60ca7f734..a679c9342 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -127,7 +127,7 @@ function ping_init(&$a) { $t1 = dba_timer(); $r = q("SELECT id, item_restrict, item_flags FROM item - WHERE item_restrict = %d and item_flags & %d and `item`.`uid` = %d", + WHERE item_restrict = %d and ( item_flags & %d ) and uid = %d", intval(ITEM_VISIBLE), intval(ITEM_UNSEEN), intval(local_user()) diff --git a/mod/profile.php b/mod/profile.php index 8ba9584b1..8fdd38ced 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -247,15 +247,18 @@ function profile_content(&$a, $update = 0) { } + if($is_owner) { - $r = q("UPDATE `item` SET `item_flags` = item_flags - %d - WHERE item_flags & %d AND `uid` = %d", + $r = q("UPDATE item SET item_flags = (item_flags ^ %d) + WHERE (item_flags & %d) AND (item_flags & %d) AND uid = %d ", + intval(ITEM_UNSEEN), intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN|ITEM_WALL), + intval(ITEM_WALL), intval(local_user()) ); } + $o .= conversation($a,$items,'profile',$update); if(! $update) diff --git a/view/tpl/wall_thread.tpl b/view/tpl/wall_thread.tpl index 8dff61057..fd294cfc3 100644 --- a/view/tpl/wall_thread.tpl +++ b/view/tpl/wall_thread.tpl @@ -66,7 +66,6 @@ {{ if $item.vote.share }}{{ endif }} - {{ endif }} {{ if $item.plink }} @@ -83,6 +82,7 @@ {{ if $item.filer }} {{ endif }} +
{{ if $item.drop.dropping }}{{ endif }} -- cgit v1.2.3