@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | // First check there's a colon at all: |
| 296 | 296 | if (strpos($string, ':') === false) { |
| 297 | - $this->error = 'Invalid address: ' . $string; |
|
| 297 | + $this->error = 'Invalid address: '.$string; |
|
| 298 | 298 | |
| 299 | 299 | return false; |
| 300 | 300 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $this->_hasUnclosedBrackets($string, '()') || |
| 377 | 377 | substr($string, -1) == '\\') { |
| 378 | 378 | if (isset($parts[$i + 1])) { |
| 379 | - $string = $string . $char . $parts[$i + 1]; |
|
| 379 | + $string = $string.$char.$parts[$i + 1]; |
|
| 380 | 380 | } |
| 381 | 381 | else { |
| 382 | 382 | $this->error = 'Invalid address spec. Unclosed bracket or quotes'; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); |
| 450 | 450 | |
| 451 | 451 | if ($num_angle_start < $num_angle_end) { |
| 452 | - $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; |
|
| 452 | + $this->error = 'Invalid address spec. Unmatched quote or bracket ('.$chars.')'; |
|
| 453 | 453 | |
| 454 | 454 | return false; |
| 455 | 455 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | --$num; |
| 474 | 474 | } |
| 475 | 475 | if (isset($parts[$i + 1])) { |
| 476 | - $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; |
|
| 476 | + $parts[$i + 1] = $parts[$i].$char.$parts[$i + 1]; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $structure->groupname = $groupname; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); |
|
| 515 | + $address['address'] = ltrim(substr($address['address'], strlen($groupname.':'))); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | // If a group then split on comma and put into an array. |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | while (strlen($address['address']) > 0) { |
| 522 | 522 | $parts = explode(',', $address['address']); |
| 523 | 523 | $addresses[] = $this->_splitCheck($parts, ','); |
| 524 | - $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); |
|
| 524 | + $address['address'] = trim(substr($address['address'], strlen(end($addresses).','))); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | else { |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | for ($i = 0; $i < count($addresses); ++$i) { |
| 540 | 540 | if (!$this->validateMailbox($addresses[$i])) { |
| 541 | 541 | if (empty($this->error)) { |
| 542 | - $this->error = 'Validation failed for: ' . $addresses[$i]; |
|
| 542 | + $this->error = 'Validation failed for: '.$addresses[$i]; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | return false; |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | $comments[] = $comment; |
| 689 | 689 | |
| 690 | 690 | // +2 is for the brackets |
| 691 | - $_mailbox = substr($_mailbox, strpos($_mailbox, '(' . $comment) + strlen($comment) + 2); |
|
| 691 | + $_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment) + strlen($comment) + 2); |
|
| 692 | 692 | } |
| 693 | 693 | else { |
| 694 | 694 | break; |
@@ -707,11 +707,11 @@ discard block |
||
| 707 | 707 | $name = $this->_splitCheck($parts, '<'); |
| 708 | 708 | |
| 709 | 709 | $phrase = trim($name); |
| 710 | - $route_addr = trim(substr($mailbox, strlen($name . '<'), -1)); |
|
| 710 | + $route_addr = trim(substr($mailbox, strlen($name.'<'), -1)); |
|
| 711 | 711 | |
| 712 | 712 | // grommunio-sync fix for umlauts and other special chars |
| 713 | 713 | if (substr($phrase, 0, 1) != '"' && substr($phrase, -1) != '"') { |
| 714 | - $phrase = '"' . $phrase . '"'; |
|
| 714 | + $phrase = '"'.$phrase.'"'; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false) { |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | return false; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - $addr_spec = substr($route_addr, strlen($route . ':')); |
|
| 795 | + $addr_spec = substr($route_addr, strlen($route.':')); |
|
| 796 | 796 | |
| 797 | 797 | // Validate addr-spec part. |
| 798 | 798 | if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | if (strpos($addr_spec, '@') !== false) { |
| 916 | 916 | $parts = explode('@', $addr_spec); |
| 917 | 917 | $local_part = $this->_splitCheck($parts, '@'); |
| 918 | - $domain = substr($addr_spec, strlen($local_part . '@')); |
|
| 918 | + $domain = substr($addr_spec, strlen($local_part.'@')); |
|
| 919 | 919 | |
| 920 | 920 | // No @ sign so assume the default domain. |
| 921 | 921 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | * @return bool always false as there was an error |
| 1024 | 1024 | */ |
| 1025 | 1025 | public function raiseError($message) { |
| 1026 | - SLog::Write(LOGLEVEL_ERROR, "z_RFC822 error: " . $message); |
|
| 1026 | + SLog::Write(LOGLEVEL_ERROR, "z_RFC822 error: ".$message); |
|
| 1027 | 1027 | |
| 1028 | 1028 | return false; |
| 1029 | 1029 | } |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | $zcs = $zip; |
| 66 | 66 | } |
| 67 | 67 | if (isset($city) && $city != "") { |
| 68 | - $zcs .= (($zcs) ? " " : "") . $city; |
|
| 68 | + $zcs .= (($zcs) ? " " : "").$city; |
|
| 69 | 69 | } |
| 70 | 70 | if (isset($state) && $state != "") { |
| 71 | - $zcs .= (($zcs) ? " " : "") . $state; |
|
| 71 | + $zcs .= (($zcs) ? " " : "").$state; |
|
| 72 | 72 | } |
| 73 | 73 | if ($zcs) { |
| 74 | - $out = $zcs . "\r\n" . $out; |
|
| 74 | + $out = $zcs."\r\n".$out; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if (isset($street) && $street != "") { |
| 78 | - $out = $street . (($out) ? "\r\n\r\n" . $out : ""); |
|
| 78 | + $out = $street.(($out) ? "\r\n\r\n".$out : ""); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | return ($out) ? $out : null; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public static function BuildFileAs($lastname = "", $firstname = "", $middlename = "", $company = "") { |
| 95 | 95 | if (defined('FILEAS_ORDER')) { |
| 96 | 96 | $fileas = $lastfirst = $firstlast = ""; |
| 97 | - $names = trim($firstname . " " . $middlename); |
|
| 97 | + $names = trim($firstname." ".$middlename); |
|
| 98 | 98 | $lastname = trim($lastname); |
| 99 | 99 | $company = trim($company); |
| 100 | 100 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $OLUid .= pack("V", 1); |
| 258 | 258 | $OLUid .= $icalUid; |
| 259 | 259 | |
| 260 | - return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000" . bin2hex($OLUid) . "00"); |
|
| 260 | + return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000".bin2hex($OLUid)."00"); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | return hex2bin($icalUid); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | public static function Utf8_truncate($string, $length, $htmlsafe = false) { |
| 411 | 411 | // make sure length is always an integer |
| 412 | - $length = (int) $length; |
|
| 412 | + $length = (int)$length; |
|
| 413 | 413 | |
| 414 | 414 | // if the input string is shorter then the trunction, make sure it's valid UTF-8! |
| 415 | 415 | if (strlen($string) <= $length) { |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | * @return bool |
| 480 | 480 | */ |
| 481 | 481 | public static function IsBase64String($string) { |
| 482 | - return (bool) preg_match("#^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+/]{4})?$#", $string); |
|
| 482 | + return (bool)preg_match("#^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+/]{4})?$#", $string); |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | if (function_exists("iconv")) { |
| 978 | - return @iconv("UTF-8", "Windows-1252" . $option, $string); |
|
| 978 | + return @iconv("UTF-8", "Windows-1252".$option, $string); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | return utf8_decode($string); // no euro support here |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | if (function_exists("iconv")) { |
| 991 | - return @iconv("Windows-1252", "UTF-8" . $option, $string); |
|
| 991 | + return @iconv("Windows-1252", "UTF-8".$option, $string); |
|
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | return utf8_encode($string); // no euro support here |
@@ -23,12 +23,12 @@ |
||
| 23 | 23 | $logLevel = $this->defaultLogLevel; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - parent::__construct($message, (int) $code); |
|
| 27 | - SLog::Write($logLevel, get_class($this) . ': ' . $message . ' - code: ' . $code . ' - file: ' . $this->getFile() . ':' . $this->getLine(), false); |
|
| 26 | + parent::__construct($message, (int)$code); |
|
| 27 | + SLog::Write($logLevel, get_class($this).': '.$message.' - code: '.$code.' - file: '.$this->getFile().':'.$this->getLine(), false); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function getHTTPCodeString() { |
| 31 | - return $this->httpReturnCode . " " . $this->httpReturnMessage; |
|
| 31 | + return $this->httpReturnCode." ".$this->httpReturnMessage; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function getHTTPHeaders() { |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | if ($code) { |
| 16 | 16 | $this->httpReturnCode = $code; |
| 17 | 17 | } |
| 18 | - parent::__construct($message, (int) $code, $previous, $logLevel); |
|
| 18 | + parent::__construct($message, (int)$code, $previous, $logLevel); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __construct($message = "", $code = 0, $previous = null, $logLevel = false) { |
| 18 | 18 | parent::__construct($message, $code, $previous, $logLevel); |
| 19 | 19 | if (RETRY_AFTER_DELAY !== false) { |
| 20 | - $this->httpHeaders[] = 'Retry-After: ' . RETRY_AFTER_DELAY; |
|
| 20 | + $this->httpHeaders[] = 'Retry-After: '.RETRY_AFTER_DELAY; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | define('TIMEZONE', ''); |
| 15 | 15 | |
| 16 | 16 | // Defines the base path on the server |
| 17 | - define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/'); |
|
| 17 | + define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); |
|
| 18 | 18 | |
| 19 | 19 | // Try to set unlimited timeout |
| 20 | 20 | define('SCRIPT_TIMEOUT', 0); |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // Filelog settings |
| 82 | 82 | define('LOGFILEDIR', '/var/log/grommunio-sync/'); |
| 83 | - define('LOGFILE', LOGFILEDIR . 'grommunio-sync.log'); |
|
| 84 | - define('LOGERRORFILE', LOGFILEDIR . 'grommunio-sync-error.log'); |
|
| 83 | + define('LOGFILE', LOGFILEDIR.'grommunio-sync.log'); |
|
| 84 | + define('LOGERRORFILE', LOGFILEDIR.'grommunio-sync-error.log'); |
|
| 85 | 85 | |
| 86 | 86 | // Syslog settings |
| 87 | 87 | // false will log to local syslog, otherwise put the remote syslog IP here |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | header(GSync::GetServerHeader()); |
| 101 | 101 | |
| 102 | 102 | if (RequestProcessor::isUserAuthenticated()) { |
| 103 | - header("X-Grommunio-Sync-Version: " . @constant('GROMMUNIOSYNC_VERSION')); |
|
| 103 | + header("X-Grommunio-Sync-Version: ".@constant('GROMMUNIOSYNC_VERSION')); |
|
| 104 | 104 | |
| 105 | 105 | // announce the supported AS versions (if not already sent to device) |
| 106 | 106 | if (GSync::GetDeviceManager()->AnnounceASVersion()) { |
| 107 | 107 | $versions = GSync::GetSupportedProtocolVersions(true); |
| 108 | 108 | SLog::Write(LOGLEVEL_INFO, sprintf("Announcing latest AS version to device: %s", $versions)); |
| 109 | - header("X-MS-RP: " . $versions); |
|
| 109 | + header("X-MS-RP: ".$versions); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if ($ex->getPrevious()) { |
| 175 | 175 | do { |
| 176 | 176 | $current_exception = $ex->getPrevious(); |
| 177 | - $exception_message .= ' -> ' . $current_exception->getMessage(); |
|
| 177 | + $exception_message .= ' -> '.$current_exception->getMessage(); |
|
| 178 | 178 | } |
| 179 | 179 | while ($current_exception->getPrevious()); |
| 180 | 180 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if (!headers_sent()) { |
| 189 | 189 | if ($ex instanceof GSyncException) { |
| 190 | - header('HTTP/1.1 ' . $ex->getHTTPCodeString()); |
|
| 190 | + header('HTTP/1.1 '.$ex->getHTTPCodeString()); |
|
| 191 | 191 | foreach ($ex->getHTTPHeaders() as $h) { |
| 192 | 192 | header($h); |
| 193 | 193 | } |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | elseif (!($ex instanceof GSyncException) || $ex->showLegalNotice()) { |
| 224 | 224 | $cmdinfo = (Request::GetCommand()) ? sprintf(" processing command <i>%s</i>", Request::GetCommand()) : ""; |
| 225 | 225 | $extrace = $ex->getTrace(); |
| 226 | - $trace = (!empty($extrace)) ? "\n\nTrace:\n" . print_r($extrace, 1) : ""; |
|
| 227 | - GSync::PrintGrommunioSyncLegal($exclass . $cmdinfo, sprintf('<pre>%s</pre>', $ex->getMessage() . $trace)); |
|
| 226 | + $trace = (!empty($extrace)) ? "\n\nTrace:\n".print_r($extrace, 1) : ""; |
|
| 227 | + GSync::PrintGrommunioSyncLegal($exclass.$cmdinfo, sprintf('<pre>%s</pre>', $ex->getMessage().$trace)); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Announce exception to process loop detection |