From 300c060be17e03497793cd966a61318f109f33db Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 1 Aug 2016 09:51:29 +0200 Subject: [PATCH 1/2] Port PHP4 style classes to PHP5 The next version of PHP will deprecated the PHP4 style classes. References: KW-99 --- php/class.pluginmdmmodule.php | 4 ++-- php/plugin.mdm.php | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/php/class.pluginmdmmodule.php b/php/class.pluginmdmmodule.php index 4018eec..ed2a27d 100755 --- a/php/class.pluginmdmmodule.php +++ b/php/class.pluginmdmmodule.php @@ -19,9 +19,9 @@ class PluginMDMModule extends Module * @param int $id unique id. * @param array $data list of all actions. */ - function PluginMDMModule($id, $data) + function __construct($id, $data) { - parent::Module($id, $data); + parent::__construct($id, $data); $this->server = (PLUGIN_MDM_SERVER_SSL ? 'https://' : 'http://') . PLUGIN_MDM_SERVER; diff --git a/php/plugin.mdm.php b/php/plugin.mdm.php index bc2e043..5126e29 100755 --- a/php/plugin.mdm.php +++ b/php/plugin.mdm.php @@ -3,8 +3,6 @@ * Handles plugin registration. */ class PluginMDM extends Plugin { - // Constructor - function PluginMDM(){} /** * Called to initialize the plugin and register for hooks. From 0564edfb748da54349559975013aa44602509690 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 1 Aug 2016 09:53:37 +0200 Subject: [PATCH 2/2] Remove backwards compatible code The authentication module is supported from the initial release, therefore the backwards compatible code can be removed. --- php/class.pluginmdmmodule.php | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/php/class.pluginmdmmodule.php b/php/class.pluginmdmmodule.php index ed2a27d..814f2a6 100755 --- a/php/class.pluginmdmmodule.php +++ b/php/class.pluginmdmmodule.php @@ -1,9 +1,6 @@ server = (PLUGIN_MDM_SERVER_SSL ? 'https://' : 'http://') . PLUGIN_MDM_SERVER; - // For backward compatibility we will check if the Encryption store exists. If not, - // we will fall back to the old way of retrieving the password from the session. - if ( class_exists('EncryptionStore') ) { - - // Get the username and password from the Encryption store - $encryptionStore = EncryptionStore::getInstance(); - $this->username = $encryptionStore->get('username'); - $this->password = $encryptionStore->get('password'); - } else { - $this->username = $GLOBALS['mapisession']->getUserName(); - - $this->password = $_SESSION['password']; - if(function_exists('openssl_decrypt')) { - // In PHP 5.3.3 the iv parameter was added - if(version_compare(phpversion(), "5.3.3", "<")) { - $this->password = openssl_decrypt($this->password, "des-ede3-cbc", PASSWORD_KEY, 0); - } else { - $this->password = openssl_decrypt($this->password, "des-ede3-cbc", PASSWORD_KEY, 0, PASSWORD_IV); - } - } - } + // Get the username and password from the Encryption store + $encryptionStore = EncryptionStore::getInstance(); + $this->username = $encryptionStore->get('username'); + $this->password = $encryptionStore->get('password'); $this->url = $this->server .'/Microsoft-Server-ActiveSync?Cmd=WebserviceDevice&DeviceId=webservice&DeviceType=webservice&User=' . $this->username; }