@@ -30,6 +30,6 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function isValidSimpleWrapper($email) |
| 32 | 32 | { |
| 33 | - return (boolean)preg_match('/^(.*<?)(.*)@(.*)(>?)$/', $email); |
|
| 33 | + return (boolean) preg_match('/^(.*<?)(.*)@(.*)(>?)$/', $email); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -702,7 +702,7 @@ |
||
| 702 | 702 | { |
| 703 | 703 | if (count($this->_immediateChildren)) { |
| 704 | 704 | $this->_setHeaderParameter('Content-Type', 'boundary', |
| 705 | - $this->getBoundary() |
|
| 705 | + $this->getBoundary() |
|
| 706 | 706 | ); |
| 707 | 707 | $this->_headers->remove('Content-Transfer-Encoding'); |
| 708 | 708 | } else { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | public function getBoundary() |
| 466 | 466 | { |
| 467 | 467 | if (!isset($this->_boundary)) { |
| 468 | - $this->_boundary = '_=_swift_v5_' . time() . '_' . md5(getmypid() . mt_rand() . uniqid('', true)) . '_=_'; |
|
| 468 | + $this->_boundary = '_=_swift_v5_'.time().'_'.md5(getmypid().mt_rand().uniqid('', true)).'_=_'; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | return $this->_boundary; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | if ($this->_cache->hasKey($this->_cacheKey, 'body')) { |
| 537 | 537 | $body = $this->_cache->getString($this->_cacheKey, 'body'); |
| 538 | 538 | } else { |
| 539 | - $body = "\r\n" . $this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
| 539 | + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
| 540 | 540 | $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); |
| 541 | 541 | } |
| 542 | 542 | $string .= $body; |
@@ -544,10 +544,10 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | if (!empty($this->_immediateChildren)) { |
| 546 | 546 | foreach ($this->_immediateChildren as $child) { |
| 547 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "\r\n"; |
|
| 547 | + $string .= "\r\n\r\n--".$this->getBoundary()."\r\n"; |
|
| 548 | 548 | $string .= $child->toString(); |
| 549 | 549 | } |
| 550 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "--\r\n"; |
|
| 550 | + $string .= "\r\n\r\n--".$this->getBoundary()."--\r\n"; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | return $string; |
@@ -614,10 +614,10 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | if (!empty($this->_immediateChildren)) { |
| 616 | 616 | foreach ($this->_immediateChildren as $child) { |
| 617 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "\r\n"); |
|
| 617 | + $is->write("\r\n\r\n--".$this->getBoundary()."\r\n"); |
|
| 618 | 618 | $child->toByteStream($is); |
| 619 | 619 | } |
| 620 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "--\r\n"); |
|
| 620 | + $is->write("\r\n\r\n--".$this->getBoundary()."--\r\n"); |
|
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |
@@ -746,14 +746,14 @@ discard block |
||
| 746 | 746 | */ |
| 747 | 747 | protected function getRandomId() |
| 748 | 748 | { |
| 749 | - $idLeft = md5(getmypid() . '.' . time() . '.' . uniqid(mt_rand(), true)); |
|
| 749 | + $idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)); |
|
| 750 | 750 | $idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated'; |
| 751 | - $id = $idLeft . '@' . $idRight; |
|
| 751 | + $id = $idLeft.'@'.$idRight; |
|
| 752 | 752 | |
| 753 | 753 | try { |
| 754 | 754 | $this->_assertValidId($id); |
| 755 | 755 | } catch (Swift_RfcComplianceException $e) { |
| 756 | - $id = $idLeft . '@swift.generated'; |
|
| 756 | + $id = $idLeft.'@swift.generated'; |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | return $id; |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | */ |
| 767 | 767 | private function _generateNewCacheKey() |
| 768 | 768 | { |
| 769 | - return md5(uniqid(getmypid() . mt_rand(), true)); |
|
| 769 | + return md5(uniqid(getmypid().mt_rand(), true)); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | private function _readStream(Swift_OutputByteStream $os) |
@@ -849,10 +849,10 @@ discard block |
||
| 849 | 849 | $lowercaseType = Swift::strtolowerWithStaticCache($child->getContentType()); |
| 850 | 850 | |
| 851 | 851 | if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { |
| 852 | - return (int)$filter[$realLevel][$lowercaseType]; |
|
| 852 | + return (int) $filter[$realLevel][$lowercaseType]; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - return (int)$realLevel; |
|
| 855 | + return (int) $realLevel; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | private function _assertValidId($id) |
| 949 | 949 | { |
| 950 | 950 | if ($this->_emailValidator->isValidWrapper($id) === false) { |
| 951 | - throw new Swift_RfcComplianceException('Invalid ID given <' . $id . '>'); |
|
| 951 | + throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>'); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
@@ -77,9 +77,9 @@ |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $count = ( |
| 80 | - count((array)$message->getTo()) |
|
| 81 | - + count((array)$message->getCc()) |
|
| 82 | - + count((array)$message->getBcc()) |
|
| 80 | + count((array) $message->getTo()) |
|
| 81 | + + count((array) $message->getCc()) |
|
| 82 | + + count((array) $message->getBcc()) |
|
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | 85 | return $count; |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | protected function createMessage1() |
| 227 | 227 | { |
| 228 | 228 | return self::NTLMSIG |
| 229 | - . $this->createByte('01') // Message 1 |
|
| 230 | - . $this->createByte('0702'); // Flags |
|
| 229 | + . $this->createByte('01') // Message 1 |
|
| 230 | + . $this->createByte('0702'); // Flags |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -255,19 +255,19 @@ discard block |
||
| 255 | 255 | $ntlmSec = $this->createSecurityBuffer($ntlmResponse, ($lmInfo[0] + $lmInfo[1]) / 2, true); |
| 256 | 256 | |
| 257 | 257 | return self::NTLMSIG |
| 258 | - . $this->createByte('03') // TYPE 3 message |
|
| 259 | - . $lmSec // LM response header |
|
| 260 | - . $ntlmSec // NTLM response header |
|
| 261 | - . $domainSec // Domain header |
|
| 262 | - . $userSec // User header |
|
| 263 | - . $workSec // Workstation header |
|
| 264 | - . $this->createByte('000000009a', 8) // session key header (empty) |
|
| 265 | - . $this->createByte('01020000') // FLAGS |
|
| 266 | - . $this->convertTo16bit($domain) // domain name |
|
| 267 | - . $this->convertTo16bit($username) // username |
|
| 268 | - . $this->convertTo16bit($workstation) // workstation |
|
| 269 | - . $lmResponse |
|
| 270 | - . $ntlmResponse; |
|
| 258 | + . $this->createByte('03') // TYPE 3 message |
|
| 259 | + . $lmSec // LM response header |
|
| 260 | + . $ntlmSec // NTLM response header |
|
| 261 | + . $domainSec // Domain header |
|
| 262 | + . $userSec // User header |
|
| 263 | + . $workSec // Workstation header |
|
| 264 | + . $this->createByte('000000009a', 8) // session key header (empty) |
|
| 265 | + . $this->createByte('01020000') // FLAGS |
|
| 266 | + . $this->convertTo16bit($domain) // domain name |
|
| 267 | + . $this->convertTo16bit($username) // username |
|
| 268 | + . $this->convertTo16bit($workstation) // workstation |
|
| 269 | + . $lmResponse |
|
| 270 | + . $ntlmResponse; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | protected function createBlob($timestamp, $client, $targetInfo) |
| 281 | 281 | { |
| 282 | 282 | return $this->createByte('0101') |
| 283 | - . $this->createByte('00') |
|
| 284 | - . $timestamp |
|
| 285 | - . $client |
|
| 286 | - . $this->createByte('00') |
|
| 287 | - . $targetInfo |
|
| 288 | - . $this->createByte('00'); |
|
| 283 | + . $this->createByte('00') |
|
| 284 | + . $timestamp |
|
| 285 | + . $client |
|
| 286 | + . $this->createByte('00') |
|
| 287 | + . $targetInfo |
|
| 288 | + . $this->createByte('00'); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -451,16 +451,16 @@ discard block |
||
| 451 | 451 | foreach ($material as $k => $v) { |
| 452 | 452 | $b = $this->castToByte(hexdec($v)); |
| 453 | 453 | $needsParity = ( |
| 454 | - ( |
|
| 455 | - $this->uRShift($b, 7) |
|
| 456 | - ^ $this->uRShift($b, 6) |
|
| 457 | - ^ $this->uRShift($b, 5) |
|
| 458 | - ^ $this->uRShift($b, 4) |
|
| 459 | - ^ $this->uRShift($b, 3) |
|
| 460 | - ^ $this->uRShift($b, 2) |
|
| 461 | - ^ $this->uRShift($b, 1) |
|
| 462 | - ) & 0x01 |
|
| 463 | - ) == 0; |
|
| 454 | + ( |
|
| 455 | + $this->uRShift($b, 7) |
|
| 456 | + ^ $this->uRShift($b, 6) |
|
| 457 | + ^ $this->uRShift($b, 5) |
|
| 458 | + ^ $this->uRShift($b, 4) |
|
| 459 | + ^ $this->uRShift($b, 3) |
|
| 460 | + ^ $this->uRShift($b, 2) |
|
| 461 | + ^ $this->uRShift($b, 1) |
|
| 462 | + ) & 0x01 |
|
| 463 | + ) == 0; |
|
| 464 | 464 | |
| 465 | 465 | list($high, $low) = str_split($v); |
| 466 | 466 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | // pad to $bits bit |
| 87 | 87 | $bin_length = strlen($bin); |
| 88 | 88 | if ($bin_length < $bits) { |
| 89 | - $bin = str_repeat('0', $bits - $bin_length) . $bin; |
|
| 89 | + $bin = str_repeat('0', $bits - $bin_length).$bin; |
|
| 90 | 90 | } |
| 91 | 91 | } else { |
| 92 | 92 | // negative |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $bin = base_convert($si, 10, 2); |
| 95 | 95 | $bin_length = strlen($bin); |
| 96 | 96 | if ($bin_length > $bits) { |
| 97 | - $bin = str_repeat('1', $bits - $bin_length) . $bin; |
|
| 97 | + $bin = str_repeat('1', $bits - $bin_length).$bin; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | list($domain, $username) = $this->getDomainAndUsername($username); |
| 201 | 201 | //$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSServerName, $blob, $ter |
| 202 | - list($challenge, , , , , $workstation, , , $blob) = $this->parseMessage2($response); |
|
| 202 | + list($challenge,,,,, $workstation,,, $blob) = $this->parseMessage2($response); |
|
| 203 | 203 | |
| 204 | 204 | if (!$v2) { |
| 205 | 205 | // LMv1 |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $desKey1 = $this->createDesKey($key1); |
| 326 | 326 | $desKey2 = $this->createDesKey($key2); |
| 327 | 327 | |
| 328 | - $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1) . $this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 328 | + $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1).$this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 329 | 329 | |
| 330 | 330 | // SECOND PART |
| 331 | 331 | list($key1, $key2, $key3) = str_split($constantDecrypt, 7); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | $desKey2 = $this->createDesKey($key2); |
| 335 | 335 | $desKey3 = $this->createDesKey($key3); |
| 336 | 336 | |
| 337 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 337 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $desKey2 = $this->createDesKey($key2); |
| 356 | 356 | $desKey3 = $this->createDesKey($key3); |
| 357 | 357 | |
| 358 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 358 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | // if $password > 15 than we can't use this method |
| 401 | 401 | if (strlen($password) <= 15) { |
| 402 | 402 | $ntlmHash = $this->md4Encrypt($password); |
| 403 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 403 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 404 | 404 | |
| 405 | - $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge . $client) . $client); |
|
| 405 | + $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge.$client).$client); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | return $this->createByte($lmPass, 24); |
@@ -426,14 +426,14 @@ discard block |
||
| 426 | 426 | protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client) |
| 427 | 427 | { |
| 428 | 428 | $ntlmHash = $this->md4Encrypt($password); |
| 429 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 429 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 430 | 430 | |
| 431 | 431 | // create blob |
| 432 | 432 | $blob = $this->createBlob($timestamp, $client, $targetInfo); |
| 433 | 433 | |
| 434 | - $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge . $blob); |
|
| 434 | + $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge.$blob); |
|
| 435 | 435 | |
| 436 | - return $ntlmv2Response . $blob; |
|
| 436 | + return $ntlmv2Response.$blob; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | protected function createDesKey($key) |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $len = strlen($key); |
| 443 | 443 | for ($i = 1; $i < $len; ++$i) { |
| 444 | 444 | list($high, $low) = str_split(bin2hex($key[$i])); |
| 445 | - $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xf)), $i)); |
|
| 445 | + $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); |
|
| 446 | 446 | $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte |
| 447 | 447 | } |
| 448 | 448 | $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0'); |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | list($high, $low) = str_split($v); |
| 466 | 466 | |
| 467 | 467 | if ($needsParity) { |
| 468 | - $material[$k] = dechex(hexdec($high) | 0x0) . dechex(hexdec($low) | 0x1); |
|
| 468 | + $material[$k] = dechex(hexdec($high) | 0x0).dechex(hexdec($low) | 0x1); |
|
| 469 | 469 | } else { |
| 470 | - $material[$k] = dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xe); |
|
| 470 | + $material[$k] = dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xe); |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $length = $is16 ? $length / 2 : $length; |
| 491 | 491 | $length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2); |
| 492 | 492 | |
| 493 | - return $length . $length . $this->createByte(dechex($offset), 4); |
|
| 493 | + return $length.$length.$this->createByte(dechex($offset), 4); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /** |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $ipadk = $key ^ str_repeat("\x36", $blocksize); |
| 613 | 613 | $opadk = $key ^ str_repeat("\x5c", $blocksize); |
| 614 | 614 | |
| 615 | - return pack('H*', md5($opadk . pack('H*', md5($ipadk . $msg)))); |
|
| 615 | + return pack('H*', md5($opadk.pack('H*', md5($ipadk.$msg)))); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | /** |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | { |
| 667 | 667 | $message = bin2hex($message); |
| 668 | 668 | $messageId = substr($message, 16, 8); |
| 669 | - echo substr($message, 0, 16) . " NTLMSSP Signature<br />\n"; |
|
| 670 | - echo $messageId . " Type Indicator<br />\n"; |
|
| 669 | + echo substr($message, 0, 16)." NTLMSSP Signature<br />\n"; |
|
| 670 | + echo $messageId." Type Indicator<br />\n"; |
|
| 671 | 671 | |
| 672 | 672 | if ($messageId === '02000000') { |
| 673 | 673 | $map = array( |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $data = $this->parseMessage2($this->hex2bin($message)); |
| 687 | 687 | |
| 688 | 688 | foreach ($map as $key => $value) { |
| 689 | - echo bin2hex($data[$key]) . ' - ' . $data[$key] . ' ||| ' . $value . "<br />\n"; |
|
| 689 | + echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value."<br />\n"; |
|
| 690 | 690 | } |
| 691 | 691 | } elseif ($messageId === '03000000') { |
| 692 | 692 | $i = 0; |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | ); |
| 730 | 730 | |
| 731 | 731 | foreach ($map as $key => $value) { |
| 732 | - echo $data[$key] . ' - ' . $this->hex2bin($data[$key]) . ' ||| ' . $value . "<br />\n"; |
|
| 732 | + echo $data[$key].' - '.$this->hex2bin($data[$key]).' ||| '.$value."<br />\n"; |
|
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | 735 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | if ($i !== null) { |
| 112 | 112 | $tree[-1] = min(count($replace) - 1, $i); |
| 113 | 113 | $tree[-2] = $last_size; |
| 114 | - $this->_treeMaxLen = (int)$size; |
|
| 114 | + $this->_treeMaxLen = (int) $size; |
|
| 115 | 115 | } |
| 116 | 116 | foreach ($replace as $rep) { |
| 117 | 117 | if (!is_array($rep)) { |
@@ -8,17 +8,17 @@ |
||
| 8 | 8 | * file that was distributed with this source code. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -require __DIR__ . '/classes/Swift.php'; |
|
| 11 | +require __DIR__.'/classes/Swift.php'; |
|
| 12 | 12 | |
| 13 | 13 | Swift::registerAutoload( |
| 14 | - function () { |
|
| 14 | + function() { |
|
| 15 | 15 | // Load in dependency maps |
| 16 | - require __DIR__ . '/dependency_maps/cache_deps.php'; |
|
| 17 | - require __DIR__ . '/dependency_maps/mime_deps.php'; |
|
| 18 | - require __DIR__ . '/dependency_maps/message_deps.php'; |
|
| 19 | - require __DIR__ . '/dependency_maps/transport_deps.php'; |
|
| 16 | + require __DIR__.'/dependency_maps/cache_deps.php'; |
|
| 17 | + require __DIR__.'/dependency_maps/mime_deps.php'; |
|
| 18 | + require __DIR__.'/dependency_maps/message_deps.php'; |
|
| 19 | + require __DIR__.'/dependency_maps/transport_deps.php'; |
|
| 20 | 20 | |
| 21 | 21 | // Load in global library preferences |
| 22 | - require __DIR__ . '/preferences.php'; |
|
| 22 | + require __DIR__.'/preferences.php'; |
|
| 23 | 23 | } |
| 24 | 24 | ); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../mime_types.php'; |
|
| 3 | +require __DIR__.'/../mime_types.php'; |
|
| 4 | 4 | |
| 5 | 5 | Swift_DependencyContainer::getInstance() |
| 6 | 6 | ->register('properties.charset') |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if (!file_exists($this->_path)) { |
| 41 | 41 | if (!mkdir($this->_path, 0777, true)) { |
| 42 | - throw new Swift_IoException('Unable to create Path [' . $this->_path . ']'); |
|
| 42 | + throw new Swift_IoException('Unable to create Path ['.$this->_path.']'); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | public function queueMessage(Swift_Mime_Message $message) |
| 93 | 93 | { |
| 94 | 94 | $ser = serialize($message); |
| 95 | - $fileName = $this->_path . '/' . $this->getRandomString(10); |
|
| 95 | + $fileName = $this->_path.'/'.$this->getRandomString(10); |
|
| 96 | 96 | for ($i = 0; $i < $this->_retryLimit; ++$i) { |
| 97 | 97 | /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */ |
| 98 | - $fp = @fopen($fileName . '.message', 'x'); |
|
| 98 | + $fp = @fopen($fileName.'.message', 'x'); |
|
| 99 | 99 | if (false !== $fp) { |
| 100 | 100 | if (false === fwrite($fp, $ser)) { |
| 101 | 101 | return false; |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /* We try a rename, it's an atomic operation, and avoid locking the file */ |
| 166 | - if (rename($file, $file . '.sending')) { |
|
| 167 | - $message = unserialize(file_get_contents($file . '.sending')); |
|
| 166 | + if (rename($file, $file.'.sending')) { |
|
| 167 | + $message = unserialize(file_get_contents($file.'.sending')); |
|
| 168 | 168 | |
| 169 | 169 | $count += $transport->send($message, $failedRecipients); |
| 170 | 170 | |
| 171 | - unlink($file . '.sending'); |
|
| 171 | + unlink($file.'.sending'); |
|
| 172 | 172 | } else { |
| 173 | 173 | /* This message has just been catched by another process */ |
| 174 | 174 | continue; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach ($this->_params as $name => $value) { |
| 133 | 133 | if (null !== $value) { |
| 134 | 134 | // Add the parameter |
| 135 | - $body .= '; ' . $this->_createParameter($name, $value); |
|
| 135 | + $body .= '; '.$this->_createParameter($name, $value); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $tokens[count($tokens) - 1] .= ';'; |
| 161 | 161 | $tokens = array_merge( |
| 162 | 162 | $tokens, |
| 163 | - $this->generateTokenLines(' ' . $this->_createParameter($name, $value)) |
|
| 163 | + $this->generateTokenLines(' '.$this->_createParameter($name, $value)) |
|
| 164 | 164 | ); |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -182,18 +182,18 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $encoded = false; |
| 184 | 184 | // Allow room for parameter name, indices, "=" and DQUOTEs |
| 185 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '=*N"";') - 1; |
|
| 185 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1; |
|
| 186 | 186 | $firstLineOffset = 0; |
| 187 | 187 | |
| 188 | 188 | // If it's not already a valid parameter value... |
| 189 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
| 189 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
| 190 | 190 | // TODO: text, or something else?? |
| 191 | 191 | // ... and it's not ascii |
| 192 | 192 | if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) { |
| 193 | 193 | $encoded = true; |
| 194 | 194 | // Allow space for the indices, charset and language |
| 195 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '*N*="";') - 1; |
|
| 196 | - $firstLineOffset = strlen($this->getCharset() . "'" . $this->getLanguage() . "'"); |
|
| 195 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1; |
|
| 196 | + $firstLineOffset = strlen($this->getCharset()."'".$this->getLanguage()."'"); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | if (count($valueLines) > 1) { |
| 220 | 220 | $paramLines = array(); |
| 221 | 221 | foreach ($valueLines as $i => $line) { |
| 222 | - $paramLines[] = $name . '*' . $i . $this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 222 | + $paramLines[] = $name.'*'.$i.$this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return implode(";\r\n ", $paramLines); |
| 226 | 226 | } else { |
| 227 | - return $name . $this->_getEndOfParameterValue( |
|
| 227 | + return $name.$this->_getEndOfParameterValue( |
|
| 228 | 228 | $valueLines[0], |
| 229 | 229 | $encoded, |
| 230 | 230 | true |
@@ -243,18 +243,18 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) |
| 245 | 245 | { |
| 246 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
| 247 | - $value = '"' . $value . '"'; |
|
| 246 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
| 247 | + $value = '"'.$value.'"'; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $prepend = '='; |
| 251 | 251 | if ($encoded) { |
| 252 | 252 | $prepend = '*='; |
| 253 | 253 | if ($firstLine) { |
| 254 | - $prepend = '*=' . $this->getCharset() . "'" . $this->getLanguage() . "'"; |
|
| 254 | + $prepend = '*='.$this->getCharset()."'".$this->getLanguage()."'"; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - return $prepend . $value; |
|
| 258 | + return $prepend.$value; |
|
| 259 | 259 | } |
| 260 | 260 | } |