Completed
Push — 1.10.x ( a788c0...4b0069 )
by Angel Fernando Quiroz
44:46
created
main/inc/lib/phpseclib/Math/BigInteger.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * ?>
252 252
      * </code>
253 253
      *
254
-     * @param optional $x base-10 number or base-$base number if $base set.
254
+     * @param integer $x base-10 number or base-$base number if $base set.
255 255
      * @param optional integer $base
256 256
      * @return Math_BigInteger
257 257
      * @access public
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
      * </code>
1369 1369
      *
1370 1370
      * @param Math_BigInteger $y
1371
-     * @return Array
1371
+     * @return Math_BigInteger[]
1372 1372
      * @access public
1373 1373
      * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}.
1374 1374
      */
@@ -3520,8 +3520,8 @@  discard block
 block discarded – undo
3520 3520
     /**
3521 3521
      * Array Repeat
3522 3522
      *
3523
-     * @param $input Array
3524
-     * @param $multiplier mixed
3523
+     * @param integer $input Array
3524
+     * @param integer $multiplier mixed
3525 3525
      * @return Array
3526 3526
      * @access private
3527 3527
      */
@@ -3536,7 +3536,7 @@  discard block
 block discarded – undo
3536 3536
      * Shifts binary strings $shift bits, essentially multiplying by 2**$shift.
3537 3537
      *
3538 3538
      * @param $x String
3539
-     * @param $shift Integer
3539
+     * @param integer $shift Integer
3540 3540
      * @return String
3541 3541
      * @access private
3542 3542
      */
@@ -3565,7 +3565,7 @@  discard block
 block discarded – undo
3565 3565
      * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder.
3566 3566
      *
3567 3567
      * @param $x String
3568
-     * @param $shift Integer
3568
+     * @param integer $shift Integer
3569 3569
      * @return String
3570 3570
      * @access private
3571 3571
      */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1662,8 +1662,8 @@  discard block
 block discarded – undo
1662 1662
             );
1663 1663
 
1664 1664
             $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
1665
-                             chunk_split(base64_encode($encapsulated)) .
1666
-                             '-----END PUBLIC KEY-----';
1665
+                                chunk_split(base64_encode($encapsulated)) .
1666
+                                '-----END PUBLIC KEY-----';
1667 1667
 
1668 1668
             $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT);
1669 1669
 
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
 
