diff options
author | friendica <info@friendica.com> | 2014-08-16 16:10:35 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-08-16 16:10:35 -0700 |
commit | 20bdcb037f29824bcb0c8307526c0e95baa7b360 (patch) | |
tree | e31463bebab395d507b88d73a590caf71df3c780 /include | |
parent | ba0bf596b58440c0e50142565d7ec77838be95cc (diff) | |
download | volse-hubzilla-20bdcb037f29824bcb0c8307526c0e95baa7b360.tar.gz volse-hubzilla-20bdcb037f29824bcb0c8307526c0e95baa7b360.tar.bz2 volse-hubzilla-20bdcb037f29824bcb0c8307526c0e95baa7b360.zip |
provide backend storage and declaration of directory realm
Diffstat (limited to 'include')
-rwxr-xr-x | include/diaspora.php | 34 | ||||
-rw-r--r-- | include/zot.php | 7 |
2 files changed, 14 insertions, 27 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index bd810710e..4fe8e6b54 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -116,29 +116,15 @@ function diaspora_handle_from_contact($contact_id) { ); if($r) { $contact = $r[0]; - -//fixme -// logger("diaspora_handle_from_contact: contact 'self' = " . $contact['self'] . " 'url' = " . $contact['url'], LOGGER_DEBUG); - - if($contact['xchan_network'] === 'diaspora') { - $handle = $contact['addr']; - -// logger("diaspora_handle_from_contact: contact id is a Diaspora person, handle = " . $handle, LOGGER_DEBUG); - } - elseif(($contact['xchan_network'] === 'zot') || ($contact['abook_flags'] & ABOOK_FLAG_SELF)) { - $handle = $contact['xchan_addr']; - - -// logger("diaspora_handle_from_contact: contact id is a redmatrix person, handle = " . $handle, LOGGER_DEBUG); - } } - + $handle = $contact['xchan_addr']; return $handle; } function diaspora_get_contact_by_handle($uid,$handle) { - $r = q("SELECT * FROM xchan where xchan_addr = '%s' limit 1", - dbesc($handle) + $r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan where xchan_addr = '%s' and abook_channel = %d limit 1", + dbesc($handle), + intval($uid) ); if($r) return $r[0]; @@ -155,11 +141,10 @@ function find_diaspora_person_by_handle($handle) { $maxloops = 10; do { - $r = q("select * from fcontact where network = '%s' and addr = '%s' limit 1", - dbesc(NETWORK_DIASPORA), + $r = q("select * from xchan where xchan_addr = '%s' limit 1", dbesc($handle) ); - if(count($r)) { + if($r) { $person = $r[0]; logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DEBUG); @@ -559,7 +544,7 @@ function diaspora_request($importer,$xml) { if(! $sender_handle || ! $recipient_handle) return; - $contact = diaspora_get_contact_by_handle($importer['uid'],$sender_handle); + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$sender_handle); if($contact) { @@ -643,7 +628,6 @@ function diaspora_request($importer,$xml) { $batch = (($ret['batch']) ? $ret['batch'] : implode('/', array_slice(explode('/',$ret['url']),0,3)) . '/receive/public'); - $r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`) VALUES ( %d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ", intval($importer['uid']), @@ -779,7 +763,7 @@ function diaspora_post($importer,$xml,$msg) { return 202; } - $contact = diaspora_get_contact_by_handle($importer['uid'],$diaspora_handle); + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); if(! $contact) return; @@ -1211,7 +1195,7 @@ function diaspora_comment($importer,$xml,$msg) { $parent_author_signature = (($xml->parent_author_signature) ? notags(unxmlify($xml->parent_author_signature)) : ''); - $contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']); + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); if(! $contact) { logger('diaspora_comment: cannot find contact: ' . $msg['author']); return; diff --git a/include/zot.php b/include/zot.php index 3a533a9e0..bd9526f2d 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2016,6 +2016,7 @@ function import_site($arr,$pubkey) { $url = htmlspecialchars($arr['url'],ENT_COMPAT,'UTF-8',false); $sellpage = htmlspecialchars($arr['sellpage'],ENT_COMPAT,'UTF-8',false); $site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false); + $site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false); if($exists) { if(($siterecord['site_flags'] != $site_directory) @@ -2023,13 +2024,14 @@ function import_site($arr,$pubkey) { || ($siterecord['site_directory'] != $directory_url) || ($siterecord['site_sellpage'] != $sellpage) || ($siterecord['site_location'] != $site_location) - || ($siterecord['site_register'] != $register_policy)) { + || ($siterecord['site_register'] != $register_policy) + || ($siterecord['site_realm'] != $site_realm)) { $update = true; // logger('import_site: input: ' . print_r($arr,true)); // logger('import_site: stored: ' . print_r($siterecord,true)); - $r = q("update site set site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s' + $r = q("update site set site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s' where site_url = '%s' limit 1", dbesc($site_location), intval($site_directory), @@ -2038,6 +2040,7 @@ function import_site($arr,$pubkey) { intval($register_policy), dbesc(datetime_convert()), dbesc($sellpage), + dbesc($site_realm), dbesc($url) ); if(! $r) { |