Commit a7bce714 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #618 in ZP/z-push from bugfix/ZP-1234-code-refactoring to develop

* commit 'b37d8180':
  ZP-1313 Remove TNEF class.
  ZP-1260 Improve isset in ASDevice->GetFolderSyncStatus().
  ZP-1242 Check for cpid directly instead of getting charset.
  ZP-1235 Improve guessTZNameFromPHPName.
  ZP-1233 Get timezone from system if it's not set for a meeting request.
parents eefbcf6d b37d8180
...@@ -598,10 +598,12 @@ class MAPIProvider { ...@@ -598,10 +598,12 @@ class MAPIProvider {
$message->meetingrequest->globalobjid = base64_encode($props[$meetingrequestproperties["goidtag"]]); $message->meetingrequest->globalobjid = base64_encode($props[$meetingrequestproperties["goidtag"]]);
// Set Timezone // Set Timezone
if(isset($props[$meetingrequestproperties["timezonetag"]])) if (isset($props[$meetingrequestproperties["timezonetag"]])) {
$tz = $this->getTZFromMAPIBlob($props[$meetingrequestproperties["timezonetag"]]); $tz = $this->getTZFromMAPIBlob($props[$meetingrequestproperties["timezonetag"]]);
else }
$tz = $this->getGMTTZ(); else {
$tz = TimezoneUtil::GetFullTZ();
}
$message->meetingrequest->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz)); $message->meetingrequest->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz));
...@@ -2504,7 +2506,7 @@ class MAPIProvider { ...@@ -2504,7 +2506,7 @@ class MAPIProvider {
} }
elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) { elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
// if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it // if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it
if (Utils::GetCodepageCharset($message->internetcpid) == "utf-8") { if ($message->internetcpid == INTERNET_CPID_UTF8) {
$message->asbody->data = MAPIStreamWrapper::Open($stream, $truncateHtmlSafe); $message->asbody->data = MAPIStreamWrapper::Open($stream, $truncateHtmlSafe);
} }
else { else {
......
This diff is collapsed.
...@@ -775,11 +775,11 @@ class ASDevice extends StateObject { ...@@ -775,11 +775,11 @@ class ASDevice extends StateObject {
* @return mixed/boolean false means the status is not available * @return mixed/boolean false means the status is not available
*/ */
public function GetFolderSyncStatus($folderid) { public function GetFolderSyncStatus($folderid) {
if (isset($this->contentData) && isset($this->contentData[$folderid]) && if (isset($this->contentData[$folderid][self::FOLDERUUID], $this->contentData[$folderid][self::FOLDERSYNCSTATUS]) &&
isset($this->contentData[$folderid][self::FOLDERUUID]) && $this->contentData[$folderid][self::FOLDERUUID] !== false && $this->contentData[$folderid][self::FOLDERUUID] !== false) {
isset($this->contentData[$folderid][self::FOLDERSYNCSTATUS]) )
return $this->contentData[$folderid][self::FOLDERSYNCSTATUS]; return $this->contentData[$folderid][self::FOLDERSYNCSTATUS];
}
return false; return false;
} }
......
...@@ -1178,7 +1178,7 @@ class TimezoneUtil { ...@@ -1178,7 +1178,7 @@ class TimezoneUtil {
} }
/** /**
* Tries to find a AS timezone for a php timezone * Tries to find a AS timezone for a php timezone.
* *
* @param string $phpname a php timezone name * @param string $phpname a php timezone name
* *
...@@ -1188,17 +1188,14 @@ class TimezoneUtil { ...@@ -1188,17 +1188,14 @@ class TimezoneUtil {
static private function guessTZNameFromPHPName($phpname) { static private function guessTZNameFromPHPName($phpname) {
foreach (self::$phptimezones as $tzn => $phptzs) { foreach (self::$phptimezones as $tzn => $phptzs) {
if (in_array($phpname, $phptzs)) { if (in_array($phpname, $phptzs)) {
$tzname = $tzn; if (!is_int($tzn)) {
return $tzn;
}
break; break;
} }
} }
ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::guessTZNameFromPHPName() no compatible timezone found for '%s'. Returning 'GMT Standard Time'. Please contact the Z-Push dev team.", $phpname));
if (!isset($tzname) || is_int($tzname)) { return self::$mstzones["085"][0];
ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::guessTZNameFromPHPName() no compatible timezone found for '%s'. Returning 'GMT Standard Time'. Please contact the Z-Push dev team.", $phpname));
return self::$mstzones["085"][0];
}
return $tzname;
} }
/** /**
......
...@@ -172,7 +172,6 @@ return array( ...@@ -172,7 +172,6 @@ return array(
'SyncUserInformation' => $baseDir . '/lib/syncobjects/syncuserinformation.php', 'SyncUserInformation' => $baseDir . '/lib/syncobjects/syncuserinformation.php',
'SyncValidateCert' => $baseDir . '/lib/syncobjects/syncvalidatecert.php', 'SyncValidateCert' => $baseDir . '/lib/syncobjects/syncvalidatecert.php',
'Syslog' => $baseDir . '/lib/log/syslog.php', 'Syslog' => $baseDir . '/lib/log/syslog.php',
'TNEFParser' => $baseDir . '/backend/kopano/tnefparser.php',
'TaskRecurrence' => $baseDir . '/backend/kopano/mapi/class.taskrecurrence.php', 'TaskRecurrence' => $baseDir . '/backend/kopano/mapi/class.taskrecurrence.php',
'TaskRequest' => $baseDir . '/backend/kopano/mapi/class.taskrequest.php', 'TaskRequest' => $baseDir . '/backend/kopano/mapi/class.taskrequest.php',
'TimezoneUtil' => $baseDir . '/lib/utils/timezoneutil.php', 'TimezoneUtil' => $baseDir . '/lib/utils/timezoneutil.php',
......
...@@ -179,7 +179,6 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f ...@@ -179,7 +179,6 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'SyncUserInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncuserinformation.php', 'SyncUserInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncuserinformation.php',
'SyncValidateCert' => __DIR__ . '/../..' . '/lib/syncobjects/syncvalidatecert.php', 'SyncValidateCert' => __DIR__ . '/../..' . '/lib/syncobjects/syncvalidatecert.php',
'Syslog' => __DIR__ . '/../..' . '/lib/log/syslog.php', 'Syslog' => __DIR__ . '/../..' . '/lib/log/syslog.php',
'TNEFParser' => __DIR__ . '/../..' . '/backend/kopano/tnefparser.php',
'TaskRecurrence' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.taskrecurrence.php', 'TaskRecurrence' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.taskrecurrence.php',
'TaskRequest' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.taskrequest.php', 'TaskRequest' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.taskrequest.php',
'TimezoneUtil' => __DIR__ . '/../..' . '/lib/utils/timezoneutil.php', 'TimezoneUtil' => __DIR__ . '/../..' . '/lib/utils/timezoneutil.php',
......
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