aboutsummaryrefslogtreecommitdiffstats
path: root/include/hubloc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/hubloc.php')
-rw-r--r--include/hubloc.php49
1 files changed, 42 insertions, 7 deletions
diff --git a/include/hubloc.php b/include/hubloc.php
index a4efe1c75..674a3885f 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -96,8 +96,7 @@ function remove_obsolete_hublocs() {
? intval(get_config('system','delivery_interval')) : 2 );
foreach($r as $rr) {
- q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d",
- intval(HUBLOC_FLAGS_DELETED),
+ q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d",
intval($rr['hubloc_id'])
);
@@ -121,7 +120,7 @@ function hubloc_change_primary($hubloc) {
logger('no hubloc');
return false;
}
- if(! ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) {
+ if(! (intval($hubloc['hubloc_primary']))) {
logger('not primary: ' . $hubloc['hubloc_url']);
return false;
}
@@ -206,7 +205,7 @@ function xchan_store($arr) {
if(! $arr['photo'])
$arr['photo'] = z_root() . '/' . 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']),
@@ -219,13 +218,19 @@ 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)
return $r;
- $photos = import_profile_photo($arr['photo'],$arr['hash']);
+ $photos = import_xchan_photo($arr['photo'],$arr['hash']);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbesc(datetime_convert()),
dbesc($photos[0]),
@@ -270,4 +275,34 @@ function xchan_fetch($arr) {
$ret[str_replace('xchan_','',$k)] = $v;
}
return $ret;
-} \ No newline at end of file
+}
+
+
+
+function ping_site($url) {
+
+ $ret = array('success' => false);
+
+ $sys = get_sys_channel();
+
+ $m = zot_build_packet($sys,'ping');
+ $r = zot_zot($url . '/post',$m);
+ if(! $r['success']) {
+ $ret['message'] = 'no answer from ' . $url;
+ return $ret;
+ }
+ $packet_result = json_decode($r['body'],true);
+ if(! $packet_result['success']) {
+ $ret['message'] = 'packet failure from ' . $url;
+ return $ret;
+ }
+
+ if($packet_result['success']) {
+ $ret['success'] = true;
+ }
+ else {
+ $ret['message'] = 'unknown error from ' . $url;
+ }
+
+ return $ret;
+}