diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/acl.php | 30 | ||||
-rw-r--r-- | mod/admin.php | 8 | ||||
-rw-r--r-- | mod/channel.php | 25 | ||||
-rw-r--r-- | mod/connections.php | 13 | ||||
-rw-r--r-- | mod/connedit.php | 4 | ||||
-rw-r--r-- | mod/dirsearch.php | 22 | ||||
-rw-r--r-- | mod/display.php | 7 | ||||
-rw-r--r-- | mod/editpost.php | 2 | ||||
-rw-r--r-- | mod/editwebpage.php | 2 | ||||
-rwxr-xr-x | mod/events.php | 2 | ||||
-rw-r--r-- | mod/filer.php | 3 | ||||
-rw-r--r-- | mod/group.php | 6 | ||||
-rw-r--r-- | mod/home.php | 2 | ||||
-rw-r--r-- | mod/import.php | 12 | ||||
-rw-r--r-- | mod/item.php | 40 | ||||
-rwxr-xr-x | mod/like.php | 17 | ||||
-rw-r--r-- | mod/locs.php | 20 | ||||
-rw-r--r-- | mod/manage.php | 12 | ||||
-rwxr-xr-x | mod/mood.php | 12 | ||||
-rw-r--r-- | mod/network.php | 16 | ||||
-rw-r--r-- | mod/openid.php | 7 | ||||
-rw-r--r-- | mod/p.php | 5 | ||||
-rw-r--r-- | mod/photos.php | 19 | ||||
-rw-r--r-- | mod/ping.php | 32 | ||||
-rwxr-xr-x | mod/poke.php | 10 | ||||
-rw-r--r-- | mod/post.php | 29 | ||||
-rw-r--r-- | mod/starred.php | 8 | ||||
-rwxr-xr-x | mod/subthread.php | 32 | ||||
-rw-r--r-- | mod/tagger.php | 6 | ||||
-rw-r--r-- | mod/thing.php | 4 | ||||
-rw-r--r-- | mod/viewconnections.php | 13 | ||||
-rw-r--r-- | mod/viewsrc.php | 4 | ||||
-rw-r--r-- | mod/zfinger.php | 2 |
33 files changed, 170 insertions, 256 deletions
diff --git a/mod/acl.php b/mod/acl.php index 8eff93a9a..5d08c3e5b 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -94,18 +94,17 @@ function acl_init(&$a){ $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags FROM abook left join xchan on abook_xchan = xchan_hash - WHERE (abook_channel = %d $extra_channels_sql) AND not ( abook_flags & %d )>0 and not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , + WHERE (abook_channel = %d $extra_channels_sql) AND not ( abook_flags & %d )>0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , intval(local_user()), - intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED), - intval(XCHAN_FLAGS_DELETED) + intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED) ); } else { // Visitors $r = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags FROM xchan left join xlink on xlink_link = xchan_hash - WHERE xlink_xchan = '%s' AND NOT (xchan_flags & %d) > 0 $sql_extra2 order by $order_extra2 xchan_name asc" , - dbesc(get_observer_hash()), - intval(XCHAN_FLAGS_DELETED)); + WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + dbesc(get_observer_hash()) + ); // Find contacts of extra channels // This is probably more complicated than it needs to be @@ -119,9 +118,8 @@ function acl_init(&$a){ $r2 = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND not ( abook_flags & %d )>0 and not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , - intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_HIDDEN), - intval(XCHAN_FLAGS_DELETED) + WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND not ( abook_flags & %d )>0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_HIDDEN) ); if($r2) $r = array_merge($r,$r2); @@ -151,8 +149,7 @@ function acl_init(&$a){ if((! $r) && $type == 'c') { $r = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags FROM xchan - WHERE not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , - intval(XCHAN_FLAGS_DELETED) + WHERE xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" ); } } @@ -162,24 +159,21 @@ function acl_init(&$a){ $r = q("SELECT xchan_hash as id, xchan_name as name, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and ( (abook_their_perms = null) or (abook_their_perms & %d )>0) - and not (xchan_flags & %d)>0 + and xchan_deleted = 0 $sql_extra3 ORDER BY `xchan_name` ASC ", intval(local_user()), - intval(PERMS_W_MAIL), - intval(XCHAN_FLAGS_DELETED) + intval(PERMS_W_MAIL) ); } elseif(($type == 'a') || ($type == 'p')) { $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d - and not (xchan_flags & %d)>0 + and xchan_deleted = 0 $sql_extra3 ORDER BY xchan_name ASC ", - intval(local_user()), - intval(XCHAN_FLAGS_DELETED) - + intval(local_user()) ); } diff --git a/mod/admin.php b/mod/admin.php index 1503bf18e..a4cb84a42 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -99,7 +99,7 @@ function admin_content(&$a) { 'channels' => Array($a->get_baseurl(true)."/admin/channels/", t("Channels") , "channels"), 'plugins' => Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"), 'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"), - 'hubloc' => Array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"), +// 'hubloc' => Array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"), 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'), 'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync") ); @@ -152,9 +152,9 @@ function admin_content(&$a) { case 'themes': $o = admin_page_themes($a); break; - case 'hubloc': - $o = admin_page_hubloc($a); - break; +// case 'hubloc': +// $o = admin_page_hubloc($a); +// break; case 'logs': $o = admin_page_logs($a); break; diff --git a/mod/channel.php b/mod/channel.php index c8ac83baf..84b302cce 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -147,23 +147,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 = '%s' and uid = %d AND item_restrict = 0 - AND (item_flags & %d) > 0 AND (item_flags & %d) > 0 $sql_extra limit 1", + AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", dbesc($mid), - intval($a->profile['profile_uid']), - intval(ITEM_WALL), - intval(ITEM_UNSEEN) + intval($a->profile['profile_uid']) ); } else { $r = q("SELECT distinct parent 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_unseen = 1 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(ITEM_UNSEEN), intval(ABOOK_FLAG_BLOCKED) ); } @@ -192,10 +188,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); @@ -205,13 +200,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_thread_top = 1 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) ); } @@ -317,11 +310,7 @@ function channel_content(&$a, $update = 0, $load = false) { } if($is_owner && $update_unseen) { - $r = q("UPDATE item SET item_flags = (item_flags & ~%d) - WHERE (item_flags & %d) > 0 AND (item_flags & %d) > 0 AND uid = %d $update_unseen", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), - intval(ITEM_WALL), + $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", intval(local_user()) ); } diff --git a/mod/connections.php b/mod/connections.php index d36734ccb..dae6fbd3e 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -214,11 +214,10 @@ function connections_content(&$a) { nav_set_selected('intros'); break; case 'ifpending': - $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)", + $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or xchan_deleted = 1 or xchan_orphan = 1)", intval(local_user()), intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); if($r && $r[0]['total']) { $search_flags = ABOOK_FLAG_PENDING; @@ -343,10 +342,9 @@ function connections_content(&$a) { } $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash - where abook_channel = %d and not (abook_flags & %d)>0 and not (xchan_flags & %d )>0 $sql_extra $sql_extra2 ", + where abook_channel = %d and not (abook_flags & %d)>0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ", intval(local_user()), - intval(ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + intval(ABOOK_FLAG_SELF) ); if($r) { $a->set_pager_total($r[0]['total']); @@ -354,10 +352,9 @@ function connections_content(&$a) { } $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash - WHERE abook_channel = %d and not (abook_flags & %d)>0 and not ( xchan_flags & %d)>0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ", + WHERE abook_channel = %d and not (abook_flags & %d)>0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ", intval(local_user()), intval(ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN), intval($a->pager['itemspage']), intval($a->pager['start']) ); diff --git a/mod/connedit.php b/mod/connedit.php index 8270fa981..34951f99d 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -187,7 +187,9 @@ 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_wall'] = 1; + $xarr['item_origin'] = 1; + $xarr['item_thread_top'] = 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/dirsearch.php b/mod/dirsearch.php index 06d530849..f62320378 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -112,7 +112,7 @@ function dirsearch_content(&$a) { $sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords); if($forums) - $sql_extra .= dir_flag_build($joiner,'xprof_flags',XCHAN_FLAGS_PUBFORUM, $forums); + $sql_extra .= dir_flag_build($joiner,'xchan_pubforum',$forums); // we only support an age range currently. You must set both agege @@ -158,20 +158,16 @@ function dirsearch_content(&$a) { } - $safesql = (($safe > 0) ? " and not ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " )>0 " : ''); + $safesql = (($safe > 0) ? " and xchan_censored = 0 and xchan_selfcensored = 0 " : ''); if($safe < 0) - $safesql = " and ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " )>0 "; + $safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) "; if($limit) $qlimit = " LIMIT $limit "; else { $qlimit = " LIMIT " . intval($perpage) . " OFFSET " . intval($startrec); if($return_total) { - $r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and xchan_network = 'zot' and not ( xchan_flags & %d)>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $safesql ", - intval(XCHAN_FLAGS_HIDDEN), - intval(XCHAN_FLAGS_ORPHAN), - intval(XCHAN_FLAGS_DELETED) - ); + $r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql "); if($r) { $ret['total_items'] = $r[0]['total']; } @@ -213,11 +209,7 @@ function dirsearch_content(&$a) { json_return_and_die($spkt); } else { - $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $safesql $order $qlimit ", - intval(XCHAN_FLAGS_HIDDEN), - intval(XCHAN_FLAGS_ORPHAN), - intval(XCHAN_FLAGS_DELETED) - ); + $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql $order $qlimit "); } $ret['page'] = $page + 1; @@ -234,7 +226,7 @@ function dirsearch_content(&$a) { $entry['name'] = $rr['xchan_name']; $entry['hash'] = $rr['xchan_hash']; - $entry['public_forum'] = (($rr['xchan_flags'] & XCHAN_FLAGS_PUBFORUM) ? true : false); + $entry['public_forum'] = (intval($rr['xchan_pubforum']) ? true : false); $entry['url'] = $rr['xchan_url']; $entry['photo_l'] = $rr['xchan_photo_l']; @@ -282,7 +274,7 @@ function dir_query_build($joiner,$field,$s) { } function dir_flag_build($joiner,$field,$bit,$s) { - return dbesc($joiner) . " ( " . dbesc('xchan_flags') . " & " . intval($bit) . " ) " . ((intval($s)) ? '>' : '=' ) . " 0 "; + return dbesc($joiner) . " ( " . dbesc($field) . " = " . intval($bit) . " ) "; } diff --git a/mod/display.php b/mod/display.php index f14aca6da..740050e41 100644 --- a/mod/display.php +++ b/mod/display.php @@ -231,10 +231,7 @@ function display_content(&$a, $update = 0, $load = false) { } if($updateable) { - $x = q("UPDATE item SET item_flags = ( item_flags & ~%d ) - WHERE (item_flags & %d)>0 AND uid = %d and parent = %d ", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), + $x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ", intval(local_user()), intval($r[0]['parent']) ); @@ -253,7 +250,7 @@ function display_content(&$a, $update = 0, $load = false) { dbesc($item_hash) ); if($r) { - if($r[0]['item_flags'] & ITEM_DELETED) { + if(intval($r[0]['item_deleted'])) { notice( t('Item has been removed.') . EOL ); } else { diff --git a/mod/editpost.php b/mod/editpost.php index dfbc8766e..4ea0c9f2b 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -55,7 +55,7 @@ function editpost_content(&$a) { - if($itm[0]['item_flags'] & ITEM_OBSCURED) { + if(intval($itm[0]['item_obscured'])) { $key = get_config('system','prvkey'); if($itm[0]['title']) $itm[0]['title'] = crypto_unencapsulate(json_decode_plus($itm[0]['title']),$key); diff --git a/mod/editwebpage.php b/mod/editwebpage.php index 191c9a9ac..d7969fb2d 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -95,7 +95,7 @@ function editwebpage_content(&$a) { intval($owner) ); - if($itm[0]['item_flags'] & ITEM_OBSCURED) { + if(intval($itm[0]['item_obscured'])) { $key = get_config('system','prvkey'); if($itm[0]['title']) $itm[0]['title'] = crypto_unencapsulate(json_decode_plus($itm[0]['title']),$key); diff --git a/mod/events.php b/mod/events.php index 28a816ea4..14ff03468 100755 --- a/mod/events.php +++ b/mod/events.php @@ -392,7 +392,7 @@ function events_content(&$a) { $last_date = $d; // FIXME - $edit = (($rr['item_flags'] & ITEM_WALL) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null); + $edit = (intval($rr['item_wall']) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null); $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); if(! $title) { list($title, $_trash) = explode("<br",bbcode($rr['desc']),2); diff --git a/mod/filer.php b/mod/filer.php index 9a409177c..e243687e3 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -27,8 +27,7 @@ function filer_content(&$a) { intval(local_user()) ); if($r) { - $x = q("update item set item_flags = ( item_flags | %d ) where id = %d and uid = %d", - intval(ITEM_RETAINED), + $x = q("update item set item_retained = 1 where id = %d and uid = %d", intval($r[0]['parent']), intval(local_user()) ); diff --git a/mod/group.php b/mod/group.php index f67623a83..36c31e355 100644 --- a/mod/group.php +++ b/mod/group.php @@ -117,10 +117,9 @@ function group_content(&$a) { check_form_security_token_ForbiddenOnErr('group_member_change', 't'); - $r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and not (xchan_flags & %d)>0 and not (abook_flags & %d)>0 and not (abook_flags & %d)>0 limit 1", + $r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and not (abook_flags & %d)>0 and not (abook_flags & %d)>0 limit 1", dbesc(base64url_decode(argv(2))), intval(local_user()), - intval(XCHAN_FLAGS_DELETED), intval(ABOOK_FLAG_BLOCKED), intval(ABOOK_FLAG_PENDING) ); @@ -211,10 +210,9 @@ function group_content(&$a) { group_rmv_member(local_user(),$group['name'],$member['xchan_hash']); } - $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND not (abook_flags & %d)>0 and not (xchan_flags & %d)>0 and not (abook_flags & %d)>0 order by xchan_name asc", + $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND not (abook_flags & %d)>0 and xchan_deleted = 0 and not (abook_flags & %d)>0 order by xchan_name asc", intval(local_user()), intval(ABOOK_FLAG_BLOCKED), - intval(XCHAN_FLAGS_DELETED), intval(ABOOK_FLAG_PENDING) ); diff --git a/mod/home.php b/mod/home.php index 2e57a2ab9..648a8ff4f 100644 --- a/mod/home.php +++ b/mod/home.php @@ -170,7 +170,7 @@ function home_content(&$a, $update = 0, $load = false) { $page_mode = 'list'; - $simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : ''); + $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); if($update && $_SESSION['loadtime']) $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; diff --git a/mod/import.php b/mod/import.php index c9a4edb67..bd95311df 100644 --- a/mod/import.php +++ b/mod/import.php @@ -200,8 +200,8 @@ function import_post(&$a) { 'url' => $hubloc['hubloc_url'], 'url_sig' => $hubloc['hubloc_url_sig'] ); - if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && ($seize)) - $hubloc['hubloc_flags'] = ($hubloc['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY); + if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && intval($hubloc['hubloc_primary']) && ($seize)) + $hubloc['hubloc_primary'] = 0; if(! zot_gethub($arr)) { unset($hubloc['hubloc_id']); @@ -220,7 +220,7 @@ function import_post(&$a) { // create new hubloc for the new channel at this site - $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_flags, + $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_primary, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey ) values ( '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )", dbesc($channel['channel_guid']), @@ -228,7 +228,7 @@ function import_post(&$a) { dbesc($channel['channel_hash']), dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), dbesc('zot'), - intval(($seize) ? HUBLOC_FLAGS_PRIMARY : 0), + intval(($seize) ? 1 : 0), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey']))), dbesc(get_app()->get_hostname()), @@ -239,9 +239,7 @@ function import_post(&$a) { // reset the original primary hubloc if it is being seized if($seize) - $r = q("update hubloc set hubloc_flags = (hubloc_flags & ~%d) where (hubloc_flags & %d)>0 and hubloc_hash = '%s' and hubloc_url != '%s' ", - intval(HUBLOC_FLAGS_PRIMARY), - intval(HUBLOC_FLAGS_PRIMARY), + $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", dbesc($channel['channel_hash']), dbesc(z_root()) ); diff --git a/mod/item.php b/mod/item.php index b3370fecf..294ee641f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -281,7 +281,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_wall'] && $parent_item['item_origin'])) { $walltowall_comment = true; $walltowall = true; } @@ -330,11 +330,6 @@ function item_post(&$a) { $body = $_REQUEST['body']; $item_flags = $orig_post['item_flags']; - // force us to recalculate if we need to obscure this post - - if($item_flags & ITEM_OBSCURED) - $item_flags = ($item_flags ^ ITEM_OBSCURED); - $item_restrict = $orig_post['item_restrict']; $postopts = $orig_post['postopts']; $created = $orig_post['created']; @@ -640,14 +635,10 @@ function item_post(&$a) { } } - if(local_user() != $profile_uid) - $item_flags |= ITEM_UNSEEN; - - if($post_type === 'wall' || $post_type === 'wall-comment') - $item_flags = $item_flags | ITEM_WALL; + $item_unseen = ((local_user() != $profile_uid) ? 1 : 0); + $item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0); + $item_origin = (($origin) ? 1 : 0); - if($origin) - $item_flags = $item_flags | ITEM_ORIGIN; if($moderated) $item_restrict = $item_restrict | ITEM_MODERATED; @@ -678,11 +669,9 @@ function item_post(&$a) { $datarray = array(); - if(! $parent) { - $item_flags = $item_flags | ITEM_THREAD_TOP; - } + $item_thead_top = ((! $parent) ? 1 : 0); - if ((! $plink) && ($item_flags & ITEM_THREAD_TOP)) { + if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; } @@ -717,6 +706,10 @@ function item_post(&$a) { $datarray['postopts'] = $postopts; $datarray['item_restrict'] = $item_restrict; $datarray['item_flags'] = $item_flags; + $datarray['item_unseen'] = $item_unseen; + $datarray['item_wall'] = $item_wall; + $datarray['item_origin'] = $item_origin; + $datarray['item_thread_top'] = $item_thread_top; $datarray['layout_mid'] = $layout_mid; $datarray['public_policy'] = $public_policy; $datarray['comment_policy'] = map_scope($channel['channel_w_comment']); @@ -767,13 +760,13 @@ function item_post(&$a) { if($uid) { if($channel['channel_hash'] === $datarray['author_xchan']) { $datarray['sig'] = base64url_encode(rsa_sign($datarray['body'],$channel['channel_prvkey'])); - $datarray['item_flags'] = $datarray['item_flags'] | ITEM_VERIFIED; + $datarray['item_verified'] = 1; } } logger('Encrypting local storage'); $key = get_config('system','pubkey'); - $datarray['item_flags'] = $datarray['item_flags'] | ITEM_OBSCURED; + $datarray['item_obscured'] = 1; if($datarray['title']) $datarray['title'] = json_encode(crypto_encapsulate($datarray['title'],$key)); if($datarray['body']) @@ -811,7 +804,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'], @@ -1054,11 +1047,10 @@ function item_check_service_class($channel_id,$iswebpage) { if ($iswebpage) { $r = q("select count(i.id) as total from item i right join channel c on (i.author_xchan=c.channel_hash and i.uid=c.channel_id ) - and i.parent=i.id and (i.item_restrict & %d)>0 and not (i.item_restrict & %d)>0 and i.uid= %d ", + and i.parent=i.id and (i.item_restrict & %d)>0 and i.item_deleted = 0 and i.uid= %d ", intval(ITEM_WEBPAGE), - intval(ITEM_DELETED), - intval($channel_id) - ); + intval($channel_id) + ); } else { $r = q("select count(i.id) as total from item i diff --git a/mod/like.php b/mod/like.php index b3afd910f..968f9c81e 100755 --- a/mod/like.php +++ b/mod/like.php @@ -293,10 +293,12 @@ function like_content(&$a) { } $mid = item_message_id(); + $arr = array(); if($extended_like) { - $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN|ITEM_WALL; - + $arr['item_thread_top'] = 1; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; } else { $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); @@ -326,12 +328,14 @@ function like_content(&$a) { ), )); - if(! ($item['item_flags'] & ITEM_THREAD_TOP)) + if(! intval($item['item_thread_top'])) $post_type = 'comment'; - $item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN; - if($item['item_flags'] & ITEM_WALL) - $item_flags |= ITEM_WALL; + $arr['item_origin'] = 1; + $arr['item_notshown'] = 1; + + if(intval($item['item_wall'])) + $arr['item_wall'] = 1; // if this was a linked photo and was hidden, unhide it. @@ -361,7 +365,6 @@ function like_content(&$a) { killme(); - $arr = array(); if($extended_like) { $ulink = '[zrl=' . $ch[0]['xchan_url'] . ']' . $ch[0]['xchan_name'] . '[/zrl]'; diff --git a/mod/locs.php b/mod/locs.php index bf2737718..d936ef5e4 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -22,13 +22,10 @@ function locs_post(&$a) { return; } - $r = q("update hubloc set hubloc_flags = (hubloc_flags - %d) where (hubloc_flags & %d)>0 and hubloc_hash = '%s' ", - intval(HUBLOC_FLAGS_PRIMARY), - intval(HUBLOC_FLAGS_PRIMARY), + $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' ", dbesc($channel['channel_hash']) ); - $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'", - intval(HUBLOC_FLAGS_PRIMARY), + $r = q("update hubloc set hubloc_primary = 1 where hubloc_id = %d and hubloc_hash = '%s'", intval($hubloc_id), dbesc($channel['channel_hash']) ); @@ -42,7 +39,7 @@ function locs_post(&$a) { $hubloc_id = intval($_REQUEST['drop']); if($hubloc_id) { - $r = q("select hubloc_id, hubloc_flags from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1", + $r = q("select * from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1", intval($hubloc_id), dbesc(z_root()), dbesc($channel['channel_hash']) @@ -52,12 +49,12 @@ function locs_post(&$a) { notice( t('Location not found.') . EOL); return; } - if($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) { + if(intval($r[0]['hubloc_primary'])) { notice( t('Primary location cannot be removed.') . EOL); return; } - $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'", - intval(HUBLOC_FLAGS_DELETED), + + $r = q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d and hubloc_hash = '%s'", intval($hubloc_id), dbesc($channel['channel_hash']) ); @@ -72,7 +69,6 @@ function locs_post(&$a) { function locs_content(&$a) { - if(! local_user()) { notice( t('Permission denied.') . EOL); return; @@ -91,8 +87,8 @@ function locs_content(&$a) { for($x = 0; $x < count($r); $x ++) { - $r[$x]['primary'] = (($r[$x]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false); - $r[$x]['deleted'] = (($r[$x]['hubloc_flags'] & HUBLOC_FLAGS_DELETED) ? true : false); + $r[$x]['primary'] = (intval($r[$x]['hubloc_primary']) ? true : false); + $r[$x]['deleted'] = (intval($r[$x]['hubloc_deleted']) ? true : false); } diff --git a/mod/manage.php b/mod/manage.php index b6e10bf46..4297e8f08 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -56,16 +56,15 @@ function manage_content(&$a) { $channels[$x]['default_links'] = '1'; - $c = q("SELECT id, item_restrict, item_flags FROM item - WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d", + $c = q("SELECT id, item_restrict, item_wall FROM item + WHERE (item_restrict = %d) and item_unseen = 1 and uid = %d", intval(ITEM_VISIBLE), - intval(ITEM_UNSEEN), 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'] ++; @@ -73,11 +72,10 @@ function manage_content(&$a) { } - $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)", + $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or xchan_deleted = 1 or xchan_orphan = 1)", intval($channels[$x]['channel_id']), intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); if($intr) diff --git a/mod/mood.php b/mod/mood.php index e6f4760e0..bf59eac1f 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -61,10 +61,6 @@ 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_UNSEEN; - if(! $parent_mid) - $item_flags |= ITEM_THREAD_TOP; - $arr = array(); @@ -72,7 +68,6 @@ function mood_init(&$a) { $arr['uid'] = $uid; $arr['mid'] = $mid; $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); - $arr['item_flags'] = $item_flags; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = (($parent_mid) ? $r[0]['owner_xchan'] : $poster['xchan_hash']); $arr['title'] = ''; @@ -83,8 +78,13 @@ function mood_init(&$a) { $arr['item_private'] = $private; $arr['verb'] = $activity; $arr['body'] = $action; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_unseen'] = 1; + if(! $parent_mid) + $item['item_thread_top'] = 1; - if ((! $arr['plink']) && ($arr['item_flags'] & ITEM_THREAD_TOP)) { + if ((! $arr['plink']) && intval($arr['item_thread_top'])) { $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; } diff --git a/mod/network.php b/mod/network.php index 65332e3f6..5e583f657 100644 --- a/mod/network.php +++ b/mod/network.php @@ -154,12 +154,12 @@ function network_content(&$a, $update = 0, $load = false) { $sql_options = (($star) - ? " and (item_flags & " . intval(ITEM_STARRED) . ") > 0" + ? " and item_starred = 1 " : ''); $sql_nets = ''; - $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ")>0 $sql_options ) "; + $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE item_thread_top = 1 $sql_options ) "; if($group) { $contact_str = ''; @@ -291,9 +291,8 @@ function network_content(&$a, $update = 0, $load = false) { } if($conv) { - $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d ) > 0)) ", - dbesc(protect_sprintf($channel['channel_hash'])), - intval(ITEM_MENTIONSME) + $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ", + dbesc(protect_sprintf($channel['channel_hash'])) ); } @@ -346,7 +345,7 @@ function network_content(&$a, $update = 0, $load = false) { else $page_mode = 'client'; - $simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : ''); + $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // or three and look at your matrix page - after opening up your browser. The first page loads just as it @@ -465,10 +464,7 @@ function network_content(&$a, $update = 0, $load = false) { } if(($update_unseen) && (! $firehose)) - $r = q("UPDATE item SET item_flags = ( item_flags & ~%d) - WHERE (item_flags & %d) > 0 AND uid = %d $update_unseen ", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), + $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ", intval(local_user()) ); diff --git a/mod/openid.php b/mod/openid.php index 9752db440..b0f927f34 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -131,8 +131,8 @@ function openid_content(&$a) { $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, - xchan_name_date, xchan_flags) - values ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d) ", + xchan_name_date, xchan_hidden) + values ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 1) ", dbesc($url), dbesc(''), dbesc(''), @@ -147,8 +147,7 @@ function openid_content(&$a) { dbesc($name), dbesc($network), dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval(XCHAN_FLAGS_HIDDEN) + dbesc(datetime_convert()) ); if($x) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", @@ -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/photos.php b/mod/photos.php index b2eb2847f..5b86da2a1 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -180,19 +180,8 @@ function photos_post(&$a) { intval($page_owner_uid) ); if(count($i)) { - q("UPDATE `item` SET item_restrict = (item_restrict | %d), `edited` = '%s', `changed` = '%s' WHERE `parent_mid` = '%s' AND `uid` = %d", - intval(ITEM_DELETED), - dbesc(datetime_convert()), - dbesc(datetime_convert()), - dbesc($i[0]['mid']), - intval($page_owner_uid) - ); - + drop_item($i[0]['id'],true,DROPITEM_PHASE1); $url = $a->get_baseurl(); - $drop_id = intval($i[0]['id']); - - if($i[0]['visible']) - proc_run('php',"include/notifier.php","drop","$drop_id"); } } @@ -877,11 +866,9 @@ function photos_content(&$a) { } if((local_user()) && (local_user() == $link_item['uid'])) { - q("UPDATE `item` SET item_flags = (item_flags & ~%d) WHERE parent = %d and uid = %d and (item_flags & %d)>0", - intval(ITEM_UNSEEN), + q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1", intval($link_item['parent']), - intval(local_user()), - intval(ITEM_UNSEEN) + intval(local_user()) ); } } diff --git a/mod/ping.php b/mod/ping.php index 1cebd152d..e8d5636b8 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -151,17 +151,12 @@ function ping_init(&$a) { if(x($_REQUEST, 'markRead') && local_user()) { switch($_REQUEST['markRead']) { case 'network': - $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and uid = %d", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), + $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d", intval(local_user()) ); break; case 'home': - $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and (item_flags & %d) > 0 and uid = %d", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), - intval(ITEM_WALL), + $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d", intval(local_user()) ); break; @@ -188,8 +183,7 @@ function ping_init(&$a) { } if(x($_REQUEST, 'markItemRead') && local_user()) { - $r = q("update item set item_flags = ( item_flags & ~%d ) where parent = %d and uid = %d", - intval(ITEM_UNSEEN), + $r = q("update item set item_unseen = 0 where parent = %d and uid = %d", intval($_REQUEST['markItemRead']), intval(local_user()) ); @@ -276,10 +270,9 @@ function ping_init(&$a) { $result = array(); $r = q("SELECT * FROM item - WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d + WHERE item_restrict = %d and item_unseen = 1 and uid = %d and author_xchan != '%s' ORDER BY created DESC", intval(ITEM_VISIBLE), - intval(ITEM_UNSEEN), intval(local_user()), dbesc($ob_hash) ); @@ -287,7 +280,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); } @@ -300,11 +293,10 @@ function ping_init(&$a) { if(argc() > 1 && (argv(1) === 'intros')) { $result = array(); - $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0) ORDER BY abook_created DESC", + $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or xchan_deleted = 1 or xchan_orphan = 1) ORDER BY abook_created DESC", intval(local_user()), intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); if($r) { @@ -384,10 +376,9 @@ function ping_init(&$a) { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { $r = q("SELECT id, item_restrict, item_flags FROM item - WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d + WHERE (item_restrict = %d) and item_unseen = 1 and uid = %d and author_xchan != '%s'", intval(ITEM_VISIBLE), - intval(ITEM_UNSEEN), intval(local_user()), dbesc($ob_hash) ); @@ -397,7 +388,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'] ++; @@ -413,11 +404,10 @@ function ping_init(&$a) { $t2 = dba_timer(); if($vnotify & VNOTIFY_INTRO) { - $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0)", + $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or xchan_deleted = 1 or xchan_orphan = 1)", intval(local_user()), intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), - intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); $t3 = dba_timer(); diff --git a/mod/poke.php b/mod/poke.php index b22f7d9d5..9fde46f62 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -87,9 +87,6 @@ function poke_init(&$a) { $arr = array(); - $arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN; - if($parent_item) - $arr['item_flags'] |= ITEM_THREAD_TOP; $arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']); $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); @@ -115,6 +112,13 @@ function poke_init(&$a) { $arr['object'] = json_encode($obj); + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_unseen'] = 1; + if(! $parent_item) + $item['item_thread_top'] = 1; + + post_activity_item($arr); return; diff --git a/mod/post.php b/mod/post.php index 9e818a7e2..15fd29607 100644 --- a/mod/post.php +++ b/mod/post.php @@ -260,23 +260,15 @@ function post_init(&$a) { $a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name'])); logger('mod_zot: auth success from ' . $x[0]['xchan_addr']); - q("update hubloc set hubloc_status = (hubloc_status | %d ) where hubloc_id = %d ", - intval(HUBLOC_WORKS), - intval($x[0]['hubloc_id']) - ); - - } else { + } + else { if($test) { $ret['message'] .= 'auth failure. ' . print_r($_REQUEST,true) . print_r($j,true) . EOL; json_return_and_die($ret); } logger('mod_zot: magic-auth failure - not authenticated: ' . $x[0]['xchan_addr']); - q("update hubloc set hubloc_status = (hubloc_status | %d ) where hubloc_id = %d ", - intval(HUBLOC_RECEIVE_ERROR), - intval($x[0]['hubloc_id']) - ); } // FIXME - we really want to save the return_url in the session before we visit rmagic. @@ -666,20 +658,16 @@ function post_post(&$a) { // a dead hub came back to life - reset any tombstones we might have - if($hub['hubloc_status'] & HUBLOC_OFFLINE) { - q("update hubloc set hubloc_status = (hubloc_status & ~%d) where hubloc_id = %d", - intval(HUBLOC_OFFLINE), + if(intval($hub['hubloc_error'])) { + q("update hubloc set hubloc_error = 0 where hubloc_id = %d", intval($hub['hubloc_id']) ); - if($r[0]['hubloc_flags'] & HUBLOC_FLAGS_ORPHANCHECK) { - q("update hubloc set hubloc_flags = (hubloc_flags & ~%d) where hubloc_id = %d", - intval(HUBLOC_FLAGS_ORPHANCHECK), + if(intval($r[0]['hubloc_orphancheck'])) { + q("update hubloc set hubloc_orhpancheck = 0 where hubloc_id = %d", intval($hub['hubloc_id']) ); } - q("update xchan set xchan_flags = (xchan_flags & ~%d) where (xchan_flags & %d)>0 and xchan_hash = '%s'", - intval(XCHAN_FLAGS_ORPHAN), - intval(XCHAN_FLAGS_ORPHAN), + q("update xchan set xchan_orphan = 0 where xchan_orphan = 1 and xchan_hash = '%s'", dbesc($hub['hubloc_hash']) ); } @@ -693,8 +681,7 @@ function post_post(&$a) { * */ - q("update hubloc set hubloc_flags = ( hubloc_flags | %d ) where hubloc_url = '%s' and hubloc_sitekey != '%s' ", - intval(HUBLOC_FLAGS_DELETED), + q("update hubloc set hubloc_deleted = 1 where hubloc_url = '%s' and hubloc_sitekey != '%s' ", dbesc($hub['hubloc_url']), dbesc($hub['hubloc_sitekey']) ); diff --git a/mod/starred.php b/mod/starred.php index 05b45bea3..931b24a71 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -19,15 +19,15 @@ function starred_init(&$a) { if(! count($r)) killme(); - $item_flags = ( $r[0]['item_flags'] ^ ITEM_STARRED ); + $item_starred = (intval($r[0]['item_starred']) ? 0 : 1); - $r = q("UPDATE item SET item_flags = %d WHERE uid = %d and id = %d", - intval($item_flags), + $r = q("UPDATE item SET item_starred = %d WHERE uid = %d and id = %d", + intval($item_starred), intval(local_user()), intval($message_id) ); header('Content-type: application/json'); - echo json_encode(array('result' => (($item_flags & ITEM_STARRED) ? 1 : 0))); + echo json_encode(array('result' => $item_starred)); killme(); } diff --git a/mod/subthread.php b/mod/subthread.php index f0f54f4a6..f4472cf05 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -96,30 +96,28 @@ function subthread_content(&$a) { ), )); - if(! ($item['item_flags'] & ITEM_THREAD_TOP)) + if(! intval($item['item_thread_top'])) $post_type = 'comment'; - $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(); - $arr['mid'] = $mid; - $arr['aid'] = $owner_aid; - $arr['uid'] = $owner_uid; - $arr['item_flags'] = $item_flags; - $arr['parent'] = $item['id']; - $arr['parent_mid'] = $item['mid']; - $arr['thr_parent'] = $item['mid']; - $arr['owner_xchan'] = $thread_owner['xchan_hash']; - $arr['author_xchan'] = $observer['xchan_hash']; + $arr['mid'] = $mid; + $arr['aid'] = $owner_aid; + $arr['uid'] = $owner_uid; + $arr['parent'] = $item['id']; + $arr['parent_mid'] = $item['mid']; + $arr['thr_parent'] = $item['mid']; + $arr['owner_xchan'] = $thread_owner['xchan_hash']; + $arr['author_xchan'] = $observer['xchan_hash']; + $arr['item_origin'] = 1; + $arr['item_notshown'] = 1; + if(intval($item['item_wall'])) + $arr['item_wall'] = 1; + else + $arr['item_wall'] = 0; - $ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]'; $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]'; $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]'; diff --git a/mod/tagger.php b/mod/tagger.php index bfda114d2..83f6ee029 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -109,10 +109,8 @@ function tagger_content(&$a) { $arr['owner_xchan'] = $item['owner_xchan']; $arr['author_xchan'] = $channel['channel_hash']; - - $arr['item_flags'] = ITEM_ORIGIN; - if($item['item_flags'] & ITEM_WALL) - $arr['item_flags'] |= ITEM_WALL; + $arr['item_origin'] = 1; + $arr['item_wall'] = ((intval($item['item_wall'])) ? 1 : 0); $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 f53a6ab7b..4896c8a6e 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -182,8 +182,10 @@ function thing_init(&$a) { $arr['owner_xchan'] = $channel['channel_hash']; $arr['author_xchan'] = $channel['channel_hash']; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_thread_top'] = 1; - $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP; $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]'; $plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]'; diff --git a/mod/viewconnections.php b/mod/viewconnections.php index aab136c43..e97c77e76 100644 --- a/mod/viewconnections.php +++ b/mod/viewconnections.php @@ -31,25 +31,24 @@ function viewconnections_content(&$a) { $is_owner = ((local_user() && local_user() == $a->profile['uid']) ? true : false); $abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF; - $xchan_flags = XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED; + $sql_extra = ''; + if(! $is_owner) { $abook_flags = $abook_flags | ABOOK_FLAG_HIDDEN; - $xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN; + $sql_extra = " and xchan_hidden = 0 "; } - $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d )>0 and not ( xchan_flags & %d )>0 ", + $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d )>0 and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra ", intval($a->profile['uid']), - intval($abook_flags), - intval($xchan_flags) + intval($abook_flags) ); if($r) { $a->set_pager_total($r[0]['total']); } - $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not ( abook_flags & %d )>0 and not ( xchan_flags & %d )>0 order by xchan_name LIMIT %d OFFSET %d ", + $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not ( abook_flags & %d )>0 and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra order by xchan_name LIMIT %d OFFSET %d ", intval($a->profile['uid']), intval($abook_flags), - intval($xchan_flags), intval($a->pager['itemspage']), intval($a->pager['start']) ); diff --git a/mod/viewsrc.php b/mod/viewsrc.php index 982d1c417..83acb1c23 100644 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -21,14 +21,14 @@ function viewsrc_content(&$a) { } if(local_user() && $item_id) { - $r = q("select item_flags, body from item where item_restrict = 0 and uid in (%d , %d) and id = %d limit 1", + $r = q("select id, item_flags, item_obscured, body from item where item_restrict = 0 and uid in (%d , %d) and id = %d limit 1", intval(local_user()), intval($sys['channel_id']), intval($item_id) ); if($r) { - if($r[0]['item_flags'] & ITEM_OBSCURED) + if(intval($r[0]['item_obscured'])) $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'],true),get_config('system','prvkey')); $o = (($json) ? json_encode($r[0]['body']) : str_replace("\n",'<br />',$r[0]['body'])); } diff --git a/mod/zfinger.php b/mod/zfinger.php index 6f4febc6f..bd124b951 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -103,7 +103,7 @@ function zfinger_init(&$a) { $adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false); $censored = (($e['channel_pageflags'] & PAGE_CENSORED) ? true : false); $searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true); - $deleted = (($e['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); + $deleted = (intval($e['xchan_deleted']) ? true : false); if($deleted || $censored) $searchable = false; |