@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if ($atEOF) { |
| 47 | 47 | $streamTheseBytes = $base64ReadBufferRemainderBytes; |
| 48 | 48 | } else { |
| 49 | - $streamTheseBytes = $base64ReadBufferRemainderBytes . $readBytes; |
|
| 49 | + $streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $base64ReadBufferRemainderBytes = null; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset; |
| 72 | 72 | |
| 73 | 73 | while ($thisMaxLineLength < strlen($encoded)) { |
| 74 | - $encodedTransformed .= \substr($encoded, 0, $thisMaxLineLength) . "\r\n"; |
|
| 74 | + $encodedTransformed .= \substr($encoded, 0, $thisMaxLineLength)."\r\n"; |
|
| 75 | 75 | $firstLineOffset = 0; |
| 76 | 76 | $encoded = \substr($encoded, $thisMaxLineLength); |
| 77 | 77 | $thisMaxLineLength = $maxLineLength; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | if ($lang && $this->_lang !== $lang) { |
| 108 | 108 | $this->clearCachedValue(); |
| 109 | - $this->_lang = (string)$lang; |
|
| 109 | + $this->_lang = (string) $lang; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | if ($lineLength && $this->_lineLength !== $lineLength) { |
| 166 | 166 | $this->clearCachedValue(); |
| 167 | 167 | |
| 168 | - $this->_lineLength = (int)$lineLength; |
|
| 168 | + $this->_lineLength = (int) $lineLength; |
|
| 169 | 169 | |
| 170 | 170 | return true; |
| 171 | 171 | } |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | // Treat token as exactly what was given |
| 232 | 232 | $phraseStr = $string; |
| 233 | 233 | // If it's not valid |
| 234 | - if (!preg_match('/^' . self::PHRASE_PATTERN . '$/D', $phraseStr)) { |
|
| 234 | + if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) { |
|
| 235 | 235 | // .. but it is just ascii text, try escaping some characters |
| 236 | 236 | // and make it a quoted-string |
| 237 | 237 | if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) { |
| 238 | 238 | $phraseStr = $this->escapeSpecials($phraseStr, array('"')); |
| 239 | - $phraseStr = '"' . $phraseStr . '"'; |
|
| 239 | + $phraseStr = '"'.$phraseStr.'"'; |
|
| 240 | 240 | } else { |
| 241 | 241 | // ... otherwise it needs encoding |
| 242 | 242 | // Determine space remaining on line if first line |
| 243 | 243 | if ($shorten) { |
| 244 | - $usedLength = \strlen($header->getFieldName() . ': '); |
|
| 244 | + $usedLength = \strlen($header->getFieldName().': '); |
|
| 245 | 245 | } else { |
| 246 | 246 | $usedLength = 0; |
| 247 | 247 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | protected function escapeSpecials($token, array $include = array()) |
| 264 | 264 | { |
| 265 | 265 | foreach (array_merge(array('\\'), $include) as $char) { |
| 266 | - $token = \str_replace($char, '\\' . $char, $token); |
|
| 266 | + $token = \str_replace($char, '\\'.$char, $token); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | return $token; |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | $charsetDecl = $this->_charset; |
| 369 | 369 | |
| 370 | 370 | if ($this->_lang) { |
| 371 | - $charsetDecl .= '*' . $this->_lang; |
|
| 371 | + $charsetDecl .= '*'.$this->_lang; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $encodingWrapperLength = \strlen('=?' . $charsetDecl . '?' . $this->_encoder->getName() . '??='); |
|
| 374 | + $encodingWrapperLength = \strlen('=?'.$charsetDecl.'?'.$this->_encoder->getName().'??='); |
|
| 375 | 375 | |
| 376 | 376 | if ($firstLineOffset >= 75) { |
| 377 | 377 | // Does this logic need to be here? |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | if (Swift::strtolowerWithStaticCache($this->_charset) !== 'iso-2022-jp') { |
| 388 | 388 | // special encoding for iso-2022-jp using mb_encode_mimeheader |
| 389 | 389 | foreach ($encodedTextLines as $lineNum => $line) { |
| 390 | - $encodedTextLines[$lineNum] = '=?' . $charsetDecl . '?' . $this->_encoder->getName() . '?' . $line . '?='; |
|
| 390 | + $encodedTextLines[$lineNum] = '=?'.$charsetDecl.'?'.$this->_encoder->getName().'?'.$line.'?='; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | $lineCount = 0; |
| 483 | 483 | $headerLines = array(); |
| 484 | - $headerLines[] = $this->_name . ': '; |
|
| 484 | + $headerLines[] = $this->_name.': '; |
|
| 485 | 485 | $currentLine = &$headerLines[$lineCount++]; |
| 486 | 486 | |
| 487 | 487 | // Build all tokens back into compliant header |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | ( |
| 497 | 497 | $i > 0 |
| 498 | 498 | && |
| 499 | - strlen($currentLine . $token) > $this->_lineLength |
|
| 499 | + strlen($currentLine.$token) > $this->_lineLength |
|
| 500 | 500 | ) |
| 501 | 501 | ) |
| 502 | 502 | ) { |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | // Implode with FWS (RFC 2822, 2.2.3) |
| 514 | - return implode("\r\n", $headerLines) . "\r\n"; |
|
| 514 | + return implode("\r\n", $headerLines)."\r\n"; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | foreach ($this->_params as $name => $value) { |
| 137 | 137 | if (null !== $value) { |
| 138 | 138 | // Add the parameter |
| 139 | - $body .= '; ' . $this->_createParameter($name, $value); |
|
| 139 | + $body .= '; '.$this->_createParameter($name, $value); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $tokens[count($tokens) - 1] .= ';'; |
| 165 | 165 | $tokens = array_merge( |
| 166 | 166 | $tokens, |
| 167 | - $this->generateTokenLines(' ' . $this->_createParameter($name, $value)) |
|
| 167 | + $this->generateTokenLines(' '.$this->_createParameter($name, $value)) |
|
| 168 | 168 | ); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $encoded = false; |
| 188 | 188 | // Allow room for parameter name, indices, "=" and DQUOTEs |
| 189 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '=*N"";') - 1; |
|
| 189 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1; |
|
| 190 | 190 | $firstLineOffset = 0; |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | if ( |
| 194 | 194 | // If it's not already a valid parameter value ... |
| 195 | - !preg_match('/^' . self::TOKEN_REGEX . '$/D', $value) |
|
| 195 | + !preg_match('/^'.self::TOKEN_REGEX.'$/D', $value) |
|
| 196 | 196 | && |
| 197 | 197 | // ... and it's not ascii |
| 198 | 198 | !UTF8::is_ascii($value) |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | $encoded = true; |
| 201 | 201 | |
| 202 | 202 | // Allow space for the indices, charset and language. |
| 203 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '*N*="";') - 1; |
|
| 204 | - $firstLineOffset = \strlen($this->getCharset() . "'" . $this->getLanguage() . "'"); |
|
| 203 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1; |
|
| 204 | + $firstLineOffset = \strlen($this->getCharset()."'".$this->getLanguage()."'"); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Encode if we need to ... |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | if (count($valueLines) > 1) { |
| 231 | 231 | $paramLines = array(); |
| 232 | 232 | foreach ($valueLines as $i => $line) { |
| 233 | - $paramLines[] = $name . '*' . $i . $this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 233 | + $paramLines[] = $name.'*'.$i.$this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return implode(";\r\n ", $paramLines); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return $name . $this->_getEndOfParameterValue( |
|
| 239 | + return $name.$this->_getEndOfParameterValue( |
|
| 240 | 240 | $valueLines[0], |
| 241 | 241 | $encoded, |
| 242 | 242 | true |
@@ -254,18 +254,18 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) |
| 256 | 256 | { |
| 257 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
| 258 | - $value = '"' . $value . '"'; |
|
| 257 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
| 258 | + $value = '"'.$value.'"'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $prepend = '='; |
| 262 | 262 | if ($encoded) { |
| 263 | 263 | $prepend = '*='; |
| 264 | 264 | if ($firstLine) { |
| 265 | - $prepend = '*=' . $this->getCharset() . "'" . $this->getLanguage() . "'"; |
|
| 265 | + $prepend = '*='.$this->getCharset()."'".$this->getLanguage()."'"; |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return $prepend . $value; |
|
| 269 | + return $prepend.$value; |
|
| 270 | 270 | } |
| 271 | 271 | } |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | return array('DKIM-Signature', 'X-DebugHash'); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - return array('DKIM-Signature'); |
|
| 513 | + return array('DKIM-Signature'); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | /** |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | if ($this->_signatureTimestamp === true) { |
| 593 | 593 | |
| 594 | - $params['t'] = time(); |
|
| 594 | + $params['t'] = time(); |
|
| 595 | 595 | if ($this->_signatureExpiration !== false) { |
| 596 | 596 | $params['x'] = $params['t'] + $this->_signatureExpiration; |
| 597 | 597 | } |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | { |
| 740 | 740 | $len = \strlen($string); |
| 741 | 741 | if ($len > ($new_len = ($this->_maxLen - $this->_bodyLen))) { |
| 742 | - /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
|
| 743 | - $string = \substr($string, 0, $new_len); |
|
| 742 | + /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
|
| 743 | + $string = \substr($string, 0, $new_len); |
|
| 744 | 744 | $len = $new_len; |
| 745 | 745 | } |
| 746 | 746 | hash_update($this->_bodyHashHandler, $string); |
@@ -779,9 +779,9 @@ discard block |
||
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | if ($this->_passphrase) { |
| 782 | - $pkeyId = openssl_get_privatekey($this->_privateKey, $this->_passphrase); |
|
| 782 | + $pkeyId = openssl_get_privatekey($this->_privateKey, $this->_passphrase); |
|
| 783 | 783 | } else { |
| 784 | - $pkeyId = openssl_get_privatekey($this->_privateKey); |
|
| 784 | + $pkeyId = openssl_get_privatekey($this->_privateKey); |
|
| 785 | 785 | } |
| 786 | 786 | if (!$pkeyId) { |
| 787 | 787 | throw new Swift_SwiftException('Unable to load DKIM Private Key [' . openssl_error_string() . ']'); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $this->_privateKey = $privateKey; |
| 211 | 211 | $this->_domainName = $domainName; |
| 212 | - $this->_signerIdentity = '@' . $domainName; |
|
| 212 | + $this->_signerIdentity = '@'.$domainName; |
|
| 213 | 213 | $this->_selector = $selector; |
| 214 | 214 | $this->_passphrase = $passphrase; |
| 215 | 215 | |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | ); |
| 581 | 581 | |
| 582 | 582 | if ($this->_bodyCanon != 'simple') { |
| 583 | - $params['c'] = $this->_headerCanon . '/' . $this->_bodyCanon; |
|
| 583 | + $params['c'] = $this->_headerCanon.'/'.$this->_bodyCanon; |
|
| 584 | 584 | } elseif ($this->_headerCanon != 'simple') { |
| 585 | 585 | $params['c'] = $this->_headerCanon; |
| 586 | 586 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | $string = ''; |
| 616 | 616 | foreach ($params as $k => $v) { |
| 617 | - $string .= $k . '=' . $v . '; '; |
|
| 617 | + $string .= $k.'='.$v.'; '; |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | $string = trim($string); |
@@ -623,14 +623,14 @@ discard block |
||
| 623 | 623 | // Add the last DKIM-Signature |
| 624 | 624 | $tmp = $headers->getAll('DKIM-Signature'); |
| 625 | 625 | $this->_dkimHeader = end($tmp); |
| 626 | - $this->_addHeader(trim($this->_dkimHeader->toString()) . "\r\n b=", true); |
|
| 626 | + $this->_addHeader(trim($this->_dkimHeader->toString())."\r\n b=", true); |
|
| 627 | 627 | $this->_endOfHeaders(); |
| 628 | 628 | |
| 629 | 629 | if ($this->_debugHeaders) { |
| 630 | 630 | $headers->addTextHeader('X-DebugHash', base64_encode($this->_headerHash)); |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - $this->_dkimHeader->setValue($string . ' b=' . trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '))); |
|
| 633 | + $this->_dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '))); |
|
| 634 | 634 | |
| 635 | 635 | return $this; |
| 636 | 636 | } |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $name = Swift::strtolowerWithStaticCache(trim($exploded[0])); |
| 649 | 649 | $value = \str_replace("\r\n", '', $exploded[1]); |
| 650 | 650 | $value = \preg_replace("/[ \t][ \t]+/", ' ', $value); |
| 651 | - $header = $name . ':' . trim($value) . ($is_sig ? '' : "\r\n"); |
|
| 651 | + $header = $name.':'.trim($value).($is_sig ? '' : "\r\n"); |
|
| 652 | 652 | case 'simple': |
| 653 | 653 | // Nothing to do |
| 654 | 654 | } |
@@ -784,13 +784,13 @@ discard block |
||
| 784 | 784 | $pkeyId = openssl_get_privatekey($this->_privateKey); |
| 785 | 785 | } |
| 786 | 786 | if (!$pkeyId) { |
| 787 | - throw new Swift_SwiftException('Unable to load DKIM Private Key [' . openssl_error_string() . ']'); |
|
| 787 | + throw new Swift_SwiftException('Unable to load DKIM Private Key ['.openssl_error_string().']'); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | if (openssl_sign($this->_headerCanonData, $signature, $pkeyId, $algorithm)) { |
| 791 | 791 | return $signature; |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - throw new Swift_SwiftException('Unable to sign DKIM Hash [' . openssl_error_string() . ']'); |
|
| 794 | + throw new Swift_SwiftException('Unable to sign DKIM Hash ['.openssl_error_string().']'); |
|
| 795 | 795 | } |
| 796 | 796 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if (strpos($path, '?') !== false) { |
| 82 | 82 | $parameter = parse_url($path, PHP_URL_QUERY); |
| 83 | 83 | |
| 84 | - $this->_path = \str_replace('?' . $parameter, '', $path); |
|
| 84 | + $this->_path = \str_replace('?'.$parameter, '', $path); |
|
| 85 | 85 | } else { |
| 86 | 86 | $this->_path = $path; |
| 87 | 87 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $pointer = @fopen($this->_path, 'rb', false, stream_context_create($opts)); |
| 211 | 211 | |
| 212 | 212 | if (!$pointer) { |
| 213 | - throw new Swift_IoException('Unable to open file for reading [' . $this->_path . ']'); |
|
| 213 | + throw new Swift_IoException('Unable to open file for reading ['.$this->_path.']'); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $this->_reader = $pointer; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $pointer = @fopen($this->_path, $this->_mode); |
| 233 | 233 | |
| 234 | 234 | if (!$pointer) { |
| 235 | - throw new Swift_IoException('Unable to open file for writing [' . $this->_path . ']'); |
|
| 235 | + throw new Swift_IoException('Unable to open file for writing ['.$this->_path.']'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $this->_writer = $pointer; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $source = @fopen($this->_path, 'rb'); |
| 304 | 304 | |
| 305 | 305 | if (!$source) { |
| 306 | - throw new Swift_IoException('Unable to open file for copying [' . $this->_path . ']'); |
|
| 306 | + throw new Swift_IoException('Unable to open file for copying ['.$this->_path.']'); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | fseek($tmpFile, 0, SEEK_SET); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | if ( |
| 64 | 64 | $currentLine !== '' |
| 65 | 65 | && |
| 66 | - \strlen($currentLine . $encodedChar) > $thisLineLength |
|
| 66 | + \strlen($currentLine.$encodedChar) > $thisLineLength |
|
| 67 | 67 | ) { |
| 68 | 68 | $lines[] = ''; |
| 69 | 69 | $currentLine = &$lines[$lineCount++]; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function send(Swift_Mime_Message $message, &$failedRecipients = null) |
| 113 | 113 | { |
| 114 | - $failedRecipients = (array)$failedRecipients; |
|
| 114 | + $failedRecipients = (array) $failedRecipients; |
|
| 115 | 115 | $command = $this->getCommand(); |
| 116 | 116 | $buffer = $this->getBuffer(); |
| 117 | 117 | $count = 0; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (false === strpos($command, ' -f')) { |
| 131 | - $command .= ' -f' . escapeshellarg($this->_getReversePath($message)); |
|
| 131 | + $command .= ' -f'.escapeshellarg($this->_getReversePath($message)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $buffer->initialize(array_merge($this->_params, array('command' => $command))); |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | $buffer->setWriteTranslations(array("\r\n" => "\n")); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $count = \count((array)$message->getTo()) |
|
| 143 | - + count((array)$message->getCc()) |
|
| 144 | - + count((array)$message->getBcc()); |
|
| 142 | + $count = \count((array) $message->getTo()) |
|
| 143 | + + count((array) $message->getCc()) |
|
| 144 | + + count((array) $message->getBcc()); |
|
| 145 | 145 | |
| 146 | 146 | $message->toByteStream($buffer); |
| 147 | 147 | $buffer->flushBuffers(); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } else { |
| 160 | 160 | $this->_throwException( |
| 161 | 161 | new Swift_TransportException( |
| 162 | - 'Unsupported sendmail command flags [' . $command . ']. ' . |
|
| 162 | + 'Unsupported sendmail command flags ['.$command.']. '. |
|
| 163 | 163 | 'Must be one of "-bs" or "-t" but can include additional flags.' |
| 164 | 164 | ) |
| 165 | 165 | ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $challenge = $agent->executeCommand("AUTH CRAM-MD5\r\n", array(334)); |
| 41 | 41 | $challenge = base64_decode(substr($challenge, 4)); |
| 42 | 42 | $message = base64_encode( |
| 43 | - $username . ' ' . $this->_getResponse($password, $challenge) |
|
| 43 | + $username.' '.$this->_getResponse($password, $challenge) |
|
| 44 | 44 | ); |
| 45 | 45 | $agent->executeCommand(sprintf("%s\r\n", $message), array(235)); |
| 46 | 46 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $k_ipad = \substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64); |
| 74 | 74 | $k_opad = \substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64); |
| 75 | 75 | |
| 76 | - $inner = pack('H32', md5($k_ipad . $challenge)); |
|
| 77 | - $digest = md5($k_opad . $inner); |
|
| 76 | + $inner = pack('H32', md5($k_ipad.$challenge)); |
|
| 77 | + $digest = md5($k_opad.$inner); |
|
| 78 | 78 | |
| 79 | 79 | return $digest; |
| 80 | 80 | } |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | protected function createMessage1() |
| 226 | 226 | { |
| 227 | 227 | return self::NTLMSIG |
| 228 | - . $this->createByte('01') // Message 1 |
|
| 229 | - . $this->createByte('0702'); // Flags |
|
| 228 | + . $this->createByte('01') // Message 1 |
|
| 229 | + . $this->createByte('0702'); // Flags |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -254,19 +254,19 @@ discard block |
||
| 254 | 254 | $ntlmSec = $this->createSecurityBuffer($ntlmResponse, ($lmInfo[0] + $lmInfo[1]) / 2, true); |
| 255 | 255 | |
| 256 | 256 | return self::NTLMSIG |
| 257 | - . $this->createByte('03') // TYPE 3 message |
|
| 258 | - . $lmSec // LM response header |
|
| 259 | - . $ntlmSec // NTLM response header |
|
| 260 | - . $domainSec // Domain header |
|
| 261 | - . $userSec // User header |
|
| 262 | - . $workSec // Workstation header |
|
| 263 | - . $this->createByte('000000009a', 8) // session key header (empty) |
|
| 264 | - . $this->createByte('01020000') // FLAGS |
|
| 265 | - . $this->convertTo16bit($domain) // domain name |
|
| 266 | - . $this->convertTo16bit($username) // username |
|
| 267 | - . $this->convertTo16bit($workstation) // workstation |
|
| 268 | - . $lmResponse |
|
| 269 | - . $ntlmResponse; |
|
| 257 | + . $this->createByte('03') // TYPE 3 message |
|
| 258 | + . $lmSec // LM response header |
|
| 259 | + . $ntlmSec // NTLM response header |
|
| 260 | + . $domainSec // Domain header |
|
| 261 | + . $userSec // User header |
|
| 262 | + . $workSec // Workstation header |
|
| 263 | + . $this->createByte('000000009a', 8) // session key header (empty) |
|
| 264 | + . $this->createByte('01020000') // FLAGS |
|
| 265 | + . $this->convertTo16bit($domain) // domain name |
|
| 266 | + . $this->convertTo16bit($username) // username |
|
| 267 | + . $this->convertTo16bit($workstation) // workstation |
|
| 268 | + . $lmResponse |
|
| 269 | + . $ntlmResponse; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | protected function createBlob($timestamp, $client, $targetInfo) |
| 280 | 280 | { |
| 281 | 281 | return $this->createByte('0101') |
| 282 | - . $this->createByte('00') |
|
| 283 | - . $timestamp |
|
| 284 | - . $client |
|
| 285 | - . $this->createByte('00') |
|
| 286 | - . $targetInfo |
|
| 287 | - . $this->createByte('00'); |
|
| 282 | + . $this->createByte('00') |
|
| 283 | + . $timestamp |
|
| 284 | + . $client |
|
| 285 | + . $this->createByte('00') |
|
| 286 | + . $targetInfo |
|
| 287 | + . $this->createByte('00'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -453,16 +453,16 @@ discard block |
||
| 453 | 453 | foreach ($material as $k => $v) { |
| 454 | 454 | $b = $this->castToByte(hexdec($v)); |
| 455 | 455 | $needsParity = ( |
| 456 | - ( |
|
| 457 | - $this->uRShift($b, 7) |
|
| 458 | - ^ $this->uRShift($b, 6) |
|
| 459 | - ^ $this->uRShift($b, 5) |
|
| 460 | - ^ $this->uRShift($b, 4) |
|
| 461 | - ^ $this->uRShift($b, 3) |
|
| 462 | - ^ $this->uRShift($b, 2) |
|
| 463 | - ^ $this->uRShift($b, 1) |
|
| 464 | - ) & 0x01 |
|
| 465 | - ) == 0; |
|
| 456 | + ( |
|
| 457 | + $this->uRShift($b, 7) |
|
| 458 | + ^ $this->uRShift($b, 6) |
|
| 459 | + ^ $this->uRShift($b, 5) |
|
| 460 | + ^ $this->uRShift($b, 4) |
|
| 461 | + ^ $this->uRShift($b, 3) |
|
| 462 | + ^ $this->uRShift($b, 2) |
|
| 463 | + ^ $this->uRShift($b, 1) |
|
| 464 | + ) & 0x01 |
|
| 465 | + ) == 0; |
|
| 466 | 466 | |
| 467 | 467 | list($high, $low) = \str_split($v); |
| 468 | 468 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // pad to $bits bit |
| 86 | 86 | $bin_length = \strlen($bin); |
| 87 | 87 | if ($bin_length < $bits) { |
| 88 | - $bin = str_repeat('0', $bits - $bin_length) . $bin; |
|
| 88 | + $bin = str_repeat('0', $bits - $bin_length).$bin; |
|
| 89 | 89 | } |
| 90 | 90 | } else { |
| 91 | 91 | // negative |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $bin = base_convert($si, 10, 2); |
| 94 | 94 | $bin_length = \strlen($bin); |
| 95 | 95 | if ($bin_length > $bits) { |
| 96 | - $bin = str_repeat('1', $bits - $bin_length) . $bin; |
|
| 96 | + $bin = str_repeat('1', $bits - $bin_length).$bin; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | list($domain, $username) = $this->getDomainAndUsername($username); |
| 200 | 200 | //$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSServerName, $blob, $ter |
| 201 | - list($challenge, , , , , $workstation, , , $blob) = $this->parseMessage2($response); |
|
| 201 | + list($challenge,,,,, $workstation,,, $blob) = $this->parseMessage2($response); |
|
| 202 | 202 | |
| 203 | 203 | if (!$v2) { |
| 204 | 204 | // LMv1 |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $desKey1 = $this->createDesKey($key1); |
| 330 | 330 | $desKey2 = $this->createDesKey($key2); |
| 331 | 331 | |
| 332 | - $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1) . $this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 332 | + $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1).$this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 333 | 333 | |
| 334 | 334 | // SECOND PART |
| 335 | 335 | list($key1, $key2, $key3) = \str_split($constantDecrypt, 7); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $desKey2 = $this->createDesKey($key2); |
| 339 | 339 | $desKey3 = $this->createDesKey($key3); |
| 340 | 340 | |
| 341 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 341 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $desKey2 = $this->createDesKey($key2); |
| 360 | 360 | $desKey3 = $this->createDesKey($key3); |
| 361 | 361 | |
| 362 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 362 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | // if $password > 15 than we can't use this method |
| 403 | 403 | if (strlen($password) <= 15) { |
| 404 | 404 | $ntlmHash = $this->md4Encrypt($password); |
| 405 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 405 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 406 | 406 | |
| 407 | - $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge . $client) . $client); |
|
| 407 | + $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge.$client).$client); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | return $this->createByte($lmPass, 24); |
@@ -428,14 +428,14 @@ discard block |
||
| 428 | 428 | protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client) |
| 429 | 429 | { |
| 430 | 430 | $ntlmHash = $this->md4Encrypt($password); |
| 431 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 431 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 432 | 432 | |
| 433 | 433 | // create blob |
| 434 | 434 | $blob = $this->createBlob($timestamp, $client, $targetInfo); |
| 435 | 435 | |
| 436 | - $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge . $blob); |
|
| 436 | + $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge.$blob); |
|
| 437 | 437 | |
| 438 | - return $ntlmv2Response . $blob; |
|
| 438 | + return $ntlmv2Response.$blob; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | protected function createDesKey($key) |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $len = \strlen($key); |
| 445 | 445 | for ($i = 1; $i < $len; ++$i) { |
| 446 | 446 | list($high, $low) = \str_split(bin2hex($key[$i])); |
| 447 | - $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xf)), $i)); |
|
| 447 | + $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); |
|
| 448 | 448 | $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte |
| 449 | 449 | } |
| 450 | 450 | $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0'); |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | list($high, $low) = \str_split($v); |
| 468 | 468 | |
| 469 | 469 | if ($needsParity) { |
| 470 | - $material[$k] = dechex(hexdec($high) | 0x0) . dechex(hexdec($low) | 0x1); |
|
| 470 | + $material[$k] = dechex(hexdec($high) | 0x0).dechex(hexdec($low) | 0x1); |
|
| 471 | 471 | } else { |
| 472 | - $material[$k] = dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xe); |
|
| 472 | + $material[$k] = dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xe); |
|
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $length = $is16 ? $length / 2 : $length; |
| 494 | 494 | $length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2); |
| 495 | 495 | |
| 496 | - return $length . $length . $this->createByte(dechex($offset), 4); |
|
| 496 | + return $length.$length.$this->createByte(dechex($offset), 4); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /** |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $ipadk = $key ^ str_repeat("\x36", $blocksize); |
| 597 | 597 | $opadk = $key ^ str_repeat("\x5c", $blocksize); |
| 598 | 598 | |
| 599 | - return pack('H*', md5($opadk . pack('H*', md5($ipadk . $msg)))); |
|
| 599 | + return pack('H*', md5($opadk.pack('H*', md5($ipadk.$msg)))); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | { |
| 635 | 635 | $message = bin2hex($message); |
| 636 | 636 | $messageId = \substr($message, 16, 8); |
| 637 | - echo substr($message, 0, 16) . " NTLMSSP Signature<br />\n"; |
|
| 638 | - echo $messageId . " Type Indicator<br />\n"; |
|
| 637 | + echo substr($message, 0, 16)." NTLMSSP Signature<br />\n"; |
|
| 638 | + echo $messageId." Type Indicator<br />\n"; |
|
| 639 | 639 | |
| 640 | 640 | if ($messageId === '02000000') { |
| 641 | 641 | $map = array( |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | $data = $this->parseMessage2(\hex2bin($message)); |
| 655 | 655 | |
| 656 | 656 | foreach ($map as $key => $value) { |
| 657 | - echo bin2hex($data[$key]) . ' - ' . $data[$key] . ' ||| ' . $value . "<br />\n"; |
|
| 657 | + echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value."<br />\n"; |
|
| 658 | 658 | } |
| 659 | 659 | } elseif ($messageId === '03000000') { |
| 660 | 660 | $i = 0; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ); |
| 698 | 698 | |
| 699 | 699 | foreach ($map as $key => $value) { |
| 700 | - echo $data[$key] . ' - ' . \hex2bin($data[$key]) . ' ||| ' . $value . "<br />\n"; |
|
| 700 | + echo $data[$key].' - '.\hex2bin($data[$key]).' ||| '.$value."<br />\n"; |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |