@@ -255,8 +255,8 @@ |
||
| 255 | 255 | // because we will then act as regular DES-CBC with just a <= 64bit key. |
| 256 | 256 | // So only if the key > 64bits (> 8 bytes) we will call setKey() for the 3 $des. |
| 257 | 257 | if ($this->mode_3cbc && $length > 8) { |
| 258 | - $this->des[0]->setKey(substr($key, 0, 8)); |
|
| 259 | - $this->des[1]->setKey(substr($key, 8, 8)); |
|
| 258 | + $this->des[0]->setKey(substr($key, 0, 8)); |
|
| 259 | + $this->des[1]->setKey(substr($key, 8, 8)); |
|
| 260 | 260 | $this->des[2]->setKey(substr($key, 16, 8)); |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * SSH2 is being used. |
| 71 | 71 | */ |
| 72 | - const MODE_SSH2 = 2; |
|
| 72 | + const MODE_SSH2 = 2; |
|
| 73 | 73 | /**#@-*/ |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | while ($sent < $size) { |
| 190 | 190 | $temp = $mode & self::SOURCE_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size); |
| 191 | 191 | $this->_send($temp); |
| 192 | - $sent+= strlen($temp); |
|
| 192 | + $sent += strlen($temp); |
|
| 193 | 193 | |
| 194 | 194 | if (is_callable($callback)) { |
| 195 | 195 | call_user_func($callback, $sent); |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | while ($size < $info['size']) { |
| 248 | 248 | $data = $this->_receive(); |
| 249 | 249 | // SCP usually seems to split stuff out into 16k chunks |
| 250 | - $size+= strlen($data); |
|
| 250 | + $size += strlen($data); |
|
| 251 | 251 | |
| 252 | 252 | if ($local_file === false) { |
| 253 | - $content.= $data; |
|
| 253 | + $content .= $data; |
|
| 254 | 254 | } else { |
| 255 | 255 | fputs($fp, $data); |
| 256 | 256 | } |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $dir = './'; |
| 683 | 683 | // suffix a slash if needed |
| 684 | 684 | } elseif ($dir[strlen($dir) - 1] != '/') { |
| 685 | - $dir.= '/'; |
|
| 685 | + $dir .= '/'; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | $dir = $this->_realpath($dir); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $files[$key] = $this->rawlist($dir . '/' . $key, true); |
| 802 | 802 | $depth--; |
| 803 | 803 | } else { |
| 804 | - $files[$key] = (object) $value; |
|
| 804 | + $files[$key] = (object)$value; |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | } else { |
| 887 | 887 | $temp = $dir . '/' . $shortname; |
| 888 | 888 | } |
| 889 | - $this->_update_stat_cache($temp, (object) array('lstat' => $attributes)); |
|
| 889 | + $this->_update_stat_cache($temp, (object)array('lstat' => $attributes)); |
|
| 890 | 890 | } |
| 891 | 891 | // SFTPv6 has an optional boolean end-of-list field, but we'll ignore that, since the |
| 892 | 892 | // final SSH_FXP_STATUS packet should tell us that, already. |
@@ -968,8 +968,8 @@ discard block |
||
| 968 | 968 | break; |
| 969 | 969 | case 'permissions': |
| 970 | 970 | case 'mode': |
| 971 | - $a[$sort]&= 07777; |
|
| 972 | - $b[$sort]&= 07777; |
|
| 971 | + $a[$sort] &= 07777; |
|
| 972 | + $b[$sort] &= 07777; |
|
| 973 | 973 | default: |
| 974 | 974 | if ($a[$sort] === $b[$sort]) { |
| 975 | 975 | break; |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | return; |
| 1008 | 1008 | } |
| 1009 | 1009 | $len = count($args) & 0x7FFFFFFE; |
| 1010 | - for ($i = 0; $i < $len; $i+=2) { |
|
| 1010 | + for ($i = 0; $i < $len; $i += 2) { |
|
| 1011 | 1011 | $this->sortOptions[$args[$i]] = $args[$i + 1]; |
| 1012 | 1012 | } |
| 1013 | 1013 | if (!count($this->sortOptions)) { |
@@ -1166,9 +1166,9 @@ discard block |
||
| 1166 | 1166 | } |
| 1167 | 1167 | if (isset($stat['type'])) { |
| 1168 | 1168 | if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { |
| 1169 | - $filename.= '/.'; |
|
| 1169 | + $filename .= '/.'; |
|
| 1170 | 1170 | } |
| 1171 | - $this->_update_stat_cache($filename, (object) array('stat' => $stat)); |
|
| 1171 | + $this->_update_stat_cache($filename, (object)array('stat' => $stat)); |
|
| 1172 | 1172 | return $stat; |
| 1173 | 1173 | } |
| 1174 | 1174 | |
@@ -1179,9 +1179,9 @@ discard block |
||
| 1179 | 1179 | $this->pwd = $pwd; |
| 1180 | 1180 | |
| 1181 | 1181 | if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { |
| 1182 | - $filename.= '/.'; |
|
| 1182 | + $filename .= '/.'; |
|
| 1183 | 1183 | } |
| 1184 | - $this->_update_stat_cache($filename, (object) array('stat' => $stat)); |
|
| 1184 | + $this->_update_stat_cache($filename, (object)array('stat' => $stat)); |
|
| 1185 | 1185 | |
| 1186 | 1186 | return $stat; |
| 1187 | 1187 | } |
@@ -1223,9 +1223,9 @@ discard block |
||
| 1223 | 1223 | } |
| 1224 | 1224 | if (isset($lstat['type'])) { |
| 1225 | 1225 | if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { |
| 1226 | - $filename.= '/.'; |
|
| 1226 | + $filename .= '/.'; |
|
| 1227 | 1227 | } |
| 1228 | - $this->_update_stat_cache($filename, (object) array('lstat' => $lstat)); |
|
| 1228 | + $this->_update_stat_cache($filename, (object)array('lstat' => $lstat)); |
|
| 1229 | 1229 | return $lstat; |
| 1230 | 1230 | } |
| 1231 | 1231 | |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | |
| 1234 | 1234 | if ($lstat != $stat) { |
| 1235 | 1235 | $lstat = array_merge($lstat, array('type' => NET_SFTP_TYPE_SYMLINK)); |
| 1236 | - $this->_update_stat_cache($filename, (object) array('lstat' => $lstat)); |
|
| 1236 | + $this->_update_stat_cache($filename, (object)array('lstat' => $lstat)); |
|
| 1237 | 1237 | return $stat; |
| 1238 | 1238 | } |
| 1239 | 1239 | |
@@ -1244,9 +1244,9 @@ discard block |
||
| 1244 | 1244 | $this->pwd = $pwd; |
| 1245 | 1245 | |
| 1246 | 1246 | if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { |
| 1247 | - $filename.= '/.'; |
|
| 1247 | + $filename .= '/.'; |
|
| 1248 | 1248 | } |
| 1249 | - $this->_update_stat_cache($filename, (object) array('lstat' => $lstat)); |
|
| 1249 | + $this->_update_stat_cache($filename, (object)array('lstat' => $lstat)); |
|
| 1250 | 1250 | |
| 1251 | 1251 | return $lstat; |
| 1252 | 1252 | } |
@@ -1827,7 +1827,7 @@ discard block |
||
| 1827 | 1827 | $offset = $size !== false ? $size : 0; |
| 1828 | 1828 | } else { |
| 1829 | 1829 | $offset = 0; |
| 1830 | - $flags|= NET_SFTP_OPEN_TRUNCATE; |
|
| 1830 | + $flags |= NET_SFTP_OPEN_TRUNCATE; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | 1833 | $packet = pack('Na*N2', strlen($remote_file), $remote_file, $flags, 0); |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | |
| 1894 | 1894 | $sftp_packet_size = 4096; // PuTTY uses 4096 |
| 1895 | 1895 | // make the SFTP packet be exactly 4096 bytes by including the bytes in the NET_SFTP_WRITE packets "header" |
| 1896 | - $sftp_packet_size-= strlen($handle) + 25; |
|
| 1896 | + $sftp_packet_size -= strlen($handle) + 25; |
|
| 1897 | 1897 | $i = 0; |
| 1898 | 1898 | while ($dataCallback || $sent < $size) { |
| 1899 | 1899 | if ($dataCallback) { |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | } |
| 1913 | 1913 | return false; |
| 1914 | 1914 | } |
| 1915 | - $sent+= strlen($temp); |
|
| 1915 | + $sent += strlen($temp); |
|
| 1916 | 1916 | if (is_callable($progressCallback)) { |
| 1917 | 1917 | call_user_func($progressCallback, $sent); |
| 1918 | 1918 | } |
@@ -2080,9 +2080,9 @@ discard block |
||
| 2080 | 2080 | switch ($this->packet_type) { |
| 2081 | 2081 | case NET_SFTP_DATA: |
| 2082 | 2082 | $temp = substr($response, 4); |
| 2083 | - $offset+= strlen($temp); |
|
| 2083 | + $offset += strlen($temp); |
|
| 2084 | 2084 | if ($local_file === false) { |
| 2085 | - $content.= $temp; |
|
| 2085 | + $content .= $temp; |
|
| 2086 | 2086 | } else { |
| 2087 | 2087 | fputs($fp, $temp); |
| 2088 | 2088 | } |
@@ -2550,20 +2550,20 @@ discard block |
||
| 2550 | 2550 | $attr['size'] = hexdec(bin2hex($this->_string_shift($response, 8))); |
| 2551 | 2551 | break; |
| 2552 | 2552 | case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only) |
| 2553 | - $attr+= unpack('Nuid/Ngid', $this->_string_shift($response, 8)); |
|
| 2553 | + $attr += unpack('Nuid/Ngid', $this->_string_shift($response, 8)); |
|
| 2554 | 2554 | break; |
| 2555 | 2555 | case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004 |
| 2556 | - $attr+= unpack('Npermissions', $this->_string_shift($response, 4)); |
|
| 2556 | + $attr += unpack('Npermissions', $this->_string_shift($response, 4)); |
|
| 2557 | 2557 | // mode == permissions; permissions was the original array key and is retained for bc purposes. |
| 2558 | 2558 | // mode was added because that's the more industry standard terminology |
| 2559 | - $attr+= array('mode' => $attr['permissions']); |
|
| 2559 | + $attr += array('mode' => $attr['permissions']); |
|
| 2560 | 2560 | $fileType = $this->_parseMode($attr['permissions']); |
| 2561 | 2561 | if ($fileType !== false) { |
| 2562 | - $attr+= array('type' => $fileType); |
|
| 2562 | + $attr += array('type' => $fileType); |
|
| 2563 | 2563 | } |
| 2564 | 2564 | break; |
| 2565 | 2565 | case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008 |
| 2566 | - $attr+= unpack('Natime/Nmtime', $this->_string_shift($response, 8)); |
|
| 2566 | + $attr += unpack('Natime/Nmtime', $this->_string_shift($response, 8)); |
|
| 2567 | 2567 | break; |
| 2568 | 2568 | case NET_SFTP_ATTR_EXTENDED: // 0x80000000 |
| 2569 | 2569 | extract(unpack('Ncount', $this->_string_shift($response, 4))); |
@@ -2669,8 +2669,7 @@ discard block |
||
| 2669 | 2669 | function _send_sftp_packet($type, $data) |
| 2670 | 2670 | { |
| 2671 | 2671 | $packet = $this->request_id !== false ? |
| 2672 | - pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : |
|
| 2673 | - pack('NCa*', strlen($data) + 1, $type, $data); |
|
| 2672 | + pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data); |
|
| 2674 | 2673 | |
| 2675 | 2674 | $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 |
| 2676 | 2675 | $result = $this->_send_channel_packet(self::CHANNEL, $packet); |
@@ -2721,11 +2720,11 @@ discard block |
||
| 2721 | 2720 | $this->packet_buffer = ''; |
| 2722 | 2721 | return false; |
| 2723 | 2722 | } |
| 2724 | - $this->packet_buffer.= $temp; |
|
| 2723 | + $this->packet_buffer .= $temp; |
|
| 2725 | 2724 | } |
| 2726 | 2725 | extract(unpack('Nlength', $this->_string_shift($this->packet_buffer, 4))); |
| 2727 | 2726 | $tempLength = $length; |
| 2728 | - $tempLength-= strlen($this->packet_buffer); |
|
| 2727 | + $tempLength -= strlen($this->packet_buffer); |
|
| 2729 | 2728 | |
| 2730 | 2729 | // SFTP packet type and data payload |
| 2731 | 2730 | while ($tempLength > 0) { |
@@ -2735,8 +2734,8 @@ discard block |
||
| 2735 | 2734 | $this->packet_buffer = ''; |
| 2736 | 2735 | return false; |
| 2737 | 2736 | } |
| 2738 | - $this->packet_buffer.= $temp; |
|
| 2739 | - $tempLength-= strlen($temp); |
|
| 2737 | + $this->packet_buffer .= $temp; |
|
| 2738 | + $tempLength -= strlen($temp); |
|
| 2740 | 2739 | } |
| 2741 | 2740 | |
| 2742 | 2741 | $stop = strtok(microtime(), ' ') + strtok(''); |
@@ -2745,9 +2744,9 @@ discard block |
||
| 2745 | 2744 | |
| 2746 | 2745 | if ($this->request_id !== false) { |
| 2747 | 2746 | $this->_string_shift($this->packet_buffer, 4); // remove the request id |
| 2748 | - $length-= 5; // account for the request id and the packet type |
|
| 2747 | + $length -= 5; // account for the request id and the packet type |
|
| 2749 | 2748 | } else { |
| 2750 | - $length-= 1; // account for the packet type |
|
| 2749 | + $length -= 1; // account for the packet type |
|
| 2751 | 2750 | } |
| 2752 | 2751 | |
| 2753 | 2752 | $packet = $this->_string_shift($this->packet_buffer, $length); |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | throw new \RuntimeException("Cannot connect to $parts[1] servers"); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - fputs($this->fsock, $this->identifier."\r\n"); |
|
| 565 | + fputs($this->fsock, $this->identifier . "\r\n"); |
|
| 566 | 566 | |
| 567 | 567 | $response = $this->_get_binary_packet(); |
| 568 | 568 | if ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | $this->crypto = new DES(); |
| 662 | 662 | $this->crypto->disablePadding(); |
| 663 | 663 | $this->crypto->enableContinuousBuffer(); |
| 664 | - $this->crypto->setKey(substr($session_key, 0, 8)); |
|
| 664 | + $this->crypto->setKey(substr($session_key, 0, 8)); |
|
| 665 | 665 | break; |
| 666 | 666 | case self::CIPHER_3DES: |
| 667 | 667 | $this->crypto = new TripleDES(TripleDES::MODE_3CBC); |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | |
| 811 | 811 | if ($response !== false) { |
| 812 | 812 | do { |
| 813 | - $output.= substr($response[self::RESPONSE_DATA], 4); |
|
| 813 | + $output .= substr($response[self::RESPONSE_DATA], 4); |
|
| 814 | 814 | $response = $this->_get_binary_packet(); |
| 815 | 815 | } while (is_array($response) && $response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_EXITSTATUS); |
| 816 | 816 | } |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | if ($response === true) { |
| 923 | 923 | return $this->_string_shift($this->interactiveBuffer, strlen($this->interactiveBuffer)); |
| 924 | 924 | } |
| 925 | - $this->interactiveBuffer.= substr($response[self::RESPONSE_DATA], 4); |
|
| 925 | + $this->interactiveBuffer .= substr($response[self::RESPONSE_DATA], 4); |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | return true; |
| 1076 | 1076 | } |
| 1077 | 1077 | $elapsed = strtok(microtime(), ' ') + strtok('') - $start; |
| 1078 | - $this->curTimeout-= $elapsed; |
|
| 1078 | + $this->curTimeout -= $elapsed; |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 |
@@ -1087,8 +1087,8 @@ discard block |
||
| 1087 | 1087 | |
| 1088 | 1088 | while ($length > 0) { |
| 1089 | 1089 | $temp = fread($this->fsock, $length); |
| 1090 | - $raw.= $temp; |
|
| 1091 | - $length-= strlen($temp); |
|
| 1090 | + $raw .= $temp; |
|
| 1091 | + $length -= strlen($temp); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | $stop = strtok(microtime(), ' ') + strtok(''); |
| 1094 | 1094 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | $orig = $data; |
| 1147 | 1147 | $data = $padding . $data; |
| 1148 | - $data.= pack('N', $this->_crc($data)); |
|
| 1148 | + $data .= pack('N', $this->_crc($data)); |
|
| 1149 | 1149 | |
| 1150 | 1150 | if ($this->crypto !== false) { |
| 1151 | 1151 | $data = $this->crypto->encrypt($data); |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | $crc = 0x00000000; |
| 1255 | 1255 | $length = strlen($data); |
| 1256 | 1256 | |
| 1257 | - for ($i=0; $i<$length; $i++) { |
|
| 1257 | + for ($i = 0; $i < $length; $i++) { |
|
| 1258 | 1258 | // We AND $crc >> 8 with 0x00FFFFFF because we want the eight newly added bits to all |
| 1259 | 1259 | // be zero. PHP, unfortunately, doesn't always do this. 0x80000000 >> 8, as an example, |
| 1260 | 1260 | // yields 0xFF800000 - not 0x00800000. The following link elaborates: |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | while (strlen($random) != $length) { |
| 1326 | 1326 | $block = Random::string($length - strlen($random)); |
| 1327 | 1327 | $block = str_replace("\x00", '', $block); |
| 1328 | - $random.= $block; |
|
| 1328 | + $random .= $block; |
|
| 1329 | 1329 | } |
| 1330 | 1330 | $temp = chr(0) . chr(2) . $random . chr(0) . $m; |
| 1331 | 1331 | |
@@ -1397,12 +1397,12 @@ discard block |
||
| 1397 | 1397 | { |
| 1398 | 1398 | $output = ''; |
| 1399 | 1399 | for ($i = 0; $i < count($message_log); $i++) { |
| 1400 | - $output.= $message_number_log[$i] . "\r\n"; |
|
| 1400 | + $output .= $message_number_log[$i] . "\r\n"; |
|
| 1401 | 1401 | $current_log = $message_log[$i]; |
| 1402 | 1402 | $j = 0; |
| 1403 | 1403 | do { |
| 1404 | 1404 | if (strlen($current_log)) { |
| 1405 | - $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; |
|
| 1405 | + $output .= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; |
|
| 1406 | 1406 | } |
| 1407 | 1407 | $fragment = $this->_string_shift($current_log, $this->log_short_width); |
| 1408 | 1408 | $hex = substr(preg_replace_callback('#.#s', array($this, '_format_log_helper'), $fragment), strlen($this->log_boundary)); |
@@ -1410,10 +1410,10 @@ discard block |
||
| 1410 | 1410 | // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters |
| 1411 | 1411 | // also replace < with a . since < messes up the output on web browsers |
| 1412 | 1412 | $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); |
| 1413 | - $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; |
|
| 1413 | + $output .= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; |
|
| 1414 | 1414 | $j++; |
| 1415 | 1415 | } while (strlen($current_log)); |
| 1416 | - $output.= "\r\n"; |
|
| 1416 | + $output .= "\r\n"; |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | return $output; |
@@ -1555,10 +1555,10 @@ discard block |
||
| 1555 | 1555 | case self::LOG_COMPLEX: |
| 1556 | 1556 | $this->protocol_flags_log[] = $protocol_flags; |
| 1557 | 1557 | $this->_string_shift($message); |
| 1558 | - $this->log_size+= strlen($message); |
|
| 1558 | + $this->log_size += strlen($message); |
|
| 1559 | 1559 | $this->message_log[] = $message; |
| 1560 | 1560 | while ($this->log_size > self::LOG_MAX_SIZE) { |
| 1561 | - $this->log_size-= strlen(array_shift($this->message_log)); |
|
| 1561 | + $this->log_size -= strlen(array_shift($this->message_log)); |
|
| 1562 | 1562 | array_shift($this->protocol_flags_log); |
| 1563 | 1563 | } |
| 1564 | 1564 | break; |
@@ -1587,10 +1587,10 @@ discard block |
||
| 1587 | 1587 | $entry = $this->_format_log(array($message), array($protocol_flags)); |
| 1588 | 1588 | if ($this->realtime_log_wrap) { |
| 1589 | 1589 | $temp = "<<< START >>>\r\n"; |
| 1590 | - $entry.= $temp; |
|
| 1590 | + $entry .= $temp; |
|
| 1591 | 1591 | fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); |
| 1592 | 1592 | } |
| 1593 | - $this->realtime_log_size+= strlen($entry); |
|
| 1593 | + $this->realtime_log_size += strlen($entry); |
|
| 1594 | 1594 | if ($this->realtime_log_size > self::LOG_MAX_SIZE) { |
| 1595 | 1595 | fseek($this->realtime_log_file, 0); |
| 1596 | 1596 | $this->realtime_log_size = strlen($entry); |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // casting $pass to a string is necessary in the event that it's a \phpseclib\Crypt\RSA object |
| 205 | - if (isset(self::$instances[$host][$port][$user][(string) $pass])) { |
|
| 206 | - $this->sftp = self::$instances[$host][$port][$user][(string) $pass]; |
|
| 205 | + if (isset(self::$instances[$host][$port][$user][(string)$pass])) { |
|
| 206 | + $this->sftp = self::$instances[$host][$port][$user][(string)$pass]; |
|
| 207 | 207 | } else { |
| 208 | 208 | $this->sftp = new SFTP($host, $port); |
| 209 | 209 | $this->sftp->disableStatCache(); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | return false; |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | - self::$instances[$host][$port][$user][(string) $pass] = $this->sftp; |
|
| 232 | + self::$instances[$host][$port][$user][(string)$pass] = $this->sftp; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $this->eof = true; |
| 319 | 319 | return false; |
| 320 | 320 | } |
| 321 | - $this->pos+= strlen($result); |
|
| 321 | + $this->pos += strlen($result); |
|
| 322 | 322 | |
| 323 | 323 | return $result; |
| 324 | 324 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | if ($result === false) { |
| 351 | 351 | return false; |
| 352 | 352 | } |
| 353 | - $this->pos+= strlen($data); |
|
| 353 | + $this->pos += strlen($data); |
|
| 354 | 354 | if ($this->pos > $this->size) { |
| 355 | 355 | $this->size = $this->pos; |
| 356 | 356 | } |
@@ -404,10 +404,10 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | break; |
| 406 | 406 | case SEEK_CUR: |
| 407 | - $offset+= $this->pos; |
|
| 407 | + $offset += $this->pos; |
|
| 408 | 408 | break; |
| 409 | 409 | case SEEK_END: |
| 410 | - $offset+= $this->size; |
|
| 410 | + $offset += $this->size; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | $this->pos = $offset; |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | } |
| 1026 | 1026 | $elapsed = microtime(true) - $start; |
| 1027 | 1027 | |
| 1028 | - $this->curTimeout-= $elapsed; |
|
| 1028 | + $this->curTimeout -= $elapsed; |
|
| 1029 | 1029 | |
| 1030 | 1030 | if ($this->curTimeout <= 0) { |
| 1031 | 1031 | $this->is_timeout = true; |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | $extra = ''; |
| 1045 | 1045 | while (!feof($this->fsock) && !preg_match('#^SSH-(\d\.\d+)#', $temp, $matches)) { |
| 1046 | 1046 | if (substr($temp, -2) == "\r\n") { |
| 1047 | - $extra.= $temp; |
|
| 1047 | + $extra .= $temp; |
|
| 1048 | 1048 | $temp = ''; |
| 1049 | 1049 | } |
| 1050 | 1050 | |
@@ -1065,10 +1065,10 @@ discard block |
||
| 1065 | 1065 | return false; |
| 1066 | 1066 | } |
| 1067 | 1067 | $elapsed = microtime(true) - $start; |
| 1068 | - $this->curTimeout-= $elapsed; |
|
| 1068 | + $this->curTimeout -= $elapsed; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | - $temp.= fgets($this->fsock, 255); |
|
| 1071 | + $temp .= fgets($this->fsock, 255); |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | if (feof($this->fsock)) { |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | return false; |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | - $this->bitmap|= self::MASK_CONNECTED; |
|
| 1109 | + $this->bitmap |= self::MASK_CONNECTED; |
|
| 1110 | 1110 | |
| 1111 | 1111 | return true; |
| 1112 | 1112 | } |
@@ -1191,31 +1191,31 @@ discard block |
||
| 1191 | 1191 | //'arcfour', // OPTIONAL the ARCFOUR stream cipher with a 128-bit key |
| 1192 | 1192 | |
| 1193 | 1193 | // CTR modes from <http://tools.ietf.org/html/rfc4344#section-4>: |
| 1194 | - 'aes128-ctr', // RECOMMENDED AES (Rijndael) in SDCTR mode, with 128-bit key |
|
| 1195 | - 'aes192-ctr', // RECOMMENDED AES with 192-bit key |
|
| 1196 | - 'aes256-ctr', // RECOMMENDED AES with 256-bit key |
|
| 1194 | + 'aes128-ctr', // RECOMMENDED AES (Rijndael) in SDCTR mode, with 128-bit key |
|
| 1195 | + 'aes192-ctr', // RECOMMENDED AES with 192-bit key |
|
| 1196 | + 'aes256-ctr', // RECOMMENDED AES with 256-bit key |
|
| 1197 | 1197 | |
| 1198 | 1198 | 'twofish128-ctr', // OPTIONAL Twofish in SDCTR mode, with 128-bit key |
| 1199 | 1199 | 'twofish192-ctr', // OPTIONAL Twofish with 192-bit key |
| 1200 | 1200 | 'twofish256-ctr', // OPTIONAL Twofish with 256-bit key |
| 1201 | 1201 | |
| 1202 | - 'aes128-cbc', // RECOMMENDED AES with a 128-bit key |
|
| 1203 | - 'aes192-cbc', // OPTIONAL AES with a 192-bit key |
|
| 1204 | - 'aes256-cbc', // OPTIONAL AES in CBC mode, with a 256-bit key |
|
| 1202 | + 'aes128-cbc', // RECOMMENDED AES with a 128-bit key |
|
| 1203 | + 'aes192-cbc', // OPTIONAL AES with a 192-bit key |
|
| 1204 | + 'aes256-cbc', // OPTIONAL AES in CBC mode, with a 256-bit key |
|
| 1205 | 1205 | |
| 1206 | 1206 | 'twofish128-cbc', // OPTIONAL Twofish with a 128-bit key |
| 1207 | 1207 | 'twofish192-cbc', // OPTIONAL Twofish with a 192-bit key |
| 1208 | 1208 | 'twofish256-cbc', |
| 1209 | - 'twofish-cbc', // OPTIONAL alias for "twofish256-cbc" |
|
| 1209 | + 'twofish-cbc', // OPTIONAL alias for "twofish256-cbc" |
|
| 1210 | 1210 | // (this is being retained for historical reasons) |
| 1211 | 1211 | |
| 1212 | - 'blowfish-ctr', // OPTIONAL Blowfish in SDCTR mode |
|
| 1212 | + 'blowfish-ctr', // OPTIONAL Blowfish in SDCTR mode |
|
| 1213 | 1213 | |
| 1214 | - 'blowfish-cbc', // OPTIONAL Blowfish in CBC mode |
|
| 1214 | + 'blowfish-cbc', // OPTIONAL Blowfish in CBC mode |
|
| 1215 | 1215 | |
| 1216 | - '3des-ctr', // RECOMMENDED Three-key 3DES in SDCTR mode |
|
| 1216 | + '3des-ctr', // RECOMMENDED Three-key 3DES in SDCTR mode |
|
| 1217 | 1217 | |
| 1218 | - '3des-cbc', // REQUIRED three-key 3DES in CBC mode |
|
| 1218 | + '3des-cbc', // REQUIRED three-key 3DES in CBC mode |
|
| 1219 | 1219 | //'none' // OPTIONAL no encryption; NOT RECOMMENDED |
| 1220 | 1220 | ); |
| 1221 | 1221 | |
@@ -1262,12 +1262,12 @@ discard block |
||
| 1262 | 1262 | |
| 1263 | 1263 | $mac_algorithms = array( |
| 1264 | 1264 | // from <http://www.ietf.org/rfc/rfc6668.txt>: |
| 1265 | - 'hmac-sha2-256',// RECOMMENDED HMAC-SHA256 (digest length = key length = 32) |
|
| 1265 | + 'hmac-sha2-256', // RECOMMENDED HMAC-SHA256 (digest length = key length = 32) |
|
| 1266 | 1266 | |
| 1267 | 1267 | 'hmac-sha1-96', // RECOMMENDED first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20) |
| 1268 | - 'hmac-sha1', // REQUIRED HMAC-SHA1 (digest length = key length = 20) |
|
| 1269 | - 'hmac-md5-96', // OPTIONAL first 96 bits of HMAC-MD5 (digest length = 12, key length = 16) |
|
| 1270 | - 'hmac-md5', // OPTIONAL HMAC-MD5 (digest length = key length = 16) |
|
| 1268 | + 'hmac-sha1', // REQUIRED HMAC-SHA1 (digest length = key length = 20) |
|
| 1269 | + 'hmac-md5-96', // OPTIONAL first 96 bits of HMAC-MD5 (digest length = 12, key length = 16) |
|
| 1270 | + 'hmac-md5', // OPTIONAL HMAC-MD5 (digest length = key length = 16) |
|
| 1271 | 1271 | //'none' // OPTIONAL no MAC; NOT RECOMMENDED |
| 1272 | 1272 | ); |
| 1273 | 1273 | |
@@ -1618,13 +1618,13 @@ discard block |
||
| 1618 | 1618 | |
| 1619 | 1619 | $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id); |
| 1620 | 1620 | while ($this->encrypt_block_size > strlen($iv)) { |
| 1621 | - $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); |
|
| 1621 | + $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); |
|
| 1622 | 1622 | } |
| 1623 | 1623 | $this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size)); |
| 1624 | 1624 | |
| 1625 | 1625 | $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'C' . $this->session_id); |
| 1626 | 1626 | while ($encryptKeyLength > strlen($key)) { |
| 1627 | - $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1627 | + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1628 | 1628 | } |
| 1629 | 1629 | $this->encrypt->setKey(substr($key, 0, $encryptKeyLength)); |
| 1630 | 1630 | } |
@@ -1642,13 +1642,13 @@ discard block |
||
| 1642 | 1642 | |
| 1643 | 1643 | $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id); |
| 1644 | 1644 | while ($this->decrypt_block_size > strlen($iv)) { |
| 1645 | - $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); |
|
| 1645 | + $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); |
|
| 1646 | 1646 | } |
| 1647 | 1647 | $this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size)); |
| 1648 | 1648 | |
| 1649 | 1649 | $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'D' . $this->session_id); |
| 1650 | 1650 | while ($decryptKeyLength > strlen($key)) { |
| 1651 | - $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1651 | + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1652 | 1652 | } |
| 1653 | 1653 | $this->decrypt->setKey(substr($key, 0, $decryptKeyLength)); |
| 1654 | 1654 | } |
@@ -1733,13 +1733,13 @@ discard block |
||
| 1733 | 1733 | |
| 1734 | 1734 | $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id); |
| 1735 | 1735 | while ($createKeyLength > strlen($key)) { |
| 1736 | - $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1736 | + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1737 | 1737 | } |
| 1738 | 1738 | $this->hmac_create->setKey(substr($key, 0, $createKeyLength)); |
| 1739 | 1739 | |
| 1740 | 1740 | $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'F' . $this->session_id); |
| 1741 | 1741 | while ($checkKeyLength > strlen($key)) { |
| 1742 | - $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1742 | + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); |
|
| 1743 | 1743 | } |
| 1744 | 1744 | $this->hmac_check->setKey(substr($key, 0, $checkKeyLength)); |
| 1745 | 1745 | |
@@ -2177,8 +2177,8 @@ discard block |
||
| 2177 | 2177 | // see http://tools.ietf.org/html/rfc4256#section-3.4 |
| 2178 | 2178 | $packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses)); |
| 2179 | 2179 | for ($i = 0; $i < count($responses); $i++) { |
| 2180 | - $packet.= pack('Na*', strlen($responses[$i]), $responses[$i]); |
|
| 2181 | - $logged.= pack('Na*', strlen('dummy-answer'), 'dummy-answer'); |
|
| 2180 | + $packet .= pack('Na*', strlen($responses[$i]), $responses[$i]); |
|
| 2181 | + $logged .= pack('Na*', strlen('dummy-answer'), 'dummy-answer'); |
|
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | 2184 | if (!$this->_send_binary_packet($packet, $logged)) { |
@@ -2309,7 +2309,7 @@ discard block |
||
| 2309 | 2309 | $privatekey->setSignatureMode(RSA::SIGNATURE_PKCS1); |
| 2310 | 2310 | $signature = $privatekey->sign(pack('Na*a*', strlen($this->session_id), $this->session_id, $packet)); |
| 2311 | 2311 | $signature = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($signature), $signature); |
| 2312 | - $packet.= pack('Na*', strlen($signature), $signature); |
|
| 2312 | + $packet .= pack('Na*', strlen($signature), $signature); |
|
| 2313 | 2313 | |
| 2314 | 2314 | if (!$this->_send_binary_packet($packet)) { |
| 2315 | 2315 | return false; |
@@ -2502,7 +2502,7 @@ discard block |
||
| 2502 | 2502 | return true; |
| 2503 | 2503 | } |
| 2504 | 2504 | } else { |
| 2505 | - $output.= $temp; |
|
| 2505 | + $output .= $temp; |
|
| 2506 | 2506 | } |
| 2507 | 2507 | } |
| 2508 | 2508 | } |
@@ -2695,7 +2695,7 @@ discard block |
||
| 2695 | 2695 | return $response ? $this->_string_shift($this->interactiveBuffer, strlen($this->interactiveBuffer)) : false; |
| 2696 | 2696 | } |
| 2697 | 2697 | |
| 2698 | - $this->interactiveBuffer.= $response; |
|
| 2698 | + $this->interactiveBuffer .= $response; |
|
| 2699 | 2699 | } |
| 2700 | 2700 | } |
| 2701 | 2701 | |
@@ -2863,7 +2863,7 @@ discard block |
||
| 2863 | 2863 | */ |
| 2864 | 2864 | function isConnected() |
| 2865 | 2865 | { |
| 2866 | - return (bool) ($this->bitmap & self::MASK_CONNECTED); |
|
| 2866 | + return (bool)($this->bitmap & self::MASK_CONNECTED); |
|
| 2867 | 2867 | } |
| 2868 | 2868 | |
| 2869 | 2869 | /** |
@@ -2915,12 +2915,12 @@ discard block |
||
| 2915 | 2915 | $this->bitmap = 0; |
| 2916 | 2916 | throw new \RuntimeException('Error reading from socket'); |
| 2917 | 2917 | } |
| 2918 | - $buffer.= $temp; |
|
| 2919 | - $remaining_length-= strlen($temp); |
|
| 2918 | + $buffer .= $temp; |
|
| 2919 | + $remaining_length -= strlen($temp); |
|
| 2920 | 2920 | } |
| 2921 | 2921 | $stop = microtime(true); |
| 2922 | 2922 | if (strlen($buffer)) { |
| 2923 | - $raw.= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer; |
|
| 2923 | + $raw .= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer; |
|
| 2924 | 2924 | } |
| 2925 | 2925 | |
| 2926 | 2926 | $payload = $this->_string_shift($raw, $packet_length - $padding_length - 1); |
@@ -3072,7 +3072,7 @@ discard block |
||
| 3072 | 3072 | $this->_string_shift($payload, 1); |
| 3073 | 3073 | extract(unpack('Nchannel', $this->_string_shift($payload, 4))); |
| 3074 | 3074 | extract(unpack('Nwindow_size', $this->_string_shift($payload, 4))); |
| 3075 | - $this->window_size_client_to_server[$channel]+= $window_size; |
|
| 3075 | + $this->window_size_client_to_server[$channel] += $window_size; |
|
| 3076 | 3076 | |
| 3077 | 3077 | $payload = ($this->bitmap & self::MASK_WINDOW_ADJUST) ? true : $this->_get_binary_packet(); |
| 3078 | 3078 | } |
@@ -3188,7 +3188,7 @@ discard block |
||
| 3188 | 3188 | return true; |
| 3189 | 3189 | } |
| 3190 | 3190 | $elapsed = microtime(true) - $start; |
| 3191 | - $this->curTimeout-= $elapsed; |
|
| 3191 | + $this->curTimeout -= $elapsed; |
|
| 3192 | 3192 | } |
| 3193 | 3193 | |
| 3194 | 3194 | $response = $this->_get_binary_packet(); |
@@ -3212,7 +3212,7 @@ discard block |
||
| 3212 | 3212 | |
| 3213 | 3213 | // will not be setup yet on incoming channel open request |
| 3214 | 3214 | if (isset($channel) && isset($this->channel_status[$channel]) && isset($this->window_size_server_to_client[$channel])) { |
| 3215 | - $this->window_size_server_to_client[$channel]-= strlen($response); |
|
| 3215 | + $this->window_size_server_to_client[$channel] -= strlen($response); |
|
| 3216 | 3216 | |
| 3217 | 3217 | // resize the window, if appropriate |
| 3218 | 3218 | if ($this->window_size_server_to_client[$channel] < 0) { |
@@ -3220,7 +3220,7 @@ discard block |
||
| 3220 | 3220 | if (!$this->_send_binary_packet($packet)) { |
| 3221 | 3221 | return false; |
| 3222 | 3222 | } |
| 3223 | - $this->window_size_server_to_client[$channel]+= $this->window_size; |
|
| 3223 | + $this->window_size_server_to_client[$channel] += $this->window_size; |
|
| 3224 | 3224 | } |
| 3225 | 3225 | |
| 3226 | 3226 | switch ($this->channel_status[$channel]) { |
@@ -3231,8 +3231,8 @@ discard block |
||
| 3231 | 3231 | $this->server_channels[$channel] = $server_channel; |
| 3232 | 3232 | extract(unpack('Nwindow_size', $this->_string_shift($response, 4))); |
| 3233 | 3233 | if ($window_size < 0) { |
| 3234 | - $window_size&= 0x7FFFFFFF; |
|
| 3235 | - $window_size+= 0x80000000; |
|
| 3234 | + $window_size &= 0x7FFFFFFF; |
|
| 3235 | + $window_size += 0x80000000; |
|
| 3236 | 3236 | } |
| 3237 | 3237 | $this->window_size_client_to_server[$channel] = $window_size; |
| 3238 | 3238 | $temp = unpack('Npacket_size_client_to_server', $this->_string_shift($response, 4)); |
@@ -3302,7 +3302,7 @@ discard block |
||
| 3302 | 3302 | // currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR |
| 3303 | 3303 | extract(unpack('Ndata_type_code/Nlength', $this->_string_shift($response, 8))); |
| 3304 | 3304 | $data = $this->_string_shift($response, $length); |
| 3305 | - $this->stdErrorLog.= $data; |
|
| 3305 | + $this->stdErrorLog .= $data; |
|
| 3306 | 3306 | if ($skip_extended || $this->quiet_mode) { |
| 3307 | 3307 | break; |
| 3308 | 3308 | } |
@@ -3325,7 +3325,7 @@ discard block |
||
| 3325 | 3325 | $this->_string_shift($response, 1); |
| 3326 | 3326 | extract(unpack('Nlength', $this->_string_shift($response, 4))); |
| 3327 | 3327 | if ($length) { |
| 3328 | - $this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length); |
|
| 3328 | + $this->errors[count($this->errors)] .= "\r\n" . $this->_string_shift($response, $length); |
|
| 3329 | 3329 | } |
| 3330 | 3330 | |
| 3331 | 3331 | $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); |
@@ -3352,7 +3352,7 @@ discard block |
||
| 3352 | 3352 | $this->curTimeout = 0; |
| 3353 | 3353 | |
| 3354 | 3354 | if ($this->bitmap & self::MASK_SHELL) { |
| 3355 | - $this->bitmap&= ~self::MASK_SHELL; |
|
| 3355 | + $this->bitmap &= ~self::MASK_SHELL; |
|
| 3356 | 3356 | } |
| 3357 | 3357 | if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { |
| 3358 | 3358 | $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); |
@@ -3396,7 +3396,7 @@ discard block |
||
| 3396 | 3396 | // 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9 |
| 3397 | 3397 | $packet_length = strlen($data) + 9; |
| 3398 | 3398 | // round up to the nearest $this->encrypt_block_size |
| 3399 | - $packet_length+= (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size; |
|
| 3399 | + $packet_length += (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size; |
|
| 3400 | 3400 | // subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length |
| 3401 | 3401 | $padding_length = $packet_length - strlen($data) - 5; |
| 3402 | 3402 | $padding = Random::string($padding_length); |
@@ -3411,7 +3411,7 @@ discard block |
||
| 3411 | 3411 | $packet = $this->encrypt->encrypt($packet); |
| 3412 | 3412 | } |
| 3413 | 3413 | |
| 3414 | - $packet.= $hmac; |
|
| 3414 | + $packet .= $hmac; |
|
| 3415 | 3415 | |
| 3416 | 3416 | $start = microtime(true); |
| 3417 | 3417 | $result = strlen($packet) == fputs($this->fsock, $packet); |
@@ -3452,10 +3452,10 @@ discard block |
||
| 3452 | 3452 | // the most useful log for SSH2 |
| 3453 | 3453 | case self::LOG_COMPLEX: |
| 3454 | 3454 | $this->message_number_log[] = $message_number; |
| 3455 | - $this->log_size+= strlen($message); |
|
| 3455 | + $this->log_size += strlen($message); |
|
| 3456 | 3456 | $this->message_log[] = $message; |
| 3457 | 3457 | while ($this->log_size > self::LOG_MAX_SIZE) { |
| 3458 | - $this->log_size-= strlen(array_shift($this->message_log)); |
|
| 3458 | + $this->log_size -= strlen(array_shift($this->message_log)); |
|
| 3459 | 3459 | array_shift($this->message_number_log); |
| 3460 | 3460 | } |
| 3461 | 3461 | break; |
@@ -3492,10 +3492,10 @@ discard block |
||
| 3492 | 3492 | $entry = $this->_format_log(array($message), array($message_number)); |
| 3493 | 3493 | if ($this->realtime_log_wrap) { |
| 3494 | 3494 | $temp = "<<< START >>>\r\n"; |
| 3495 | - $entry.= $temp; |
|
| 3495 | + $entry .= $temp; |
|
| 3496 | 3496 | fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); |
| 3497 | 3497 | } |
| 3498 | - $this->realtime_log_size+= strlen($entry); |
|
| 3498 | + $this->realtime_log_size += strlen($entry); |
|
| 3499 | 3499 | if ($this->realtime_log_size > self::LOG_MAX_SIZE) { |
| 3500 | 3500 | fseek($this->realtime_log_file, 0); |
| 3501 | 3501 | $this->realtime_log_size = strlen($entry); |
@@ -3519,10 +3519,10 @@ discard block |
||
| 3519 | 3519 | { |
| 3520 | 3520 | while (strlen($data)) { |
| 3521 | 3521 | if (!$this->window_size_client_to_server[$client_channel]) { |
| 3522 | - $this->bitmap^= self::MASK_WINDOW_ADJUST; |
|
| 3522 | + $this->bitmap ^= self::MASK_WINDOW_ADJUST; |
|
| 3523 | 3523 | // using an invalid channel will let the buffers be built up for the valid channels |
| 3524 | 3524 | $this->_get_channel_packet(-1); |
| 3525 | - $this->bitmap^= self::MASK_WINDOW_ADJUST; |
|
| 3525 | + $this->bitmap ^= self::MASK_WINDOW_ADJUST; |
|
| 3526 | 3526 | } |
| 3527 | 3527 | |
| 3528 | 3528 | /* The maximum amount of data allowed is determined by the maximum |
@@ -3542,7 +3542,7 @@ discard block |
||
| 3542 | 3542 | strlen($temp), |
| 3543 | 3543 | $temp |
| 3544 | 3544 | ); |
| 3545 | - $this->window_size_client_to_server[$client_channel]-= strlen($temp); |
|
| 3545 | + $this->window_size_client_to_server[$client_channel] -= strlen($temp); |
|
| 3546 | 3546 | if (!$this->_send_binary_packet($packet)) { |
| 3547 | 3547 | return false; |
| 3548 | 3548 | } |
@@ -3585,7 +3585,7 @@ discard block |
||
| 3585 | 3585 | } |
| 3586 | 3586 | |
| 3587 | 3587 | if ($this->bitmap & self::MASK_SHELL) { |
| 3588 | - $this->bitmap&= ~self::MASK_SHELL; |
|
| 3588 | + $this->bitmap &= ~self::MASK_SHELL; |
|
| 3589 | 3589 | } |
| 3590 | 3590 | } |
| 3591 | 3591 | |
@@ -3686,12 +3686,12 @@ discard block |
||
| 3686 | 3686 | { |
| 3687 | 3687 | $output = ''; |
| 3688 | 3688 | for ($i = 0; $i < count($message_log); $i++) { |
| 3689 | - $output.= $message_number_log[$i] . "\r\n"; |
|
| 3689 | + $output .= $message_number_log[$i] . "\r\n"; |
|
| 3690 | 3690 | $current_log = $message_log[$i]; |
| 3691 | 3691 | $j = 0; |
| 3692 | 3692 | do { |
| 3693 | 3693 | if (strlen($current_log)) { |
| 3694 | - $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; |
|
| 3694 | + $output .= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; |
|
| 3695 | 3695 | } |
| 3696 | 3696 | $fragment = $this->_string_shift($current_log, $this->log_short_width); |
| 3697 | 3697 | $hex = substr(preg_replace_callback('#.#s', array($this, '_format_log_helper'), $fragment), strlen($this->log_boundary)); |
@@ -3699,10 +3699,10 @@ discard block |
||
| 3699 | 3699 | // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters |
| 3700 | 3700 | // also replace < with a . since < messes up the output on web browsers |
| 3701 | 3701 | $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); |
| 3702 | - $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; |
|
| 3702 | + $output .= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; |
|
| 3703 | 3703 | $j++; |
| 3704 | 3704 | } while (strlen($current_log)); |
| 3705 | - $output.= "\r\n"; |
|
| 3705 | + $output .= "\r\n"; |
|
| 3706 | 3706 | } |
| 3707 | 3707 | |
| 3708 | 3708 | return $output; |
@@ -3963,8 +3963,7 @@ discard block |
||
| 3963 | 3963 | |
| 3964 | 3964 | if ($this->signature_validated) { |
| 3965 | 3965 | return $this->bitmap ? |
| 3966 | - $this->signature_format . ' ' . base64_encode($this->server_public_host_key) : |
|
| 3967 | - false; |
|
| 3966 | + $this->signature_format . ' ' . base64_encode($this->server_public_host_key) : false; |
|
| 3968 | 3967 | } |
| 3969 | 3968 | |
| 3970 | 3969 | $this->signature_validated = true; |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | 'children' => $BuiltInDomainDefinedAttribute |
| 648 | 648 | ); |
| 649 | 649 | |
| 650 | - $BuiltInStandardAttributes = array( |
|
| 650 | + $BuiltInStandardAttributes = array( |
|
| 651 | 651 | 'type' => ASN1::TYPE_SEQUENCE, |
| 652 | 652 | 'children' => array( |
| 653 | 653 | 'country-name' => array('optional' => true) + $CountryName, |
@@ -2316,7 +2316,7 @@ discard block |
||
| 2316 | 2316 | return false; |
| 2317 | 2317 | } |
| 2318 | 2318 | |
| 2319 | - foreach ((array) $propValue as $v) { |
|
| 2319 | + foreach ((array)$propValue as $v) { |
|
| 2320 | 2320 | if (!is_array($v) && isset($type)) { |
| 2321 | 2321 | $v = array($type => $v); |
| 2322 | 2322 | } |
@@ -2441,7 +2441,7 @@ discard block |
||
| 2441 | 2441 | |
| 2442 | 2442 | // handles everything else |
| 2443 | 2443 | $results = preg_split('#((?:^|, *|/)(?:C=|O=|OU=|CN=|L=|ST=|SN=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=|title=|description=|role=|x500UniqueIdentifier=))#', $dn, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 2444 | - for ($i = 1; $i < count($results); $i+=2) { |
|
| 2444 | + for ($i = 1; $i < count($results); $i += 2) { |
|
| 2445 | 2445 | $prop = trim($results[$i], ', =/'); |
| 2446 | 2446 | $value = $results[$i + 1]; |
| 2447 | 2447 | if (!$this->setDNProp($prop, $value, $type)) { |
@@ -2466,7 +2466,7 @@ discard block |
||
| 2466 | 2466 | $dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn; |
| 2467 | 2467 | } |
| 2468 | 2468 | |
| 2469 | - switch ((int) $format) { |
|
| 2469 | + switch ((int)$format) { |
|
| 2470 | 2470 | case self::DN_ARRAY: |
| 2471 | 2471 | return $dn; |
| 2472 | 2472 | case self::DN_ASN1: |
@@ -2489,7 +2489,7 @@ discard block |
||
| 2489 | 2489 | if (!isset($dn[$prop])) { |
| 2490 | 2490 | $dn[$prop] = $value; |
| 2491 | 2491 | } else { |
| 2492 | - $dn[$prop] = array_merge((array) $dn[$prop], array($value)); |
|
| 2492 | + $dn[$prop] = array_merge((array)$dn[$prop], array($value)); |
|
| 2493 | 2493 | } |
| 2494 | 2494 | } |
| 2495 | 2495 | return $dn; |
@@ -2567,11 +2567,11 @@ discard block |
||
| 2567 | 2567 | break; |
| 2568 | 2568 | default: |
| 2569 | 2569 | $delim = '/'; |
| 2570 | - $desc = preg_replace('#.+-([^-]+)$#', '$1', $prop) . '='; |
|
| 2570 | + $desc = preg_replace('#.+-([^-]+)$#', '$1', $prop) . '='; |
|
| 2571 | 2571 | } |
| 2572 | 2572 | |
| 2573 | 2573 | if (!$start) { |
| 2574 | - $output.= $delim; |
|
| 2574 | + $output .= $delim; |
|
| 2575 | 2575 | } |
| 2576 | 2576 | if (is_array($value)) { |
| 2577 | 2577 | foreach ($value as $type => $v) { |
@@ -2588,7 +2588,7 @@ discard block |
||
| 2588 | 2588 | $value = array_pop($value); // Always strip data type. |
| 2589 | 2589 | } |
| 2590 | 2590 | } |
| 2591 | - $output.= $desc . $value; |
|
| 2591 | + $output .= $desc . $value; |
|
| 2592 | 2592 | $start = false; |
| 2593 | 2593 | } |
| 2594 | 2594 | |
@@ -3210,7 +3210,7 @@ discard block |
||
| 3210 | 3210 | } |
| 3211 | 3211 | |
| 3212 | 3212 | $currentCert = isset($this->currentCert) ? $this->currentCert : null; |
| 3213 | - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; |
|
| 3213 | + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; |
|
| 3214 | 3214 | |
| 3215 | 3215 | if (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertificate'])) { |
| 3216 | 3216 | $this->currentCert = $subject->currentCert; |
@@ -3253,8 +3253,7 @@ discard block |
||
| 3253 | 3253 | application of a bitmap |
| 3254 | 3254 | */ |
| 3255 | 3255 | $serialNumber = !empty($this->serialNumber) ? |
| 3256 | - $this->serialNumber : |
|
| 3257 | - new BigInteger(Random::string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256); |
|
| 3256 | + $this->serialNumber : new BigInteger(Random::string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256); |
|
| 3258 | 3257 | |
| 3259 | 3258 | $this->currentCert = array( |
| 3260 | 3259 | 'tbsCertificate' => |
@@ -3393,7 +3392,7 @@ discard block |
||
| 3393 | 3392 | $this->publicKey = $origPublicKey; |
| 3394 | 3393 | |
| 3395 | 3394 | $currentCert = isset($this->currentCert) ? $this->currentCert : null; |
| 3396 | - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; |
|
| 3395 | + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; |
|
| 3397 | 3396 | |
| 3398 | 3397 | if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['certificationRequestInfo'])) { |
| 3399 | 3398 | $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; |
@@ -3452,7 +3451,7 @@ discard block |
||
| 3452 | 3451 | $this->publicKey = $origPublicKey; |
| 3453 | 3452 | |
| 3454 | 3453 | $currentCert = isset($this->currentCert) ? $this->currentCert : null; |
| 3455 | - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; |
|
| 3454 | + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; |
|
| 3456 | 3455 | |
| 3457 | 3456 | // re-signing a SPKAC seems silly but since everything else supports re-signing why not? |
| 3458 | 3457 | if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['publicKeyAndChallenge'])) { |
@@ -4141,7 +4140,7 @@ discard block |
||
| 4141 | 4140 | $attributes[$last]['value'][] = $value; |
| 4142 | 4141 | break; |
| 4143 | 4142 | default: |
| 4144 | - $attributes[] = array('type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value: array($value)); |
|
| 4143 | + $attributes[] = array('type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value : array($value)); |
|
| 4145 | 4144 | break; |
| 4146 | 4145 | } |
| 4147 | 4146 | |
@@ -4213,12 +4212,12 @@ discard block |
||
| 4213 | 4212 | // If the key is private, compute identifier from its corresponding public key. |
| 4214 | 4213 | $key = new RSA(); |
| 4215 | 4214 | if (!$key->loadKey($raw)) { |
| 4216 | - return false; // Not an unencrypted RSA key. |
|
| 4215 | + return false; // Not an unencrypted RSA key. |
|
| 4217 | 4216 | } |
| 4218 | 4217 | if ($key->getPrivateKey() !== false) { // If private. |
| 4219 | 4218 | return $this->computeKeyIdentifier($key, $method); |
| 4220 | 4219 | } |
| 4221 | - $key = $raw; // Is a public key. |
|
| 4220 | + $key = $raw; // Is a public key. |
|
| 4222 | 4221 | break; |
| 4223 | 4222 | case $key instanceof X509: |
| 4224 | 4223 | if (isset($key->publicKey)) { |
@@ -4488,7 +4487,7 @@ discard block |
||
| 4488 | 4487 | |
| 4489 | 4488 | if (is_array($rclist = $this->_subArray($crl, 'tbsCertList/revokedCertificates'))) { |
| 4490 | 4489 | if (($i = $this->_revokedCertificate($rclist, $serial)) !== false) { |
| 4491 | - return $this->_getExtension($id, $crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); |
|
| 4490 | + return $this->_getExtension($id, $crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); |
|
| 4492 | 4491 | } |
| 4493 | 4492 | } |
| 4494 | 4493 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->tokenization = array(''); |
| 236 | 236 | for ($i = 0; $i < strlen($source); $i++) { |
| 237 | 237 | if (strlen($this->ansi)) { |
| 238 | - $this->ansi.= $source[$i]; |
|
| 238 | + $this->ansi .= $source[$i]; |
|
| 239 | 239 | $chr = ord($source[$i]); |
| 240 | 240 | // http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements |
| 241 | 241 | // single character CSI's not currently supported |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | switch (true) { |
| 291 | 291 | case preg_match('#\x1B\[(\d+)B#', $this->ansi, $match): // Move cursor down n lines |
| 292 | 292 | $this->old_y = $this->y; |
| 293 | - $this->y+= $match[1]; |
|
| 293 | + $this->y += $match[1]; |
|
| 294 | 294 | break; |
| 295 | 295 | case preg_match('#\x1B\[(\d+);(\d+)H#', $this->ansi, $match): // Move cursor to screen location v,h |
| 296 | 296 | $this->old_x = $this->x; |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | break; |
| 301 | 301 | case preg_match('#\x1B\[(\d+)C#', $this->ansi, $match): // Move cursor right n lines |
| 302 | 302 | $this->old_x = $this->x; |
| 303 | - $this->x+= $match[1]; |
|
| 303 | + $this->x += $match[1]; |
|
| 304 | 304 | break; |
| 305 | 305 | case preg_match('#\x1B\[(\d+)D#', $this->ansi, $match): // Move cursor left n lines |
| 306 | 306 | $this->old_x = $this->x; |
| 307 | - $this->x-= $match[1]; |
|
| 307 | + $this->x -= $match[1]; |
|
| 308 | 308 | break; |
| 309 | 309 | case preg_match('#\x1B\[(\d+);(\d+)r#', $this->ansi, $match): // Set top and bottom lines of a window |
| 310 | 310 | break; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | continue; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $this->tokenization[count($this->tokenization) - 1].= $source[$i]; |
|
| 376 | + $this->tokenization[count($this->tokenization) - 1] .= $source[$i]; |
|
| 377 | 377 | switch ($source[$i]) { |
| 378 | 378 | case "\r": |
| 379 | 379 | $this->x = 0; |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | //if (!strlen($this->tokenization[count($this->tokenization) - 1])) { |
| 401 | 401 | // array_pop($this->tokenization); |
| 402 | 402 | //} |
| 403 | - $this->ansi.= "\x1B"; |
|
| 403 | + $this->ansi .= "\x1B"; |
|
| 404 | 404 | break; |
| 405 | 405 | default: |
| 406 | 406 | $this->attrs[$this->y][$this->x] = clone $this->attr_cell; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $close = $open = ''; |
| 469 | 469 | if ($last_attr->foreground != $cur_attr->foreground) { |
| 470 | 470 | if ($cur_attr->foreground != 'white') { |
| 471 | - $open.= '<span style="color: ' . $cur_attr->foreground . '">'; |
|
| 471 | + $open .= '<span style="color: ' . $cur_attr->foreground . '">'; |
|
| 472 | 472 | } |
| 473 | 473 | if ($last_attr->foreground != 'white') { |
| 474 | 474 | $close = '</span>' . $close; |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | if ($last_attr->background != $cur_attr->background) { |
| 478 | 478 | if ($cur_attr->background != 'black') { |
| 479 | - $open.= '<span style="background: ' . $cur_attr->background . '">'; |
|
| 479 | + $open .= '<span style="background: ' . $cur_attr->background . '">'; |
|
| 480 | 480 | } |
| 481 | 481 | if ($last_attr->background != 'black') { |
| 482 | 482 | $close = '</span>' . $close; |
@@ -484,29 +484,29 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | if ($last_attr->bold != $cur_attr->bold) { |
| 486 | 486 | if ($cur_attr->bold) { |
| 487 | - $open.= '<b>'; |
|
| 487 | + $open .= '<b>'; |
|
| 488 | 488 | } else { |
| 489 | 489 | $close = '</b>' . $close; |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | if ($last_attr->underline != $cur_attr->underline) { |
| 493 | 493 | if ($cur_attr->underline) { |
| 494 | - $open.= '<u>'; |
|
| 494 | + $open .= '<u>'; |
|
| 495 | 495 | } else { |
| 496 | 496 | $close = '</u>' . $close; |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | if ($last_attr->blink != $cur_attr->blink) { |
| 500 | 500 | if ($cur_attr->blink) { |
| 501 | - $open.= '<blink>'; |
|
| 501 | + $open .= '<blink>'; |
|
| 502 | 502 | } else { |
| 503 | 503 | $close = '</blink>' . $close; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | - $output.= $close . $open; |
|
| 506 | + $output .= $close . $open; |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - $output.= htmlspecialchars($char); |
|
| 509 | + $output .= htmlspecialchars($char); |
|
| 510 | 510 | |
| 511 | 511 | return $output; |
| 512 | 512 | } |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | for ($i = 0; $i <= $this->max_y; $i++) { |
| 525 | 525 | for ($j = 0; $j <= $this->max_x; $j++) { |
| 526 | 526 | $cur_attr = $this->attrs[$i][$j]; |
| 527 | - $output.= $this->_processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : ''); |
|
| 527 | + $output .= $this->_processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : ''); |
|
| 528 | 528 | $last_attr = $this->attrs[$i][$j]; |
| 529 | 529 | } |
| 530 | - $output.= "\r\n"; |
|
| 530 | + $output .= "\r\n"; |
|
| 531 | 531 | } |
| 532 | 532 | $output = substr($output, 0, -2); |
| 533 | 533 | // close any remaining open tags |
| 534 | - $output.= $this->_processCoordinate($last_attr, $this->base_attr_cell, ''); |
|
| 534 | + $output .= $this->_processCoordinate($last_attr, $this->base_attr_cell, ''); |
|
| 535 | 535 | return rtrim($output); |
| 536 | 536 | } |
| 537 | 537 | |
@@ -559,14 +559,14 @@ discard block |
||
| 559 | 559 | for ($i = 0; $i < count($this->history); $i++) { |
| 560 | 560 | for ($j = 0; $j <= $this->max_x + 1; $j++) { |
| 561 | 561 | $cur_attr = $this->history_attrs[$i][$j]; |
| 562 | - $scrollback.= $this->_processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : ''); |
|
| 562 | + $scrollback .= $this->_processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : ''); |
|
| 563 | 563 | $last_attr = $this->history_attrs[$i][$j]; |
| 564 | 564 | } |
| 565 | - $scrollback.= "\r\n"; |
|
| 565 | + $scrollback .= "\r\n"; |
|
| 566 | 566 | } |
| 567 | 567 | $base_attr_cell = $this->base_attr_cell; |
| 568 | 568 | $this->base_attr_cell = $last_attr; |
| 569 | - $scrollback.= $this->_getScreen(); |
|
| 569 | + $scrollback .= $this->_getScreen(); |
|
| 570 | 570 | $this->base_attr_cell = $base_attr_cell; |
| 571 | 571 | |
| 572 | 572 | return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $scrollback . '</span></pre>'; |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | } elseif ($length & 0x80) { // definite length, long form |
| 259 | 259 | // technically, the long form of the length can be represented by up to 126 octets (bytes), but we'll only |
| 260 | 260 | // support it up to four. |
| 261 | - $length&= 0x7F; |
|
| 261 | + $length &= 0x7F; |
|
| 262 | 262 | $temp = $this->_string_shift($encoded, $length); |
| 263 | 263 | // tags of indefinte length don't really have a header length; this length includes the tag |
| 264 | - $current+= array('headerlength' => $length + 2); |
|
| 265 | - $start+= $length; |
|
| 264 | + $current += array('headerlength' => $length + 2); |
|
| 265 | + $start += $length; |
|
| 266 | 266 | extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))); |
| 267 | 267 | } else { |
| 268 | - $current+= array('headerlength' => 2); |
|
| 268 | + $current += array('headerlength' => 2); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if ($length > strlen($encoded)) { |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | $length = $temp['length']; |
| 307 | 307 | // end-of-content octets - see paragraph 8.1.5 |
| 308 | 308 | if (substr($content, $length, 2) == "\0\0") { |
| 309 | - $length+= 2; |
|
| 310 | - $start+= $length; |
|
| 309 | + $length += 2; |
|
| 310 | + $start += $length; |
|
| 311 | 311 | $newcontent[] = $temp; |
| 312 | 312 | break; |
| 313 | 313 | } |
| 314 | - $start+= $length; |
|
| 315 | - $remainingLength-= $length; |
|
| 314 | + $start += $length; |
|
| 315 | + $remainingLength -= $length; |
|
| 316 | 316 | $newcontent[] = $temp; |
| 317 | 317 | $this->_string_shift($content, $length); |
| 318 | 318 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | ) + $current; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $current+= array('type' => $tag); |
|
| 332 | + $current += array('type' => $tag); |
|
| 333 | 333 | |
| 334 | 334 | // decode UNIVERSAL tags |
| 335 | 335 | switch ($tag) { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | //if (strlen($content) != 1) { |
| 339 | 339 | // return false; |
| 340 | 340 | //} |
| 341 | - $current['content'] = (bool) ord($content[0]); |
|
| 341 | + $current['content'] = (bool)ord($content[0]); |
|
| 342 | 342 | break; |
| 343 | 343 | case self::TYPE_INTEGER: |
| 344 | 344 | case self::TYPE_ENUMERATED: |
@@ -354,14 +354,14 @@ discard block |
||
| 354 | 354 | $current['content'] = $content; |
| 355 | 355 | } else { |
| 356 | 356 | $temp = $this->_decode_ber($content, $start); |
| 357 | - $length-= strlen($content); |
|
| 357 | + $length -= strlen($content); |
|
| 358 | 358 | $last = count($temp) - 1; |
| 359 | 359 | for ($i = 0; $i < $last; $i++) { |
| 360 | 360 | // all subtags should be bit strings |
| 361 | 361 | //if ($temp[$i]['type'] != self::TYPE_BIT_STRING) { |
| 362 | 362 | // return false; |
| 363 | 363 | //} |
| 364 | - $current['content'].= substr($temp[$i]['content'], 1); |
|
| 364 | + $current['content'] .= substr($temp[$i]['content'], 1); |
|
| 365 | 365 | } |
| 366 | 366 | // all subtags should be bit strings |
| 367 | 367 | //if ($temp[$last]['type'] != self::TYPE_BIT_STRING) { |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | //if ($temp['type'] != self::TYPE_OCTET_STRING) { |
| 384 | 384 | // return false; |
| 385 | 385 | //} |
| 386 | - $current['content'].= $temp['content']; |
|
| 387 | - $length+= $temp['length']; |
|
| 386 | + $current['content'] .= $temp['content']; |
|
| 387 | + $length += $temp['length']; |
|
| 388 | 388 | } |
| 389 | 389 | if (substr($content, 0, 2) == "\0\0") { |
| 390 | - $length+= 2; // +2 for the EOC |
|
| 390 | + $length += 2; // +2 for the EOC |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | break; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $temp = $this->_decode_ber($content, $start + $offset); |
| 412 | 412 | $this->_string_shift($content, $temp['length']); |
| 413 | 413 | $current['content'][] = $temp; |
| 414 | - $offset+= $temp['length']; |
|
| 414 | + $offset += $temp['length']; |
|
| 415 | 415 | } |
| 416 | 416 | break; |
| 417 | 417 | case self::TYPE_OBJECT_IDENTIFIER: |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $valuen <<= 7; |
| 425 | 425 | $valuen |= $temp & 0x7F; |
| 426 | 426 | if (~$temp & 0x80) { |
| 427 | - $current['content'].= ".$valuen"; |
|
| 427 | + $current['content'] .= ".$valuen"; |
|
| 428 | 428 | $valuen = 0; |
| 429 | 429 | } |
| 430 | 430 | } |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | default: |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - $start+= $length; |
|
| 472 | + $start += $length; |
|
| 473 | 473 | |
| 474 | 474 | // ie. length is the length of the full TLV encoding - it's not just the length of the value |
| 475 | 475 | return $current + array('length' => $start - $current['start']); |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Fail mapping if all input items have not been consumed. |
| 619 | - return $i < $n? null: $map; |
|
| 619 | + return $i < $n ? null: $map; |
|
| 620 | 620 | |
| 621 | 621 | // the main diff between sets and sequences is the encapsulation of the foreach in another for loop |
| 622 | 622 | case self::TYPE_SET: |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | for ($i = strlen($decoded['content']) - 1; $i > 0; $i--) { |
| 720 | 720 | $current = ord($decoded['content'][$i]); |
| 721 | 721 | for ($j = $offset; $j < 8; $j++) { |
| 722 | - $bits[] = (bool) ($current & (1 << $j)); |
|
| 722 | + $bits[] = (bool)($current & (1 << $j)); |
|
| 723 | 723 | } |
| 724 | 724 | $offset = 0; |
| 725 | 725 | } |
@@ -757,10 +757,9 @@ discard block |
||
| 757 | 757 | $temp = new BigInteger($decoded['content'], -256); |
| 758 | 758 | } |
| 759 | 759 | if (isset($mapping['mapping'])) { |
| 760 | - $temp = (int) $temp->toString(); |
|
| 760 | + $temp = (int)$temp->toString(); |
|
| 761 | 761 | return isset($mapping['mapping'][$temp]) ? |
| 762 | - $mapping['mapping'][$temp] : |
|
| 763 | - false; |
|
| 762 | + $mapping['mapping'][$temp] : false; |
|
| 764 | 763 | } |
| 765 | 764 | return $temp; |
| 766 | 765 | } |
@@ -819,7 +818,7 @@ discard block |
||
| 819 | 818 | switch ($tag) { |
| 820 | 819 | case self::TYPE_SET: // Children order is not important, thus process in sequence. |
| 821 | 820 | case self::TYPE_SEQUENCE: |
| 822 | - $tag|= 0x20; // set the constructed bit |
|
| 821 | + $tag |= 0x20; // set the constructed bit |
|
| 823 | 822 | $value = ''; |
| 824 | 823 | |
| 825 | 824 | // ignore the min and max |
@@ -831,7 +830,7 @@ discard block |
||
| 831 | 830 | if ($temp === false) { |
| 832 | 831 | return false; |
| 833 | 832 | } |
| 834 | - $value.= $temp; |
|
| 833 | + $value .= $temp; |
|
| 835 | 834 | } |
| 836 | 835 | break; |
| 837 | 836 | } |
@@ -874,7 +873,7 @@ discard block |
||
| 874 | 873 | $temp = $subtag . substr($temp, 1); |
| 875 | 874 | } |
| 876 | 875 | } |
| 877 | - $value.= $temp; |
|
| 876 | + $value .= $temp; |
|
| 878 | 877 | } |
| 879 | 878 | break; |
| 880 | 879 | case self::TYPE_CHOICE: |
@@ -941,7 +940,7 @@ discard block |
||
| 941 | 940 | case self::TYPE_UTC_TIME: |
| 942 | 941 | case self::TYPE_GENERALIZED_TIME: |
| 943 | 942 | $format = $mapping['type'] == self::TYPE_UTC_TIME ? 'y' : 'Y'; |
| 944 | - $format.= 'mdHis'; |
|
| 943 | + $format .= 'mdHis'; |
|
| 945 | 944 | $value = @gmdate($format, strtotime($source)) . 'Z'; |
| 946 | 945 | break; |
| 947 | 946 | case self::TYPE_BIT_STRING: |
@@ -971,7 +970,7 @@ discard block |
||
| 971 | 970 | $bits = implode('', array_pad($bits, $size + $offset + 1, 0)); |
| 972 | 971 | $bytes = explode(' ', rtrim(chunk_split($bits, 8, ' '))); |
| 973 | 972 | foreach ($bytes as $byte) { |
| 974 | - $value.= chr(bindec($byte)); |
|
| 973 | + $value .= chr(bindec($byte)); |
|
| 975 | 974 | } |
| 976 | 975 | |
| 977 | 976 | break; |
@@ -1003,7 +1002,7 @@ discard block |
||
| 1003 | 1002 | } |
| 1004 | 1003 | $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F); |
| 1005 | 1004 | } |
| 1006 | - $value.= $temp; |
|
| 1005 | + $value .= $temp; |
|
| 1007 | 1006 | } |
| 1008 | 1007 | break; |
| 1009 | 1008 | case self::TYPE_ANY: |
@@ -1124,8 +1123,7 @@ discard block |
||
| 1124 | 1123 | http://www.obj-sys.com/asn1tutorial/node14.html */ |
| 1125 | 1124 | |
| 1126 | 1125 | $pattern = $tag == self::TYPE_UTC_TIME ? |
| 1127 | - '#(..)(..)(..)(..)(..)(..)(.*)#' : |
|
| 1128 | - '#(....)(..)(..)(..)(..)(..).*([Z+-].*)$#'; |
|
| 1126 | + '#(..)(..)(..)(..)(..)(..)(.*)#' : '#(....)(..)(..)(..)(..)(..).*([Z+-].*)$#'; |
|
| 1129 | 1127 | |
| 1130 | 1128 | preg_match($pattern, $content, $matches); |
| 1131 | 1129 | |