diff options
-rwxr-xr-x | boot.php | 7 | ||||
-rwxr-xr-x | include/diaspora.php | 34 | ||||
-rw-r--r-- | include/zot.php | 7 | ||||
-rw-r--r-- | install/database.sql | 4 | ||||
-rw-r--r-- | install/update.php | 11 | ||||
-rw-r--r-- | mod/zfinger.php | 1 | ||||
-rw-r--r-- | version.inc | 2 |
7 files changed, 35 insertions, 31 deletions
@@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1121 ); +define ( 'DB_UPDATE_VERSION', 1122 ); define ( 'EOL', '<br />' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -2040,3 +2040,8 @@ function head_get_icon() { return $icon; } +function get_directory_realm() { + if($x = get_config('system','directory_realm')) + return $x; + return DIRECTORY_REALM; +}
\ No newline at end of file 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) { diff --git a/install/database.sql b/install/database.sql index eabd45d4c..2791f94be 100644 --- a/install/database.sql +++ b/install/database.sql @@ -945,13 +945,15 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_register` int(11) NOT NULL DEFAULT '0', `site_sellpage` char(255) NOT NULL DEFAULT '', `site_location` char(255) NOT NULL DEFAULT '', + `site_realm` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`site_url`), KEY `site_flags` (`site_flags`), KEY `site_update` (`site_update`), KEY `site_directory` (`site_directory`), KEY `site_register` (`site_register`), KEY `site_access` (`site_access`), - KEY `site_sellpage` (`site_sellpage`) + KEY `site_sellpage` (`site_sellpage`), + KEY `site_realm` (`site_realm`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `source` ( diff --git a/install/update.php b/install/update.php index 135aba674..bd4e043a0 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1121 ); +define( 'UPDATE_VERSION' , 1122 ); /** * @@ -1360,3 +1360,12 @@ ADD INDEX ( `public_policy` )"); } +function update_r1121() { + $r = q("ALTER TABLE `site` ADD `site_realm` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `site_realm` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + diff --git a/mod/zfinger.php b/mod/zfinger.php index d1493da03..cf8a3fda1 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -297,6 +297,7 @@ function zfinger_init(&$a) { $ret['site']['sitename'] = get_config('system','sitename'); $ret['site']['sellpage'] = get_config('system','sellpage'); $ret['site']['location'] = get_config('system','site_location'); + $ret['site']['realm'] = get_directory_realm(); } call_hooks('zot_finger',$ret); diff --git a/version.inc b/version.inc index 543b58c5f..652a04db0 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-08-15.768 +2014-08-16.769 |