Commit 318b03b2 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #281 in ZP/z-push from...

Merge pull request #281 in ZP/z-push from bugfix/ZP-966-koe-make-sync-gab-script-zcp-7.1-compatible to develop

* commit 'ddff68fc':
  ZP-966 Fixed dot and removed and removed static.
  ZP-966 Use different login parameters depending on the MAPI version.
parents 55d34748 ddff68fc
...@@ -209,13 +209,14 @@ class Utils { ...@@ -209,13 +209,14 @@ class Utils {
ZLog::Write(LOGLEVEL_DEBUG, "FILEAS_ORDER not defined. Add it to your config.php."); ZLog::Write(LOGLEVEL_DEBUG, "FILEAS_ORDER not defined. Add it to your config.php.");
return null; return null;
} }
/** /**
* Checks if the PHP-MAPI extension is available and in a requested version * Checks if the PHP-MAPI extension is available and in a requested version.
* *
* @param string $version the version to be checked ("6.30.10-18495", parts or build number) * @param string $version the version to be checked ("6.30.10-18495", parts or build number)
* *
* @access public * @access public
* @return boolean installed version is superior to the checked strin * @return boolean installed version is superior to the checked string
*/ */
static public function CheckMapiExtVersion($version = "") { static public function CheckMapiExtVersion($version = "") {
// compare build number if requested // compare build number if requested
...@@ -236,8 +237,7 @@ class Utils { ...@@ -236,8 +237,7 @@ class Utils {
} }
/** /**
* Parses and returns an ecoded vCal-Uid from an * Parses and returns an ecoded vCal-Uid from an OL compatible GlobalObjectID.
* OL compatible GlobalObjectID
* *
* @param string $olUid an OL compatible GlobalObjectID * @param string $olUid an OL compatible GlobalObjectID
* *
......
...@@ -67,7 +67,14 @@ class Kopano extends SyncWorker { ...@@ -67,7 +67,14 @@ class Kopano extends SyncWorker {
*/ */
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->session = mapi_logon_zarafa(USERNAME, PASSWORD, SERVER, CERTIFICATE, CERTIFICATE_PASSWORD, 0, self::VERSION, self::NAME. " ". self::VERSION); // send Z-Push version and user agent to ZCP >7.2.0
if ($this->checkMapiExtVersion('7.2.0')) {
$this->session = mapi_logon_zarafa(USERNAME, PASSWORD, SERVER, CERTIFICATE, CERTIFICATE_PASSWORD, 0, self::VERSION, self::NAME. " ". self::VERSION);
}
else {
$this->session = mapi_logon_zarafa(USERNAME, PASSWORD, SERVER, CERTIFICATE, CERTIFICATE_PASSWORD, 0);
}
if (mapi_last_hresult()) { if (mapi_last_hresult()) {
$this->Terminate(sprintf("Kopano: login failed with error code: 0x%08X", mapi_last_hresult())); $this->Terminate(sprintf("Kopano: login failed with error code: 0x%08X", mapi_last_hresult()));
} }
...@@ -722,4 +729,30 @@ class Kopano extends SyncWorker { ...@@ -722,4 +729,30 @@ class Kopano extends SyncWorker {
return $string; return $string;
} }
/**
* Checks if the PHP-MAPI extension is available and in a requested version.
*
* @param string $version the version to be checked ("6.30.10-18495", parts or build number)
*
* @access private
* @return boolean installed version is superior to the checked string
*/
private function checkMapiExtVersion($version = "") {
// compare build number if requested
if (preg_match('/^\d+$/', $version) && strlen($version) > 3) {
$vs = preg_split('/-/', phpversion("mapi"));
return ($version <= $vs[1]);
}
if (extension_loaded("mapi")){
if (version_compare(phpversion("mapi"), $version) == -1){
return false;
}
}
else
return false;
return true;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment