diff options
author | Mario <mario@mariovavti.com> | 2021-05-26 12:18:59 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-26 12:18:59 +0000 |
commit | 1fa4bc9ac024983d4748262f98c6ddf323ad327c (patch) | |
tree | 807e3253255a8a24ded4ff81dd9313b37fb6e4cb | |
parent | b742910107720797b05ec69ae626b420699e0630 (diff) | |
download | volse-hubzilla-1fa4bc9ac024983d4748262f98c6ddf323ad327c.tar.gz volse-hubzilla-1fa4bc9ac024983d4748262f98c6ddf323ad327c.tar.bz2 volse-hubzilla-1fa4bc9ac024983d4748262f98c6ddf323ad327c.zip |
remove most legacy zot quirks
-rw-r--r-- | Zotlabs/Daemon/Onedirsync.php | 2 | ||||
-rw-r--r-- | Zotlabs/Daemon/Onepoll.php | 10 | ||||
-rw-r--r-- | Zotlabs/Daemon/Poller.php | 11 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Apps.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Connect.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Connedit.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Fhublocs.php | 17 | ||||
-rw-r--r-- | Zotlabs/Module/Import.php | 59 | ||||
-rw-r--r-- | include/bookmarks.php | 2 | ||||
-rw-r--r-- | include/channel.php | 60 | ||||
-rw-r--r-- | include/connections.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | include/import.php | 2 | ||||
-rw-r--r-- | include/items.php | 2 | ||||
-rw-r--r-- | include/network.php | 25 | ||||
-rw-r--r-- | include/permissions.php | 4 | ||||
-rw-r--r-- | include/socgraph.php | 40 | ||||
-rw-r--r-- | include/text.php | 2 | ||||
-rw-r--r-- | include/xchan.php | 7 | ||||
-rw-r--r-- | include/zid.php | 2 |
21 files changed, 42 insertions, 224 deletions
diff --git a/Zotlabs/Daemon/Onedirsync.php b/Zotlabs/Daemon/Onedirsync.php index f29fbe5b8..01879a470 100644 --- a/Zotlabs/Daemon/Onedirsync.php +++ b/Zotlabs/Daemon/Onedirsync.php @@ -72,7 +72,7 @@ class Onedirsync { // we might have to pull this out some day, but for now update_directory_entry() // runs zot_finger() and is kind of zot specific - if ($h && !in_array($h['hubloc_network'], ['zot6', 'zot'])) + if ($h && $h['hubloc_network'] !== 'zot6') return; Libzotdir::update_directory_entry($r[0]); diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index d747e65f3..0fd695e17 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -75,16 +75,12 @@ class Onepoll { return; } - if (!in_array($contact['xchan_network'], ['zot', 'zot6'])) + if ($contact['xchan_network'] !== 'zot6')) return; // update permissions - if ($contact['xchan_network'] === 'zot6') - $x = Libzot::refresh($contact, $importer); - - if ($contact['xchan_network'] === 'zot') - $x = zot_refresh($contact, $importer); + $x = Libzot::refresh($contact, $importer); $responded = false; $updated = datetime_convert(); @@ -125,7 +121,7 @@ class Onepoll { if (!$can_send_stream) $fetch_feed = false; - if ($fetch_feed && $contact['xchan_network'] !== 'zot') { + if ($fetch_feed) { $max = intval(get_config('system', 'max_imported_posts', 30)); diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 762f1349c..88213a7c9 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -69,11 +69,11 @@ class Poller { abook.abook_channel, abook.abook_id, abook.abook_archived, abook.abook_pending, abook.abook_ignored, abook.abook_blocked, xchan.xchan_network, - account.account_lastlog, account.account_flags - FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash + account.account_lastlog, account.account_flags + FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash LEFT JOIN account on abook_account = account_id where abook_self = 0 - $sql_extra + $sql_extra AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY $randfunc", intval(ACCOUNT_OK), intval(ACCOUNT_UNVERIFIED) // FIXME @@ -102,8 +102,7 @@ class Poller { continue; } - - if (!in_array($contact['xchan_network'], ['zot', 'zot6'])) + if ($contact['xchan_network'] !== 'zot6') continue; if ($c == $t) { @@ -191,7 +190,7 @@ class Poller { set_config('system', 'lastpoll', datetime_convert()); - //All done - clear the lockfile + //All done - clear the lockfile @unlink($lockfile); diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 6e8344def..500e99ee8 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -3496,7 +3496,7 @@ class Activity { static function find_best_identity($xchan) { if (filter_var($xchan, FILTER_VALIDATE_URL)) { - $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' and hubloc_network in ('zot6', 'zot') and hubloc_deleted = 0", + $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' and hubloc_deleted = 0", dbesc($xchan) ); if ($r) { diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 5ef4ecc8d..bd51f0896 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -524,7 +524,7 @@ class Apps { } elseif(remote_channel()) { $observer = \App::get_observer(); - if($observer && in_array($observer['xchan_network'], ['zot6', 'zot'])) { + if($observer && $observer['xchan_network'] === 'zot6') { // some folks might have xchan_url redirected offsite, use the connurl $x = parse_url($observer['xchan_connurl']); if($x) { diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php index 21bec171b..38fe69995 100644 --- a/Zotlabs/Lib/Connect.php +++ b/Zotlabs/Lib/Connect.php @@ -146,7 +146,7 @@ class Connect { } - $allowed = ((in_array($xchan['xchan_network'],['rss','zot','zot6'])) ? 1 : 0); + $allowed = ((in_array($xchan['xchan_network'],['rss', 'zot6'])) ? 1 : 0); $hookdata = ['channel_id' => $uid, 'follow_address' => $url, 'xchan' => $xchan, 'allowed' => $allowed, 'singleton' => 0]; call_hooks('follow_allow',$hookdata); diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 44211c8b9..61fe4a889 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -478,16 +478,11 @@ class Connedit extends Controller { } if($cmd === 'refresh') { - if($orig_record[0]['xchan_network'] === 'zot') { - if(! zot_refresh($orig_record[0],App::get_channel())) - notice( t('Refresh failed - channel is currently unavailable.') ); - } - elseif($orig_record[0]['xchan_network'] === 'zot6') { + if($orig_record[0]['xchan_network'] === 'zot6') { if(! Libzot::refresh($orig_record[0],App::get_channel())) notice( t('Refresh failed - channel is currently unavailable.') ); } else { - // if you are on a different network we'll force a refresh of the connection basic info Master::Summon(array('Notifier','permission_update',$contact_id)); } @@ -667,7 +662,7 @@ class Connedit extends Controller { ); - if(in_array($contact['xchan_network'], ['zot6', 'zot'])) { + if($contact['xchan_network'] === 'zot6') { $tools['fetchvc'] = [ 'label' => t('Fetch Vcard'), 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/fetchvc', @@ -841,7 +836,7 @@ class Connedit extends Controller { $locstr = unpunify($contact['xchan_url']); $clone_warn = ''; - $clonable = (in_array($contact['xchan_network'],['zot', 'zot6', 'rss']) ? true : false); + $clonable = (in_array($contact['xchan_network'], ['zot6', 'rss']); if(! $clonable) { $clone_warn = '<strong>'; $clone_warn .= ((intval($contact['abook_not_here'])) diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php index 42dac5b12..4918f751b 100644 --- a/Zotlabs/Module/Fhublocs.php +++ b/Zotlabs/Module/Fhublocs.php @@ -59,23 +59,6 @@ class Fhublocs extends \Zotlabs\Web\Controller { // Create a verified hub location pointing to this site. -/* - $h = hubloc_store_lowlevel( - [ - 'hubloc_guid' => $rr['channel_guid'], - 'hubloc_guid_sig' => $rr['channel_guid_sig'], - 'hubloc_hash' => $rr['channel_hash'], - 'hubloc_addr' => channel_reddress($rr), - 'hubloc_network' => 'zot', - 'hubloc_primary' => $primary, - 'hubloc_url' => z_root(), - 'hubloc_url_sig' => base64url_encode(Crypto::sign(z_root(),$rr['channel_prvkey'])), - 'hubloc_host' => \App::get_hostname(), - 'hubloc_callback' => z_root() . '/post', - 'hubloc_sitekey' => $sitekey - ] - ); -*/ $h = hubloc_store_lowlevel( [ 'hubloc_guid' => $rr['channel_guid'], diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 4622a588d..76d4fa733 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -212,35 +212,8 @@ class Import extends \Zotlabs\Web\Controller { // create new hubloc for the new channel at this site if(array_key_exists('channel',$data)) { - if($channel['channel_portable_id']) { - $r = hubloc_store_lowlevel( - [ - 'hubloc_guid' => $channel['channel_guid'], - 'hubloc_guid_sig' => $channel['channel_guid_sig'], - 'hubloc_hash' => $channel['channel_portable_id'], - 'hubloc_addr' => channel_reddress($channel), - 'hubloc_network' => 'zot', - 'hubloc_primary' => (($seize) ? 1 : 0), - 'hubloc_url' => z_root(), - 'hubloc_url_sig' => base64url_encode(Crypto::sign(z_root(),$channel['channel_prvkey'])), - 'hubloc_host' => \App::get_hostname(), - 'hubloc_callback' => z_root() . '/post', - 'hubloc_sitekey' => get_config('system','pubkey'), - 'hubloc_updated' => datetime_convert(), - 'hubloc_id_url' => channel_url($channel) - ] - ); - // reset the original primary hubloc if it is being seized - if($seize) { - $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", - dbesc($channel['channel_portable_id']), - dbesc(z_root()) - ); - } - } - - // create a new zot6 hubloc if we have got a channel_portable_id + // create a new zot6 hubloc $r = hubloc_store_lowlevel( [ @@ -285,28 +258,6 @@ class Import extends \Zotlabs\Web\Controller { dbesc($channel['channel_portable_id']) ); - if($channel['channel_portable_id']) { - $r = xchan_store_lowlevel( - [ - 'xchan_hash' => $channel['channel_portable_id'], - 'xchan_guid' => $channel['channel_guid'], - 'xchan_guid_sig' => $channel['channel_guid_sig'], - 'xchan_pubkey' => $channel['channel_pubkey'], - 'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'], - 'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'], - 'xchan_photo_s' => z_root() . "/photo/profile/s/" . $channel['channel_id'], - 'xchan_addr' => channel_reddress($channel), - 'xchan_url' => z_root() . '/channel/' . $channel['channel_address'], - 'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'], - 'xchan_follow' => z_root() . '/follow?f=&url=%s', - 'xchan_name' => $channel['channel_name'], - 'xchan_network' => 'zot', - 'xchan_photo_date' => datetime_convert(), - 'xchan_name_date' => datetime_convert() - ] - ); - } - $r = xchan_store_lowlevel( [ 'xchan_hash' => $channel['channel_hash'], @@ -336,14 +287,6 @@ class Import extends \Zotlabs\Web\Controller { if($xchans) { foreach($xchans as $xchan) { - if($xchan['xchan_network'] === 'zot') { - $hash = make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_guid_sig']); - if($hash !== $xchan['xchan_hash']) { - logger('forged xchan: ' . print_r($xchan,true)); - continue; - } - } - if($xchan['xchan_network'] === 'zot6') { $zhash = Libzot::make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_pubkey']); if($zhash !== $xchan['xchan_hash']) { diff --git a/include/bookmarks.php b/include/bookmarks.php index 207cf5a33..95043ae89 100644 --- a/include/bookmarks.php +++ b/include/bookmarks.php @@ -68,7 +68,7 @@ function bookmark_add($channel,$sender,$taxonomy,$private,$opts = null) { function get_bookmark_link($observer) { - if((! $observer) || !in_array($observer['xchan_network'], ['zot6', 'zot'])) + if(!$observer || $observer['xchan_network'] !== 'zot6') return ''; $h = @parse_url($observer['xchan_url']); diff --git a/include/channel.php b/include/channel.php index 804d8c63a..085aa5ea5 100644 --- a/include/channel.php +++ b/include/channel.php @@ -275,7 +275,7 @@ function create_identity($arr) { 'channel_guid' => $guid, 'channel_guid_sig' => $sig, 'channel_hash' => $hash, - 'channel_portable_id' => $zhash, + 'channel_portable_id' => '', 'channel_prvkey' => $key['prvkey'], 'channel_pubkey' => $key['pubkey'], 'channel_pageflags' => intval($pageflags), @@ -340,26 +340,6 @@ function create_identity($arr) { $r = hubloc_store_lowlevel( [ 'hubloc_guid' => $guid, - 'hubloc_guid_sig' => $zsig, - 'hubloc_hash' => $zhash, - 'hubloc_id_url' => channel_url($ret['channel']), - 'hubloc_addr' => channel_reddress($ret['channel']), - 'hubloc_primary' => intval($primary), - 'hubloc_url' => z_root(), - 'hubloc_url_sig' => base64url_encode(Crypto::sign(z_root(),$ret['channel']['channel_prvkey'])), - 'hubloc_host' => App::get_hostname(), - 'hubloc_callback' => z_root() . '/post', - 'hubloc_sitekey' => get_config('system','pubkey'), - 'hubloc_network' => 'zot', - 'hubloc_updated' => datetime_convert() - ] - ); - if(! $r) - logger('Unable to store hub location (zot)'); - - $r = hubloc_store_lowlevel( - [ - 'hubloc_guid' => $guid, 'hubloc_guid_sig' => $sig, 'hubloc_hash' => $hash, 'hubloc_id_url' => channel_url($ret['channel']), @@ -383,30 +363,6 @@ function create_identity($arr) { $r = xchan_store_lowlevel( [ - 'xchan_hash' => $zhash, - 'xchan_guid' => $guid, - 'xchan_guid_sig' => $zsig, - 'xchan_pubkey' => $key['pubkey'], - 'xchan_photo_mimetype' => (($photo_type) ? $photo_type : 'image/png'), - 'xchan_photo_l' => z_root() . "/photo/profile/l/{$newuid}", - 'xchan_photo_m' => z_root() . "/photo/profile/m/{$newuid}", - 'xchan_photo_s' => z_root() . "/photo/profile/s/{$newuid}", - 'xchan_addr' => channel_reddress($ret['channel']), - 'xchan_url' => z_root() . '/channel/' . $ret['channel']['channel_address'], - 'xchan_follow' => z_root() . '/follow?f=&url=%s', - 'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'], - 'xchan_name' => $ret['channel']['channel_name'], - 'xchan_network' => 'zot', - 'xchan_photo_date' => datetime_convert(), - 'xchan_name_date' => datetime_convert(), - 'xchan_system' => $system - ] - ); - if(! $r) - logger('Unable to store xchan (zot)'); - - $r = xchan_store_lowlevel( - [ 'xchan_hash' => $hash, 'xchan_guid' => $guid, 'xchan_guid_sig' => $sig, @@ -981,12 +937,6 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals } - // pick up the zot xchan and hublocs also - - if($ret['channel']['channel_portable_id'] && ! $zot_compat) { - $xchans[] = $ret['channel']['channel_portable_id']; - } - stringify_array_elms($xchans); } @@ -2936,9 +2886,8 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { logger('deleting hublocs',LOGGER_DEBUG); - $r = q("UPDATE hubloc SET hubloc_deleted = 1 WHERE (hubloc_hash = '%s' OR hubloc_hash = '%s') AND hubloc_url = '%s' ", + $r = q("UPDATE hubloc SET hubloc_deleted = 1 WHERE hubloc_hash = '%s' AND hubloc_url = '%s' ", dbesc($channel['channel_hash']), - dbesc($channel['channel_portable_id']), dbesc(z_root()) ); @@ -2953,9 +2902,8 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { $hublocs = count($r); if(! $hublocs) { - $r = q("UPDATE xchan SET xchan_deleted = 1 WHERE xchan_hash = '%s' OR xchan_hash = '%s'", - dbesc($channel['channel_hash']), - dbesc($channel['channel_portable_id']) + $r = q("UPDATE xchan SET xchan_deleted = 1 WHERE xchan_hash = '%s'", + dbesc($channel['channel_hash']) ); } diff --git a/include/connections.php b/include/connections.php index 87db7faa9..a1b27e301 100644 --- a/include/connections.php +++ b/include/connections.php @@ -212,7 +212,7 @@ function mark_orphan_hubsxchans() { return; $r = q("UPDATE hubloc SET hubloc_error = 1 WHERE hubloc_error = 0 - AND hubloc_network IN ('zot6', 'zot') AND hubloc_connected < %s - INTERVAL %s", + AND hubloc_network = 'zot6' AND hubloc_connected < %s - INTERVAL %s", db_utcnow(), db_quoteinterval('36 day') ); diff --git a/include/conversation.php b/include/conversation.php index 04aa1ef5a..9fc70c511 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1022,8 +1022,6 @@ function author_is_pmable($xchan, $abook) { if($x['result'] !== 'unset') return $x['result']; - if($xchan['xchan_network'] === 'zot' && get_observer_hash()) - return true; return false; } diff --git a/include/import.php b/include/import.php index 379789109..022440676 100644 --- a/include/import.php +++ b/include/import.php @@ -778,7 +778,7 @@ function sync_items($channel, $items, $relocate = null) { // to avoid confusing with cloned channels $size = count($items); for($i = 0; $i < $size; $i++) { - if(($items[$i]['owner']['network'] != 'zot') && ($items[$i]['owner']['network'] != 'zot6')) { + if($items[$i]['owner']['network'] !== 'zot6') { $r = q("SELECT * FROM abook WHERE abook_channel = %d AND abook_xchan = ( SELECT xchan_hash FROM xchan WHERE xchan_guid = '%s' LIMIT 1 ) AND abook_not_here = 0 AND abook_ignored = 0 AND abook_blocked = 0", diff --git a/include/items.php b/include/items.php index a45a266a7..2ee259e51 100644 --- a/include/items.php +++ b/include/items.php @@ -132,7 +132,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { case 'sit': case 'any': case 'con': - if(!in_array($rr['xchan_network'], ['zot6', 'zot'])) + if($rr['xchan_network'] !== 'zot6') break; case 'pub': case '': diff --git a/include/network.php b/include/network.php index 77b7c49d6..194b50885 100644 --- a/include/network.php +++ b/include/network.php @@ -1159,31 +1159,6 @@ function discover_by_webbie($webbie, $protocol = '') { } } } - - foreach($x['links'] as $link) { - if(array_key_exists('rel',$link)) { - - // If we discover zot - don't search further; grab the info and get out of - // here. - - if($link['rel'] === PROTOCOL_ZOT && ((! $protocol) || (strtolower($protocol) === 'zot'))) { - logger('zot found for ' . $webbie, LOGGER_DEBUG); - if(array_key_exists('zot',$x) && $x['zot']['success']) { - $i = import_xchan($x['zot']); - return true; - } - else { - $z = z_fetch_url($link['href']); - if($z['success']) { - $j = json_decode($z['body'],true); - $i = import_xchan($j); - return true; - } - } - } - } - } - } logger('webfinger: ' . print_r($x,true), LOGGER_DATA, LOG_INFO); diff --git a/include/permissions.php b/include/permissions.php index 9dd503132..33b385490 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -157,7 +157,7 @@ function get_all_perms($uid, $observer_xchan, $check_siteblock = true, $default_ // If we're still here, we have an observer, check the network. if($channel_perm & PERMS_NETWORK) { - if($x && in_array($x[0]['xchan_network'],[ 'zot','zot6'])) { + if($x && $x[0]['xchan_network'] === 'zot6') { $ret[$perm_name] = true; continue; } @@ -366,7 +366,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock = // If we're still here, we have an observer, check the network. if($channel_perm & PERMS_NETWORK) { - if ($x && in_array($x[0]['xchan_network'], ['zot','zot6'])) + if ($x && $x[0]['xchan_network'] === 'zot6') return true; } diff --git a/include/socgraph.php b/include/socgraph.php index aaea4550c..03681ff57 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -24,7 +24,7 @@ require_once('include/zot.php'); * * Once the global contact is stored add (if necessary) the contact linkage which associates * the given uid, cid to the global contact entry. There can be many uid/cid combinations - * pointing to the same global contact id. + * pointing to the same global contact id. * * @param string $xchan * @param string $url @@ -127,14 +127,14 @@ function poco_load($xchan = '', $url = null) { $profile_url = $url['value']; continue; } - if(in_array($url['type'], ['zot','zot6'] )) { + if($url['type'] === 'zot6') { $network = $url['type']; $address = str_replace('acct:' , '', $url['value']); continue; } } } - if(x($entry,'photos') && is_array($entry['photos'])) { + if(x($entry,'photos') && is_array($entry['photos'])) { foreach($entry['photos'] as $photo) { if($photo['type'] == 'profile') { $profile_photo = $photo['value']; @@ -145,7 +145,7 @@ function poco_load($xchan = '', $url = null) { if((! $name) || (! $profile_url) || (! $profile_photo) || (! $hash) || (! $address)) { logger('poco_load: missing data'); - continue; + continue; } $x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", @@ -168,18 +168,6 @@ function poco_load($xchan = '', $url = null) { continue; } } - if($network === 'zot') { - $j = Zotlabs\Zot\Finger::run($address,null); - if($j['success']) { - import_xchan($j); - } - $x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", - dbesc($hash) - ); - if(! $x) { - continue; - } - } } else { continue; @@ -242,7 +230,7 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false if($shuffle) $sql_extra = " order by $rand "; else - $sql_extra = " order by xchan_name asc "; + $sql_extra = " order by xchan_name asc "; $r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in (select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 ) $sql_extra limit %d offset %d", @@ -329,8 +317,8 @@ function update_suggestions() { if($ret['success']) { // We will grab fresh data once a day via the poller. Remove anything over a week old because - // the targets may have changed their preferences and don't want to be suggested - and they - // may have simply gone away. + // the targets may have changed their preferences and don't want to be suggested - and they + // may have simply gone away. $r = q("delete from xlink where xlink_xchan = '' and xlink_updated < %s - INTERVAL %s and xlink_static = 0", db_utcnow(), db_quoteinterval('7 DAY') @@ -413,11 +401,11 @@ function poco($a,$extended = false) { $sql_extra = sprintf(" and abook_id = %d and abook_hidden = 0 and abook_pending = 0 ",intval($cid)); if($system_mode) { - $r = q("SELECT count(*) as total from abook where abook_self = 1 + $r = q("SELECT count(*) as total from abook where abook_self = 1 and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') "); } else { - $r = q("SELECT count(*) as total from abook where abook_channel = %d + $r = q("SELECT count(*) as total from abook where abook_channel = %d $sql_extra ", intval($channel_id) ); @@ -437,14 +425,14 @@ function poco($a,$extended = false) { $itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults); if($system_mode) { - $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1 - and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') + $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1 + and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') limit %d offset %d ", intval($itemsPerPage), intval($startIndex) ); } else { - $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d + $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $sql_extra LIMIT %d OFFSET %d", intval($channel_id), intval($itemsPerPage), @@ -513,7 +501,7 @@ function poco($a,$extended = false) { $entry['urls'] = array(array('value' => $rr['xchan_url'], 'type' => 'profile')); $network = $rr['xchan_network']; if($rr['xchan_addr']) - $entry['urls'][] = array('value' => 'acct:' . $rr['xchan_addr'], 'type' => $network); + $entry['urls'][] = array('value' => 'acct:' . $rr['xchan_addr'], 'type' => $network); } if($fields_ret['preferredUsername']) $entry['preferredUsername'] = substr($rr['xchan_addr'],0,strpos($rr['xchan_addr'],'@')); @@ -536,7 +524,7 @@ function poco($a,$extended = false) { if($format === 'json') { header('Content-type: application/json'); echo json_encode($ret); - killme(); + killme(); } else http_status_exit(500); diff --git a/include/text.php b/include/text.php index d2ab8bc72..35a65bcfb 100644 --- a/include/text.php +++ b/include/text.php @@ -2067,7 +2067,7 @@ function get_plink($item,$conversation_mode = true) { $zidify = true; - if(array_key_exists('author',$item) && in_array($item['author']['xchan_network'], ['zot6', 'zot']) === false) + if(array_key_exists('author',$item) && $item['author']['xchan_network'] !== 'zot6') $zidify = false; if(x($item,$key)) { diff --git a/include/xchan.php b/include/xchan.php index 07fdb8b47..a32064303 100644 --- a/include/xchan.php +++ b/include/xchan.php @@ -85,13 +85,6 @@ function xchan_store($arr) { } } - if($arr['network'] === 'zot') { - if((! $arr['key']) || (! Crypto::verify($arr['guid'],base64url_decode($arr['guid_sig']),$arr['key']))) { - logger('Unable to verify signature for ' . $arr['hash']); - return false; - } - } - $columns = db_columns('xchan'); $x = []; diff --git a/include/zid.php b/include/zid.php index 0a33280ee..422683c95 100644 --- a/include/zid.php +++ b/include/zid.php @@ -14,7 +14,7 @@ function is_matrix_url($url) { if(array_key_exists($m['host'],$remembered)) return $remembered[$m['host']]; - $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network in ('zot', 'zot6') limit 1", + $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network = 'zot6' limit 1", dbesc($m['host']) ); if($r) { |