3246 3246
         if (!$t) {
3247 3247
             // see HAC 4.49 "Note (controlling the error probability)"
3248
-                 if ($length >= 163) { $t =  2; } // floor(1300 / 8)
3248
+                    if ($length >= 163) { $t =  2; } // floor(1300 / 8)
3249 3249
             else if ($length >= 106) { $t =  3; } // floor( 850 / 8)
3250 3250
             else if ($length >= 81 ) { $t =  4; } // floor( 650 / 8)
3251 3251
             else if ($length >= 68 ) { $t =  5; } // floor( 550 / 8)
Please login to merge, or discard this patch.
Spacing   +169 added lines, -174 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     function Math_BigInteger($x = 0, $base = 10)
260 260
     {
261
-        if ( !defined('MATH_BIGINTEGER_MODE') ) {
261
+        if (!defined('MATH_BIGINTEGER_MODE')) {
262 262
             switch (true) {
263 263
                 case extension_loaded('gmp'):
264 264
                     define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP);
@@ -282,25 +282,25 @@  discard block
 block discarded – undo
282 282
         if (!defined('MATH_BIGINTEGER_BASE') && MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_INTERNAL) {
283 283
             switch (PHP_INT_SIZE) {
284 284
                 case 8: // use 64-bit integers if int size is 8 bytes
285
-                    define('MATH_BIGINTEGER_BASE',       31);
286
-                    define('MATH_BIGINTEGER_BASE_FULL',  0x80000000);
287
-                    define('MATH_BIGINTEGER_MAX_DIGIT',  0x7FFFFFFF);
288
-                    define('MATH_BIGINTEGER_MSB',        0x40000000);
285
+                    define('MATH_BIGINTEGER_BASE', 31);
286
+                    define('MATH_BIGINTEGER_BASE_FULL', 0x80000000);
287
+                    define('MATH_BIGINTEGER_MAX_DIGIT', 0x7FFFFFFF);
288
+                    define('MATH_BIGINTEGER_MSB', 0x40000000);
289 289
                     // 10**9 is the closest we can get to 2**31 without passing it
290
-                    define('MATH_BIGINTEGER_MAX10',      1000000000);
291
-                    define('MATH_BIGINTEGER_MAX10_LEN',  9);
290
+                    define('MATH_BIGINTEGER_MAX10', 1000000000);
291
+                    define('MATH_BIGINTEGER_MAX10_LEN', 9);
292 292
                     // the largest digit that may be used in addition / subtraction
293 293
                     define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 62));
294 294
                     break;
295 295
                 //case 4: // use 64-bit floats if int size is 4 bytes
296 296
                 default:
297
-                    define('MATH_BIGINTEGER_BASE',       26);
298
-                    define('MATH_BIGINTEGER_BASE_FULL',  0x4000000);
299
-                    define('MATH_BIGINTEGER_MAX_DIGIT',  0x3FFFFFF);
300
-                    define('MATH_BIGINTEGER_MSB',        0x2000000);
297
+                    define('MATH_BIGINTEGER_BASE', 26);
298
+                    define('MATH_BIGINTEGER_BASE_FULL', 0x4000000);
299
+                    define('MATH_BIGINTEGER_MAX_DIGIT', 0x3FFFFFF);
300
+                    define('MATH_BIGINTEGER_MSB', 0x2000000);
301 301
                     // 10**7 is the closest to 2**26 without passing it
302
-                    define('MATH_BIGINTEGER_MAX10',      10000000);
303
-                    define('MATH_BIGINTEGER_MAX10_LEN',  7);
302
+                    define('MATH_BIGINTEGER_MAX10', 10000000);
303
+                    define('MATH_BIGINTEGER_MAX10_LEN', 7);
304 304
                     // the largest digit that may be used in addition / subtraction
305 305
                     // we do pow(2, 52) instead of using 4503599627370496 directly because some
306 306
                     // PHP installations will truncate 4503599627370496.
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             }
309 309
         }
310 310
 
311
-        switch ( MATH_BIGINTEGER_MODE ) {
311
+        switch (MATH_BIGINTEGER_MODE) {
312 312
             case MATH_BIGINTEGER_MODE_GMP:
313 313
                 if (is_resource($x) && get_resource_type($x) == 'GMP integer') {
314 314
                     $this->value = $x;
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
                     $this->is_negative = true;
337 337
                 }
338 338
             case  256:
339
-                switch ( MATH_BIGINTEGER_MODE ) {
339
+                switch (MATH_BIGINTEGER_MODE) {
340 340
                     case MATH_BIGINTEGER_MODE_GMP:
341 341
                         $sign = $this->is_negative ? '-' : '';
342
-                        $this->value = gmp_init($sign . '0x' . bin2hex($x));
342
+                        $this->value = gmp_init($sign.'0x'.bin2hex($x));
343 343
                         break;
344 344
                     case MATH_BIGINTEGER_MODE_BCMATH:
345 345
                         // round $len to the nearest 4 (thanks, DavidMJ!)
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 
348 348
                         $x = str_pad($x, $len, chr(0), STR_PAD_LEFT);
349 349
 
350
-                        for ($i = 0; $i < $len; $i+= 4) {
350
+                        for ($i = 0; $i < $len; $i += 4) {
351 351
                             $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32
352 352
                             $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0);
353 353
                         }
354 354
 
355 355
                         if ($this->is_negative) {
356
-                            $this->value = '-' . $this->value;
356
+                            $this->value = '-'.$this->value;
357 357
                         }
358 358
 
359 359
                         break;
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
                     $x = bin2hex(~pack('H*', $x));
388 388
                 }
389 389
 
390
-                switch ( MATH_BIGINTEGER_MODE ) {
390
+                switch (MATH_BIGINTEGER_MODE) {
391 391
                     case MATH_BIGINTEGER_MODE_GMP:
392
-                        $temp = $this->is_negative ? '-0x' . $x : '0x' . $x;
392
+                        $temp = $this->is_negative ? '-0x'.$x : '0x'.$x;
393 393
                         $this->value = gmp_init($temp);
394 394
                         $this->is_negative = false;
395 395
                         break;
396 396
                     case MATH_BIGINTEGER_MODE_BCMATH:
397
-                        $x = ( strlen($x) & 1 ) ? '0' . $x : $x;
397
+                        $x = (strlen($x) & 1) ? '0'.$x : $x;
398 398
                         $temp = new Math_BigInteger(pack('H*', $x), 256);
399
-                        $this->value = $this->is_negative ? '-' . $temp->value : $temp->value;
399
+                        $this->value = $this->is_negative ? '-'.$temp->value : $temp->value;
400 400
                         $this->is_negative = false;
401 401
                         break;
402 402
                     default:
403
-                        $x = ( strlen($x) & 1 ) ? '0' . $x : $x;
403
+                        $x = (strlen($x) & 1) ? '0'.$x : $x;
404 404
                         $temp = new Math_BigInteger(pack('H*', $x), 256);
405 405
                         $this->value = $temp->value;
406 406
                 }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
                 // [^-0-9].*: find any non-numeric characters and then any characters that follow that
418 418
                 $x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
419 419
 
420
-                switch ( MATH_BIGINTEGER_MODE ) {
420
+                switch (MATH_BIGINTEGER_MODE) {
421 421
                     case MATH_BIGINTEGER_MODE_GMP:
422 422
                         $this->value = gmp_init($x);
423 423
                         break;
@@ -461,12 +461,12 @@  discard block
 block discarded – undo
461 461
                 $str = '0x';
462 462
                 while (strlen($x)) {
463 463
                     $part = substr($x, 0, 4);
464
-                    $str.= dechex(bindec($part));
464
+                    $str .= dechex(bindec($part));
465 465
                     $x = substr($x, 4);
466 466
                 }
467 467
 
468 468
                 if ($this->is_negative) {
469
-                    $str = '-' . $str;
469
+                    $str = '-'.$str;
470 470
                 }
471 471
 
472 472
                 $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16
@@ -517,25 +517,24 @@  discard block
 block discarded – undo
517 517
             }
518 518
 
519 519
             if (ord($bytes[0]) & 0x80) {
520
-                $bytes = chr(0) . $bytes;
520
+                $bytes = chr(0).$bytes;
521 521
             }
522 522
 
523 523
             return $comparison < 0 ? ~$bytes : $bytes;
524 524
         }
525 525
 
526
-        switch ( MATH_BIGINTEGER_MODE ) {
526
+        switch (MATH_BIGINTEGER_MODE) {
527 527
             case MATH_BIGINTEGER_MODE_GMP:
528 528
                 if (gmp_cmp($this->value, gmp_init(0)) == 0) {
529 529
                     return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
530 530
                 }
531 531
 
532 532
                 $temp = gmp_strval(gmp_abs($this->value), 16);
533
-                $temp = ( strlen($temp) & 1 ) ? '0' . $temp : $temp;
533
+                $temp = (strlen($temp) & 1) ? '0'.$temp : $temp;
534 534
                 $temp = pack('H*', $temp);
535 535
 
536 536
                 return $this->precision > 0 ?
537
-                    substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) :
538
-                    ltrim($temp, chr(0));
537
+                    substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($temp, chr(0));
539 538
             case MATH_BIGINTEGER_MODE_BCMATH:
540 539
                 if ($this->value === '0') {
541 540
                     return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
@@ -550,13 +549,12 @@  discard block
 block discarded – undo
550 549
 
551 550
                 while (bccomp($current, '0', 0) > 0) {
552 551
                     $temp = bcmod($current, '16777216');
553
-                    $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value;
552
+                    $value = chr($temp >> 16).chr($temp >> 8).chr($temp).$value;
554 553
                     $current = bcdiv($current, '16777216', 0);
555 554
                 }
556 555
 
557 556
                 return $this->precision > 0 ?
558
-                    substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) :
559
-                    ltrim($value, chr(0));
557
+                    substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($value, chr(0));
560 558
         }
561 559
 
562 560
         if (!count($this->value)) {
@@ -572,8 +570,7 @@  discard block
 block discarded – undo
572 570
         }
573 571
 
574 572
         return $this->precision > 0 ?
575
-            str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) :
576
-            $result;
573
+            str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) : $result;
577 574
     }
578 575
 
579 576
     /**
@@ -629,16 +626,16 @@  discard block
 block discarded – undo
629 626
     {
630 627
         $hex = $this->toHex($twos_compliment);
631 628
         $bits = '';
632
-        for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) {
633
-            $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits;
629
+        for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i -= 8) {
630
+            $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT).$bits;
634 631
         }
635 632
         if ($start) { // hexdec('') == 0
636
-            $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits;
633
+            $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT).$bits;
637 634
         }
638 635
         $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
639 636
 
640 637
         if ($twos_compliment && $this->compare(new Math_BigInteger()) > 0 && $this->precision <= 0) {
641
-            return '0' . $result;
638
+            return '0'.$result;
642 639
         }
643 640
 
644 641
         return $result;
@@ -664,7 +661,7 @@  discard block
 block discarded – undo
664 661
      */
665 662
     function toString()
666 663
     {
667
-        switch ( MATH_BIGINTEGER_MODE ) {
664
+        switch (MATH_BIGINTEGER_MODE) {
668 665
             case MATH_BIGINTEGER_MODE_GMP:
669 666
                 return gmp_strval($this->value);
670 667
             case MATH_BIGINTEGER_MODE_BCMATH:
@@ -687,7 +684,7 @@  discard block
 block discarded – undo
687 684
         $result = '';
688 685
         while (count($temp->value)) {
689 686
             list($temp, $mod) = $temp->divide($divisor);
690
-            $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', MATH_BIGINTEGER_MAX10_LEN, '0', STR_PAD_LEFT) . $result;
687
+            $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', MATH_BIGINTEGER_MAX10_LEN, '0', STR_PAD_LEFT).$result;
691 688
         }
692 689
         $result = ltrim($result, '0');
693 690
         if (empty($result)) {
@@ -695,7 +692,7 @@  discard block
 block discarded – undo
695 692
         }
696 693
 
697 694
         if ($this->is_negative) {
698
-            $result = '-' . $result;
695
+            $result = '-'.$result;
699 696
         }
700 697
 
701 698
         return $result;
@@ -821,7 +818,7 @@  discard block
 block discarded – undo
821 818
      */
822 819
     function add($y)
823 820
     {
824
-        switch ( MATH_BIGINTEGER_MODE ) {
821
+        switch (MATH_BIGINTEGER_MODE) {
825 822
             case MATH_BIGINTEGER_MODE_GMP:
826 823
                 $temp = new Math_BigInteger();
827 824
                 $temp->value = gmp_add($this->value, $y->value);
@@ -871,8 +868,8 @@  discard block
 block discarded – undo
871 868
         }
872 869
 
873 870
         // subtract, if appropriate
874
-        if ( $x_negative != $y_negative ) {
875
-            if ( $x_value == $y_value ) {
871
+        if ($x_negative != $y_negative) {
872
+            if ($x_value == $y_value) {
876 873
                 return array(
877 874
                     MATH_BIGINTEGER_VALUE => array(),
878 875
                     MATH_BIGINTEGER_SIGN => false
@@ -897,7 +894,7 @@  discard block
 block discarded – undo
897 894
         $value[] = 0; // just in case the carry adds an extra digit
898 895
 
899 896
         $carry = 0;
900
-        for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) {
897
+        for ($i = 0, $j = 1; $j < $size; $i += 2, $j += 2) {
901 898
             $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] + $y_value[$j] * MATH_BIGINTEGER_BASE_FULL + $y_value[$i] + $carry;
902 899
             $carry = $sum >= MATH_BIGINTEGER_MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
903 900
             $sum = $carry ? $sum - MATH_BIGINTEGER_MAX_DIGIT2 : $sum;
@@ -952,7 +949,7 @@  discard block
 block discarded – undo
952 949
      */
953 950
     function subtract($y)
954 951
     {
955
-        switch ( MATH_BIGINTEGER_MODE ) {
952
+        switch (MATH_BIGINTEGER_MODE) {
956 953
             case MATH_BIGINTEGER_MODE_GMP:
957 954
                 $temp = new Math_BigInteger();
958 955
                 $temp->value = gmp_sub($this->value, $y->value);
@@ -1002,7 +999,7 @@  discard block
 block discarded – undo
1002 999
         }
1003 1000
 
1004 1001
         // add, if appropriate (ie. -$x - +$y or +$x - -$y)
1005
-        if ( $x_negative != $y_negative ) {
1002
+        if ($x_negative != $y_negative) {
1006 1003
             $temp = $this->_add($x_value, false, $y_value, false);
1007 1004
             $temp[MATH_BIGINTEGER_SIGN] = $x_negative;
1008 1005
 
@@ -1011,7 +1008,7 @@  discard block
 block discarded – undo
1011 1008
 
1012 1009
         $diff = $this->_compare($x_value, $x_negative, $y_value, $y_negative);
1013 1010
 
1014
-        if ( !$diff ) {
1011
+        if (!$diff) {
1015 1012
             return array(
1016 1013
                 MATH_BIGINTEGER_VALUE => array(),
1017 1014
                 MATH_BIGINTEGER_SIGN => false
@@ -1019,7 +1016,7 @@  discard block
 block discarded – undo
1019 1016
         }
1020 1017
 
1021 1018
         // switch $x and $y around, if appropriate.
1022
-        if ( (!$x_negative && $diff < 0) || ($x_negative && $diff > 0) ) {
1019
+        if ((!$x_negative && $diff < 0) || ($x_negative && $diff > 0)) {
1023 1020
             $temp = $x_value;
1024 1021
             $x_value = $y_value;
1025 1022
             $y_value = $temp;
@@ -1033,7 +1030,7 @@  discard block
 block discarded – undo
1033 1030
         // at this point, $x_value should be at least as big as - if not bigger than - $y_value
1034 1031
 
1035 1032
         $carry = 0;
1036
-        for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) {
1033
+        for ($i = 0, $j = 1; $j < $y_size; $i += 2, $j += 2) {
1037 1034
             $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] - $y_value[$j] * MATH_BIGINTEGER_BASE_FULL - $y_value[$i] - $carry;
1038 1035
             $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
1039 1036
             $sum = $carry ? $sum + MATH_BIGINTEGER_MAX_DIGIT2 : $sum;
@@ -1087,7 +1084,7 @@  discard block
 block discarded – undo
1087 1084
      */
1088 1085
     function multiply($x)
1089 1086
     {
1090
-        switch ( MATH_BIGINTEGER_MODE ) {
1087
+        switch (MATH_BIGINTEGER_MODE) {
1091 1088
             case MATH_BIGINTEGER_MODE_GMP:
1092 1089
                 $temp = new Math_BigInteger();
1093 1090
                 $temp->value = gmp_mul($this->value, $x->value);
@@ -1131,7 +1128,7 @@  discard block
 block discarded – undo
1131 1128
         $x_length = count($x_value);
1132 1129
         $y_length = count($y_value);
1133 1130
 
1134
-        if ( !$x_length || !$y_length ) { // a 0 is being multiplied
1131
+        if (!$x_length || !$y_length) { // a 0 is being multiplied
1135 1132
             return array(
1136 1133
                 MATH_BIGINTEGER_VALUE => array(),
1137 1134
                 MATH_BIGINTEGER_SIGN => false
@@ -1140,8 +1137,7 @@  discard block
 block discarded – undo
1140 1137
 
1141 1138
         return array(
1142 1139
             MATH_BIGINTEGER_VALUE => min($x_length, $y_length) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ?
1143
-                $this->_trim($this->_regularMultiply($x_value, $y_value)) :
1144
-                $this->_trim($this->_karatsuba($x_value, $y_value)),
1140
+                $this->_trim($this->_regularMultiply($x_value, $y_value)) : $this->_trim($this->_karatsuba($x_value, $y_value)),
1145 1141
             MATH_BIGINTEGER_SIGN => $x_negative != $y_negative
1146 1142
         );
1147 1143
     }
@@ -1161,11 +1157,11 @@  discard block
 block discarded – undo
1161 1157
         $x_length = count($x_value);
1162 1158
         $y_length = count($y_value);
1163 1159
 
1164
-        if ( !$x_length || !$y_length ) { // a 0 is being multiplied
1160
+        if (!$x_length || !$y_length) { // a 0 is being multiplied
1165 1161
             return array();
1166 1162
         }
1167 1163
 
1168
-        if ( $x_length < $y_length ) {
1164
+        if ($x_length < $y_length) {
1169 1165
             $temp = $x_value;
1170 1166
             $x_value = $y_value;
1171 1167
             $y_value = $temp;
@@ -1261,8 +1257,7 @@  discard block
 block discarded – undo
1261 1257
     function _square($x = false)
1262 1258
     {
1263 1259
         return count($x) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ?
1264
-            $this->_trim($this->_baseSquare($x)) :
1265
-            $this->_trim($this->_karatsubaSquare($x));
1260
+            $this->_trim($this->_baseSquare($x)) : $this->_trim($this->_karatsubaSquare($x));
1266 1261
     }
1267 1262
 
1268 1263
     /**
@@ -1278,7 +1273,7 @@  discard block
 block discarded – undo
1278 1273
      */
1279 1274
     function _baseSquare($value)
1280 1275
     {
1281
-        if ( empty($value) ) {
1276
+        if (empty($value)) {
1282 1277
             return array();
1283 1278
         }
1284 1279
         $square_value = $this->_array_repeat(0, 2 * count($value));
@@ -1374,7 +1369,7 @@  discard block
 block discarded – undo
1374 1369
      */
1375 1370
     function divide($y)
1376 1371
     {
1377
-        switch ( MATH_BIGINTEGER_MODE ) {
1372
+        switch (MATH_BIGINTEGER_MODE) {
1378 1373
             case MATH_BIGINTEGER_MODE_GMP:
1379 1374
                 $quotient = new Math_BigInteger();
1380 1375
                 $remainder = new Math_BigInteger();
@@ -1411,7 +1406,7 @@  discard block
 block discarded – undo
1411 1406
         }
1412 1407
 
1413 1408
         static $zero;
1414
-        if ( !isset($zero) ) {
1409
+        if (!isset($zero)) {
1415 1410
             $zero = new Math_BigInteger();
1416 1411
         }
1417 1412
 
@@ -1425,16 +1420,16 @@  discard block
 block discarded – undo
1425 1420
 
1426 1421
         $diff = $x->compare($y);
1427 1422
 
1428
-        if ( !$diff ) {
1423
+        if (!$diff) {
1429 1424
             $temp = new Math_BigInteger();
1430 1425
             $temp->value = array(1);
1431 1426
             $temp->is_negative = $x_sign != $y_sign;
1432 1427
             return array($this->_normalize($temp), $this->_normalize(new Math_BigInteger()));
1433 1428
         }
1434 1429
 
1435
-        if ( $diff < 0 ) {
1430
+        if ($diff < 0) {
1436 1431
             // if $x is negative, "add" $y.
1437
-            if ( $x_sign ) {
1432
+            if ($x_sign) {
1438 1433
                 $x = $y->subtract($x);
1439 1434
             }
1440 1435
             return array($this->_normalize(new Math_BigInteger()), $this->_normalize($x));
@@ -1459,16 +1454,16 @@  discard block
 block discarded – undo
1459 1454
         static $temp, $lhs, $rhs;
1460 1455
         if (!isset($temp)) {
1461 1456
             $temp = new Math_BigInteger();
1462
-            $lhs =  new Math_BigInteger();
1463
-            $rhs =  new Math_BigInteger();
1457
+            $lhs = new Math_BigInteger();
1458
+            $rhs = new Math_BigInteger();
1464 1459
         }
1465 1460
         $temp_value = &$temp->value;
1466
-        $rhs_value =  &$rhs->value;
1461
+        $rhs_value = &$rhs->value;
1467 1462
 
1468 1463
         // $temp = $y << ($x_max - $y_max-1) in base 2**26
1469 1464
         $temp_value = array_merge($this->_array_repeat(0, $x_max - $y_max), $y_value);
1470 1465
 
1471
-        while ( $x->compare($temp) >= 0 ) {
1466
+        while ($x->compare($temp) >= 0) {
1472 1467
             // calculate the "common residue"
1473 1468
             ++$quotient_value[$x_max - $y_max];
1474 1469
             $x = $x->subtract($temp);
@@ -1484,7 +1479,7 @@  discard block
 block discarded – undo
1484 1479
             );
1485 1480
             $y_window = array(
1486 1481
                 $y_value[$y_max],
1487
-                ( $y_max > 0 ) ? $y_value[$y_max - 1] : 0
1482
+                ($y_max > 0) ? $y_value[$y_max - 1] : 0
1488 1483
             );
1489 1484
 
1490 1485
             $q_index = $i - $y_max - 1;
@@ -1505,7 +1500,7 @@  discard block
 block discarded – undo
1505 1500
 
1506 1501
             $rhs_value = array($x_window[2], $x_window[1], $x_window[0]);
1507 1502
 
1508
-            while ( $lhs->compare($rhs) > 0 ) {
1503
+            while ($lhs->compare($rhs) > 0) {
1509 1504
                 --$quotient_value[$q_index];
1510 1505
 
1511 1506
                 $lhs->value = array($quotient_value[$q_index]);
@@ -1536,7 +1531,7 @@  discard block
 block discarded – undo
1536 1531
         $quotient->is_negative = $x_sign != $y_sign;
1537 1532
 
1538 1533
         // calculate the "common residue", if appropriate
1539
-        if ( $x_sign ) {
1534
+        if ($x_sign) {
1540 1535
             $y->_rshift($shift);
1541 1536
             $x = $y->subtract($x);
1542 1537
         }
@@ -1625,7 +1620,7 @@  discard block
 block discarded – undo
1625 1620
             return $this->_normalize($temp->modPow($e, $n));
1626 1621
         }
1627 1622
 
1628
-        if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP ) {
1623
+        if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP) {
1629 1624
             $temp = new Math_BigInteger();
1630 1625
             $temp->value = gmp_powm($this->value, $e->value, $n->value);
1631 1626
 
@@ -1654,15 +1649,15 @@  discard block
 block discarded – undo
1654 1649
             );
1655 1650
 
1656 1651
             $rsaOID = pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA
1657
-            $RSAPublicKey = chr(0) . $RSAPublicKey;
1658
-            $RSAPublicKey = chr(3) . $this->_encodeASN1Length(strlen($RSAPublicKey)) . $RSAPublicKey;
1652
+            $RSAPublicKey = chr(0).$RSAPublicKey;
1653
+            $RSAPublicKey = chr(3).$this->_encodeASN1Length(strlen($RSAPublicKey)).$RSAPublicKey;
1659 1654
 
1660 1655
             $encapsulated = pack('Ca*a*',
1661
-                48, $this->_encodeASN1Length(strlen($rsaOID . $RSAPublicKey)), $rsaOID . $RSAPublicKey
1656
+                48, $this->_encodeASN1Length(strlen($rsaOID.$RSAPublicKey)), $rsaOID.$RSAPublicKey
1662 1657
             );
1663 1658
 
1664
-            $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
1665
-                             chunk_split(base64_encode($encapsulated)) .
1659
+            $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n".
1660
+                             chunk_split(base64_encode($encapsulated)).
1666 1661
                              '-----END PUBLIC KEY-----';
1667 1662
 
1668 1663
             $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT);
@@ -1672,25 +1667,25 @@  discard block
 block discarded – undo
1672 1667
             }
1673 1668
         }
1674 1669
 
1675
-        if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
1670
+        if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) {
1676 1671
                 $temp = new Math_BigInteger();
1677 1672
                 $temp->value = bcpowmod($this->value, $e->value, $n->value, 0);
1678 1673
 
1679 1674
                 return $this->_normalize($temp);
1680 1675
         }
1681 1676
 
1682
-        if ( empty($e->value) ) {
1677
+        if (empty($e->value)) {
1683 1678
             $temp = new Math_BigInteger();
1684 1679
             $temp->value = array(1);
1685 1680
             return $this->_normalize($temp);
1686 1681
         }
1687 1682
 
1688
-        if ( $e->value == array(1) ) {
1683
+        if ($e->value == array(1)) {
1689 1684
             list(, $temp) = $this->divide($n);
1690 1685
             return $this->_normalize($temp);
1691 1686
         }
1692 1687
 
1693
-        if ( $e->value == array(2) ) {
1688
+        if ($e->value == array(2)) {
1694 1689
             $temp = new Math_BigInteger();
1695 1690
             $temp->value = $this->_square($this->value);
1696 1691
             list(, $temp) = $temp->divide($n);
@@ -1700,17 +1695,17 @@  discard block
 block discarded – undo
1700 1695
         return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_BARRETT));
1701 1696
 
1702 1697
         // is the modulo odd?
1703
-        if ( $n->value[0] & 1 ) {
1698
+        if ($n->value[0] & 1) {
1704 1699
             return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_MONTGOMERY));
1705 1700
         }
1706 1701
         // if it's not, it's even
1707 1702
 
1708 1703
         // find the lowest set bit (eg. the max pow of 2 that divides $n)
1709 1704
         for ($i = 0; $i < count($n->value); ++$i) {
1710
-            if ( $n->value[$i] ) {
1705
+            if ($n->value[$i]) {
1711 1706
                 $temp = decbin($n->value[$i]);
1712 1707
                 $j = strlen($temp) - strrpos($temp, '1') - 1;
1713
-                $j+= 26 * $i;
1708
+                $j += 26 * $i;
1714 1709
                 break;
1715 1710
             }
1716 1711
         }
@@ -1722,7 +1717,7 @@  discard block
 block discarded – undo
1722 1717
         $mod2->value = array(1);
1723 1718
         $mod2->_lshift($j);
1724 1719
 
1725
-        $part1 = ( $mod1->value != array(1) ) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger();
1720
+        $part1 = ($mod1->value != array(1)) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger();
1726 1721
         $part2 = $this->_slidingWindow($e, $mod2, MATH_BIGINTEGER_POWEROF2);
1727 1722
 
1728 1723
         $y1 = $mod2->modInverse($mod1);
@@ -1778,7 +1773,7 @@  discard block
 block discarded – undo
1778 1773
         $e_length = count($e_value) - 1;
1779 1774
         $e_bits = decbin($e_value[$e_length]);
1780 1775
         for ($i = $e_length - 1; $i >= 0; --$i) {
1781
-            $e_bits.= str_pad(decbin($e_value[$i]), MATH_BIGINTEGER_BASE, '0', STR_PAD_LEFT);
1776
+            $e_bits .= str_pad(decbin($e_value[$i]), MATH_BIGINTEGER_BASE, '0', STR_PAD_LEFT);
1782 1777
         }
1783 1778
 
1784 1779
         $e_length = strlen($e_bits);
@@ -1805,13 +1800,13 @@  discard block
 block discarded – undo
1805 1800
         $result = array(1);
1806 1801
         $result = $this->_prepareReduce($result, $n_value, $mode);
1807 1802
 
1808
-        for ($i = 0; $i < $e_length; ) {
1809
-            if ( !$e_bits[$i] ) {
1803
+        for ($i = 0; $i < $e_length;) {
1804
+            if (!$e_bits[$i]) {
1810 1805
                 $result = $this->_squareReduce($result, $n_value, $mode);
1811 1806
                 ++$i;
1812 1807
             } else {
1813 1808
                 for ($j = $window_size - 1; $j > 0; --$j) {
1814
-                    if ( !empty($e_bits[$i + $j]) ) {
1809
+                    if (!empty($e_bits[$i + $j])) {
1815 1810
                         break;
1816 1811
                     }
1817 1812
                 }
@@ -1822,7 +1817,7 @@  discard block
 block discarded – undo
1822 1817
 
1823 1818
                 $result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode);
1824 1819
 
1825
-                $i+=$j + 1;
1820
+                $i += $j + 1;
1826 1821
             }
1827 1822
         }
1828 1823
 
@@ -1995,7 +1990,7 @@  discard block
 block discarded – undo
1995 1990
 
1996 1991
         // n = 2 * m.length
1997 1992
 
1998
-        if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
1993
+        if (($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false) {
1999 1994
             $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2000 1995
             $cache[MATH_BIGINTEGER_VARIABLE][] = $m;
2001 1996
 
@@ -2020,7 +2015,7 @@  discard block
 block discarded – undo
2020 2015
 
2021 2016
         $cutoff = $m_length + ($m_length >> 1);
2022 2017
         $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1)
2023
-        $msd = array_slice($n, $cutoff);    // m.length >> 1
2018
+        $msd = array_slice($n, $cutoff); // m.length >> 1
2024 2019
         $lsd = $this->_trim($lsd);
2025 2020
         $temp = $this->_multiply($msd, false, $m1, false);
2026 2021
         $n = $this->_add($lsd, false, $temp[MATH_BIGINTEGER_VALUE], false); // m.length + (m.length >> 1) + 1
@@ -2084,7 +2079,7 @@  discard block
 block discarded – undo
2084 2079
             return $temp->value;
2085 2080
         }
2086 2081
 
2087
-        if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2082
+        if (($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false) {
2088 2083
             $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2089 2084
             $cache[MATH_BIGINTEGER_VARIABLE][] = $n;
2090 2085
             $lhs = new Math_BigInteger();
@@ -2093,7 +2088,7 @@  discard block
 block discarded – undo
2093 2088
             $lhs_value[] = 1;
2094 2089
             $rhs = new Math_BigInteger();
2095 2090
             $rhs->value = $n;
2096
-            list($temp, ) = $lhs->divide($rhs); // m.length
2091
+            list($temp,) = $lhs->divide($rhs); // m.length
2097 2092
             $cache[MATH_BIGINTEGER_DATA][] = $temp->value;
2098 2093
         }
2099 2094
 
@@ -2145,14 +2140,14 @@  discard block
 block discarded – undo
2145 2140
         $x_length = count($x_value);
2146 2141
         $y_length = count($y_value);
2147 2142
 
2148
-        if ( !$x_length || !$y_length ) { // a 0 is being multiplied
2143
+        if (!$x_length || !$y_length) { // a 0 is being multiplied
2149 2144
             return array(
2150 2145
                 MATH_BIGINTEGER_VALUE => array(),
2151 2146
                 MATH_BIGINTEGER_SIGN => false
2152 2147
             );
2153 2148
         }
2154 2149
 
2155
-        if ( $x_length < $y_length ) {
2150
+        if ($x_length < $y_length) {
2156 2151
             $temp = $x_value;
2157 2152
             $x_value = $y_value;
2158 2153
             $y_value = $temp;
@@ -2226,7 +2221,7 @@  discard block
 block discarded – undo
2226 2221
             MATH_BIGINTEGER_DATA => array()
2227 2222
         );
2228 2223
 
2229
-        if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2224
+        if (($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false) {
2230 2225
             $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2231 2226
             $cache[MATH_BIGINTEGER_VARIABLE][] = $x;
2232 2227
             $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($n);
@@ -2277,7 +2272,7 @@  discard block
 block discarded – undo
2277 2272
             MATH_BIGINTEGER_DATA => array()
2278 2273
         );
2279 2274
 
2280
-        if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2275
+        if (($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false) {
2281 2276
             $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2282 2277
             $cache[MATH_BIGINTEGER_VARIABLE][] = $m;
2283 2278
             $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($m);
@@ -2355,7 +2350,7 @@  discard block
 block discarded – undo
2355 2350
         $x = -$x[0];
2356 2351
         $result = $x & 0x3; // x**-1 mod 2**2
2357 2352
         $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4
2358
-        $result = ($result * (2 - ($x & 0xFF) * $result))  & 0xFF; // x**-1 mod 2**8
2353
+        $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8
2359 2354
         $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16
2360 2355
         $result = fmod($result * (2 - fmod($x * $result, MATH_BIGINTEGER_BASE_FULL)), MATH_BIGINTEGER_BASE_FULL); // x**-1 mod 2**26
2361 2356
         return $result & MATH_BIGINTEGER_MAX_DIGIT;
@@ -2392,12 +2387,12 @@  discard block
 block discarded – undo
2392 2387
      */
2393 2388
     function modInverse($n)
2394 2389
     {
2395
-        switch ( MATH_BIGINTEGER_MODE ) {
2390
+        switch (MATH_BIGINTEGER_MODE) {
2396 2391
             case MATH_BIGINTEGER_MODE_GMP:
2397 2392
                 $temp = new Math_BigInteger();
2398 2393
                 $temp->value = gmp_invert($this->value, $n->value);
2399 2394
 
2400
-                return ( $temp->value === false ) ? false : $this->_normalize($temp);
2395
+                return ($temp->value === false) ? false : $this->_normalize($temp);
2401 2396
         }
2402 2397
 
2403 2398
         static $zero, $one;
@@ -2458,7 +2453,7 @@  discard block
 block discarded – undo
2458 2453
      */
2459 2454
     function extendedGCD($n)
2460 2455
     {
2461
-        switch ( MATH_BIGINTEGER_MODE ) {
2456
+        switch (MATH_BIGINTEGER_MODE) {
2462 2457
             case MATH_BIGINTEGER_MODE_GMP:
2463 2458
                 extract(gmp_gcdext($this->value, $n->value));
2464 2459
 
@@ -2508,7 +2503,7 @@  discard block
 block discarded – undo
2508 2503
         $g = new Math_BigInteger();
2509 2504
         $g->value = array(1);
2510 2505
 
2511
-        while ( !(($x->value[0] & 1)|| ($y->value[0] & 1)) ) {
2506
+        while (!(($x->value[0] & 1) || ($y->value[0] & 1))) {
2512 2507
             $x->_rshift(1);
2513 2508
             $y->_rshift(1);
2514 2509
             $g->_lshift(1);
@@ -2525,10 +2520,10 @@  discard block
 block discarded – undo
2525 2520
         $a->value = $d->value = $g->value = array(1);
2526 2521
         $b->value = $c->value = array();
2527 2522
 
2528
-        while ( !empty($u->value) ) {
2529
-            while ( !($u->value[0] & 1) ) {
2523
+        while (!empty($u->value)) {
2524
+            while (!($u->value[0] & 1)) {
2530 2525
                 $u->_rshift(1);
2531
-                if ( (!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1)) ) {
2526
+                if ((!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1))) {
2532 2527
                     $a = $a->add($y);
2533 2528
                     $b = $b->subtract($x);
2534 2529
                 }
@@ -2536,9 +2531,9 @@  discard block
 block discarded – undo
2536 2531
                 $b->_rshift(1);
2537 2532
             }
2538 2533
 
2539
-            while ( !($v->value[0] & 1) ) {
2534
+            while (!($v->value[0] & 1)) {
2540 2535
                 $v->_rshift(1);
2541
-                if ( (!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1)) ) {
2536
+                if ((!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1))) {
2542 2537
                     $c = $c->add($y);
2543 2538
                     $d = $d->subtract($x);
2544 2539
                 }
@@ -2603,7 +2598,7 @@  discard block
 block discarded – undo
2603 2598
     {
2604 2599
         $temp = new Math_BigInteger();
2605 2600
 
2606
-        switch ( MATH_BIGINTEGER_MODE ) {
2601
+        switch (MATH_BIGINTEGER_MODE) {
2607 2602
             case MATH_BIGINTEGER_MODE_GMP:
2608 2603
                 $temp->value = gmp_abs($this->value);
2609 2604
                 break;
@@ -2637,7 +2632,7 @@  discard block
 block discarded – undo
2637 2632
      */
2638 2633
     function compare($y)
2639 2634
     {
2640
-        switch ( MATH_BIGINTEGER_MODE ) {
2635
+        switch (MATH_BIGINTEGER_MODE) {
2641 2636
             case MATH_BIGINTEGER_MODE_GMP:
2642 2637
                 return gmp_cmp($this->value, $y->value);
2643 2638
             case MATH_BIGINTEGER_MODE_BCMATH:
@@ -2660,14 +2655,14 @@  discard block
 block discarded – undo
2660 2655
      */
2661 2656
     function _compare($x_value, $x_negative, $y_value, $y_negative)
2662 2657
     {
2663
-        if ( $x_negative != $y_negative ) {
2664
-            return ( !$x_negative && $y_negative ) ? 1 : -1;
2658
+        if ($x_negative != $y_negative) {
2659
+            return (!$x_negative && $y_negative) ? 1 : -1;
2665 2660
         }
2666 2661
 
2667 2662
         $result = $x_negative ? -1 : 1;
2668 2663
 
2669
-        if ( count($x_value) != count($y_value) ) {
2670
-            return ( count($x_value) > count($y_value) ) ? $result : -$result;
2664
+        if (count($x_value) != count($y_value)) {
2665
+            return (count($x_value) > count($y_value)) ? $result : -$result;
2671 2666
         }
2672 2667
         $size = max(count($x_value), count($y_value));
2673 2668
 
@@ -2676,7 +2671,7 @@  discard block
 block discarded – undo
2676 2671
 
2677 2672
         for ($i = count($x_value) - 1; $i >= 0; --$i) {
2678 2673
             if ($x_value[$i] != $y_value[$i]) {
2679
-                return ( $x_value[$i] > $y_value[$i] ) ? $result : -$result;
2674
+                return ($x_value[$i] > $y_value[$i]) ? $result : -$result;
2680 2675
             }
2681 2676
         }
2682 2677
 
@@ -2695,7 +2690,7 @@  discard block
 block discarded – undo
2695 2690
      */
2696 2691
     function equals($x)
2697 2692
     {
2698
-        switch ( MATH_BIGINTEGER_MODE ) {
2693
+        switch (MATH_BIGINTEGER_MODE) {
2699 2694
             case MATH_BIGINTEGER_MODE_GMP:
2700 2695
                 return gmp_cmp($this->value, $x->value) == 0;
2701 2696
             default:
@@ -2715,8 +2710,8 @@  discard block
 block discarded – undo
2715 2710
     function setPrecision($bits)
2716 2711
     {
2717 2712
         $this->precision = $bits;
2718
-        if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ) {
2719
-            $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256);
2713
+        if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH) {
2714
+            $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1).str_repeat(chr(0xFF), $bits >> 3), 256);
2720 2715
         } else {
2721 2716
             $this->bitmask = new Math_BigInteger(bcpow('2', $bits, 0));
2722 2717
         }
@@ -2735,7 +2730,7 @@  discard block
 block discarded – undo
2735 2730
      */
2736 2731
     function bitwise_and($x)
2737 2732
     {
2738
-        switch ( MATH_BIGINTEGER_MODE ) {
2733
+        switch (MATH_BIGINTEGER_MODE) {
2739 2734
             case MATH_BIGINTEGER_MODE_GMP:
2740 2735
                 $temp = new Math_BigInteger();
2741 2736
                 $temp->value = gmp_and($this->value, $x->value);
@@ -2760,7 +2755,7 @@  discard block
 block discarded – undo
2760 2755
         $result->value = array_slice($result->value, 0, $length);
2761 2756
 
2762 2757
         for ($i = 0; $i < $length; ++$i) {
2763
-            $result->value[$i]&= $x->value[$i];
2758
+            $result->value[$i] &= $x->value[$i];
2764 2759
         }
2765 2760
 
2766 2761
         return $this->_normalize($result);
@@ -2776,7 +2771,7 @@  discard block
 block discarded – undo
2776 2771
      */
2777 2772
     function bitwise_or($x)
2778 2773
     {
2779
-        switch ( MATH_BIGINTEGER_MODE ) {
2774
+        switch (MATH_BIGINTEGER_MODE) {
2780 2775
             case MATH_BIGINTEGER_MODE_GMP:
2781 2776
                 $temp = new Math_BigInteger();
2782 2777
                 $temp->value = gmp_or($this->value, $x->value);
@@ -2800,7 +2795,7 @@  discard block
 block discarded – undo
2800 2795
         $x->value = array_pad($x->value, $length, 0);
2801 2796
 
2802 2797
         for ($i = 0; $i < $length; ++$i) {
2803
-            $result->value[$i]|= $x->value[$i];
2798
+            $result->value[$i] |= $x->value[$i];
2804 2799
         }
2805 2800
 
2806 2801
         return $this->_normalize($result);
@@ -2816,7 +2811,7 @@  discard block
 block discarded – undo
2816 2811
      */
2817 2812
     function bitwise_xor($x)
2818 2813
     {
2819
-        switch ( MATH_BIGINTEGER_MODE ) {
2814
+        switch (MATH_BIGINTEGER_MODE) {
2820 2815
             case MATH_BIGINTEGER_MODE_GMP:
2821 2816
                 $temp = new Math_BigInteger();
2822 2817
                 $temp->value = gmp_xor($this->value, $x->value);
@@ -2840,7 +2835,7 @@  discard block
 block discarded – undo
2840 2835
         $x->value = array_pad($x->value, $length, 0);
2841 2836
 
2842 2837
         for ($i = 0; $i < $length; ++$i) {
2843
-            $result->value[$i]^= $x->value[$i];
2838
+            $result->value[$i] ^= $x->value[$i];
2844 2839
         }
2845 2840
 
2846 2841
         return $this->_normalize($result);
@@ -2874,7 +2869,7 @@  discard block
 block discarded – undo
2874 2869
         }
2875 2870
 
2876 2871
         // generate as many leading 1's as we need to.
2877
-        $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3);
2872
+        $leading_ones = chr((1 << ($new_bits & 0x7)) - 1).str_repeat(chr(0xFF), $new_bits >> 3);
2878 2873
         $this->_base256_lshift($leading_ones, $current_bits);
2879 2874
 
2880 2875
         $temp = str_pad($temp, ceil($this->bits / 8), chr(0), STR_PAD_LEFT);
@@ -2896,7 +2891,7 @@  discard block
 block discarded – undo
2896 2891
     {
2897 2892
         $temp = new Math_BigInteger();
2898 2893
 
2899
-        switch ( MATH_BIGINTEGER_MODE ) {
2894
+        switch (MATH_BIGINTEGER_MODE) {
2900 2895
             case MATH_BIGINTEGER_MODE_GMP:
2901 2896
                 static $two;
2902 2897
 
@@ -2934,7 +2929,7 @@  discard block
 block discarded – undo
2934 2929
     {
2935 2930
         $temp = new Math_BigInteger();
2936 2931
 
2937
-        switch ( MATH_BIGINTEGER_MODE ) {
2932
+        switch (MATH_BIGINTEGER_MODE) {
2938 2933
             case MATH_BIGINTEGER_MODE_GMP:
2939 2934
                 static $two;
2940 2935
 
@@ -2973,7 +2968,7 @@  discard block
 block discarded – undo
2973 2968
 
2974 2969
         if ($this->precision > 0) {
2975 2970
             $precision = $this->precision;
2976
-            if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
2971
+            if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) {
2977 2972
                 $mask = $this->bitmask->subtract(new Math_BigInteger(1));
2978 2973
                 $mask = $mask->toBytes();
2979 2974
             } else {
@@ -2983,13 +2978,13 @@  discard block
 block discarded – undo
2983 2978
             $temp = ord($bits[0]);
2984 2979
             for ($i = 0; $temp >> $i; ++$i);
2985 2980
             $precision = 8 * strlen($bits) - 8 + $i;
2986
-            $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3);
2981
+            $mask = chr((1 << ($precision & 0x7)) - 1).str_repeat(chr(0xFF), $precision >> 3);
2987 2982
         }
2988 2983
 
2989 2984
         if ($shift < 0) {
2990
-            $shift+= $precision;
2985
+            $shift += $precision;
2991 2986
         }
2992
-        $shift%= $precision;
2987
+        $shift %= $precision;
2993 2988
 
2994 2989
         if (!$shift) {
2995 2990
             return $this->copy();
@@ -3068,13 +3063,13 @@  discard block
 block discarded – undo
3068 3063
             $random = '';
3069 3064
 
3070 3065
             if ($size & 1) {
3071
-                $random.= chr(mt_rand(0, 255));
3066
+                $random .= chr(mt_rand(0, 255));
3072 3067
             }
3073 3068
 
3074 3069
             $blocks = $size >> 1;
3075 3070
             for ($i = 0; $i < $blocks; ++$i) {
3076 3071
                 // mt_rand(-2147483648, 0x7FFFFFFF) always produces -2147483648 on some systems
3077
-                $random.= pack('n', mt_rand(0, 0xFFFF));
3072
+                $random .= pack('n', mt_rand(0, 0xFFFF));
3078 3073
             }
3079 3074
         }
3080 3075
 
@@ -3089,14 +3084,14 @@  discard block
 block discarded – undo
3089 3084
             while (true) {
3090 3085
                 $msb = ord(crypt_random_string(1));
3091 3086
                 if ($msb <= $cutoff) {
3092
-                    $msb%= $leading;
3087
+                    $msb %= $leading;
3093 3088
                     break;
3094 3089
                 }
3095 3090
             }
3096 3091
             $msb = chr($msb);
3097 3092
         }
3098 3093
 
3099
-        $random = new Math_BigInteger($msb . $random, 256);
3094
+        $random = new Math_BigInteger($msb.$random, 256);
3100 3095
 
3101 3096
         return $this->_normalize($random->add($min));
3102 3097
     }
@@ -3146,7 +3141,7 @@  discard block
 block discarded – undo
3146 3141
         $x = $this->random($min, $max);
3147 3142
 
3148 3143
         // gmp_nextprime() requires PHP 5 >= 5.2.0 per <http://php.net/gmp-nextprime>.
3149
-        if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && function_exists('gmp_nextprime') ) {
3144
+        if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && function_exists('gmp_nextprime')) {
3150 3145
             $p->value = gmp_nextprime($x->value);
3151 3146
 
3152 3147
             if ($p->compare($max) <= 0) {
@@ -3211,7 +3206,7 @@  discard block
 block discarded – undo
3211 3206
      */
3212 3207
     function _make_odd()
3213 3208
     {
3214
-        switch ( MATH_BIGINTEGER_MODE ) {
3209
+        switch (MATH_BIGINTEGER_MODE) {
3215 3210
             case MATH_BIGINTEGER_MODE_GMP:
3216 3211
                 gmp_setbit($this->value, 0);
3217 3212
                 break;
@@ -3245,23 +3240,23 @@  discard block
 block discarded – undo
3245 3240
 
3246 3241
         if (!$t) {
3247 3242
             // see HAC 4.49 "Note (controlling the error probability)"
3248
-                 if ($length >= 163) { $t =  2; } // floor(1300 / 8)
3249
-            else if ($length >= 106) { $t =  3; } // floor( 850 / 8)
3250
-            else if ($length >= 81 ) { $t =  4; } // floor( 650 / 8)
3251
-            else if ($length >= 68 ) { $t =  5; } // floor( 550 / 8)
3252
-            else if ($length >= 56 ) { $t =  6; } // floor( 450 / 8)
3253
-            else if ($length >= 50 ) { $t =  7; } // floor( 400 / 8)
3254
-            else if ($length >= 43 ) { $t =  8; } // floor( 350 / 8)
3255
-            else if ($length >= 37 ) { $t =  9; } // floor( 300 / 8)
3256
-            else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8)
3257
-            else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8)
3258
-            else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8)
3259
-            else                     { $t = 27; }
3243
+                 if ($length >= 163) { $t = 2; } // floor(1300 / 8)
3244
+            else if ($length >= 106) { $t = 3; } // floor( 850 / 8)
3245
+            else if ($length >= 81) { $t = 4; } // floor( 650 / 8)
3246
+            else if ($length >= 68) { $t = 5; } // floor( 550 / 8)
3247
+            else if ($length >= 56) { $t = 6; } // floor( 450 / 8)
3248
+            else if ($length >= 50) { $t = 7; } // floor( 400 / 8)
3249
+            else if ($length >= 43) { $t = 8; } // floor( 350 / 8)
3250
+            else if ($length >= 37) { $t = 9; } // floor( 300 / 8)
3251
+            else if ($length >= 31) { $t = 12; } // floor( 250 / 8)
3252
+            else if ($length >= 25) { $t = 15; } // floor( 200 / 8)
3253
+            else if ($length >= 18) { $t = 18; } // floor( 150 / 8)
3254
+            else { $t = 27; }
3260 3255
         }
3261 3256
 
3262 3257
         // ie. gmp_testbit($this, 0)
3263 3258
         // ie. isEven() or !isOdd()
3264
-        switch ( MATH_BIGINTEGER_MODE ) {
3259
+        switch (MATH_BIGINTEGER_MODE) {
3265 3260
             case MATH_BIGINTEGER_MODE_GMP:
3266 3261
                 return gmp_prob_prime($this->value, $t) != 0;
3267 3262
             case MATH_BIGINTEGER_MODE_BCMATH:
@@ -3285,20 +3280,20 @@  discard block
 block discarded – undo
3285 3280
 
3286 3281
         if (!isset($primes)) {
3287 3282
             $primes = array(
3288
-                3,    5,    7,    11,   13,   17,   19,   23,   29,   31,   37,   41,   43,   47,   53,   59,   
3289
-                61,   67,   71,   73,   79,   83,   89,   97,   101,  103,  107,  109,  113,  127,  131,  137,  
3290
-                139,  149,  151,  157,  163,  167,  173,  179,  181,  191,  193,  197,  199,  211,  223,  227,  
3291
-                229,  233,  239,  241,  251,  257,  263,  269,  271,  277,  281,  283,  293,  307,  311,  313,  
3292
-                317,  331,  337,  347,  349,  353,  359,  367,  373,  379,  383,  389,  397,  401,  409,  419,  
3293
-                421,  431,  433,  439,  443,  449,  457,  461,  463,  467,  479,  487,  491,  499,  503,  509,  
3294
-                521,  523,  541,  547,  557,  563,  569,  571,  577,  587,  593,  599,  601,  607,  613,  617,  
3295
-                619,  631,  641,  643,  647,  653,  659,  661,  673,  677,  683,  691,  701,  709,  719,  727,  
3296
-                733,  739,  743,  751,  757,  761,  769,  773,  787,  797,  809,  811,  821,  823,  827,  829,  
3297
-                839,  853,  857,  859,  863,  877,  881,  883,  887,  907,  911,  919,  929,  937,  941,  947,  
3298
-                953,  967,  971,  977,  983,  991,  997
3283
+                3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,   
3284
+                61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,  
3285
+                139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227,  
3286
+                229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,  
3287
+                317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,  
3288
+                421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,  
3289
+                521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617,  
3290
+                619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727,  
3291
+                733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829,  
3292
+                839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947,  
3293
+                953, 967, 971, 977, 983, 991, 997
3299 3294
             );
3300 3295
 
3301
-            if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) {
3296
+            if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) {
3302 3297
                 for ($i = 0; $i < count($primes); ++$i) {
3303 3298
                     $primes[$i] = new Math_BigInteger($primes[$i]);
3304 3299
                 }
@@ -3314,7 +3309,7 @@  discard block
 block discarded – undo
3314 3309
         }
3315 3310
 
3316 3311
         // see HAC 4.4.1 "Random search for probable primes"
3317
-        if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) {
3312
+        if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) {
3318 3313
             foreach ($primes as $prime) {
3319 3314
                 list(, $r) = $this->divide($prime);
3320 3315
                 if ($r->equals($zero)) {
@@ -3338,7 +3333,7 @@  discard block
 block discarded – undo
3338 3333
         $r = $n_1->copy();
3339 3334
         $r_value = $r->value;
3340 3335
         // ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s));
3341
-        if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
3336
+        if (MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH) {
3342 3337
             $s = 0;
3343 3338
             // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals($one) check earlier
3344 3339
             while ($r->value[strlen($r->value) - 1] % 2 == 0) {
@@ -3387,7 +3382,7 @@  discard block
 block discarded – undo
3387 3382
      */
3388 3383
     function _lshift($shift)
3389 3384
     {
3390
-        if ( $shift == 0 ) {
3385
+        if ($shift == 0) {
3391 3386
             return;
3392 3387
         }
3393 3388
 
@@ -3403,7 +3398,7 @@  discard block
 block discarded – undo
3403 3398
             $this->value[$i] = (int) ($temp - $carry * MATH_BIGINTEGER_BASE_FULL);
3404 3399
         }
3405 3400
 
3406
-        if ( $carry ) {
3401
+        if ($carry) {
3407 3402
             $this->value[] = $carry;
3408 3403
         }
3409 3404
 
@@ -3431,7 +3426,7 @@  discard block
 block discarded – undo
3431 3426
         $carry_shift = MATH_BIGINTEGER_BASE - $shift;
3432 3427
         $carry_mask = (1 << $shift) - 1;
3433 3428
 
3434
-        if ( $num_digits ) {
3429
+        if ($num_digits) {
3435 3430
             $this->value = array_slice($this->value, $num_digits);
3436 3431
         }
3437 3432
 
@@ -3461,7 +3456,7 @@  discard block
 block discarded – undo
3461 3456
         $result->precision = $this->precision;
3462 3457
         $result->bitmask = $this->bitmask;
3463 3458
 
3464
-        switch ( MATH_BIGINTEGER_MODE ) {
3459
+        switch (MATH_BIGINTEGER_MODE) {
3465 3460
             case MATH_BIGINTEGER_MODE_GMP:
3466 3461
                 if (!empty($result->bitmask->value)) {
3467 3462
                     $result->value = gmp_and($result->value, $result->bitmask->value);
@@ -3478,7 +3473,7 @@  discard block
 block discarded – undo
3478 3473
 
3479 3474
         $value = &$result->value;
3480 3475
 
3481
-        if ( !count($value) ) {
3476
+        if (!count($value)) {
3482 3477
             return $result;
3483 3478
         }
3484 3479
 
@@ -3508,7 +3503,7 @@  discard block
 block discarded – undo
3508 3503
     function _trim($value)
3509 3504
     {
3510 3505
         for ($i = count($value) - 1; $i >= 0; --$i) {
3511
-            if ( $value[$i] ) {
3506
+            if ($value[$i]) {
3512 3507
                 break;
3513 3508
             }
3514 3509
             unset($value[$i]);
@@ -3556,7 +3551,7 @@  discard block
 block discarded – undo
3556 3551
             $carry = $temp >> 8;
3557 3552
         }
3558 3553
         $carry = ($carry != 0) ? chr($carry) : '';
3559
-        $x = $carry . $x . str_repeat(chr(0), $num_bytes);
3554
+        $x = $carry.$x.str_repeat(chr(0), $num_bytes);
3560 3555
     }
3561 3556
 
3562 3557
     /**
@@ -3595,7 +3590,7 @@  discard block
 block discarded – undo
3595 3590
         }
3596 3591
         $x = ltrim($x, chr(0));
3597 3592
 
3598
-        $remainder = chr($carry >> $carry_shift) . $remainder;
3593
+        $remainder = chr($carry >> $carry_shift).$remainder;
3599 3594
 
3600 3595
         return ltrim($remainder, chr(0));
3601 3596
     }
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Net/SCP.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,6 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * Connects to an SSH server
119 119
      *
120
-     * @param String $host
121 120
      * @param optional Integer $port
122 121
      * @param optional Integer $timeout
123 122
      * @return Net_SCP
@@ -161,7 +160,7 @@  discard block
 block discarded – undo
161 160
      * @param String $remote_file
162 161
      * @param String $data
163 162
      * @param optional Integer $mode
164
-     * @return Boolean
163
+     * @return false|null
165 164
      * @access public
166 165
      */
167 166
     function put($remote_file, $data, $mode = NET_SCP_STRING)
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
      *
219 218
      * @param String $remote_file
220 219
      * @param optional String $local_file
221
-     * @return Mixed
220
+     * @return boolean|string
222 221
      * @access public
223 222
      */
224 223
     function get($remote_file, $local_file = false)
Please login to merge, or discard this patch.
Indentation   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@  discard block
 block discarded – undo
18 18
  *    if (!$ssh->login('username', 'password')) {
19 19
  *        exit('bad login');
20 20
  *    }
21
-
22 21
  *    $scp = new Net_SCP($ssh);
23 22
  *    $scp->put('abcd', str_repeat('x', 1024*1024));
24 23
  * ?>
@@ -284,7 +283,7 @@  discard block
 block discarded – undo
284 283
             case NET_SCP_SSH1:
285 284
                 $data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($data), $data);
286 285
                 $this->ssh->_send_binary_packet($data);
287
-         }
286
+            }
288 287
     }
289 288
 
290 289
     /**
@@ -320,7 +319,7 @@  discard block
 block discarded – undo
320 319
                             return false;
321 320
                     }
322 321
                 }
323
-         }
322
+            }
324 323
     }
325 324
 
326 325
     /**
@@ -336,6 +335,6 @@  discard block
 block discarded – undo
336 335
                 break;
337 336
             case NET_SCP_SSH1:
338 337
                 $this->ssh->disconnect();
339
-         }
338
+            }
340 339
     }
341 340
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 /**
62 62
  * Reads data from a string.
63 63
  */
64
-define('NET_SCP_STRING',  2);
64
+define('NET_SCP_STRING', 2);
65 65
 /**#@-*/
66 66
 
67 67
 /**#@+
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 /**
77 77
  * SSH2 is being used.
78 78
  */
79
-define('NET_SCP_SSH2',  2);
79
+define('NET_SCP_SSH2', 2);
80 80
 /**#@-*/
81 81
 
82 82
 /**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             return false;
171 171
         }
172 172
 
173
-        $this->ssh->exec('scp -t ' . $remote_file, false); // -t = to
173
+        $this->ssh->exec('scp -t '.$remote_file, false); // -t = to
174 174
 
175 175
         $temp = $this->_receive();
176 176
         if ($temp !== chr(0)) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         $remote_file = basename($remote_file);
185
-        $this->_send('C0644 ' . strlen($data) . ' ' . $remote_file . "\n");
185
+        $this->_send('C0644 '.strlen($data).' '.$remote_file."\n");
186 186
 
187 187
         $temp = $this->_receive();
188 188
         if ($temp !== chr(0)) {
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             return false;
228 228
         }
229 229
 
230
-        $this->ssh->exec('scp -f ' . $remote_file, false); // -f = from
230
+        $this->ssh->exec('scp -f '.$remote_file, false); // -f = from
231 231
 
232 232
         $this->_send("\0");
233 233
 
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
         while ($size < $info['size']) {
251 251
             $data = $this->_receive();
252 252
             // SCP usually seems to split stuff out into 16k chunks
253
-            $size+= strlen($data);
253
+            $size += strlen($data);
254 254
 
255 255
             if ($local_file === false) {
256
-                $content.= $data;
256
+                $content .= $data;
257 257
             } else {
258 258
                 fputs($fp, $data);
259 259
             }
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Net/SFTP.php 3 patches
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
     /**
511 511
      * Returns the current directory name
512 512
      *
513
-     * @return Mixed
513
+     * @return string
514 514
      * @access public
515 515
      */
516 516
     function pwd()
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
      *
550 550
      * @see Net_SFTP::chdir()
551 551
      * @param String $path
552
-     * @return Mixed
552
+     * @return false|string
553 553
      * @access private
554 554
      */
555 555
     function _realpath($path)
@@ -1374,6 +1374,7 @@  discard block
 block discarded – undo
1374 1374
      * Helper function for directory creation
1375 1375
      *
1376 1376
      * @param String $dir
1377
+     * @param string $attr
1377 1378
      * @return Boolean
1378 1379
      * @access private
1379 1380
      */
@@ -1626,7 +1627,7 @@  discard block
 block discarded – undo
1626 1627
      * @param optional String $local_file
1627 1628
      * @param optional Integer $offset
1628 1629
      * @param optional Integer $length
1629
-     * @return Mixed
1630
+     * @return string|boolean
1630 1631
      * @access public
1631 1632
      */
1632 1633
     function get($remote_file, $local_file = false, $offset = 0, $length = -1)
@@ -2212,7 +2213,7 @@  discard block
 block discarded – undo
2212 2213
      * Disconnect
2213 2214
      *
2214 2215
      * @param Integer $reason
2215
-     * @return Boolean
2216
+     * @return boolean|null
2216 2217
      * @access private
2217 2218
      */
2218 2219
     function _disconnect($reason)
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
         if ($response === false) {
414 414
             // from PuTTY's psftp.exe
415 415
             $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" .
416
-                       "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" .
417
-                       "exec sftp-server";
416
+                        "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" .
417
+                        "exec sftp-server";
418 418
             // we don't do $this->exec($command, false) because exec() operates on a different channel and plus the SSH_MSG_CHANNEL_OPEN that exec() does
419 419
             // is redundant
420 420
             $packet = pack('CNNa*CNa*',
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
         if (defined('NET_SFTP_LOGGING')) {
2057 2057
             $packet_type = '-> ' . $this->packet_types[$type] . 
2058
-                           ' (' . round($stop - $start, 4) . 's)';
2058
+                            ' (' . round($stop - $start, 4) . 's)';
2059 2059
             if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
2060 2060
                 echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n";
2061 2061
                 flush();
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 
2132 2132
         if (defined('NET_SFTP_LOGGING')) {
2133 2133
             $packet_type = '<- ' . $this->packet_types[$this->packet_type] . 
2134
-                           ' (' . round($stop - $start, 4) . 's)';
2134
+                            ' (' . round($stop - $start, 4) . 's)';
2135 2135
             if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
2136 2136
                 echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n";
2137 2137
                 flush();
Please login to merge, or discard this patch.
Spacing   +39 added lines, -42 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 /**
69 69
  * Returns the message numbers
70 70
  */
71
-define('NET_SFTP_LOG_SIMPLE',  NET_SSH2_LOG_SIMPLE);
71
+define('NET_SFTP_LOG_SIMPLE', NET_SSH2_LOG_SIMPLE);
72 72
 /**
73 73
  * Returns the message content
74 74
  */
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
  * Reads data from a string.
103 103
  */
104 104
 // this value isn't really used anymore but i'm keeping it reserved for historical reasons
105
-define('NET_SFTP_STRING',  2);
105
+define('NET_SFTP_STRING', 2);
106 106
 /**
107 107
  * Resumes an upload
108 108
  */
109
-define('NET_SFTP_RESUME',  4);
109
+define('NET_SFTP_RESUME', 4);
110 110
 /**#@-*/
111 111
 
112 112
 /**
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
         $response = $this->_get_channel_packet(NET_SFTP_CHANNEL);
413 413
         if ($response === false) {
414 414
             // from PuTTY's psftp.exe
415
-            $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" .
416
-                       "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" .
415
+            $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n".
416
+                       "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n".
417 417
                        "exec sftp-server";
418 418
             // we don't do $this->exec($command, false) because exec() operates on a different channel and plus the SSH_MSG_CHANNEL_OPEN that exec() does
419 419
             // is redundant
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 
536 536
         if ($this->version > 2) {
537 537
             extract(unpack('Nlength', $this->_string_shift($response, 4)));
538
-            $this->sftp_errors[] = $error . ': ' . $this->_string_shift($response, $length);
538
+            $this->sftp_errors[] = $error.': '.$this->_string_shift($response, $length);
539 539
         } else {
540 540
             $this->sftp_errors[] = $error;
541 541
         }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         }
580 580
 
581 581
         if ($path[0] != '/') {
582
-            $path = $this->pwd . '/' . $path;
582
+            $path = $this->pwd.'/'.$path;
583 583
         }
584 584
 
585 585
         $path = explode('/', $path);
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             }
599 599
         }
600 600
 
601
-        return '/' . implode('/', $new);
601
+        return '/'.implode('/', $new);
602 602
     }
603 603
 
604 604
     /**
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
         }
616 616
 
617 617
         if ($dir[strlen($dir) - 1] != '/') {
618
-            $dir.= '/';
618
+            $dir .= '/';
619 619
         }
620 620
 
621 621
         $dir = $this->_realpath($dir);
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
             return false;
714 714
         }
715 715
 
716
-        $dir = $this->_realpath($dir . '/');
716
+        $dir = $this->_realpath($dir.'/');
717 717
         if ($dir === false) {
718 718
             return false;
719 719
         }
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                         }
775 775
 
776 776
                         if (isset($attributes['type']) && $attributes['type'] == NET_SFTP_TYPE_DIRECTORY && ($shortname != '.' && $shortname != '..')) {
777
-                            $this->_save_dir($dir . '/' . $shortname);
777
+                            $this->_save_dir($dir.'/'.$shortname);
778 778
                         }
779 779
                         // SFTPv6 has an optional boolean end-of-list field, but we'll ignore that, since the
780 780
                         // final SSH_FXP_STATUS packet should tell us that, already.
@@ -933,8 +933,7 @@  discard block
 block discarded – undo
933 933
 
934 934
         $pwd = $this->pwd;
935 935
         $stat['type'] = $this->chdir($filename) ?
936
-            NET_SFTP_TYPE_DIRECTORY :
937
-            NET_SFTP_TYPE_REGULAR;
936
+            NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR;
938 937
         $this->pwd = $pwd;
939 938
 
940 939
         return $stat;
@@ -976,8 +975,7 @@  discard block
 block discarded – undo
976 975
 
977 976
         $pwd = $this->pwd;
978 977
         $lstat['type'] = $this->chdir($filename) ?
979
-            NET_SFTP_TYPE_DIRECTORY :
980
-            NET_SFTP_TYPE_REGULAR;
978
+            NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR;
981 979
         $this->pwd = $pwd;
982 980
 
983 981
         return $lstat;
@@ -1298,7 +1296,7 @@  discard block
 block discarded – undo
1298 1296
                 return false;
1299 1297
             }
1300 1298
 
1301
-            $temp = $path . '/' . $filename;
1299
+            $temp = $path.'/'.$filename;
1302 1300
             if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) {
1303 1301
                 if (!$this->_setstat_recursive($temp, $attr, $i)) {
1304 1302
                     return false;
@@ -1357,7 +1355,7 @@  discard block
 block discarded – undo
1357 1355
             $dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir));
1358 1356
             if (empty($dirs[0])) {
1359 1357
                 array_shift($dirs);
1360
-                $dirs[0] = '/' . $dirs[0];
1358
+                $dirs[0] = '/'.$dirs[0];
1361 1359
             }
1362 1360
             for ($i = 0; $i < count($dirs); $i++) {
1363 1361
                 $temp = array_slice($dirs, 0, $i + 1);
@@ -1492,7 +1490,7 @@  discard block
 block discarded – undo
1492 1490
                 $offset = $size !== false ? $size : 0;
1493 1491
             }
1494 1492
         } else {
1495
-            $flags|= NET_SFTP_OPEN_TRUNCATE;
1493
+            $flags |= NET_SFTP_OPEN_TRUNCATE;
1496 1494
         }
1497 1495
         // --------------
1498 1496
 
@@ -1544,7 +1542,7 @@  discard block
 block discarded – undo
1544 1542
                 fclose($fp);
1545 1543
                 return false;
1546 1544
             }
1547
-            $sent+= strlen($temp);
1545
+            $sent += strlen($temp);
1548 1546
 
1549 1547
             $i++;
1550 1548
 
@@ -1681,9 +1679,9 @@  discard block
 block discarded – undo
1681 1679
             switch ($this->packet_type) {
1682 1680
                 case NET_SFTP_DATA:
1683 1681
                     $temp = substr($response, 4);
1684
-                    $offset+= strlen($temp);
1682
+                    $offset += strlen($temp);
1685 1683
                     if ($local_file === false) {
1686
-                        $content.= $temp;
1684
+                        $content .= $temp;
1687 1685
                     } else {
1688 1686
                         fputs($fp, $temp);
1689 1687
                     }
@@ -1820,7 +1818,7 @@  discard block
 block discarded – undo
1820 1818
                 return false;
1821 1819
             }
1822 1820
 
1823
-            $temp = $path . '/' . $filename;
1821
+            $temp = $path.'/'.$filename;
1824 1822
             if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) {
1825 1823
                 if (!$this->_delete_recursive($temp, $i)) {
1826 1824
                     return false;
@@ -1924,23 +1922,23 @@  discard block
 block discarded – undo
1924 1922
                     // 4GB as being 4GB.
1925 1923
                     extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
1926 1924
                     $attr['size'] = $upper ? 0x100000000 * $upper : 0;
1927
-                    $attr['size']+= $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
1925
+                    $attr['size'] += $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
1928 1926
                     break;
1929 1927
                 case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only)
1930
-                    $attr+= unpack('Nuid/Ngid', $this->_string_shift($response, 8));
1928
+                    $attr += unpack('Nuid/Ngid', $this->_string_shift($response, 8));
1931 1929
                     break;
1932 1930
                 case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004
1933
-                    $attr+= unpack('Npermissions', $this->_string_shift($response, 4));
1931
+                    $attr += unpack('Npermissions', $this->_string_shift($response, 4));
1934 1932
                     // mode == permissions; permissions was the original array key and is retained for bc purposes.
1935 1933
                     // mode was added because that's the more industry standard terminology
1936
-                    $attr+= array('mode' => $attr['permissions']);
1934
+                    $attr += array('mode' => $attr['permissions']);
1937 1935
                     $fileType = $this->_parseMode($attr['permissions']);
1938 1936
                     if ($fileType !== false) {
1939
-                        $attr+= array('type' => $fileType);
1937
+                        $attr += array('type' => $fileType);
1940 1938
                     }
1941 1939
                     break;
1942 1940
                 case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008
1943
-                    $attr+= unpack('Natime/Nmtime', $this->_string_shift($response, 8));
1941
+                    $attr += unpack('Natime/Nmtime', $this->_string_shift($response, 8));
1944 1942
                     break;
1945 1943
                 case NET_SFTP_ATTR_EXTENDED: // 0x80000000
1946 1944
                     extract(unpack('Ncount', $this->_string_shift($response, 4)));
@@ -2046,18 +2044,17 @@  discard block
 block discarded – undo
2046 2044
     function _send_sftp_packet($type, $data)
2047 2045
     {
2048 2046
         $packet = $this->request_id !== false ?
2049
-            pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) :
2050
-            pack('NCa*',  strlen($data) + 1, $type, $data);
2047
+            pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data);
2051 2048
 
2052 2049
         $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
2053 2050
         $result = $this->_send_channel_packet(NET_SFTP_CHANNEL, $packet);
2054 2051
         $stop = strtok(microtime(), ' ') + strtok('');
2055 2052
 
2056 2053
         if (defined('NET_SFTP_LOGGING')) {
2057
-            $packet_type = '-> ' . $this->packet_types[$type] . 
2058
-                           ' (' . round($stop - $start, 4) . 's)';
2054
+            $packet_type = '-> '.$this->packet_types[$type]. 
2055
+                           ' ('.round($stop - $start, 4).'s)';
2059 2056
             if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
2060
-                echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n";
2057
+                echo "<pre>\r\n".$this->_format_log(array($data), array($packet_type))."\r\n</pre>\r\n";
2061 2058
                 flush();
2062 2059
                 ob_flush();
2063 2060
             } else {
@@ -2098,11 +2095,11 @@  discard block
 block discarded – undo
2098 2095
                 $this->packet_buffer = '';
2099 2096
                 return false;
2100 2097
             }
2101
-            $this->packet_buffer.= $temp;
2098
+            $this->packet_buffer .= $temp;
2102 2099
         }
2103 2100
         extract(unpack('Nlength', $this->_string_shift($this->packet_buffer, 4)));
2104 2101
         $tempLength = $length;
2105
-        $tempLength-= strlen($this->packet_buffer);
2102
+        $tempLength -= strlen($this->packet_buffer);
2106 2103
 
2107 2104
         // SFTP packet type and data payload
2108 2105
         while ($tempLength > 0) {
@@ -2112,8 +2109,8 @@  discard block
 block discarded – undo
2112 2109
                 $this->packet_buffer = '';
2113 2110
                 return false;
2114 2111
             }
2115
-            $this->packet_buffer.= $temp;
2116
-            $tempLength-= strlen($temp);
2112
+            $this->packet_buffer .= $temp;
2113
+            $tempLength -= strlen($temp);
2117 2114
         }
2118 2115
 
2119 2116
         $stop = strtok(microtime(), ' ') + strtok('');
@@ -2122,18 +2119,18 @@  discard block
 block discarded – undo
2122 2119
 
2123 2120
         if ($this->request_id !== false) {
2124 2121
             $this->_string_shift($this->packet_buffer, 4); // remove the request id
2125
-            $length-= 5; // account for the request id and the packet type
2122
+            $length -= 5; // account for the request id and the packet type
2126 2123
         } else {
2127
-            $length-= 1; // account for the packet type
2124
+            $length -= 1; // account for the packet type
2128 2125
         }
2129 2126
 
2130 2127
         $packet = $this->_string_shift($this->packet_buffer, $length);
2131 2128
 
2132 2129
         if (defined('NET_SFTP_LOGGING')) {
2133
-            $packet_type = '<- ' . $this->packet_types[$this->packet_type] . 
2134
-                           ' (' . round($stop - $start, 4) . 's)';
2130
+            $packet_type = '<- '.$this->packet_types[$this->packet_type]. 
2131
+                           ' ('.round($stop - $start, 4).'s)';
2135 2132
             if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
2136
-                echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n";
2133
+                echo "<pre>\r\n".$this->_format_log(array($packet), array($packet_type))."\r\n</pre>\r\n";
2137 2134
                 flush();
2138 2135
                 ob_flush();
2139 2136
             } else {
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Net/SFTP/Stream.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -593,7 +593,6 @@
 block discarded – undo
593 593
      * $options. What does 8 correspond to?
594 594
      *
595 595
      * @param String $path
596
-     * @param Integer $mode
597 596
      * @param Integer $options
598 597
      * @return Boolean
599 598
      * @access public
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $this->eof = true;
310 310
             return false;
311 311
         }
312
-        $this->pos+= strlen($result);
312
+        $this->pos += strlen($result);
313 313
 
314 314
         return $result;
315 315
     }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         if ($result === false) {
342 342
             return false;
343 343
         }
344
-        $this->pos+= strlen($data);
344
+        $this->pos += strlen($data);
345 345
         if ($this->pos > $this->size) {
346 346
             $this->size = $this->pos;
347 347
         }
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
                 }
396 396
                 break;
397 397
             case SEEK_CUR:
398
-                $offset+= $this->pos;
398
+                $offset += $this->pos;
399 399
                 break;
400 400
             case SEEK_END:
401
-                $offset+= $this->size;
401
+                $offset += $this->size;
402 402
         }
403 403
 
404 404
         $this->pos = $offset;
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
     function __call($name, $arguments)
744 744
     {
745 745
         if (defined('NET_SFTP_STREAM_LOGGING')) {
746
-            echo $name . '(';
746
+            echo $name.'(';
747 747
             $last = count($arguments) - 1;
748 748
             foreach ($arguments as $i => $argument) {
749 749
                 var_export($argument);
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             }
754 754
             echo ")\r\n";
755 755
         }
756
-        $name = '_' . $name;
756
+        $name = '_'.$name;
757 757
         if (!method_exists($this, $name)) {
758 758
             return false;
759 759
         }
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Net/SSH1.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
      * @see Net_SSH1::interactiveRead()
733 733
      * @see Net_SSH1::interactiveWrite()
734 734
      * @param String $cmd
735
-     * @return mixed
735
+     * @return boolean|string
736 736
      * @access public
737 737
      */
738 738
     function exec($cmd, $block = true)
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
      *
1246 1246
      * @see Net_SSH1::Net_SSH1()
1247 1247
      * @param Math_BigInteger $m
1248
-     * @param Array $key
1249
-     * @return Math_BigInteger
1248
+     * @param Math_BigInteger[] $key
1249
+     * @return string
1250 1250
      * @access private
1251 1251
      */
1252 1252
     function _rsa_crypt($m, $key)
@@ -1298,7 +1298,6 @@  discard block
 block discarded – undo
1298 1298
      * named constants from it, using the value as the name of the constant and the index as the value of the constant.
1299 1299
      * If any of the constants that would be defined already exists, none of the constants will be defined.
1300 1300
      *
1301
-     * @param Array $array
1302 1301
      * @access private
1303 1302
      */
1304 1303
     function _define_array()
@@ -1491,8 +1490,9 @@  discard block
 block discarded – undo
1491 1490
      *
1492 1491
      * Makes sure that only the last 1MB worth of packets will be logged
1493 1492
      *
1494
-     * @param String $data
1495 1493
      * @access private
1494
+     * @param string $protocol_flags
1495
+     * @param string $message
1496 1496
      */
1497 1497
     function _append_log($protocol_flags, $message)
1498 1498
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1364,12 +1364,12 @@
 block discarded – undo
1364 1364
                 }
1365 1365
                 $fragment = $this->_string_shift($current_log, $short_width);
1366 1366
                 $hex = substr(
1367
-                           preg_replace(
1368
-                               '#(.)#es',
1369
-                               '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
1370
-                               $fragment),
1371
-                           strlen($boundary)
1372
-                       );
1367
+                            preg_replace(
1368
+                                '#(.)#es',
1369
+                                '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
1370
+                                $fragment),
1371
+                            strlen($boundary)
1372
+                        );
1373 1373
                 // replace non ASCII printable characters with dots
1374 1374
                 // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
1375 1375
                 // also replace < with a . since < messes up the output on web browsers
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -76,23 +76,23 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * Not supported.
78 78
  */
79
-define('NET_SSH1_CIPHER_NONE',       0);
79
+define('NET_SSH1_CIPHER_NONE', 0);
80 80
 /**
81 81
  * IDEA in CFB mode
82 82
  *
83 83
  * Not supported.
84 84
  */
85
-define('NET_SSH1_CIPHER_IDEA',       1);
85
+define('NET_SSH1_CIPHER_IDEA', 1);
86 86
 /**
87 87
  * DES in CBC mode
88 88
  */
89
-define('NET_SSH1_CIPHER_DES',        2);
89
+define('NET_SSH1_CIPHER_DES', 2);
90 90
 /**
91 91
  * Triple-DES in CBC mode
92 92
  *
93 93
  * All implementations are required to support this
94 94
  */
95
-define('NET_SSH1_CIPHER_3DES',       3);
95
+define('NET_SSH1_CIPHER_3DES', 3);
96 96
 /**
97 97
  * TRI's Simple Stream encryption CBC
98 98
  *
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
  *     This library currently only supports encryption when the same key is being used for both directions.  This is
116 116
  *     because there's only one $crypto object.  Two could be added ($encrypt and $decrypt, perhaps).
117 117
  */
118
-define('NET_SSH1_CIPHER_RC4',        5);
118
+define('NET_SSH1_CIPHER_RC4', 5);
119 119
 /**
120 120
  * Blowfish
121 121
  *
122 122
  * Not supported nor is it defined in the official SSH1 specs.  OpenSSH, however, defines it (see cipher.h) and
123 123
  * uses it (see cipher.c)
124 124
  */
125
-define('NET_SSH1_CIPHER_BLOWFISH',   6);
125
+define('NET_SSH1_CIPHER_BLOWFISH', 6);
126 126
 /**#@-*/
127 127
 
128 128
 /**#@+
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 /**
135 135
  * .rhosts or /etc/hosts.equiv
136 136
  */
137
-define('NET_SSH1_AUTH_RHOSTS',     1);
137
+define('NET_SSH1_AUTH_RHOSTS', 1);
138 138
 /**
139 139
  * pure RSA authentication
140 140
  */
141
-define('NET_SSH1_AUTH_RSA',        2);
141
+define('NET_SSH1_AUTH_RSA', 2);
142 142
 /**
143 143
  * password authentication
144 144
  *
145 145
  * This is the only method that is supported by this library.
146 146
  */
147
-define('NET_SSH1_AUTH_PASSWORD',   3);
147
+define('NET_SSH1_AUTH_PASSWORD', 3);
148 148
 /**
149 149
  * .rhosts with RSA host authentication
150 150
  */
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  * @link http://3sp.com/content/developer/maverick-net/docs/Maverick.SSH.PseudoTerminalModesMembers.html
158 158
  * @access private
159 159
  */
160
-define('NET_SSH1_TTY_OP_END',  0);
160
+define('NET_SSH1_TTY_OP_END', 0);
161 161
 /**#@-*/
162 162
 
163 163
 /**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
  * @access private
184 184
  */
185 185
 define('NET_SSH1_MASK_CONSTRUCTOR', 0x00000001);
186
-define('NET_SSH1_MASK_LOGIN',       0x00000002);
187
-define('NET_SSH1_MASK_SHELL',       0x00000004);
186
+define('NET_SSH1_MASK_LOGIN', 0x00000002);
187
+define('NET_SSH1_MASK_SHELL', 0x00000004);
188 188
 /**#@-*/
189 189
 
190 190
 /**#@+
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 /**
195 195
  * Returns the message numbers
196 196
  */
197
-define('NET_SSH1_LOG_SIMPLE',  1);
197
+define('NET_SSH1_LOG_SIMPLE', 1);
198 198
 /**
199 199
  * Returns the message content
200 200
  */
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 /**
217 217
  * Returns when a string matching $expect exactly is found
218 218
  */
219
-define('NET_SSH1_READ_SIMPLE',  1);
219
+define('NET_SSH1_READ_SIMPLE', 1);
220 220
 /**
221 221
  * Returns when a string matching the regular expression $expect is found
222 222
  */
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 
493 493
         if (defined('NET_SSH1_LOGGING')) {
494 494
             $this->_append_log('<-', $this->server_identification);
495
-            $this->_append_log('->', $this->identifier . "\r\n");
495
+            $this->_append_log('->', $this->identifier."\r\n");
496 496
         }
497 497
 
498 498
         if (!preg_match('#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
             }
553 553
         }
554 554
 
555
-        $session_id = pack('H*', md5($host_key_public_modulus->toBytes() . $server_key_public_modulus->toBytes() . $anti_spoofing_cookie));
555
+        $session_id = pack('H*', md5($host_key_public_modulus->toBytes().$server_key_public_modulus->toBytes().$anti_spoofing_cookie));
556 556
 
557 557
         $session_key = crypt_random_string(32);
558 558
         $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0));
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                 $this->crypto = new Crypt_DES();
609 609
                 $this->crypto->disablePadding();
610 610
                 $this->crypto->enableContinuousBuffer();
611
-                $this->crypto->setKey(substr($session_key, 0,  8));
611
+                $this->crypto->setKey(substr($session_key, 0, 8));
612 612
                 break;
613 613
             case NET_SSH1_CIPHER_3DES:
614 614
                 if (!class_exists('Crypt_TripleDES')) {
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 
759 759
         if ($response !== false) {
760 760
             do {
761
-                $output.= substr($response[NET_SSH1_RESPONSE_DATA], 4);
761
+                $output .= substr($response[NET_SSH1_RESPONSE_DATA], 4);
762 762
                 $response = $this->_get_binary_packet();
763 763
             } while (is_array($response) && $response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_EXITSTATUS);
764 764
         }
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
             if ($response === true) {
873 873
                 return $this->_string_shift($this->interactiveBuffer, strlen($this->interactiveBuffer));
874 874
             }
875
-            $this->interactiveBuffer.= substr($response[NET_SSH1_RESPONSE_DATA], 4);
875
+            $this->interactiveBuffer .= substr($response[NET_SSH1_RESPONSE_DATA], 4);
876 876
         }
877 877
     }
878 878
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
                 return true;
1029 1029
             }
1030 1030
             $elapsed = strtok(microtime(), ' ') + strtok('') - $start;
1031
-            $this->curTimeout-= $elapsed;
1031
+            $this->curTimeout -= $elapsed;
1032 1032
         }
1033 1033
 
1034 1034
         $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
@@ -1039,8 +1039,8 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
         while ($length > 0) {
1041 1041
             $temp = fread($this->fsock, $length);
1042
-            $raw.= $temp;
1043
-            $length-= strlen($temp);
1042
+            $raw .= $temp;
1043
+            $length -= strlen($temp);
1044 1044
         }
1045 1045
         $stop = strtok(microtime(), ' ') + strtok('');
1046 1046
 
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
         if (defined('NET_SSH1_LOGGING')) {
1065 1065
             $temp = isset($this->protocol_flags[$type]) ? $this->protocol_flags[$type] : 'UNKNOWN';
1066
-            $temp = '<- ' . $temp .
1067
-                    ' (' . round($stop - $start, 4) . 's)';
1066
+            $temp = '<- '.$temp.
1067
+                    ' ('.round($stop - $start, 4).'s)';
1068 1068
             $this->_append_log($temp, $data);
1069 1069
         }
1070 1070
 
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
         $padding = crypt_random_string(8 - ($length & 7));
1097 1097
 
1098 1098
         $orig = $data;
1099
-        $data = $padding . $data;
1100
-        $data.= pack('N', $this->_crc($data));
1099
+        $data = $padding.$data;
1100
+        $data .= pack('N', $this->_crc($data));
1101 1101
 
1102 1102
         if ($this->crypto !== false) {
1103 1103
             $data = $this->crypto->encrypt($data);
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
         if (defined('NET_SSH1_LOGGING')) {
1113 1113
             $temp = isset($this->protocol_flags[ord($orig[0])]) ? $this->protocol_flags[ord($orig[0])] : 'UNKNOWN';
1114
-            $temp = '-> ' . $temp .
1115
-                    ' (' . round($stop - $start, 4) . 's)';
1114
+            $temp = '-> '.$temp.
1115
+                    ' ('.round($stop - $start, 4).'s)';
1116 1116
             $this->_append_log($temp, $orig);
1117 1117
         }
1118 1118
 
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
         $crc = 0x00000000;
1207 1207
         $length = strlen($data);
1208 1208
 
1209
-        for ($i=0;$i<$length;$i++) {
1209
+        for ($i = 0; $i < $length; $i++) {
1210 1210
             // We AND $crc >> 8 with 0x00FFFFFF because we want the eight newly added bits to all
1211 1211
             // be zero.  PHP, unfortunately, doesn't always do this.  0x80000000 >> 8, as an example,
1212 1212
             // yields 0xFF800000 - not 0x00800000.  The following link elaborates:
@@ -1281,9 +1281,9 @@  discard block
 block discarded – undo
1281 1281
         while (strlen($random) != $length) {
1282 1282
             $block = crypt_random_string($length - strlen($random));
1283 1283
             $block = str_replace("\x00", '', $block);
1284
-            $random.= $block;
1284
+            $random .= $block;
1285 1285
         }
1286
-        $temp = chr(0) . chr(2) . $random . chr(0) . $m;
1286
+        $temp = chr(0).chr(2).$random.chr(0).$m;
1287 1287
 
1288 1288
         $m = new Math_BigInteger($temp, 256);
1289 1289
         $m = $m->modPow($key[0], $key[1]);
@@ -1355,18 +1355,18 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
         $output = '';
1357 1357
         for ($i = 0; $i < count($message_log); $i++) {
1358
-            $output.= $message_number_log[$i] . "\r\n";
1358
+            $output .= $message_number_log[$i]."\r\n";
1359 1359
             $current_log = $message_log[$i];
1360 1360
             $j = 0;
1361 1361
             do {
1362 1362
                 if (strlen($current_log)) {
1363
-                    $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0  ';
1363
+                    $output .= str_pad(dechex($j), 7, '0', STR_PAD_LEFT).'0  ';
1364 1364
                 }
1365 1365
                 $fragment = $this->_string_shift($current_log, $short_width);
1366 1366
                 $hex = substr(
1367 1367
                            preg_replace(
1368 1368
                                '#(.)#es',
1369
-                               '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
1369
+                               '"'.$boundary.'" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
1370 1370
                                $fragment),
1371 1371
                            strlen($boundary)
1372 1372
                        );
@@ -1374,10 +1374,10 @@  discard block
 block discarded – undo
1374 1374
                 // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
1375 1375
                 // also replace < with a . since < messes up the output on web browsers
1376 1376
                 $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment);
1377
-                $output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n";
1377
+                $output .= str_pad($hex, $long_width - $short_width, ' ').$raw."\r\n";
1378 1378
                 $j++;
1379 1379
             } while (strlen($current_log));
1380
-            $output.= "\r\n";
1380
+            $output .= "\r\n";
1381 1381
         }
1382 1382
 
1383 1383
         return $output;
@@ -1505,10 +1505,10 @@  discard block
 block discarded – undo
1505 1505
                 case NET_SSH1_LOG_COMPLEX:
1506 1506
                     $this->protocol_flags_log[] = $protocol_flags;
1507 1507
                     $this->_string_shift($message);
1508
-                    $this->log_size+= strlen($message);
1508
+                    $this->log_size += strlen($message);
1509 1509
                     $this->message_log[] = $message;
1510 1510
                     while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) {
1511
-                        $this->log_size-= strlen(array_shift($this->message_log));
1511
+                        $this->log_size -= strlen(array_shift($this->message_log));
1512 1512
                         array_shift($this->protocol_flags_log);
1513 1513
                     }
1514 1514
                     break;
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                 // passwords won't be filtered out and select other packets may not be correctly
1517 1517
                 // identified
1518 1518
                 case NET_SSH1_LOG_REALTIME:
1519
-                    echo "<pre>\r\n" . $this->_format_log(array($message), array($protocol_flags)) . "\r\n</pre>\r\n";
1519
+                    echo "<pre>\r\n".$this->_format_log(array($message), array($protocol_flags))."\r\n</pre>\r\n";
1520 1520
                     @flush();
1521 1521
                     @ob_flush();
1522 1522
                     break;
@@ -1537,10 +1537,10 @@  discard block
 block discarded – undo
1537 1537
                     $entry = $this->_format_log(array($message), array($protocol_flags));
1538 1538
                     if ($this->realtime_log_wrap) {
1539 1539
                         $temp = "<<< START >>>\r\n";
1540
-                        $entry.= $temp;
1540
+                        $entry .= $temp;
1541 1541
                         fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp));
1542 1542
                     }
1543
-                    $this->realtime_log_size+= strlen($entry);
1543
+                    $this->realtime_log_size += strlen($entry);
1544 1544
                     if ($this->realtime_log_size > NET_SSH1_LOG_MAX_SIZE) {
1545 1545
                         fseek($this->realtime_log_file, 0);
1546 1546
                         $this->realtime_log_size = strlen($entry);
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Net/SSH2.php 3 patches
Doc Comments   +10 added lines, -13 removed lines patch added patch discarded remove patch
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
      * @param String $host
736 736
      * @param optional Integer $port
737 737
      * @param optional Integer $timeout
738
-     * @return Net_SSH2
738
+     * @return null|false
739 739
      * @access public
740 740
      */
741 741
     function Net_SSH2($host, $port = 22, $timeout = 10)
@@ -1588,9 +1588,7 @@  discard block
 block discarded – undo
1588 1588
      * The $password parameter can be a plaintext password, a Crypt_RSA object or an array
1589 1589
      *
1590 1590
      * @param String $username
1591
-     * @param Mixed $password
1592
-     * @param Mixed $...
1593
-     * @return Boolean
1591
+     * @return boolean|null
1594 1592
      * @see _login_helper
1595 1593
      * @access public
1596 1594
      */
@@ -1614,7 +1612,7 @@  discard block
 block discarded – undo
1614 1612
      *
1615 1613
      * @param String $username
1616 1614
      * @param optional String $password
1617
-     * @return Boolean
1615
+     * @return boolean|null
1618 1616
      * @access private
1619 1617
      * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis}
1620 1618
      *           by sending dummy SSH_MSG_IGNORE messages.
@@ -1779,7 +1777,6 @@  discard block
 block discarded – undo
1779 1777
     /**
1780 1778
      * Handle the keyboard-interactive requests / responses.
1781 1779
      *
1782
-     * @param String $responses...
1783 1780
      * @return Boolean
1784 1781
      * @access private
1785 1782
      */
@@ -1896,7 +1893,6 @@  discard block
 block discarded – undo
1896 1893
      * Login with an RSA private key
1897 1894
      *
1898 1895
      * @param String $username
1899
-     * @param Crypt_RSA $password
1900 1896
      * @return Boolean
1901 1897
      * @access private
1902 1898
      * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis}
@@ -2131,7 +2127,7 @@  discard block
 block discarded – undo
2131 2127
      *
2132 2128
      * @see Net_SSH2::read()
2133 2129
      * @see Net_SSH2::write()
2134
-     * @return Boolean
2130
+     * @return boolean|null
2135 2131
      * @access private
2136 2132
      */
2137 2133
     function _initShell()
@@ -2427,6 +2423,7 @@  discard block
 block discarded – undo
2427 2423
      * Because some binary packets need to be ignored...
2428 2424
      *
2429 2425
      * @see Net_SSH2::_get_binary_packet()
2426
+     * @param string $payload
2430 2427
      * @return String
2431 2428
      * @access private
2432 2429
      */
@@ -2556,7 +2553,7 @@  discard block
 block discarded – undo
2556 2553
      *
2557 2554
      * Returns the data as a string if it's available and false if not.
2558 2555
      *
2559
-     * @param $client_channel
2556
+     * @param integer $client_channel
2560 2557
      * @return Mixed
2561 2558
      * @access private
2562 2559
      */
@@ -2795,8 +2792,9 @@  discard block
 block discarded – undo
2795 2792
      *
2796 2793
      * Makes sure that only the last 1MB worth of packets will be logged
2797 2794
      *
2798
-     * @param String $data
2799 2795
      * @access private
2796
+     * @param string $message_number
2797
+     * @param string $message
2800 2798
      */
2801 2799
     function _append_log($message_number, $message)
2802 2800
     {
@@ -2894,7 +2892,7 @@  discard block
 block discarded – undo
2894 2892
      * for SCP more than anything.
2895 2893
      *
2896 2894
      * @param Integer $client_channel
2897
-     * @return Boolean
2895
+     * @return boolean|null
2898 2896
      * @access private
2899 2897
      */
2900 2898
     function _close_channel($client_channel)
@@ -2920,7 +2918,7 @@  discard block
 block discarded – undo
2920 2918
      * Disconnect
2921 2919
      *
2922 2920
      * @param Integer $reason
2923
-     * @return Boolean
2921
+     * @return false|null
2924 2922
      * @access private
2925 2923
      */
2926 2924
     function _disconnect($reason)
@@ -2958,7 +2956,6 @@  discard block
 block discarded – undo
2958 2956
      * named constants from it, using the value as the name of the constant and the index as the value of the constant.
2959 2957
      * If any of the constants that would be defined already exists, none of the constants will be defined.
2960 2958
      *
2961
-     * @param Array $array
2962 2959
      * @access private
2963 2960
      */
2964 2961
     function _define_array()
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
             array(60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'),
823 823
             array(60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'),
824 824
             array(60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST',
825
-                  61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE')
825
+                    61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE')
826 826
         );
827 827
 
828 828
         $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
             'twofish192-cbc', // OPTIONAL          Twofish with a 192-bit key
971 971
             'twofish256-cbc',
972 972
             'twofish-cbc',    // OPTIONAL          alias for "twofish256-cbc"
973
-                              //                   (this is being retained for historical reasons)
973
+                                //                   (this is being retained for historical reasons)
974 974
             '3des-ctr',       // RECOMMENDED       Three-key 3DES in SDCTR mode
975 975
 
976 976
             '3des-cbc',       // REQUIRED          three-key 3DES in CBC mode
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
         }
1001 1001
 
1002 1002
         static $str_kex_algorithms, $str_server_host_key_algorithms,
1003
-               $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client,
1004
-               $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server;
1003
+                $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client,
1004
+                $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server;
1005 1005
 
1006 1006
         if (empty($str_kex_algorithms)) {
1007 1007
             $str_kex_algorithms = implode(',', $kex_algorithms);
@@ -1171,20 +1171,20 @@  discard block
 block discarded – undo
1171 1171
             // http://tools.ietf.org/html/rfc2412, appendex E
1172 1172
             case 'diffie-hellman-group1-sha1':
1173 1173
                 $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . 
1174
-                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1175
-                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1176
-                         'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF';
1174
+                            '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1175
+                            '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1176
+                            'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF';
1177 1177
                 break;
1178 1178
             // see http://tools.ietf.org/html/rfc3526#section-3
1179 1179
             case 'diffie-hellman-group14-sha1':
1180 1180
                 $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . 
1181
-                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1182
-                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1183
-                         'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . 
1184
-                         '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . 
1185
-                         '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 
1186
-                         'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . 
1187
-                         '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF';
1181
+                            '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1182
+                            '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1183
+                            'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . 
1184
+                            '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . 
1185
+                            '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 
1186
+                            'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . 
1187
+                            '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF';
1188 1188
                 break;
1189 1189
         }
1190 1190
 
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
             $current = strtok(microtime(), ' ') + strtok('');
2414 2414
             $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')';
2415 2415
             $message_number = '<- ' . $message_number .
2416
-                              ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2416
+                                ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2417 2417
             $this->_append_log($message_number, $payload);
2418 2418
             $this->last_packet = $current;
2419 2419
         }
@@ -2782,7 +2782,7 @@  discard block
 block discarded – undo
2782 2782
             $current = strtok(microtime(), ' ') + strtok('');
2783 2783
             $message_number = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN (' . ord($data[0]) . ')';
2784 2784
             $message_number = '-> ' . $message_number .
2785
-                              ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2785
+                                ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2786 2786
             $this->_append_log($message_number, $data);
2787 2787
             $this->last_packet = $current;
2788 2788
         }
@@ -3024,12 +3024,12 @@  discard block
 block discarded – undo
3024 3024
                 }
3025 3025
                 $fragment = $this->_string_shift($current_log, $short_width);
3026 3026
                 $hex = substr(
3027
-                           preg_replace(
3028
-                               '#(.)#es',
3029
-                               '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
3030
-                               $fragment),
3031
-                           strlen($boundary)
3032
-                       );
3027
+                            preg_replace(
3028
+                                '#(.)#es',
3029
+                                '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
3030
+                                $fragment),
3031
+                            strlen($boundary)
3032
+                        );
3033 3033
                 // replace non ASCII printable characters with dots
3034 3034
                 // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
3035 3035
                 // also replace < with a . since < messes up the output on web browsers
Please login to merge, or discard this patch.
Spacing   +96 added lines, -97 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
  * @access private
75 75
  */
76 76
 define('NET_SSH2_MASK_CONSTRUCTOR', 0x00000001);
77
-define('NET_SSH2_MASK_LOGIN_REQ',   0x00000002);
78
-define('NET_SSH2_MASK_LOGIN',       0x00000004);
79
-define('NET_SSH2_MASK_SHELL',       0x00000008);
77
+define('NET_SSH2_MASK_LOGIN_REQ', 0x00000002);
78
+define('NET_SSH2_MASK_LOGIN', 0x00000004);
79
+define('NET_SSH2_MASK_SHELL', 0x00000008);
80 80
 /**#@-*/
81 81
 
82 82
 /**#@+
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * @access private
97 97
  */
98 98
 define('NET_SSH2_CHANNEL_EXEC', 0); // PuTTy uses 0x100
99
-define('NET_SSH2_CHANNEL_SHELL',1);
99
+define('NET_SSH2_CHANNEL_SHELL', 1);
100 100
 /**#@-*/
101 101
 
102 102
 /**#@+
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 /**
107 107
  * Returns the message numbers
108 108
  */
109
-define('NET_SSH2_LOG_SIMPLE',  1);
109
+define('NET_SSH2_LOG_SIMPLE', 1);
110 110
 /**
111 111
  * Returns the message content
112 112
  */
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 /**
129 129
  * Returns when a string matching $expect exactly is found
130 130
  */
131
-define('NET_SSH2_READ_SIMPLE',  1);
131
+define('NET_SSH2_READ_SIMPLE', 1);
132 132
 /**
133 133
  * Returns when a string matching the regular expression $expect is found
134 134
  */
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
         }
834 834
         $elapsed = strtok(microtime(), ' ') + strtok('') - $start;
835 835
 
836
-        $timeout-= $elapsed;
836
+        $timeout -= $elapsed;
837 837
 
838 838
         if ($timeout <= 0) {
839 839
             user_error(rtrim("Cannot connect to $host. Timeout error"));
@@ -864,10 +864,10 @@  discard block
 block discarded – undo
864 864
         $extra = '';
865 865
         while (!feof($this->fsock) && !preg_match('#^SSH-(\d\.\d+)#', $temp, $matches)) {
866 866
             if (substr($temp, -2) == "\r\n") {
867
-                $extra.= $temp;
867
+                $extra .= $temp;
868 868
                 $temp = '';
869 869
             }
870
-            $temp.= fgets($this->fsock, 255);
870
+            $temp .= fgets($this->fsock, 255);
871 871
         }
872 872
 
873 873
         if (feof($this->fsock)) {
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
         }
887 887
 
888 888
         if (!empty($ext)) {
889
-            $this->identifier.= ' (' . implode(', ', $ext) . ')';
889
+            $this->identifier .= ' ('.implode(', ', $ext).')';
890 890
         }
891 891
 
892 892
         if (defined('NET_SSH2_LOGGING')) {
893
-            $this->_append_log('<-', $extra . $temp);
894
-            $this->_append_log('->', $this->identifier . "\r\n");
893
+            $this->_append_log('<-', $extra.$temp);
894
+            $this->_append_log('->', $this->identifier."\r\n");
895 895
         }
896 896
 
897 897
         $this->server_identifier = trim($temp, "\r\n");
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
             return;
905 905
         }
906 906
 
907
-        fputs($this->fsock, $this->identifier . "\r\n");
907
+        fputs($this->fsock, $this->identifier."\r\n");
908 908
 
909 909
         $response = $this->_get_binary_packet();
910 910
         if ($response === false) {
@@ -947,41 +947,41 @@  discard block
 block discarded – undo
947 947
             'arcfour256',
948 948
             'arcfour128',
949 949
 
950
-            'arcfour',        // OPTIONAL          the ARCFOUR stream cipher with a 128-bit key
950
+            'arcfour', // OPTIONAL          the ARCFOUR stream cipher with a 128-bit key
951 951
 
952 952
             // CTR modes from <http://tools.ietf.org/html/rfc4344#section-4>:
953
-            'aes128-ctr',     // RECOMMENDED       AES (Rijndael) in SDCTR mode, with 128-bit key
954
-            'aes192-ctr',     // RECOMMENDED       AES with 192-bit key
955
-            'aes256-ctr',     // RECOMMENDED       AES with 256-bit key
953
+            'aes128-ctr', // RECOMMENDED       AES (Rijndael) in SDCTR mode, with 128-bit key
954
+            'aes192-ctr', // RECOMMENDED       AES with 192-bit key
955
+            'aes256-ctr', // RECOMMENDED       AES with 256-bit key
956 956
 
957
-            'blowfish-ctr',   // OPTIONAL          Blowfish in SDCTR mode
957
+            'blowfish-ctr', // OPTIONAL          Blowfish in SDCTR mode
958 958
 
959 959
             'twofish128-ctr', // OPTIONAL          Twofish in SDCTR mode, with 128-bit key
960 960
             'twofish192-ctr', // OPTIONAL          Twofish with 192-bit key
961 961
             'twofish256-ctr', // OPTIONAL          Twofish with 256-bit key
962 962
 
963
-            'aes128-cbc',     // RECOMMENDED       AES with a 128-bit key
964
-            'aes192-cbc',     // OPTIONAL          AES with a 192-bit key
965
-            'aes256-cbc',     // OPTIONAL          AES in CBC mode, with a 256-bit key
963
+            'aes128-cbc', // RECOMMENDED       AES with a 128-bit key
964
+            'aes192-cbc', // OPTIONAL          AES with a 192-bit key
965
+            'aes256-cbc', // OPTIONAL          AES in CBC mode, with a 256-bit key
966 966
 
967
-            'blowfish-cbc',   // OPTIONAL          Blowfish in CBC mode
967
+            'blowfish-cbc', // OPTIONAL          Blowfish in CBC mode
968 968
 
969 969
             'twofish128-cbc', // OPTIONAL          Twofish with a 128-bit key
970 970
             'twofish192-cbc', // OPTIONAL          Twofish with a 192-bit key
971 971
             'twofish256-cbc',
972
-            'twofish-cbc',    // OPTIONAL          alias for "twofish256-cbc"
972
+            'twofish-cbc', // OPTIONAL          alias for "twofish256-cbc"
973 973
                               //                   (this is being retained for historical reasons)
974
-            '3des-ctr',       // RECOMMENDED       Three-key 3DES in SDCTR mode
974
+            '3des-ctr', // RECOMMENDED       Three-key 3DES in SDCTR mode
975 975
 
976
-            '3des-cbc',       // REQUIRED          three-key 3DES in CBC mode
976
+            '3des-cbc', // REQUIRED          three-key 3DES in CBC mode
977 977
             'none'            // OPTIONAL          no encryption; NOT RECOMMENDED
978 978
         );
979 979
 
980 980
         static $mac_algorithms = array(
981 981
             'hmac-sha1-96', // RECOMMENDED     first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20)
982
-            'hmac-sha1',    // REQUIRED        HMAC-SHA1 (digest length = key length = 20)
983
-            'hmac-md5-96',  // OPTIONAL        first 96 bits of HMAC-MD5 (digest length = 12, key length = 16)
984
-            'hmac-md5',     // OPTIONAL        HMAC-MD5 (digest length = key length = 16)
982
+            'hmac-sha1', // REQUIRED        HMAC-SHA1 (digest length = key length = 20)
983
+            'hmac-md5-96', // OPTIONAL        first 96 bits of HMAC-MD5 (digest length = 12, key length = 16)
984
+            'hmac-md5', // OPTIONAL        HMAC-MD5 (digest length = key length = 16)
985 985
             'none'          // OPTIONAL        no MAC; NOT RECOMMENDED
986 986
         );
987 987
 
@@ -1170,20 +1170,20 @@  discard block
 block discarded – undo
1170 1170
             // see http://tools.ietf.org/html/rfc2409#section-6.2 and 
1171 1171
             // http://tools.ietf.org/html/rfc2412, appendex E
1172 1172
             case 'diffie-hellman-group1-sha1':
1173
-                $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . 
1174
-                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1175
-                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1173
+                $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74'. 
1174
+                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437'. 
1175
+                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED'. 
1176 1176
                          'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF';
1177 1177
                 break;
1178 1178
             // see http://tools.ietf.org/html/rfc3526#section-3
1179 1179
             case 'diffie-hellman-group14-sha1':
1180
-                $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . 
1181
-                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . 
1182
-                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 
1183
-                         'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . 
1184
-                         '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . 
1185
-                         '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 
1186
-                         'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . 
1180
+                $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74'. 
1181
+                         '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437'. 
1182
+                         '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED'. 
1183
+                         'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05'. 
1184
+                         '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB'. 
1185
+                         '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B'. 
1186
+                         'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718'. 
1187 1187
                          '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF';
1188 1188
                 break;
1189 1189
         }
@@ -1454,15 +1454,15 @@  discard block
 block discarded – undo
1454 1454
             $this->encrypt->enableContinuousBuffer();
1455 1455
             $this->encrypt->disablePadding();
1456 1456
 
1457
-            $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id);
1457
+            $iv = $kexHash->hash($keyBytes.$this->exchange_hash.'A'.$this->session_id);
1458 1458
             while ($this->encrypt_block_size > strlen($iv)) {
1459
-                $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
1459
+                $iv .= $kexHash->hash($keyBytes.$this->exchange_hash.$iv);
1460 1460
             }
1461 1461
             $this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size));
1462 1462
 
1463
-            $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'C' . $this->session_id);
1463
+            $key = $kexHash->hash($keyBytes.$this->exchange_hash.'C'.$this->session_id);
1464 1464
             while ($encryptKeyLength > strlen($key)) {
1465
-                $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
1465
+                $key .= $kexHash->hash($keyBytes.$this->exchange_hash.$key);
1466 1466
             }
1467 1467
             $this->encrypt->setKey(substr($key, 0, $encryptKeyLength));
1468 1468
         }
@@ -1471,15 +1471,15 @@  discard block
 block discarded – undo
1471 1471
             $this->decrypt->enableContinuousBuffer();
1472 1472
             $this->decrypt->disablePadding();
1473 1473
 
1474
-            $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id);
1474
+            $iv = $kexHash->hash($keyBytes.$this->exchange_hash.'B'.$this->session_id);
1475 1475
             while ($this->decrypt_block_size > strlen($iv)) {
1476
-                $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
1476
+                $iv .= $kexHash->hash($keyBytes.$this->exchange_hash.$iv);
1477 1477
             }
1478 1478
             $this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size));
1479 1479
 
1480
-            $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'D' . $this->session_id);
1480
+            $key = $kexHash->hash($keyBytes.$this->exchange_hash.'D'.$this->session_id);
1481 1481
             while ($decryptKeyLength > strlen($key)) {
1482
-                $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
1482
+                $key .= $kexHash->hash($keyBytes.$this->exchange_hash.$key);
1483 1483
             }
1484 1484
             $this->decrypt->setKey(substr($key, 0, $decryptKeyLength));
1485 1485
         }
@@ -1553,15 +1553,15 @@  discard block
 block discarded – undo
1553 1553
                 $this->hmac_size = 12;
1554 1554
         }
1555 1555
 
1556
-        $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id);
1556
+        $key = $kexHash->hash($keyBytes.$this->exchange_hash.'E'.$this->session_id);
1557 1557
         while ($createKeyLength > strlen($key)) {
1558
-            $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
1558
+            $key .= $kexHash->hash($keyBytes.$this->exchange_hash.$key);
1559 1559
         }
1560 1560
         $this->hmac_create->setKey(substr($key, 0, $createKeyLength));
1561 1561
 
1562
-        $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'F' . $this->session_id);
1562
+        $key = $kexHash->hash($keyBytes.$this->exchange_hash.'F'.$this->session_id);
1563 1563
         while ($checkKeyLength > strlen($key)) {
1564
-            $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
1564
+            $key .= $kexHash->hash($keyBytes.$this->exchange_hash.$key);
1565 1565
         }
1566 1566
         $this->hmac_check->setKey(substr($key, 0, $checkKeyLength));
1567 1567
 
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
                     $this->message_number_log[count($this->message_number_log) - 1] = 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ';
1727 1727
                 }
1728 1728
                 extract(unpack('Nlength', $this->_string_shift($response, 4)));
1729
-                $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . utf8_decode($this->_string_shift($response, $length));
1729
+                $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: '.utf8_decode($this->_string_shift($response, $length));
1730 1730
                 return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
1731 1731
             case NET_SSH2_MSG_USERAUTH_FAILURE:
1732 1732
                 // can we use keyboard-interactive authentication?  if not then either the login is bad or the server employees
@@ -1858,8 +1858,8 @@  discard block
 block discarded – undo
1858 1858
                 // see http://tools.ietf.org/html/rfc4256#section-3.4
1859 1859
                 $packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses));
1860 1860
                 for ($i = 0; $i < count($responses); $i++) {
1861
-                    $packet.= pack('Na*', strlen($responses[$i]), $responses[$i]);
1862
-                    $logged.= pack('Na*', strlen('dummy-answer'), 'dummy-answer');
1861
+                    $packet .= pack('Na*', strlen($responses[$i]), $responses[$i]);
1862
+                    $logged .= pack('Na*', strlen('dummy-answer'), 'dummy-answer');
1863 1863
                 }
1864 1864
 
1865 1865
                 if (!$this->_send_binary_packet($packet)) {
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
         );
1925 1925
         $part2 = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey), $publickey);
1926 1926
 
1927
-        $packet = $part1 . chr(0) . $part2;
1927
+        $packet = $part1.chr(0).$part2;
1928 1928
         if (!$this->_send_binary_packet($packet)) {
1929 1929
             return false;
1930 1930
         }
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         switch ($type) {
1941 1941
             case NET_SSH2_MSG_USERAUTH_FAILURE:
1942 1942
                 extract(unpack('Nlength', $this->_string_shift($response, 4)));
1943
-                $this->errors[] = 'SSH_MSG_USERAUTH_FAILURE: ' . $this->_string_shift($response, $length);
1943
+                $this->errors[] = 'SSH_MSG_USERAUTH_FAILURE: '.$this->_string_shift($response, $length);
1944 1944
                 return false;
1945 1945
             case NET_SSH2_MSG_USERAUTH_PK_OK:
1946 1946
                 // we'll just take it on faith that the public key blob and the public key algorithm name are as
@@ -1954,11 +1954,11 @@  discard block
 block discarded – undo
1954 1954
                 }
1955 1955
         }
1956 1956
 
1957
-        $packet = $part1 . chr(1) . $part2;
1957
+        $packet = $part1.chr(1).$part2;
1958 1958
         $privatekey->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
1959 1959
         $signature = $privatekey->sign(pack('Na*a*', strlen($this->session_id), $this->session_id, $packet));
1960 1960
         $signature = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($signature), $signature);
1961
-        $packet.= pack('Na*', strlen($signature), $signature);
1961
+        $packet .= pack('Na*', strlen($signature), $signature);
1962 1962
 
1963 1963
         if (!$this->_send_binary_packet($packet)) {
1964 1964
             return false;
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
                     if (is_callable($callback)) {
2121 2121
                         $callback($temp);
2122 2122
                     } else {
2123
-                        $output.= $temp;
2123
+                        $output .= $temp;
2124 2124
                     }
2125 2125
             }
2126 2126
         }
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
                 return $response ? $this->_string_shift($this->interactiveBuffer, strlen($this->interactiveBuffer)) : false;
2249 2249
             }
2250 2250
 
2251
-            $this->interactiveBuffer.= $response;
2251
+            $this->interactiveBuffer .= $response;
2252 2252
         }
2253 2253
     }
2254 2254
 
@@ -2384,12 +2384,12 @@  discard block
 block discarded – undo
2384 2384
         $buffer = '';
2385 2385
         while ($remaining_length > 0) {
2386 2386
             $temp = fread($this->fsock, $remaining_length);
2387
-            $buffer.= $temp;
2388
-            $remaining_length-= strlen($temp);
2387
+            $buffer .= $temp;
2388
+            $remaining_length -= strlen($temp);
2389 2389
         }
2390 2390
         $stop = strtok(microtime(), ' ') + strtok('');
2391 2391
         if (strlen($buffer)) {
2392
-            $raw.= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer;
2392
+            $raw .= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer;
2393 2393
         }
2394 2394
 
2395 2395
         $payload = $this->_string_shift($raw, $packet_length - $padding_length - 1);
@@ -2397,7 +2397,7 @@  discard block
 block discarded – undo
2397 2397
 
2398 2398
         if ($this->hmac_check !== false) {
2399 2399
             $hmac = fread($this->fsock, $this->hmac_size);
2400
-            if ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) {
2400
+            if ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload.$padding))) {
2401 2401
                 user_error('Invalid HMAC');
2402 2402
                 return false;
2403 2403
             }
@@ -2411,9 +2411,9 @@  discard block
 block discarded – undo
2411 2411
 
2412 2412
         if (defined('NET_SSH2_LOGGING')) {
2413 2413
             $current = strtok(microtime(), ' ') + strtok('');
2414
-            $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')';
2415
-            $message_number = '<- ' . $message_number .
2416
-                              ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2414
+            $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN ('.ord($payload[0]).')';
2415
+            $message_number = '<- '.$message_number.
2416
+                              ' (since last: '.round($current - $this->last_packet, 4).', network: '.round($stop - $start, 4).'s)';
2417 2417
             $this->_append_log($message_number, $payload);
2418 2418
             $this->last_packet = $current;
2419 2419
         }
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
             case NET_SSH2_MSG_DISCONNECT:
2437 2437
                 $this->_string_shift($payload, 1);
2438 2438
                 extract(unpack('Nreason_code/Nlength', $this->_string_shift($payload, 8)));
2439
-                $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . utf8_decode($this->_string_shift($payload, $length));
2439
+                $this->errors[] = 'SSH_MSG_DISCONNECT: '.$this->disconnect_reasons[$reason_code]."\r\n".utf8_decode($this->_string_shift($payload, $length));
2440 2440
                 $this->bitmask = 0;
2441 2441
                 return false;
2442 2442
             case NET_SSH2_MSG_IGNORE:
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
             case NET_SSH2_MSG_DEBUG:
2446 2446
                 $this->_string_shift($payload, 2);
2447 2447
                 extract(unpack('Nlength', $this->_string_shift($payload, 4)));
2448
-                $this->errors[] = 'SSH_MSG_DEBUG: ' . utf8_decode($this->_string_shift($payload, $length));
2448
+                $this->errors[] = 'SSH_MSG_DEBUG: '.utf8_decode($this->_string_shift($payload, $length));
2449 2449
                 $payload = $this->_get_binary_packet();
2450 2450
                 break;
2451 2451
             case NET_SSH2_MSG_UNIMPLEMENTED:
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
                 case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4
2475 2475
                     $this->_string_shift($payload, 1);
2476 2476
                     extract(unpack('Nlength', $this->_string_shift($payload)));
2477
-                    $this->errors[] = 'SSH_MSG_GLOBAL_REQUEST: ' . utf8_decode($this->_string_shift($payload, $length));
2477
+                    $this->errors[] = 'SSH_MSG_GLOBAL_REQUEST: '.utf8_decode($this->_string_shift($payload, $length));
2478 2478
 
2479 2479
                     if (!$this->_send_binary_packet(pack('C', NET_SSH2_MSG_REQUEST_FAILURE))) {
2480 2480
                         return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
                 case NET_SSH2_MSG_CHANNEL_OPEN: // see http://tools.ietf.org/html/rfc4254#section-5.1
2486 2486
                     $this->_string_shift($payload, 1);
2487 2487
                     extract(unpack('N', $this->_string_shift($payload, 4)));
2488
-                    $this->errors[] = 'SSH_MSG_CHANNEL_OPEN: ' . utf8_decode($this->_string_shift($payload, $length));
2488
+                    $this->errors[] = 'SSH_MSG_CHANNEL_OPEN: '.utf8_decode($this->_string_shift($payload, $length));
2489 2489
 
2490 2490
                     $this->_string_shift($payload, 4); // skip over client channel
2491 2491
                     extract(unpack('Nserver_channel', $this->_string_shift($payload, 4)));
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
                     return true;
2586 2586
                 }
2587 2587
                 $elapsed = strtok(microtime(), ' ') + strtok('') - $start;
2588
-                $this->curTimeout-= $elapsed;
2588
+                $this->curTimeout -= $elapsed;
2589 2589
             }
2590 2590
 
2591 2591
             $response = $this->_get_binary_packet();
@@ -2598,13 +2598,13 @@  discard block
 block discarded – undo
2598 2598
             }
2599 2599
 
2600 2600
             // resize the window, if appropriate
2601
-            $this->window_size_server_to_client[$client_channel]-= strlen($response);
2601
+            $this->window_size_server_to_client[$client_channel] -= strlen($response);
2602 2602
             if ($this->window_size_server_to_client[$client_channel] < 0) {
2603 2603
                 $packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$client_channel], $this->window_size);
2604 2604
                 if (!$this->_send_binary_packet($packet)) {
2605 2605
                     return false;
2606 2606
                 }
2607
-                $this->window_size_server_to_client[$client_channel]+= $this->window_size;
2607
+                $this->window_size_server_to_client[$client_channel] += $this->window_size;
2608 2608
             }
2609 2609
 
2610 2610
             extract(unpack('Ctype/Nchannel', $this->_string_shift($response, 5)));
@@ -2688,11 +2688,11 @@  discard block
 block discarded – undo
2688 2688
                         case 'exit-signal':
2689 2689
                             $this->_string_shift($response, 1);
2690 2690
                             extract(unpack('Nlength', $this->_string_shift($response, 4)));
2691
-                            $this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . $this->_string_shift($response, $length);
2691
+                            $this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): '.$this->_string_shift($response, $length);
2692 2692
                             $this->_string_shift($response, 1);
2693 2693
                             extract(unpack('Nlength', $this->_string_shift($response, 4)));
2694 2694
                             if ($length) {
2695
-                                $this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length);
2695
+                                $this->errors[count($this->errors)] .= "\r\n".$this->_string_shift($response, $length);
2696 2696
                             }
2697 2697
                         case 'exit-status':
2698 2698
                             extract(unpack('Cfalse/Nexit_status', $this->_string_shift($response, 5)));
@@ -2713,7 +2713,7 @@  discard block
 block discarded – undo
2713 2713
                     $this->curTimeout = 0;
2714 2714
 
2715 2715
                     if ($this->bitmap & NET_SSH2_MASK_SHELL) {
2716
-                        $this->bitmap&= ~NET_SSH2_MASK_SHELL;
2716
+                        $this->bitmap &= ~NET_SSH2_MASK_SHELL;
2717 2717
                     }
2718 2718
                     if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) {
2719 2719
                         $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));
@@ -2757,13 +2757,13 @@  discard block
 block discarded – undo
2757 2757
         // 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9
2758 2758
         $packet_length = strlen($data) + 9;
2759 2759
         // round up to the nearest $this->encrypt_block_size
2760
-        $packet_length+= (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size;
2760
+        $packet_length += (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size;
2761 2761
         // subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length
2762 2762
         $padding_length = $packet_length - strlen($data) - 5;
2763 2763
         $padding = crypt_random_string($padding_length);
2764 2764
 
2765 2765
         // we subtract 4 from packet_length because the packet_length field isn't supposed to include itself
2766
-        $packet = pack('NCa*', $packet_length - 4, $padding_length, $data . $padding);
2766
+        $packet = pack('NCa*', $packet_length - 4, $padding_length, $data.$padding);
2767 2767
 
2768 2768
         $hmac = $this->hmac_create !== false ? $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)) : '';
2769 2769
         $this->send_seq_no++;
@@ -2772,7 +2772,7 @@  discard block
 block discarded – undo
2772 2772
             $packet = $this->encrypt->encrypt($packet);
2773 2773
         }
2774 2774
 
2775
-        $packet.= $hmac;
2775
+        $packet .= $hmac;
2776 2776
 
2777 2777
         $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
2778 2778
         $result = strlen($packet) == fputs($this->fsock, $packet);
@@ -2780,9 +2780,9 @@  discard block
 block discarded – undo
2780 2780
 
2781 2781
         if (defined('NET_SSH2_LOGGING')) {
2782 2782
             $current = strtok(microtime(), ' ') + strtok('');
2783
-            $message_number = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN (' . ord($data[0]) . ')';
2784
-            $message_number = '-> ' . $message_number .
2785
-                              ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
2783
+            $message_number = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN ('.ord($data[0]).')';
2784
+            $message_number = '-> '.$message_number.
2785
+                              ' (since last: '.round($current - $this->last_packet, 4).', network: '.round($stop - $start, 4).'s)';
2786 2786
             $this->_append_log($message_number, $data);
2787 2787
             $this->last_packet = $current;
2788 2788
         }
@@ -2809,10 +2809,10 @@  discard block
 block discarded – undo
2809 2809
                 case NET_SSH2_LOG_COMPLEX:
2810 2810
                     $this->message_number_log[] = $message_number;
2811 2811
                     $this->_string_shift($message);
2812
-                    $this->log_size+= strlen($message);
2812
+                    $this->log_size += strlen($message);
2813 2813
                     $this->message_log[] = $message;
2814 2814
                     while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) {
2815
-                        $this->log_size-= strlen(array_shift($this->message_log));
2815
+                        $this->log_size -= strlen(array_shift($this->message_log));
2816 2816
                         array_shift($this->message_number_log);
2817 2817
                     }
2818 2818
                     break;
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
                 // passwords won't be filtered out and select other packets may not be correctly
2821 2821
                 // identified
2822 2822
                 case NET_SSH2_LOG_REALTIME:
2823
-                    echo "<pre>\r\n" . $this->_format_log(array($message), array($message_number)) . "\r\n</pre>\r\n";
2823
+                    echo "<pre>\r\n".$this->_format_log(array($message), array($message_number))."\r\n</pre>\r\n";
2824 2824
                     @flush();
2825 2825
                     @ob_flush();
2826 2826
                     break;
@@ -2841,10 +2841,10 @@  discard block
 block discarded – undo
2841 2841
                     $entry = $this->_format_log(array($message), array($message_number));
2842 2842
                     if ($this->realtime_log_wrap) {
2843 2843
                         $temp = "<<< START >>>\r\n";
2844
-                        $entry.= $temp;
2844
+                        $entry .= $temp;
2845 2845
                         fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp));
2846 2846
                     }
2847
-                    $this->realtime_log_size+= strlen($entry);
2847
+                    $this->realtime_log_size += strlen($entry);
2848 2848
                     if ($this->realtime_log_size > NET_SSH2_LOG_MAX_SIZE) {
2849 2849
                         fseek($this->realtime_log_file, 0);
2850 2850
                         $this->realtime_log_size = strlen($entry);
@@ -2912,7 +2912,7 @@  discard block
 block discarded – undo
2912 2912
         while (!is_bool($this->_get_channel_packet($client_channel)));
2913 2913
 
2914 2914
         if ($this->bitmap & NET_SSH2_MASK_SHELL) {
2915
-            $this->bitmap&= ~NET_SSH2_MASK_SHELL;
2915
+            $this->bitmap &= ~NET_SSH2_MASK_SHELL;
2916 2916
         }
2917 2917
     }
2918 2918
 
@@ -3015,18 +3015,18 @@  discard block
 block discarded – undo
3015 3015
 
3016 3016
         $output = '';
3017 3017
         for ($i = 0; $i < count($message_log); $i++) {
3018
-            $output.= $message_number_log[$i] . "\r\n";
3018
+            $output .= $message_number_log[$i]."\r\n";
3019 3019
             $current_log = $message_log[$i];
3020 3020
             $j = 0;
3021 3021
             do {
3022 3022
                 if (strlen($current_log)) {
3023
-                    $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0  ';
3023
+                    $output .= str_pad(dechex($j), 7, '0', STR_PAD_LEFT).'0  ';
3024 3024
                 }
3025 3025
                 $fragment = $this->_string_shift($current_log, $short_width);
3026 3026
                 $hex = substr(
3027 3027
                            preg_replace(
3028 3028
                                '#(.)#es',
3029
-                               '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
3029
+                               '"'.$boundary.'" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)',
3030 3030
                                $fragment),
3031 3031
                            strlen($boundary)
3032 3032
                        );
@@ -3034,10 +3034,10 @@  discard block
 block discarded – undo
3034 3034
                 // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
3035 3035
                 // also replace < with a . since < messes up the output on web browsers
3036 3036
                 $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment);
3037
-                $output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n";
3037
+                $output .= str_pad($hex, $long_width - $short_width, ' ').$raw."\r\n";
3038 3038
                 $j++;
3039 3039
             } while (strlen($current_log));
3040
-            $output.= "\r\n";
3040
+            $output .= "\r\n";
3041 3041
         }
3042 3042
 
3043 3043
         return $output;
@@ -3219,8 +3219,7 @@  discard block
 block discarded – undo
3219 3219
 
3220 3220
         if ($this->signature_validated) {
3221 3221
             return $this->bitmap ?
3222
-                $this->signature_format . ' ' . base64_encode($this->server_public_host_key) :
3223
-                false;
3222
+                $this->signature_format.' '.base64_encode($this->server_public_host_key) : false;
3224 3223
         }
3225 3224
 
3226 3225
         $this->signature_validated = true;
@@ -3320,7 +3319,7 @@  discard block
 block discarded – undo
3320 3319
                 $s = $s->toBytes();
3321 3320
 
3322 3321
                 $h = pack('N4H*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, sha1($this->exchange_hash));
3323
-                $h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 3 - strlen($h)) . $h;
3322
+                $h = chr(0x01).str_repeat(chr(0xFF), $nLength - 3 - strlen($h)).$h;
3324 3323
 
3325 3324
                 if ($s != $h) {
3326 3325
                     user_error('Bad server signature');
@@ -3332,7 +3331,7 @@  discard block
 block discarded – undo
3332 3331
                 return $this->_disconnect(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE);
3333 3332
         }
3334 3333
 
3335
-        return $this->signature_format . ' ' . base64_encode($this->server_public_host_key);
3334
+        return $this->signature_format.' '.base64_encode($this->server_public_host_key);
3336 3335
     }
3337 3336
 
3338 3337
     /**
Please login to merge, or discard this patch.
main/inc/lib/plugin.class.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
     /**
145 145
      * Returns the contents of the CSS defined by the plugin
146
-     * @return array
146
+     * @return string
147 147
      */
148 148
     public function get_css()
149 149
     {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
     /**
163 163
      * Returns an HTML form (generated by FormValidator) of the plugin settings
164
-     * @return string FormValidator-generated form
164
+     * @return FormValidator FormValidator-generated form
165 165
      */
166 166
     public function get_settings_form()
167 167
     {
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * @param boolean $add_tool_link Whether to add a tool link or not
384 384
      * (some tools might just offer a configuration section and act on the backend)
385 385
      *
386
-     * @return boolean  False on error, null otherwise
386
+     * @return boolean|null  False on error, null otherwise
387 387
      */
388 388
     public function install_course_fields($courseId, $add_tool_link = true)
389 389
     {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      * tool on the course's homepage
492 492
      * @param int $courseId
493 493
      *
494
-     * @return void
494
+     * @return false|null
495 495
      */
496 496
     public function uninstall_course_fields($courseId)
497 497
     {
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     * @param string   $tabName
597 597
     * @param string   $url
598 598
     *
599
-    * @return boolean
599
+    * @return false|string
600 600
     */
601 601
     public function addTab($tabName, $url)
602 602
     {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -591,13 +591,13 @@
 block discarded – undo
591 591
 
592 592
     }
593 593
 
594
-   /**
595
-    * Add a tab to platform
596
-    * @param string   $tabName
597
-    * @param string   $url
598
-    *
599
-    * @return boolean
600
-    */
594
+    /**
595
+     * Add a tab to platform
596
+     * @param string   $tabName
597
+     * @param string   $url
598
+     *
599
+     * @return boolean
600
+     */
601 601
     public function addTab($tabName, $url)
602 602
     {
603 603
         $sql = "SELECT * FROM settings_current
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->fields = $settings;
61 61
 
62 62
         global $language_files;
63
-        $language_files[] = 'plugin_' . $this->get_name();
63
+        $language_files[] = 'plugin_'.$this->get_name();
64 64
     }
65 65
 
66 66
     /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     {
267 267
         $settings = $this->get_settings();
268 268
         foreach ($settings as $setting) {
269
-            if ($setting['variable'] == ($this->get_name() . '_' . $name)) {
269
+            if ($setting['variable'] == ($this->get_name().'_'.$name)) {
270 270
                 return $setting['selected_value'];
271 271
             }
272 272
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
             $interfaceLanguageId = api_get_language_id($language_interface);
323 323
             $interfaceLanguageInfo = api_get_language_info($interfaceLanguageId);
324
-            $languageParentId = (!empty($interfaceLanguageInfo['parent_id'])?intval($interfaceLanguageInfo['parent_id']):0);
324
+            $languageParentId = (!empty($interfaceLanguageInfo['parent_id']) ? intval($interfaceLanguageInfo['parent_id']) : 0);
325 325
 
326 326
             //1. Loading english if exists
327 327
             $english_path = $root.$plugin_name."/lang/english.php";
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         if (!empty($this->course_settings)) {
400 400
             foreach ($this->course_settings as $setting) {
401 401
                 $variable = $setting['name'];
402
-                $value ='';
402
+                $value = '';
403 403
                 if (isset($setting['init_value'])) {
404 404
                     $value = ($setting['init_value']);
405 405
                 }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 
612 612
         //Avoid Tab Name Spaces
613 613
         $tabNameNoSpaces = preg_replace('/\s+/', '', $tabName);
614
-        $subkeytext = "Tabs" . $tabNameNoSpaces;
614
+        $subkeytext = "Tabs".$tabNameNoSpaces;
615 615
 
616 616
         //Check if it is already added
617 617
         $checkCondition = array(
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
             return false;
628 628
         }
629 629
         //End Check
630
-        $subkey = 'custom_tab_' . $tabNum;
630
+        $subkey = 'custom_tab_'.$tabNum;
631 631
         $attributes = array(
632 632
             'variable' => 'show_tabs',
633 633
             'subkey' => $subkey,
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
         //Save the id
647 647
         $settings = $this->get_settings();
648
-        $setData = array (
648
+        $setData = array(
649 649
             'comment' => $subkey
650 650
         );
651 651
         $whereCondition = array(
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
                 $i = 1;
687 687
                 foreach ($tabs as $row) {
688 688
                     $attributes = array(
689
-                        'subkey' => 'custom_tab_' . $i
689
+                        'subkey' => 'custom_tab_'.$i
690 690
                     );
691 691
                     $this->updateTab($row['subkey'], $attributes);
692 692
                     $i++;
Please login to merge, or discard this patch.
main/inc/lib/plugin.lib.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -626,7 +626,7 @@
 block discarded – undo
626 626
 
627 627
     /**
628 628
      * Get first SMS plugin name
629
-     * @return string|boolean
629
+     * @return string|false
630 630
      */
631 631
     public function getSMSPluginName()
632 632
     {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
     }
174 174
 
175 175
     /**
176
-    * @param string $pluginName
177
-    * @param int    $urlId
178
-    */
176
+     * @param string $pluginName
177
+     * @param int    $urlId
178
+     */
179 179
     public function uninstall($pluginName, $urlId = null)
180 180
     {
181 181
         if (empty($urlId)) {
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
     }
253 253
 
254 254
     /**
255
-    * @param string $region
256
-    * @param string $template
257
-    * @param bool   $forced
258
-    *
259
-    * @return null|string
260
-    */
255
+     * @param string $region
256
+     * @param string $template
257
+     * @param bool   $forced
258
+     *
259
+     * @return null|string
260
+     */
261 261
     public function load_region($region, $template, $forced = false)
262 262
     {
263 263
         if ($region == 'course_tool_plugin') {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             //extra options
426 426
             $plugin_settings = api_get_settings_params(
427 427
                 array(
428
-                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting')
428
+                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting')
429 429
                 )
430 430
             );
431 431
             $settings_filtered = array();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             if (!empty($obj->course_settings)) {
531 531
                 if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) {
532 532
                     $icon = Display::return_icon(
533
-                        $plugin_name . '.png',
533
+                        $plugin_name.'.png',
534 534
                         Security::remove_XSS($pluginTitle),
535 535
                         '',
536 536
                         ICON_SIZE_SMALL
Please login to merge, or discard this patch.
main/inc/lib/portfolio.class.php 2 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,6 +126,7 @@  discard block
 block discarded – undo
126 126
      * Returns a temporary url to download files and/or folders.
127 127
      *
128 128
      * @param string|array $ids
129
+     * @param string $tool
129 130
      * @return string
130 131
      */
131 132
     public static function download_url($ids, $tool)
@@ -293,7 +294,7 @@  discard block
 block discarded – undo
293 294
     /**
294 295
      * The name of the porfolio where to send.
295 296
      *
296
-     * @return type
297
+     * @return string
297 298
      */
298 299
     function get_portfolio()
299 300
     {
@@ -391,7 +392,6 @@  discard block
 block discarded – undo
391 392
      * Create a "send to portfolio" button
392 393
      *
393 394
      * @param string $tool          The name of the tool: document, work.
394
-     * @param int $c_id             The id of the course
395 395
      * @param int $id               The id of the object
396 396
      * @param array $attributes     Html attributes
397 397
      * @return \PortfolioShare
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     /**
406 406
      * Returns the current secuirty token. Used to avoid see surfing attacks.
407 407
      *
408
-     * @return type
408
+     * @return string
409 409
      */
410 410
     static function security_token()
411 411
     {
@@ -420,6 +420,10 @@  discard block
 block discarded – undo
420 420
     protected $attributes = array();
421 421
     protected $tool = '';
422 422
 
423
+    /**
424
+     * @param string $tool
425
+     * @param integer $id
426
+     */
423 427
     function __construct($tool, $id, $attributes = array())
424 428
     {
425 429
         $this->tool = $tool;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
         $attributes['z-index'] = 100000;
483 483
         $s = ' ';
484 484
         foreach ($attributes as $key => $value) {
485
-            $s .= $key . '="' . $value . '" ';
485
+            $s .= $key.'="'.$value.'" ';
486 486
         }
487 487
 
488 488
         $result = array();
489
-        $result[] = '<span ' . $s . ' >';
489
+        $result[] = '<span '.$s.' >';
490 490
         $result[] = '<span class="dropdown" >';
491 491
         $result[] = '<a href="#" data-toggle="dropdown" class="dropdown-toggle">';
492
-        $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL) . '<b class="caret"></b>';
492
+        $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL).'<b class="caret"></b>';
493 493
         $result[] = '</a>';
494 494
         $result[] = '<ul class="dropdown-menu">';
495 495
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             $parameters[PortfolioController::PARAM_TOOL] = $tool;
506 506
             $url = api_get_path(WEB_CODE_PATH).'portfolio/share.php?';
507 507
             $result[] = '<li>';
508
-            $result[] = '<a href="' . $url . '">' . $portfolio->get_title() . '</a>';
508
+            $result[] = '<a href="'.$url.'">'.$portfolio->get_title().'</a>';
509 509
             $result[] = '</li>';
510 510
         }
511 511
         $result[] = '</ul>';
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
      */
565 565
     public function __construct($portfolio)
566 566
     {
567
-        $this->name = md5(__CLASS__) . '_' . $portfolio->get_name();
568
-        $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo') . ' ' . $portfolio->get_name();
567
+        $this->name = md5(__CLASS__).'_'.$portfolio->get_name();
568
+        $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo').' '.$portfolio->get_name();
569 569
         $this->portfolio = $portfolio;
570 570
     }
571 571
 
Please login to merge, or discard this patch.