From 82d168de34be6ea376b7da5ff1752f0c520562b7 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Sun, 7 Feb 2016 20:54:09 +0100 Subject: [PATCH] * [MOD] Minor tweaks. --- inc/Exts/phpseclib/Crypt/RSA.php | 7 ++++--- inc/SP/Config/Config.class.php | 12 ++++++------ inc/SP/Config/ConfigData.class.php | 27 ++++++++++++++++++++++++--- inc/SP/Http/Request.class.php | 1 + inc/SP/Storage/XmlHandler.class.php | 4 ++++ 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/inc/Exts/phpseclib/Crypt/RSA.php b/inc/Exts/phpseclib/Crypt/RSA.php index 9570f0b1..e0b17f80 100644 --- a/inc/Exts/phpseclib/Crypt/RSA.php +++ b/inc/Exts/phpseclib/Crypt/RSA.php @@ -2908,10 +2908,11 @@ class RSA /** * Decryption * - * @see encrypt() - * @access public - * @param string $plaintext + * @see encrypt() + * @access public + * @param $ciphertext * @return string + * @internal param string $plaintext */ function decrypt($ciphertext) { diff --git a/inc/SP/Config/Config.class.php b/inc/SP/Config/Config.class.php index 9c1c0a5a..972667e5 100644 --- a/inc/SP/Config/Config.class.php +++ b/inc/SP/Config/Config.class.php @@ -98,12 +98,12 @@ class Config */ public static function saveConfig(ConfigData $Config = null, $backup = true) { - if (is_null($Config)){ - Factory::getConfigStorage()->setItems(self::getConfig()); - } else { - Factory::getConfigStorage()->setItems($Config); - } + $ConfigData = (is_null($Config)) ? self::getConfig() : $Config; + $ConfigData->setConfigDate(time()); + $ConfigData->setConfigSaver(Session::getUserLogin()); + $ConfigData->setConfigHash(); + Factory::getConfigStorage()->setItems($ConfigData); Factory::getConfigStorage()->save('config'); if ($backup) { @@ -131,7 +131,7 @@ class Config foreach ($Reflection->getProperties() as $property) { $property->setAccessible(true); - $property->setValue(self::$Config, $items[$property->getName()]); + $property->setValue(self::$Config, @$items[$property->getName()]); $property->setAccessible(false); } } catch (SPException $e) {} diff --git a/inc/SP/Config/ConfigData.class.php b/inc/SP/Config/ConfigData.class.php index 5ea3cbdd..70ce8fb2 100644 --- a/inc/SP/Config/ConfigData.class.php +++ b/inc/SP/Config/ConfigData.class.php @@ -24,6 +24,7 @@ */ namespace SP\Config; + use JsonSerializable; /** @@ -329,6 +330,10 @@ class ConfigData implements JsonSerializable * @var bool */ private $accountPassToImage = false; + /** + * @var string + */ + private $configSaver = ''; /** * @return boolean @@ -755,11 +760,11 @@ class ConfigData implements JsonSerializable } /** - * @param string $configHash + * */ - public function setConfigHash($configHash) + public function setConfigHash() { - $this->configHash = $configHash; + $this->configHash = md5(serialize($this)); } /** @@ -1518,4 +1523,20 @@ class ConfigData implements JsonSerializable { return get_object_vars($this); } + + /** + * @return string + */ + public function getConfigSaver() + { + return $this->configSaver; + } + + /** + * @param string $configSaver + */ + public function setConfigSaver($configSaver) + { + $this->configSaver = $configSaver; + } } \ No newline at end of file diff --git a/inc/SP/Http/Request.class.php b/inc/SP/Http/Request.class.php index 96583980..79cc4f75 100644 --- a/inc/SP/Http/Request.class.php +++ b/inc/SP/Http/Request.class.php @@ -71,6 +71,7 @@ class Request $CryptPKI = new CryptPKI(); $clearData = $CryptPKI->decryptRSA(base64_decode($encryptedData)); } catch (\Exception $e) { + error_log($e->getMessage()); return $encryptedData; } diff --git a/inc/SP/Storage/XmlHandler.class.php b/inc/SP/Storage/XmlHandler.class.php index a33ef319..ce1ae81e 100644 --- a/inc/SP/Storage/XmlHandler.class.php +++ b/inc/SP/Storage/XmlHandler.class.php @@ -176,6 +176,8 @@ class XmlHandler implements FileStorageInterface protected function analyzeItems() { if (is_array($this->items)) { + ksort($this->items); + return $this->items; } elseif (is_object($this->items)) { return $this->analyzeObject(); @@ -201,6 +203,8 @@ class XmlHandler implements FileStorageInterface $property->setAccessible(false); } + ksort($items); + return $items; }