aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-20 19:33:19 -0800
committerfriendica <info@friendica.com>2015-01-20 19:33:19 -0800
commit51848c619080e19cace647966a17eb9a1b42ca25 (patch)
tree6aee6c9487813051801cabbd2a4914528232d5b5 /mod
parentee3eee425c92b37fba5a7035d8e9ec0b0b563d0b (diff)
downloadvolse-hubzilla-51848c619080e19cace647966a17eb9a1b42ca25.tar.gz
volse-hubzilla-51848c619080e19cace647966a17eb9a1b42ca25.tar.bz2
volse-hubzilla-51848c619080e19cace647966a17eb9a1b42ca25.zip
working through the xchan table to remove bitfields, mostly complete except for updating the updater
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php30
-rw-r--r--mod/admin.php8
-rw-r--r--mod/connections.php13
-rw-r--r--mod/dirsearch.php22
-rw-r--r--mod/group.php6
-rw-r--r--mod/manage.php5
-rw-r--r--mod/openid.php7
-rw-r--r--mod/ping.php10
-rw-r--r--mod/post.php16
-rw-r--r--mod/viewconnections.php13
-rw-r--r--mod/zfinger.php2
11 files changed, 49 insertions, 83 deletions
diff --git a/mod/acl.php b/mod/acl.php
index d406942c3..a1ed177c8 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,23 +159,20 @@ 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())
);
}
elseif($type == 'x') {
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/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/dirsearch.php b/mod/dirsearch.php
index a88db0a2c..947198466 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($startrec) . " , " . intval($perpage);
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/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/manage.php b/mod/manage.php
index b6e10bf46..6797b4892 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -73,11 +73,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/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",
diff --git a/mod/ping.php b/mod/ping.php
index 593ae21f8..e5fc4d930 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -300,11 +300,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) {
@@ -413,11 +412,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/post.php b/mod/post.php
index 338cd71c0..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.
@@ -675,9 +667,7 @@ function post_post(&$a) {
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'])
);
}
diff --git a/mod/viewconnections.php b/mod/viewconnections.php
index 40d26c823..d4731d8c4 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/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;