Merge pull request #1 in KWA/mobile-device-management from KW-99-port-php4-classes to master
* commit '0564edfb748da54349559975013aa44602509690': Remove backwards compatible code Port PHP4 style classes to PHP5
This commit is contained in:
commit
a3c9ffaa73
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
// For backward compatibility we must check if the file exists
|
||||
if ( file_exists(BASE_PATH . 'server/includes/core/class.encryptionstore.php') ) {
|
||||
require_once(BASE_PATH . 'server/includes/core/class.encryptionstore.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PluginMDMModule Module
|
||||
@ -19,33 +16,16 @@ 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;
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = $this->server .'/Microsoft-Server-ActiveSync?Cmd=WebserviceDevice&DeviceId=webservice&DeviceType=webservice&User=' . $this->username;
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
* Handles plugin registration.
|
||||
*/
|
||||
class PluginMDM extends Plugin {
|
||||
// Constructor
|
||||
function PluginMDM(){}
|
||||
|
||||
/**
|
||||
* Called to initialize the plugin and register for hooks.
|
||||
|
Loading…
Reference in New Issue
Block a user