From 2c42daf6090ba8d0e3a50b8350ea5a3750891b68 Mon Sep 17 00:00:00 2001 From: Zot Date: Thu, 30 Jan 2020 20:06:15 +0100 Subject: z6 compat work --- Zotlabs/Lib/Libsync.php | 4 ++-- Zotlabs/Lib/Libzot.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index d93270bc5..b9e9bb38a 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -83,7 +83,7 @@ class Libsync { $info = (($packet) ? $packet : array()); $info['type'] = 'sync'; - $info['encoding'] = 'red'; // note: not zot, this packet is very platform specific + $info['encoding'] = 'hz'; // note: not zot, this packet is very platform specific $info['relocate'] = ['channel_address' => $channel['channel_address'], 'url' => z_root() ]; if(array_key_exists($uid,\App::$config) && array_key_exists('transient',\App::$config[$uid])) { @@ -144,7 +144,7 @@ class Libsync { foreach($synchubs as $hub) { $hash = random_string(); - $n = Libzot::build_packet($channel,'sync',$env_recips,json_encode($info),'red',$hub['hubloc_sitekey'],$hub['site_crypto']); + $n = Libzot::build_packet($channel,'sync',$env_recips,json_encode($info),'hz',$hub['hubloc_sitekey'],$hub['site_crypto']); Queue::insert(array( 'hash' => $hash, 'account_id' => $channel['channel_account_id'], diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index ad00aa97a..bb70dfbf2 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1277,7 +1277,12 @@ class Libzot { logger('Channel sync received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG); logger('Channel sync recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG); - $result = Libsync::process_channel_sync_delivery($env['sender'],$arr,$deliveries); + if ($env['encoding'] === 'hz') { + $result = Libsync::process_channel_sync_delivery($env['sender'],$arr,$deliveries); + } + else { + logger('sync packet type not supported.'); + } } } if ($result) { -- cgit v1.2.3 From 8ed3971ef05be4015b65c9a5b721954c7767ba22 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Thu, 30 Jan 2020 20:18:25 +0100 Subject: Prevent multiple database requests on name platform check --- Zotlabs/Lib/System.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 7bf1343bb..3f500486c 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -5,9 +5,14 @@ namespace Zotlabs\Lib; class System { static public function get_platform_name() { - if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('platform_name',\App::$config['system'])) - return \App::$config['system']['platform_name']; - return PLATFORM_NAME; + + if(! isset($platform_name)) { + if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('platform_name',\App::$config['system'])) + static $platform_name = \App::$config['system']['platform_name']; + else + static $platform_name = PLATFORM_NAME; + } + return $platform_name; } static public function get_site_name() { -- cgit v1.2.3 From 5e76318e44d682ce631aa575550ce666eff2ea79 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Thu, 30 Jan 2020 20:28:55 +0100 Subject: Update System.php --- Zotlabs/Lib/System.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 3f500486c..b66f66bce 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -6,11 +6,12 @@ class System { static public function get_platform_name() { - if(! isset($platform_name)) { + static $platform_name = ''; + if(empty($platform_name)) { if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('platform_name',\App::$config['system'])) - static $platform_name = \App::$config['system']['platform_name']; + $platform_name = \App::$config['system']['platform_name']; else - static $platform_name = PLATFORM_NAME; + $platform_name = PLATFORM_NAME; } return $platform_name; } -- cgit v1.2.3 From b37e5a426abee519f20a9cec557538bde3841ad8 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Thu, 30 Jan 2020 20:36:00 +0100 Subject: Update System.php --- Zotlabs/Lib/System.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index b66f66bce..3cc46fbda 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -5,8 +5,7 @@ namespace Zotlabs\Lib; class System { static public function get_platform_name() { - - static $platform_name = ''; + static $platform_name = ''; if(empty($platform_name)) { if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('platform_name',\App::$config['system'])) $platform_name = \App::$config['system']['platform_name']; -- cgit v1.2.3