mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 02:35:12 +00:00
working through the xchan table to remove bitfields, mostly complete except for updating the updater
This commit is contained in:
parent
ee3eee425c
commit
51848c6190
20 changed files with 107 additions and 203 deletions
30
boot.php
30
boot.php
|
@ -401,36 +401,6 @@ define ( 'VNOTIFY_INTRO', 0x0200 );
|
|||
define ( 'VNOTIFY_REGISTER', 0x0400 );
|
||||
|
||||
|
||||
// We need a flag to designate that a site is a
|
||||
// global directory mirror, but probably doesn't
|
||||
// belong in hubloc.
|
||||
// This indicates a need for an 'xsite' table
|
||||
// which contains only sites and not people.
|
||||
// Then we might have to revisit hubloc as a
|
||||
// linked structure between xchan and xsite
|
||||
|
||||
define ( 'HUBLOC_FLAGS_PRIMARY', 0x0001);
|
||||
define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002);
|
||||
define ( 'HUBLOC_FLAGS_ORPHANCHECK', 0x0004);
|
||||
define ( 'HUBLOC_FLAGS_DELETED', 0x1000);
|
||||
|
||||
define ( 'XCHAN_FLAGS_NORMAL', 0x0000);
|
||||
define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
|
||||
define ( 'XCHAN_FLAGS_ORPHAN', 0x0002);
|
||||
define ( 'XCHAN_FLAGS_CENSORED', 0x0004);
|
||||
define ( 'XCHAN_FLAGS_SELFCENSORED', 0x0008);
|
||||
define ( 'XCHAN_FLAGS_SYSTEM', 0x0010);
|
||||
define ( 'XCHAN_FLAGS_PUBFORUM', 0x0020);
|
||||
define ( 'XCHAN_FLAGS_DELETED', 0x1000);
|
||||
/*
|
||||
* Traficlights for Administration of HubLoc
|
||||
* to detect problems in inter server communication
|
||||
*/
|
||||
define ('HUBLOC_NOTUSED', 0x0000);
|
||||
define ('HUBLOC_SEND_ERROR', 0x0001);
|
||||
define ('HUBLOC_RECEIVE_ERROR', 0x0002);
|
||||
define ('HUBLOC_WORKS', 0x0004);
|
||||
define ('HUBLOC_OFFLINE', 0x0008);
|
||||
|
||||
/**
|
||||
* Tag/term types
|
||||
|
|
|
@ -276,8 +276,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
);
|
||||
|
||||
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
$r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s'",
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
||||
|
@ -326,8 +325,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
$hublocs = count($r);
|
||||
|
||||
if(! $hublocs) {
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
$r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s' ",
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
}
|
||||
|
@ -402,9 +400,7 @@ function mark_orphan_hubsxchans() {
|
|||
|
||||
// yes - if the xchan was marked as an orphan, undo it
|
||||
|
||||
$y = 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),
|
||||
$y = q("update xchan set xchan_orphan = 0 where xchan_orphan = 1 and xchan_hash = '%s'",
|
||||
dbesc($rr['hubloc_hash'])
|
||||
);
|
||||
|
||||
|
@ -413,8 +409,7 @@ function mark_orphan_hubsxchans() {
|
|||
|
||||
// nope - mark the xchan as an orphan
|
||||
|
||||
$y = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_ORPHAN),
|
||||
$y = q("update xchan set xchan_orphan = 1 where xchan_hash = '%s'",
|
||||
dbesc($rr['hubloc_hash'])
|
||||
);
|
||||
}
|
||||
|
@ -494,8 +489,7 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
|
|||
dbesc($xchan)
|
||||
);
|
||||
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
$r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s'",
|
||||
dbesc($xchan)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -295,23 +295,15 @@ function local_dir_update($uid,$force) {
|
|||
|
||||
logger('hidden: ' . $hidden);
|
||||
|
||||
$r = q("select xchan_flags from xchan where xchan_hash = '%s' limit 1",
|
||||
$r = q("select xchan_hidden from xchan where xchan_hash = '%s' limit 1",
|
||||
dbesc($p[0]['channel_hash'])
|
||||
);
|
||||
|
||||
// Be careful - XCHAN_FLAGS_HIDDEN should evaluate to 1
|
||||
if(($r[0]['xchan_flags'] & XCHAN_FLAGS_HIDDEN) != $hidden)
|
||||
$new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_HIDDEN;
|
||||
else
|
||||
$new_flags = $r[0]['xchan_flags'];
|
||||
|
||||
if($new_flags != $r[0]['xchan_flags']) {
|
||||
|
||||
$r = q("update xchan set xchan_flags = %d where xchan_hash = '%s'",
|
||||
intval($new_flags),
|
||||
if(intval($r[0]['xchan_hidden']) != $hidden) {
|
||||
$r = q("update xchan set xchan_hidden = %d where xchan_hash = '%s'",
|
||||
intval($hidden),
|
||||
dbesc($p[0]['channel_hash'])
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$address = $p[0]['channel_address'] . '@' . get_app()->get_hostname();
|
||||
|
|
|
@ -200,11 +200,10 @@ function group_get_members($gid) {
|
|||
if(intval($gid)) {
|
||||
$r = q("SELECT * FROM `group_member`
|
||||
LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan
|
||||
WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and not ( xchan_flags & %d )>0 and not ( abook_flags & %d )>0 and not ( abook_flags & %d )>0 ORDER BY xchan_name ASC ",
|
||||
WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and xchan_deleted = 0 and not ( abook_flags & %d )>0 and not ( abook_flags & %d )>0 ORDER BY xchan_name ASC ",
|
||||
intval($gid),
|
||||
intval(local_user()),
|
||||
intval(local_user()),
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
intval(ABOOK_FLAG_BLOCKED),
|
||||
intval(ABOOK_FLAG_PENDING)
|
||||
);
|
||||
|
|
|
@ -193,7 +193,7 @@ function xchan_store($arr) {
|
|||
if(! $arr['photo'])
|
||||
$arr['photo'] = get_default_profile_photo();
|
||||
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_instance_url, xchan_flags, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s',%d,'%s') ",
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_instance_url, xchan_hidden, xchan_orphan, xchan_censored, xchan_selfcensored, xchan_system, xchan_pubforum, xchan_deleted, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s',%d, %d, %d, %d, %d, %d, %d, '%s') ",
|
||||
dbesc($arr['hash']),
|
||||
dbesc($arr['guid']),
|
||||
dbesc($arr['guid_sig']),
|
||||
|
@ -206,7 +206,13 @@ function xchan_store($arr) {
|
|||
dbesc($arr['name']),
|
||||
dbesc($arr['network']),
|
||||
dbesc($arr['instance_url']),
|
||||
intval($arr['flags']),
|
||||
intval($arr['hidden']),
|
||||
intval($arr['orphan']),
|
||||
intval($arr['censored']),
|
||||
intval($arr['selfcensored']),
|
||||
intval($arr['system']),
|
||||
intval($arr['pubforum']),
|
||||
intval($arr['deleted']),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
if(! $r)
|
||||
|
|
|
@ -99,7 +99,7 @@ function create_sys_channel() {
|
|||
'name' => 'System',
|
||||
'pageflags' => PAGE_SYSTEM,
|
||||
'publish' => 0,
|
||||
'xchanflags' => XCHAN_FLAGS_SYSTEM
|
||||
'system' => 1
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ function create_identity($arr) {
|
|||
|
||||
$name = escape_tags($arr['name']);
|
||||
$pageflags = ((x($arr,'pageflags')) ? intval($arr['pageflags']) : PAGE_NORMAL);
|
||||
$xchanflags = ((x($arr,'xchanflags')) ? intval($arr['xchanflags']) : XCHAN_FLAGS_NORMAL);
|
||||
$system = ((x($arr,'system')) ? intval($arr['system']) : 0);
|
||||
$name_error = validate_channelname($arr['name']);
|
||||
if($name_error) {
|
||||
$ret['message'] = $name_error;
|
||||
|
@ -312,7 +312,7 @@ function create_identity($arr) {
|
|||
|
||||
$newuid = $ret['channel']['channel_id'];
|
||||
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, 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)",
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_system ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
|
||||
dbesc($hash),
|
||||
dbesc($guid),
|
||||
dbesc($sig),
|
||||
|
@ -328,7 +328,7 @@ function create_identity($arr) {
|
|||
dbesc('zot'),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($xchanflags)
|
||||
intval($system)
|
||||
);
|
||||
|
||||
// Not checking return value.
|
||||
|
|
|
@ -340,14 +340,12 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
|
|||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||
and xlink_xchan != ''
|
||||
and not ( xchan_flags & %d )>0
|
||||
and not ( xchan_flags & %d )>0
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval(XCHAN_FLAGS_HIDDEN),
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
intval($limit),
|
||||
intval($start)
|
||||
);
|
||||
|
@ -360,13 +358,11 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
|
|||
where xlink_xchan = ''
|
||||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||
and not ( xchan_flags & %d )>0
|
||||
and not ( xchan_flags & %d )>0
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval(XCHAN_FLAGS_HIDDEN),
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
intval($limit),
|
||||
intval($start)
|
||||
);
|
||||
|
|
|
@ -728,20 +728,20 @@ function contact_block() {
|
|||
return;
|
||||
|
||||
$is_owner = ((local_user() && local_user() == $a->profile['uid']) ? true : false);
|
||||
$sql_extra = '';
|
||||
|
||||
$abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF;
|
||||
$xchan_flags = XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED;
|
||||
|
||||
if(! $is_owner) {
|
||||
$abook_flags = $abook_flags | ABOOK_FLAG_HIDDEN;
|
||||
$xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN;
|
||||
$sql_extra = " and xchan_hidden = 0 ";
|
||||
}
|
||||
|
||||
if((! is_array($a->profile)) || ($a->profile['hide_friends']))
|
||||
return $o;
|
||||
$r = q("SELECT COUNT(abook_id) 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(abook_id) 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(count($r)) {
|
||||
$total = intval($r[0]['total']);
|
||||
|
@ -755,10 +755,9 @@ function contact_block() {
|
|||
} else {
|
||||
$randfunc = 'RAND()';
|
||||
}
|
||||
$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 ORDER BY $randfunc LIMIT %d",
|
||||
$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 xchan_orphan = 0 and xchan_deleted = 0 $sql_extra ORDER BY $randfunc LIMIT %d",
|
||||
intval($a->profile['uid']),
|
||||
intval($abook_flags|ABOOK_FLAG_ARCHIVED),
|
||||
intval($xchan_flags),
|
||||
intval($shown)
|
||||
);
|
||||
|
||||
|
|
|
@ -705,43 +705,36 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
|
|||
|
||||
$hidden = (1 - intval($arr['searchable']));
|
||||
|
||||
// Be careful - XCHAN_FLAGS_HIDDEN should evaluate to 1
|
||||
if(($r[0]['xchan_flags'] & XCHAN_FLAGS_HIDDEN) != $hidden)
|
||||
$new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_HIDDEN;
|
||||
else
|
||||
$new_flags = $r[0]['xchan_flags'];
|
||||
$hidden_changed = $adult_changed = $deleted_changed = $pubforum_changed = 0;
|
||||
|
||||
$adult = (($r[0]['xchan_flags'] & XCHAN_FLAGS_SELFCENSORED) ? true : false);
|
||||
$adult_changed = ((intval($adult) != intval($arr['adult_content'])) ? true : false);
|
||||
if($adult_changed)
|
||||
$new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED;
|
||||
|
||||
$deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false);
|
||||
$deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false);
|
||||
if($deleted_changed)
|
||||
$new_flags = $new_flags ^ XCHAN_FLAGS_DELETED;
|
||||
|
||||
$public_forum = (($r[0]['xchan_flags'] & XCHAN_FLAGS_PUBFORUM) ? true : false);
|
||||
$pubforum_changed = ((intval($public_forum) != intval($arr['public_forum'])) ? true : false);
|
||||
if($pubforum_changed)
|
||||
$new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_PUBFORUM;
|
||||
if(intval($r[0]['xchan_hidden']) != (1 - intval($arr['searchable'])))
|
||||
$hidden_changed = 1;
|
||||
if(intval($r[0]['xchan_selfcensored']) != intval($arr['adult_content']))
|
||||
$adult_changed = 1;
|
||||
if(intval($r[0]['xchan_deleted']) != intval($arr['deleted']))
|
||||
$deleted_changed = 1;
|
||||
if(intval($r[0]['xchan_pubforum']) != intval($arr['public_forum']))
|
||||
$pubforum_changed = 1;
|
||||
|
||||
if(($r[0]['xchan_name_date'] != $arr['name_updated'])
|
||||
|| ($r[0]['xchan_connurl'] != $arr['connections_url'])
|
||||
|| ($r[0]['xchan_flags'] != $new_flags)
|
||||
|| ($r[0]['xchan_addr'] != $arr['address'])
|
||||
|| ($r[0]['xchan_follow'] != $arr['follow_url'])
|
||||
|| ($r[0]['xchan_connpage'] != $arr['connect_url'])
|
||||
|| ($r[0]['xchan_url'] != $arr['url'])) {
|
||||
|| ($r[0]['xchan_url'] != $arr['url'])
|
||||
|| $hidden_changed || adult_changed || deleted_changed || $pubforum_changed ) {
|
||||
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_connurl = '%s', xchan_follow = '%s',
|
||||
xchan_connpage = '%s', xchan_flags = %d,
|
||||
xchan_connpage = '%s', xchan_hidden = %d, xchan_selfcensored = %d, xchan_deleted = %d, xchan_pubforum = %d,
|
||||
xchan_addr = '%s', xchan_url = '%s' where xchan_hash = '%s'",
|
||||
dbesc(($arr['name']) ? $arr['name'] : '-'),
|
||||
dbesc($arr['name_updated']),
|
||||
dbesc($arr['connections_url']),
|
||||
dbesc($arr['follow_url']),
|
||||
dbesc($arr['connect_url']),
|
||||
intval($new_flags),
|
||||
intval(1 - intval($arr['searchable'])),
|
||||
intval($arr['adult_content']),
|
||||
intval($arr['deleted']),
|
||||
intval($arr['public_forum']),
|
||||
dbesc($arr['address']),
|
||||
dbesc($arr['url']),
|
||||
dbesc($xchan_hash)
|
||||
|
@ -761,20 +754,9 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
|
|||
&& ($arr['site']['url'] != z_root()))
|
||||
$arr['searchable'] = false;
|
||||
|
||||
$hidden = (1 - intval($arr['searchable']));
|
||||
|
||||
if($hidden)
|
||||
$new_flags = XCHAN_FLAGS_HIDDEN;
|
||||
else
|
||||
$new_flags = 0;
|
||||
if($arr['adult_content'])
|
||||
$new_flags |= XCHAN_FLAGS_SELFCENSORED;
|
||||
if(array_key_exists('deleted',$arr) && $arr['deleted'])
|
||||
$new_flags |= XCHAN_FLAGS_DELETED;
|
||||
|
||||
$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_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_hidden, xchan_selfcensored, xchan_deleted, xchan_pubforum, )
|
||||
values ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d) ",
|
||||
dbesc($xchan_hash),
|
||||
dbesc($arr['guid']),
|
||||
dbesc($arr['guid_sig']),
|
||||
|
@ -790,7 +772,10 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
|
|||
dbesc('zot'),
|
||||
dbescdate($arr['photo_updated']),
|
||||
dbescdate($arr['name_updated']),
|
||||
intval($new_flags)
|
||||
intval(1 - intval($arr['searchable'])),
|
||||
intval($arr['adult_content']),
|
||||
intval($arr['deleted']),
|
||||
intval($arr['public_forum'])
|
||||
);
|
||||
|
||||
$what .= 'new_xchan';
|
||||
|
@ -1433,11 +1418,11 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
|
|||
if(($channel['channel_pageflags'] & PAGE_SYSTEM) && (! $arr['item_private'])) {
|
||||
$local_public = true;
|
||||
|
||||
$r = q("select xchan_flags from xchan where xchan_hash = '%s' limit 1",
|
||||
$r = q("select xchan_selfcensored from xchan where xchan_hash = '%s' limit 1",
|
||||
dbesc($sender['hash'])
|
||||
);
|
||||
// don't import sys channel posts from selfcensored authors
|
||||
if($r && ($r[0]['xchan_flags'] & XCHAN_FLAGS_SELFCENSORED)) {
|
||||
if($r && (intval($r[0]['xchan_selfcensored']))) {
|
||||
$local_public = false;
|
||||
continue;
|
||||
}
|
||||
|
@ -1890,9 +1875,7 @@ function sync_locations($sender,$arr,$absolute = false) {
|
|||
intval($r[0]['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($sender['hash'])
|
||||
);
|
||||
}
|
||||
|
@ -2078,8 +2061,7 @@ function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_
|
|||
|
||||
|
||||
if(in_arrayi('nsfw',$clean) || in_arrayi('adult',$clean)) {
|
||||
q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_SELFCENSORED),
|
||||
q("update xchan set xchan_selfcensored = 1 where xchan_hash = '%s'",
|
||||
dbesc($hash)
|
||||
);
|
||||
}
|
||||
|
|
30
mod/acl.php
30
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') {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'])
|
||||
);
|
||||
|
|
|
@ -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) . " ) ";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
10
mod/ping.php
10
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();
|
||||
|
|
16
mod/post.php
16
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'])
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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'])
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue