diff options
author | zotlabs <mike@macgirvin.com> | 2017-01-28 15:01:19 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-01-28 15:01:19 -0800 |
commit | 5aa0017e91cac135ef8b84c138becb09decb1d58 (patch) | |
tree | c44b5632ab4493bfc8731b7614e8ee66bf260bca /include/hubloc.php | |
parent | f90d5f3dc8b26d5a1fd3e44013385bda9a7361b2 (diff) | |
download | volse-hubzilla-5aa0017e91cac135ef8b84c138becb09decb1d58.tar.gz volse-hubzilla-5aa0017e91cac135ef8b84c138becb09decb1d58.tar.bz2 volse-hubzilla-5aa0017e91cac135ef8b84c138becb09decb1d58.zip |
provide lowlevel xchan storage function to ensure that all non-null rows are initialised
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/include/hubloc.php b/include/hubloc.php index 6f81ea31f..4da92ae72 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -176,110 +176,6 @@ function hubloc_mark_as_down($posturl) { } -function xchan_store($arr) { - - logger('xchan_store: ' . print_r($arr,true)); - - if(! $arr['hash']) - $arr['hash'] = $arr['guid']; - if(! $arr['hash']) - return false; - - $r = q("select * from xchan where xchan_hash = '%s' limit 1", - dbesc($arr['hash']) - ); - if($r) - return true; - - if(! $arr['network']) - $arr['network'] = 'unknown'; - if(! $arr['name']) - $arr['name'] = 'unknown'; - if(! $arr['url']) - $arr['url'] = z_root(); - if(! $arr['photo']) - $arr['photo'] = z_root() . '/' . get_default_profile_photo(); - - - if($arr['network'] === 'zot') { - if((! $arr['key']) || (! rsa_verify($arr['guid'],base64url_decode($arr['guid_sig']),$arr['key']))) { - logger('Unable to verify signature for ' . $arr['hash']); - return false; - } - } - - $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']), - dbesc($arr['pubkey']), - dbesc($arr['address']), - dbesc($arr['url']), - dbesc($arr['connurl']), - dbesc($arr['follow']), - dbesc($arr['connpage']), - dbesc($arr['name']), - dbesc($arr['network']), - dbesc($arr['instance_url']), - 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_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]), - dbesc($photos[1]), - dbesc($photos[2]), - dbesc($photos[3]), - dbesc($arr['hash']) - ); - return $r; - -} - - -function xchan_fetch($arr) { - - $key = ''; - if($arr['hash']) { - $key = 'xchan_hash'; - $v = $arr['hash']; - } - elseif($arr['guid']) { - $key = 'xchan_guid'; - $v = $arr['guid']; - } - elseif($arr['address']) { - $key = 'xchan_addr'; - $v = $arr['address']; - } - - if(! $key) - return false; - - $r = q("select * from xchan where $key = '$v' limit 1"); - if(! $r) - return false; - - $ret = array(); - foreach($r[0] as $k => $v) { - if($k === 'xchan_addr') - $ret['address'] = $v; - else - $ret[str_replace('xchan_','',$k)] = $v; - } - return $ret; -} - function ping_site($url) { |