aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php30
-rw-r--r--mod/admin.php10
-rw-r--r--mod/channel.php10
-rw-r--r--mod/connections.php13
-rw-r--r--mod/connedit.php3
-rw-r--r--mod/dirsearch.php23
-rw-r--r--mod/display.php8
-rw-r--r--mod/editlayout.php2
-rw-r--r--mod/editpost.php2
-rw-r--r--mod/editwebpage.php4
-rwxr-xr-xmod/events.php7
-rw-r--r--mod/filer.php3
-rw-r--r--mod/group.php6
-rw-r--r--mod/home.php2
-rw-r--r--mod/impel.php6
-rw-r--r--mod/import.php12
-rw-r--r--mod/item.php47
-rw-r--r--mod/layouts.php2
-rwxr-xr-xmod/like.php29
-rw-r--r--mod/locs.php20
-rw-r--r--mod/manage.php7
-rwxr-xr-xmod/mood.php12
-rw-r--r--mod/network.php11
-rw-r--r--mod/openid.php7
-rw-r--r--mod/page.php10
-rw-r--r--mod/photos.php17
-rw-r--r--mod/ping.php12
-rwxr-xr-xmod/poke.php10
-rw-r--r--mod/post.php30
-rw-r--r--mod/starred.php8
-rwxr-xr-xmod/subthread.php30
-rw-r--r--mod/tagger.php5
-rw-r--r--mod/thing.php3
-rw-r--r--mod/viewconnections.php13
-rw-r--r--mod/viewsrc.php5
-rw-r--r--mod/webpages.php2
-rw-r--r--mod/zfinger.php2
37 files changed, 182 insertions, 241 deletions
diff --git a/mod/acl.php b/mod/acl.php
index e919bb912..ba2159dbc 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -94,19 +94,18 @@ 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_channel()),
- 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
@@ -120,9 +119,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);
@@ -152,8 +150,7 @@ function acl_init(&$a){
if((count($r) < 100) && $type == 'c') {
$r2 = 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"
);
if($r2)
$r = array_merge($r,$r2);
@@ -165,24 +162,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_channel()),
- 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_channel()),
- intval(XCHAN_FLAGS_DELETED)
-
+ intval(local_channel())
);
}
diff --git a/mod/admin.php b/mod/admin.php
index e84f155ed..a7318894d 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -89,6 +89,7 @@ function admin_content(&$a) {
*/
// array( url, name, extra css classes )
+
$aside = array(
'site' => array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
'users' => array($a->get_baseurl(true)."/admin/users/", t("Accounts") , "users"),
@@ -99,6 +100,7 @@ function admin_content(&$a) {
// '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")
+
);
/* get plugins admin page */
@@ -148,9 +150,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;
@@ -1436,4 +1438,4 @@ function admin_page_profs(&$a) {
'$submit' => t('Save')
));
}
-} \ No newline at end of file
+}
diff --git a/mod/channel.php b/mod/channel.php
index f33ba8072..5f825fe37 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -166,7 +166,7 @@ function channel_content(&$a, $update = 0, $load = false) {
if(($update) && (! $load)) {
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0
- AND item_wall = 1 $simple_update $sql_extra limit 1",
+ AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
dbesc($mid . '%'),
intval($a->profile['profile_uid'])
);
@@ -174,7 +174,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$r = q("SELECT distinct parent AS `item_id`, created from item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d AND item_restrict = 0
- AND item_wall = 1 $simple_update
+ 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",
@@ -220,12 +220,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_wall = 1 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_THREAD_TOP),
intval(ABOOK_FLAG_BLOCKED)
);
}
@@ -334,8 +333,7 @@ function channel_content(&$a, $update = 0, $load = false) {
}
if($is_owner && $update_unseen) {
- $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1
- AND item_wall = 1 AND uid = %d $update_unseen",
+ $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
intval(local_channel())
);
}
diff --git a/mod/connections.php b/mod/connections.php
index 469d3a62f..c732cf272 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_channel()),
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_channel()),
- 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_channel()),
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 b346f3de0..250da672a 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -240,8 +240,9 @@ function connedit_post(&$a) {
&& (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) {
$xarr = array();
$xarr['verb'] = ACTIVITY_FRIEND;
- $xarr['item_flags'] = 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 d997020b2..0b8cfdc6d 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -127,7 +127,6 @@ function dirsearch_content(&$a) {
if($forums)
$safesql .= dir_flag_build(' AND ','xchan_flags',XCHAN_FLAGS_PUBFORUM, $forums);
-
// we only support an age range currently. You must set both agege
// (greater than or equal) and agele (less than or equal)
@@ -170,21 +169,16 @@ function dirsearch_content(&$a) {
$sql_extra .= " and xchan_addr like '%%" . get_app()->get_hostname() . "' ";
}
-
- $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'];
}
@@ -251,15 +245,10 @@ 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 ) $hub_query 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 ) $hub_query and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql $order $qlimit ",
$ret['page'] = $page + 1;
$ret['records'] = count($r);
+ );
}
@@ -283,7 +272,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'];
diff --git a/mod/display.php b/mod/display.php
index b5daea2de..33fb83e70 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -81,7 +81,7 @@ function display_content(&$a, $update = 0, $load = false) {
$target_item = null;
- $r = q("select id, uid, mid, parent_mid, item_restrict from item where mid like '%s' limit 1",
+ $r = q("select id, uid, mid, parent_mid, item_type, item_deleted from item where mid like '%s' limit 1",
dbesc($item_hash . '%')
);
@@ -91,7 +91,7 @@ function display_content(&$a, $update = 0, $load = false) {
$r = null;
- if($target_item['item_restrict'] & ITEM_WEBPAGE) {
+ if($target_item['item_type'] == ITEM_TYPE_WEBPAGE) {
$x = q("select * from channel where channel_id = %d limit 1",
intval($target_item['uid'])
);
@@ -247,7 +247,7 @@ function display_content(&$a, $update = 0, $load = false) {
}
if($updateable) {
- $x = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d and parent = %d ",
+ $x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ",
intval(local_channel()),
intval($r[0]['parent'])
);
@@ -266,7 +266,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/editlayout.php b/mod/editlayout.php
index 8ab5aab22..d61a14a48 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -135,7 +135,7 @@ function editlayout_content(&$a) {
$o .= replace_macros($tpl,array(
'$return_path' => $rp,
'$action' => 'item',
- '$webpage' => ITEM_PDL,
+ '$webpage' => ITEM_TYPE_PDL,
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
diff --git a/mod/editpost.php b/mod/editpost.php
index 58ebe31cb..0103e513c 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 cdf5d8c20..3b0b543a6 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -102,7 +102,7 @@ function editwebpage_content(&$a) {
return;
}
- 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);
@@ -169,7 +169,7 @@ function editwebpage_content(&$a) {
$editor = replace_macros($tpl,array(
'$return_path' => $rp,
- '$webpage' => ITEM_WEBPAGE,
+ '$webpage' => ITEM_TYPE_WEBPAGE,
'$placeholdpagetitle' => t('Page link title'),
'$pagetitle' => $page_title,
'$writefiles' => (perm_is_allowed($owner, get_observer_hash(), 'post_photos') || perm_is_allowed($owner, get_observer_hash(), 'write_storage')),
diff --git a/mod/events.php b/mod/events.php
index ba7ef6b7d..a89bbb760 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -414,8 +414,9 @@ function events_content(&$a) {
$is_first = ($d !== $last_date);
$last_date = $d;
-// FIXME
- $edit = ((intval($rr['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);
+
$drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
@@ -632,7 +633,7 @@ function events_content(&$a) {
'$s_text' => t('Event Starts:'),
'$stext' => $stext,
'$ftext' => $ftext,
- '$required' => ' <span class="required" title="' . t('Required') . '">*</span>',
+ '$required' => '<span class="required" title="' . t('Required') . '">*</span>',
'$ModalCANCEL' => t('Cancel'),
'$ModalOK' => t('OK'),
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true),
diff --git a/mod/filer.php b/mod/filer.php
index e8160bba2..8d69503b2 100644
--- a/mod/filer.php
+++ b/mod/filer.php
@@ -27,8 +27,7 @@ function filer_content(&$a) {
intval(local_channel())
);
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_channel())
);
diff --git a/mod/group.php b/mod/group.php
index 66297d6ac..f3984f9c8 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_channel()),
- intval(XCHAN_FLAGS_DELETED),
intval(ABOOK_FLAG_BLOCKED),
intval(ABOOK_FLAG_PENDING)
);
@@ -211,10 +210,9 @@ function group_content(&$a) {
group_rmv_member(local_channel(),$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_channel()),
intval(ABOOK_FLAG_BLOCKED),
- intval(XCHAN_FLAGS_DELETED),
intval(ABOOK_FLAG_PENDING)
);
diff --git a/mod/home.php b/mod/home.php
index 1b941a639..202a4d2d7 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -82,7 +82,7 @@ function home_content(&$a, $update = 0, $load = false) {
$r = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and ( sid = '%s' or sid like '%s' ) and service = 'WEBPAGE' and
- item_restrict = %d ORDER BY $randfunc limit 1",
+ item_type = %d ORDER BY $randfunc limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
dbesc($randpage_id),
diff --git a/mod/impel.php b/mod/impel.php
index f4d40f7a8..930158589 100644
--- a/mod/impel.php
+++ b/mod/impel.php
@@ -28,17 +28,17 @@ function impel_init(&$a) {
switch($j['type']) {
case 'webpage':
- $arr['item_restrict'] = ITEM_WEBPAGE;
+ $arr['item_type'] = ITEM_TYPE_WEBPAGE;
$namespace = 'WEBPAGE';
$installed_type = t('webpage');
break;
case 'block':
- $arr['item_restrict'] = ITEM_BUILDBLOCK;
+ $arr['item_type'] = ITEM_TYPE_BLOCK;
$namespace = 'BUILDBLOCK';
$installed_type = t('block');
break;
case 'layout':
- $arr['item_restrict'] = ITEM_PDL;
+ $arr['item_type'] = ITEM_TYPE_PDL;
$namespace = 'PDL';
$installed_type = t('layout');
break;
diff --git a/mod/import.php b/mod/import.php
index 088c5cb61..030b714bc 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 4777dd5c0..36cbaff6c 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -295,7 +295,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_ORIGIN) && intval($parent_item['item_wall'])) {
+ if(($parent_item) && ($parent_item['item_wall'] && $parent_item['item_origin'])) {
$walltowall_comment = true;
$walltowall = true;
}
@@ -344,11 +344,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'];
@@ -657,14 +652,10 @@ function item_post(&$a) {
}
}
- $item_unseen = 1;
- $item_wall = 0;
-
- if($post_type === 'wall' || $post_type === 'wall-comment')
- $item_wall = 1;
- if($origin)
- $item_flags = $item_flags | ITEM_ORIGIN;
+ $item_unseen = ((local_channel() != $profile_uid) ? 1 : 0);
+ $item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0);
+ $item_origin = (($origin) ? 1 : 0);
if($moderated)
$item_restrict = $item_restrict | ITEM_MODERATED;
@@ -695,14 +686,10 @@ function item_post(&$a) {
$datarray = array();
- if(! $parent) {
- $item_flags = $item_flags | ITEM_THREAD_TOP;
- }
+ $item_thead_top = ((! $parent) ? 1 : 0);
- if($consensus)
- $item_flags |= ITEM_CONSENSUS;
- if ((! $plink) && ($item_flags & ITEM_THREAD_TOP)) {
+ if ((! $plink) && ($item_thread_top)) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
}
@@ -738,6 +725,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']);
@@ -789,7 +780,7 @@ 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;
}
}
}
@@ -825,7 +816,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']) && intval($parent_item['item_wall'])) {
+ if(($datarray['owner_xchan'] != $datarray['author_xchan']) && (intval($parent_item['item_wall']))) {
notification(array(
'type' => NOTIFY_COMMENT,
'from_xchan' => $datarray['author_xchan'],
@@ -867,9 +858,8 @@ function item_post(&$a) {
// This way we don't see every picture in your new photo album posted to your wall at once.
// They will show up as people comment on them.
- if($parent_item['item_restrict'] & ITEM_HIDDEN) {
- $r = q("UPDATE `item` SET `item_restrict` = %d WHERE `id` = %d",
- intval($parent_item['item_restrict'] - ITEM_HIDDEN),
+ if(intval($parent_item['item_hidden'])) {
+ $r = q("UPDATE item SET item_hidden = 0 WHERE id = %d",
intval($parent_item['id'])
);
}
@@ -1078,11 +1068,10 @@ function item_check_service_class($channel_id,$iswebpage) {
$ret = array('success' => false, $message => '');
if ($iswebpage) {
- // note: we aren't counting comanche templates and blocks, only webpages
- $r = q("select count(id) as total from item where parent = id
- and ( item_restrict & %d ) > 0 and ( item_restrict & %d ) = 0 and uid = %d ",
- intval(ITEM_WEBPAGE),
- intval(ITEM_DELETED),
+ $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_type = %d and i.item_deleted = 0 and i.uid= %d ",
+ intval(ITEM_TYPE_WEBPAGE),
intval($channel_id)
);
}
diff --git a/mod/layouts.php b/mod/layouts.php
index 70a09b134..9d27ed4ac 100644
--- a/mod/layouts.php
+++ b/mod/layouts.php
@@ -111,7 +111,7 @@ function layouts_content(&$a) {
// This lets you post pages at other people's channels.
$x = array(
- 'webpage' => ITEM_PDL,
+ 'webpage' => ITEM_TYPE_PDL,
'is_owner' => true,
'nickname' => $a->profile['channel_address'],
'bang' => '',
diff --git a/mod/like.php b/mod/like.php
index 226f0f62b..57939885a 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -241,9 +241,10 @@ function like_content(&$a) {
// get the item. Allow linked photos (which are normally hidden) to be liked
- $r = q("SELECT * FROM item WHERE id = %d and (item_restrict = 0 or item_restrict = %d) LIMIT 1",
- intval($item_id),
- intval(ITEM_HIDDEN)
+ $r = q("SELECT * FROM item WHERE id = %d
+ and item_blocked = 0 and item_moderated = 0 and item_spam = 0
+ and item_deleted = 0 and item_unpublished = 0 and item_delayed_publish = 0 LIMIT 1",
+ intval($item_id)
);
if(! $item_id || (! $r)) {
@@ -337,11 +338,13 @@ function like_content(&$a) {
}
$mid = item_message_id();
- $item_wall = 0;
+
+ $arr = array();
if($extended_like) {
- $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN;
- $item_wall = 1;
+ $arr['item_thread_top'] = 1;
+ $arr['item_origin'] = 1;
+ $arr['item_wall'] = 1;
}
else {
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
@@ -373,18 +376,19 @@ 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;
+ $arr['item_origin'] = 1;
+ $arr['item_notshown'] = 1;
+
if(intval($item['item_wall']))
- $item_wall = 1;
+ $arr['item_wall'] = 1;
// if this was a linked photo and was hidden, unhide it.
- if($item['item_restrict'] & ITEM_HIDDEN) {
- $r = q("update item set item_restrict = (item_restrict ^ %d) where id = %d",
- intval(ITEM_HIDDEN),
+ if(intval($item['item_hidden'])) {
+ $r = q("update item set item_hidden = 0 where id = %d",
intval($item['id'])
);
}
@@ -412,7 +416,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 5b04bb343..3f8bd9029 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_channel()) {
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 de5f9c8ad..bb6c010f6 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -56,7 +56,7 @@ function manage_content(&$a) {
$channels[$x]['default_links'] = '1';
- $c = q("SELECT id, item_restrict, item_flags, item_wall FROM item
+ $c = q("SELECT id, item_restrict, item_wall FROM item
WHERE item_restrict = 0 and item_unseen = 1 and uid = %d",
intval($channels[$x]['channel_id'])
);
@@ -71,11 +71,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 4bb291182..92a4f391b 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -61,9 +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_ORIGIN;
- if(! $parent_mid)
- $item_flags |= ITEM_THREAD_TOP;
$arr = array();
@@ -71,8 +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['item_wall'] = 1;
$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 d96c6830d..9ebdf7198 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -176,12 +176,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 = '';
@@ -324,9 +324,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) and item_restrict = 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']))
);
}
@@ -500,7 +499,7 @@ function network_content(&$a, $update = 0, $load = false) {
}
if(($update_unseen) && (! $firehose))
- $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d $update_unseen ",
+ $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
intval(local_channel())
);
diff --git a/mod/openid.php b/mod/openid.php
index 1af95a81c..70da2690a 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",
diff --git a/mod/page.php b/mod/page.php
index 25b4d8888..2d977fb7a 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -59,11 +59,11 @@ function page_init(&$a) {
$sql_options = item_permissions_sql($u[0]['channel_id']);
$r = q("select item.* from item left join item_id on item.id = item_id.iid
- where item.uid = %d and sid = '%s' and (( service = 'WEBPAGE' and
- item_restrict = %d ) or ( service = 'PDL' and item_restrict = %d )) $sql_options $revision limit 1",
+ where item.uid = %d and sid = '%s' and (( service = 'WEBPAGE' and item_type = %d )
+ OR ( service = 'PDL' AND item_type = %d )) $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
- intval(ITEM_WEBPAGE),
+ intval(ITEM_TYPE_WEBPAGE),
intval(ITEM_PDL)
);
if(! $r) {
@@ -72,10 +72,10 @@ function page_init(&$a) {
$x = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
- item_restrict = %d $revision limit 1",
+ item_type = %d $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
- intval(ITEM_WEBPAGE)
+ intval(ITEM_TYPE_WEBPAGE)
);
if($x) {
// Yes, it's there. You just aren't allowed to see it.
diff --git a/mod/photos.php b/mod/photos.php
index 296aab67f..7cbb798a8 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");
}
}
@@ -878,8 +867,8 @@ function photos_content(&$a) {
}
}
- if((local_channel()) && (local_channel() == $link_item['uid'])) {
- q("UPDATE `item` SET item_unseen = 0 WHERE item_unseen = 1 AND parent = %d AND uid = %d ",
+ if((local_channel()) && (local_user() == $link_item['uid'])) {
+ q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1",
intval($link_item['parent']),
intval(local_channel())
);
diff --git a/mod/ping.php b/mod/ping.php
index 181e4f80a..d43694358 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -294,11 +294,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 LIMIT 50",
+ $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 LIMIT 50",
intval(local_channel()),
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) {
@@ -378,7 +377,7 @@ function ping_init(&$a) {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE item_restrict = 0 and item_unseen = 1 and uid = %d
+ WHERE (item_restrict = 0) and item_unseen = 1 and uid = %d
and author_xchan != '%s'",
intval(local_channel()),
dbesc($ob_hash)
@@ -405,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_channel()),
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 517387453..f66d28956 100755
--- a/mod/poke.php
+++ b/mod/poke.php
@@ -87,9 +87,6 @@ function poke_init(&$a) {
$arr = array();
- $arr['item_flags'] = ITEM_ORIGIN;
- if($parent_item)
- $arr['item_flags'] |= ITEM_THREAD_TOP;
$arr['item_wall'] = 1;
$arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']);
@@ -116,6 +113,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 95931a3f0..fe0860cc6 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -285,20 +285,13 @@ 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 {
- if ($test) {
+ }
+ 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'])
- );
}
/**
@@ -693,20 +686,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'])
);
}
@@ -718,8 +707,7 @@ function post_post(&$a) {
* Get rid of them (mark them deleted). There's a good chance they were re-installs.
*/
- 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 b6736fd85..103e5f4b4 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_channel()),
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 bdb582a57..9cfe5c24d 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -96,28 +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;
-
$arr = array();
- $arr['mid'] = $mid;
- $arr['aid'] = $owner_aid;
- $arr['uid'] = $owner_uid;
- $arr['item_flags'] = $item_flags;
- $arr['item_wall'] = $item['item_wall'];
- $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 c32b55548..c6365d707 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -107,10 +107,9 @@ function tagger_content(&$a) {
$arr['owner_xchan'] = $item['owner_xchan'];
$arr['author_xchan'] = $channel['channel_hash'];
+ $arr['item_origin'] = 1;
+ $arr['item_wall'] = ((intval($item['item_wall'])) ? 1 : 0);
- $arr['item_flags'] = ITEM_ORIGIN;
- $arr['item_wall'] = $item['item_wall'];
-
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
$alink = '[zrl=' . $item['xchan_url'] . ']' . $item['xchan_name'] . '[/zrl]';
$plink = '[zrl=' . $item['plink'] . ']' . $post_type . '[/zrl]';
diff --git a/mod/thing.php b/mod/thing.php
index 92fc82e53..b4b8ad027 100644
--- a/mod/thing.php
+++ b/mod/thing.php
@@ -177,8 +177,9 @@ function thing_init(&$a) {
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['author_xchan'] = $channel['channel_hash'];
- $arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
+ $arr['item_origin'] = 1;
$arr['item_wall'] = 1;
+ $arr['item_thread_top'] = 1;
$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 ef6681e64..c1da07292 100644
--- a/mod/viewconnections.php
+++ b/mod/viewconnections.php
@@ -35,25 +35,24 @@ function viewconnections_content(&$a) {
$is_owner = ((local_channel() && local_channel() == $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 3125ae4c0..931175a44 100644
--- a/mod/viewsrc.php
+++ b/mod/viewsrc.php
@@ -20,15 +20,16 @@ function viewsrc_content(&$a) {
notice( t('Item not found.') . EOL);
}
+
if(local_channel() && $item_id) {
- $r = q("select item_flags, body, id 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_channel()),
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/webpages.php b/mod/webpages.php
index 62abfb34a..f7043d5e1 100644
--- a/mod/webpages.php
+++ b/mod/webpages.php
@@ -102,7 +102,7 @@ function webpages_content(&$a) {
$o = profile_tabs($a, $is_owner, $a->profile['channel_address']);
$x = array(
- 'webpage' => ITEM_WEBPAGE,
+ 'webpage' => ITEM_TYPE_WEBPAGE,
'is_owner' => true,
'nickname' => $a->profile['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 6b93b3410..37243922c 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -104,7 +104,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 || $sys_channel)
$searchable = false;