@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $attachments = mapi_table_queryallrows($attachmentTable, [PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD]); |
| 284 | 284 | |
| 285 | 285 | foreach ($attachments as $attach_props) { |
| 286 | - $attach_old = mapi_message_openattach($this->message, (int) $attach_props[PR_ATTACH_NUM]); |
|
| 286 | + $attach_old = mapi_message_openattach($this->message, (int)$attach_props[PR_ATTACH_NUM]); |
|
| 287 | 287 | $attach_newResourceMsg = mapi_message_createattach($newMessage); |
| 288 | 288 | |
| 289 | 289 | mapi_copyto($attach_old, [], [], $attach_newResourceMsg, 0); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $separator = "------------\r\n"; |
| 301 | 301 | |
| 302 | 302 | if (!empty($msgbody) && false === strrpos($msgbody, $separator)) { |
| 303 | - $msgbody = $separator . $msgbody; |
|
| 303 | + $msgbody = $separator.$msgbody; |
|
| 304 | 304 | $stream = mapi_openproperty($this->message, PR_BODY, IID_IStream, STGM_TRANSACTED, 0); |
| 305 | 305 | mapi_stream_setsize($stream, strlen($msgbody)); |
| 306 | 306 | mapi_stream_write($stream, $msgbody); |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | header(GSync::GetServerHeader()); |
| 94 | 94 | |
| 95 | 95 | if (RequestProcessor::isUserAuthenticated()) { |
| 96 | - header('X-Grommunio-Sync-Version: ' . @constant('GROMMUNIOSYNC_VERSION')); |
|
| 96 | + header('X-Grommunio-Sync-Version: '.@constant('GROMMUNIOSYNC_VERSION')); |
|
| 97 | 97 | |
| 98 | 98 | // announce the supported AS versions (if not already sent to device) |
| 99 | 99 | if (GSync::GetDeviceManager()->AnnounceASVersion()) { |
| 100 | 100 | $versions = GSync::GetSupportedProtocolVersions(true); |
| 101 | 101 | SLog::Write(LOGLEVEL_INFO, sprintf('Announcing latest AS version to device: %s', $versions)); |
| 102 | - header('X-MS-RP: ' . $versions); |
|
| 102 | + header('X-MS-RP: '.$versions); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | if ($ex->getPrevious()) { |
| 165 | 165 | do { |
| 166 | 166 | $current_exception = $ex->getPrevious(); |
| 167 | - $exception_message .= ' -> ' . $current_exception->getMessage(); |
|
| 167 | + $exception_message .= ' -> '.$current_exception->getMessage(); |
|
| 168 | 168 | } while ($current_exception->getPrevious()); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if (!headers_sent()) { |
| 178 | 178 | if ($ex instanceof GSyncException) { |
| 179 | - header('HTTP/1.1 ' . $ex->getHTTPCodeString()); |
|
| 179 | + header('HTTP/1.1 '.$ex->getHTTPCodeString()); |
|
| 180 | 180 | foreach ($ex->getHTTPHeaders() as $h) { |
| 181 | 181 | header($h); |
| 182 | 182 | } |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | elseif (!($ex instanceof GSyncException) || $ex->showLegalNotice()) { |
| 213 | 213 | $cmdinfo = (Request::GetCommand()) ? sprintf(' processing command <i>%s</i>', Request::GetCommand()) : ''; |
| 214 | 214 | $extrace = $ex->getTrace(); |
| 215 | - $trace = (!empty($extrace)) ? "\n\nTrace:\n" . print_r($extrace, 1) : ''; |
|
| 216 | - GSync::PrintGrommunioSyncLegal($exclass . $cmdinfo, sprintf('<pre>%s</pre>', $ex->getMessage() . $trace)); |
|
| 215 | + $trace = (!empty($extrace)) ? "\n\nTrace:\n".print_r($extrace, 1) : ''; |
|
| 216 | + GSync::PrintGrommunioSyncLegal($exclass.$cmdinfo, sprintf('<pre>%s</pre>', $ex->getMessage().$trace)); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // Announce exception to process loop detection |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | class Request { |
| 11 | - public const MAXMEMORYUSAGE = 0.9; // use max. 90% of allowed memory when syncing |
|
| 11 | + public const MAXMEMORYUSAGE = 0.9; // use max. 90% of allowed memory when syncing |
|
| 12 | 12 | public const UNKNOWN = 'unknown'; |
| 13 | 13 | public const IMPERSONATE_DELIM = '#'; |
| 14 | 14 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset(self::$base64QueryDecoded['PolKey'])) { |
| 143 | - self::$policykey = (int) self::filterEvilInput(self::$base64QueryDecoded['PolKey'], self::NUMBERS_ONLY); |
|
| 143 | + self::$policykey = (int)self::filterEvilInput(self::$base64QueryDecoded['PolKey'], self::NUMBERS_ONLY); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (isset(self::$base64QueryDecoded['ProtVer'])) { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } else { |
| 198 | 198 | preg_replace_callback( |
| 199 | 199 | '/(\-?\d+)(.?)/', |
| 200 | - function ($m) { |
|
| 200 | + function($m) { |
|
| 201 | 201 | self::$memoryLimit = $m[1] * pow(1024, strpos('BKMG', $m[2])) * self::MAXMEMORYUSAGE; |
| 202 | 202 | }, |
| 203 | 203 | strtoupper($memoryLimit) |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | // the policy key might be set in Request::Initialize from the base64 encoded query |
| 222 | 222 | if (!isset(self::$policykey)) { |
| 223 | 223 | if (isset(self::$headers['x-ms-policykey'])) { |
| 224 | - self::$policykey = (int) self::filterEvilInput(self::$headers['x-ms-policykey'], self::NUMBERS_ONLY); |
|
| 224 | + self::$policykey = (int)self::filterEvilInput(self::$headers['x-ms-policykey'], self::NUMBERS_ONLY); |
|
| 225 | 225 | } else { |
| 226 | 226 | self::$policykey = 0; |
| 227 | 227 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | * @return int |
| 636 | 636 | */ |
| 637 | 637 | public static function GetContentLength() { |
| 638 | - return (isset(self::$headers['content-length'])) ? (int) self::$headers['content-length'] : 0; |
|
| 638 | + return (isset(self::$headers['content-length'])) ? (int)self::$headers['content-length'] : 0; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | private static function filterIP($input) { |
| 759 | 759 | $in_addr = @inet_pton($input); |
| 760 | 760 | if (false === $in_addr) { |
| 761 | - return 'badip-' . self::filterEvilInput($input, self::HEX_EXTENDED); |
|
| 761 | + return 'badip-'.self::filterEvilInput($input, self::HEX_EXTENDED); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | return inet_ntop($in_addr); |
@@ -790,14 +790,14 @@ discard block |
||
| 790 | 790 | $polKeyLength = ord($decoded[5 + $devIdLength]); // policy key length |
| 791 | 791 | $devTypeLength = ord($decoded[6 + $devIdLength + $polKeyLength]); // device type length |
| 792 | 792 | // unpack the decoded query string values |
| 793 | - self::$base64QueryDecoded = unpack('CProtVer/CCommand/vLocale/CDevIDLen/H' . ($devIdLength * 2) . 'DevID/CPolKeyLen' . (4 == $polKeyLength ? '/VPolKey' : '') . '/CDevTypeLen/A' . ($devTypeLength) . 'DevType', $decoded); |
|
| 793 | + self::$base64QueryDecoded = unpack('CProtVer/CCommand/vLocale/CDevIDLen/H'.($devIdLength * 2).'DevID/CPolKeyLen'.(4 == $polKeyLength ? '/VPolKey' : '').'/CDevTypeLen/A'.($devTypeLength).'DevType', $decoded); |
|
| 794 | 794 | |
| 795 | 795 | // get the command parameters |
| 796 | 796 | $pos = 7 + $devIdLength + $polKeyLength + $devTypeLength; |
| 797 | 797 | $decoded = substr($decoded, $pos); |
| 798 | 798 | while (strlen($decoded) > 0) { |
| 799 | 799 | $paramLength = ord($decoded[1]); |
| 800 | - $unpackedParam = unpack('CParamTag/CParamLength/A' . $paramLength . 'ParamValue', $decoded); |
|
| 800 | + $unpackedParam = unpack('CParamTag/CParamLength/A'.$paramLength.'ParamValue', $decoded); |
|
| 801 | 801 | self::$base64QueryDecoded[ord($decoded[0])] = $unpackedParam['ParamValue']; |
| 802 | 802 | // remove parameter from decoded query string |
| 803 | 803 | $decoded = substr($decoded, 2 + $paramLength); |