From fefde9f37ad1ff7faf0570765012ab2c3d21a023 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 19 Nov 2017 18:24:56 +0100 Subject: [PATCH] baculum: Support sending config as serialized array for older version --- gui/baculum/protected/API/Pages/API/Config.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/baculum/protected/API/Pages/API/Config.php b/gui/baculum/protected/API/Pages/API/Config.php index 0ecdb0c842..f1c04d248c 100644 --- a/gui/baculum/protected/API/Pages/API/Config.php +++ b/gui/baculum/protected/API/Pages/API/Config.php @@ -36,7 +36,12 @@ class Config extends BaculumAPIServer { public function set($id, $params) { $config = (array)$params; if (array_key_exists('config', $config)) { - $config = json_decode($config['config'], true); + if ($this->getClientVersion() <= 0.2) { + // old way sending config as serialized array + $config = unserialize($config['config']); + } else { + $config = json_decode($config['config'], true); + } } else { $config = array(); } @@ -51,7 +56,6 @@ class Config extends BaculumAPIServer { } else if ($result['is_valid'] === false) { $this->output = BaculaConfigError::MSG_ERROR_CONFIG_VALIDATION_ERROR . print_r($result['result'], true); $this->error = BaculaConfigError::ERROR_CONFIG_VALIDATION_ERROR; - } else { $this->output = BaculaConfigError::MSG_ERROR_WRITE_TO_CONFIG_ERROR . print_r($result['result'], true); $this->error = BaculaConfigError::ERROR_WRITE_TO_CONFIG_ERROR; -- 2.39.5