@@ -355,30 +355,45 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | |
358 | + /** |
|
359 | + * @param integer $packet_code |
|
360 | + */ |
|
358 | 361 | function SetPacketCodeToSend($packet_code) |
359 | 362 | { |
360 | 363 | $this->_radius_packet_to_send = $packet_code; |
361 | 364 | } |
362 | 365 | |
363 | 366 | |
367 | + /** |
|
368 | + * @param boolean $debug_mode |
|
369 | + */ |
|
364 | 370 | function SetDebugMode($debug_mode) |
365 | 371 | { |
366 | 372 | $this->_debug_mode = (TRUE === $debug_mode); |
367 | 373 | } |
368 | 374 | |
369 | 375 | |
376 | + /** |
|
377 | + * @param string $ip_radius_server |
|
378 | + */ |
|
370 | 379 | function SetIpRadiusServer($ip_radius_server) |
371 | 380 | { |
372 | 381 | $this->_ip_radius_server = gethostbyname($ip_radius_server); |
373 | 382 | } |
374 | 383 | |
375 | 384 | |
385 | + /** |
|
386 | + * @param string $shared_secret |
|
387 | + */ |
|
376 | 388 | function SetSharedSecret($shared_secret) |
377 | 389 | { |
378 | 390 | $this->_shared_secret = $shared_secret; |
379 | 391 | } |
380 | 392 | |
381 | 393 | |
394 | + /** |
|
395 | + * @param string $radius_suffix |
|
396 | + */ |
|
382 | 397 | function SetRadiusSuffix($radius_suffix) |
383 | 398 | { |
384 | 399 | $this->_radius_suffix = $radius_suffix; |
@@ -468,6 +483,9 @@ discard block |
||
468 | 483 | } |
469 | 484 | |
470 | 485 | |
486 | + /** |
|
487 | + * @param integer $authentication_port |
|
488 | + */ |
|
471 | 489 | function SetAuthenticationPort($authentication_port) |
472 | 490 | { |
473 | 491 | if ((intval($authentication_port) > 0) && (intval($authentication_port) < 65536)) |
@@ -477,6 +495,9 @@ discard block |
||
477 | 495 | } |
478 | 496 | |
479 | 497 | |
498 | + /** |
|
499 | + * @param integer $accounting_port |
|
500 | + */ |
|
480 | 501 | function SetAccountingPort($accounting_port) |
481 | 502 | { |
482 | 503 | if ((intval($accounting_port) > 0) && (intval($accounting_port) < 65536)) |
@@ -541,6 +562,9 @@ discard block |
||
541 | 562 | } |
542 | 563 | |
543 | 564 | |
565 | + /** |
|
566 | + * @param integer $info_index |
|
567 | + */ |
|
544 | 568 | function GetRadiusPacketInfo($info_index) |
545 | 569 | { |
546 | 570 | if (isset($this->_radius_packet_info[intval($info_index)])) |
@@ -567,6 +591,9 @@ discard block |
||
567 | 591 | } |
568 | 592 | |
569 | 593 | |
594 | + /** |
|
595 | + * @param string $debug_info |
|
596 | + */ |
|
570 | 597 | function DebugInfo($debug_info) |
571 | 598 | { |
572 | 599 | if ($this->_debug_mode) |
@@ -577,6 +604,9 @@ discard block |
||
577 | 604 | } |
578 | 605 | |
579 | 606 | |
607 | + /** |
|
608 | + * @param integer $type |
|
609 | + */ |
|
580 | 610 | function SetAttribute($type, $value) |
581 | 611 | { |
582 | 612 | $attribute_index = -1; |
@@ -631,6 +661,10 @@ discard block |
||
631 | 661 | } |
632 | 662 | |
633 | 663 | |
664 | + /** |
|
665 | + * @param string $attribute_raw_value |
|
666 | + * @param integer $attribute_format |
|
667 | + */ |
|
634 | 668 | function DecodeAttribute($attribute_raw_value, $attribute_format) |
635 | 669 | { |
636 | 670 | $attribute_value = NULL; |
@@ -330,11 +330,10 @@ discard block |
||
330 | 330 | |
331 | 331 | function GetLastError() |
332 | 332 | { |
333 | - if (0 < $this->_last_error_code) |
|
334 | - { |
|
333 | + if (0 < $this->_last_error_code) { |
|
335 | 334 | return $this->_last_error_message.' ('.$this->_last_error_code.')'; |
336 | - } else |
|
337 | - { |
|
335 | + } |
|
336 | + else { |
|
338 | 337 | return ''; |
339 | 338 | } |
340 | 339 | } |
@@ -387,8 +386,7 @@ discard block |
||
387 | 386 | function SetUsername($username = '') |
388 | 387 | { |
389 | 388 | $temp_username = $username; |
390 | - if (false === strpos($temp_username, '@')) |
|
391 | - { |
|
389 | + if (false === strpos($temp_username, '@')) { |
|
392 | 390 | $temp_username .= $this->_radius_suffix; |
393 | 391 | } |
394 | 392 | |
@@ -403,8 +401,7 @@ discard block |
||
403 | 401 | $encrypted_password = ''; |
404 | 402 | $padded_password = $password; |
405 | 403 | |
406 | - if (0 != (strlen($password) % 16)) |
|
407 | - { |
|
404 | + if (0 != (strlen($password) % 16)) { |
|
408 | 405 | $padded_password .= str_repeat(chr(0), (16 - strlen($password) % 16)); |
409 | 406 | } |
410 | 407 | |
@@ -432,11 +429,10 @@ discard block |
||
432 | 429 | |
433 | 430 | function SetNasIPAddress($nas_ip_address = '') |
434 | 431 | { |
435 | - if (0 < strlen($nas_ip_address)) |
|
436 | - { |
|
432 | + if (0 < strlen($nas_ip_address)) { |
|
437 | 433 | $this->_nas_ip_address = gethostbyname($nas_ip_address); |
438 | - } else |
|
439 | - { |
|
434 | + } |
|
435 | + else { |
|
440 | 436 | $this->_nas_ip_address = gethostbyname(isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0'); |
441 | 437 | } |
442 | 438 | $this->SetAttribute(4, $this->_nas_ip_address); |
@@ -452,8 +448,7 @@ discard block |
||
452 | 448 | |
453 | 449 | function SetUdpTimeout($udp_timeout = 5) |
454 | 450 | { |
455 | - if (intval($udp_timeout) > 0) |
|
456 | - { |
|
451 | + if (intval($udp_timeout) > 0) { |
|
457 | 452 | $this->_udp_timeout = intval($udp_timeout); |
458 | 453 | } |
459 | 454 | } |
@@ -468,8 +463,7 @@ discard block |
||
468 | 463 | |
469 | 464 | function SetAuthenticationPort($authentication_port) |
470 | 465 | { |
471 | - if ((intval($authentication_port) > 0) && (intval($authentication_port) < 65536)) |
|
472 | - { |
|
466 | + if ((intval($authentication_port) > 0) && (intval($authentication_port) < 65536)) { |
|
473 | 467 | $this->_authentication_port = intval($authentication_port); |
474 | 468 | } |
475 | 469 | } |
@@ -477,8 +471,7 @@ discard block |
||
477 | 471 | |
478 | 472 | function SetAccountingPort($accounting_port) |
479 | 473 | { |
480 | - if ((intval($accounting_port) > 0) && (intval($accounting_port) < 65536)) |
|
481 | - { |
|
474 | + if ((intval($accounting_port) > 0) && (intval($accounting_port) < 65536)) { |
|
482 | 475 | $this->_accounting_port = intval($accounting_port); |
483 | 476 | } |
484 | 477 | } |
@@ -499,21 +492,19 @@ discard block |
||
499 | 492 | function GetReadableReceivedAttributes() |
500 | 493 | { |
501 | 494 | $readable_attributes = ''; |
502 | - if (isset($this->_attributes_received)) |
|
503 | - { |
|
495 | + if (isset($this->_attributes_received)) { |
|
504 | 496 | foreach ($this->_attributes_received as $one_received_attribute) |
505 | 497 | { |
506 | 498 | $attributes_info = $this->GetAttributesInfo($one_received_attribute[0]); |
507 | 499 | $readable_attributes .= $attributes_info[0].": "; |
508 | - if (26 == $one_received_attribute[0]) |
|
509 | - { |
|
500 | + if (26 == $one_received_attribute[0]) { |
|
510 | 501 | $vendor_array = $this->DecodeVendorSpecificContent($one_received_attribute[1]); |
511 | 502 | foreach ($vendor_array as $vendor_one) |
512 | 503 | { |
513 | 504 | $readable_attributes .= 'Vendor-Id: '.$vendor_one[0].", Vendor-type: ".$vendor_one[1].", Attribute-specific: ".$vendor_one[2]; |
514 | 505 | } |
515 | - } else |
|
516 | - { |
|
506 | + } |
|
507 | + else { |
|
517 | 508 | $readable_attributes .= $one_received_attribute[1]; |
518 | 509 | } |
519 | 510 | $readable_attributes .= "<br />\n"; |
@@ -528,8 +519,7 @@ discard block |
||
528 | 519 | $attribute_value = NULL; |
529 | 520 | foreach ($this->_attributes_received as $one_received_attribute) |
530 | 521 | { |
531 | - if (intval($attribute_type) == $one_received_attribute[0]) |
|
532 | - { |
|
522 | + if (intval($attribute_type) == $one_received_attribute[0]) { |
|
533 | 523 | $attribute_value = $one_received_attribute[1]; |
534 | 524 | break; |
535 | 525 | } |
@@ -540,11 +530,10 @@ discard block |
||
540 | 530 | |
541 | 531 | function GetRadiusPacketInfo($info_index) |
542 | 532 | { |
543 | - if (isset($this->_radius_packet_info[intval($info_index)])) |
|
544 | - { |
|
533 | + if (isset($this->_radius_packet_info[intval($info_index)])) { |
|
545 | 534 | return $this->_radius_packet_info[intval($info_index)]; |
546 | - } else |
|
547 | - { |
|
535 | + } |
|
536 | + else { |
|
548 | 537 | return ''; |
549 | 538 | } |
550 | 539 | } |
@@ -552,11 +541,10 @@ discard block |
||
552 | 541 | |
553 | 542 | function GetAttributesInfo($info_index) |
554 | 543 | { |
555 | - if (isset($this->_attributes_info[intval($info_index)])) |
|
556 | - { |
|
544 | + if (isset($this->_attributes_info[intval($info_index)])) { |
|
557 | 545 | return $this->_attributes_info[intval($info_index)]; |
558 | - } else |
|
559 | - { |
|
546 | + } |
|
547 | + else { |
|
560 | 548 | return array('', ''); |
561 | 549 | } |
562 | 550 | } |
@@ -564,8 +552,7 @@ discard block |
||
564 | 552 | |
565 | 553 | function DebugInfo($debug_info) |
566 | 554 | { |
567 | - if ($this->_debug_mode) |
|
568 | - { |
|
555 | + if ($this->_debug_mode) { |
|
569 | 556 | //save debugging |
570 | 557 | $this->debug_text[] = date('Y-m-d H:i:s').' DEBUG: '.$debug_info; |
571 | 558 | } |
@@ -577,8 +564,7 @@ discard block |
||
577 | 564 | $attribute_index = -1; |
578 | 565 | for ($attributes_loop = 0; $attributes_loop < count($this->_attributes_to_send); $attributes_loop++) |
579 | 566 | { |
580 | - if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1))) |
|
581 | - { |
|
567 | + if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1))) { |
|
582 | 568 | $attribute_index = $attributes_loop; |
583 | 569 | break; |
584 | 570 | } |
@@ -586,10 +572,8 @@ discard block |
||
586 | 572 | |
587 | 573 | $temp_attribute = NULL; |
588 | 574 | |
589 | - if (isset($this->_attributes_info[$type])) |
|
590 | - { |
|
591 | - switch ($this->_attributes_info[$type][1]) |
|
592 | - { |
|
575 | + if (isset($this->_attributes_info[$type])) { |
|
576 | + switch ($this->_attributes_info[$type][1]) { |
|
593 | 577 | case 'T': // Text, 1-253 octets containing UTF-8 encoded ISO 10646 characters (RFC 2279). |
594 | 578 | $temp_attribute = chr($type).chr(2 + strlen($value)).$value; |
595 | 579 | break; |
@@ -611,12 +595,11 @@ discard block |
||
611 | 595 | } |
612 | 596 | } |
613 | 597 | |
614 | - if ($attribute_index > -1) |
|
615 | - { |
|
598 | + if ($attribute_index > -1) { |
|
616 | 599 | $this->_attributes_to_send[$attribute_index] = $temp_attribute; |
617 | 600 | $additional_debug = 'Modified'; |
618 | - } else |
|
619 | - { |
|
601 | + } |
|
602 | + else { |
|
620 | 603 | $this->_attributes_to_send[] = $temp_attribute; |
621 | 604 | $additional_debug = 'Added'; |
622 | 605 | } |
@@ -629,10 +612,8 @@ discard block |
||
629 | 612 | { |
630 | 613 | $attribute_value = NULL; |
631 | 614 | |
632 | - if (isset($this->_attributes_info[$attribute_format])) |
|
633 | - { |
|
634 | - switch ($this->_attributes_info[$attribute_format][1]) |
|
635 | - { |
|
615 | + if (isset($this->_attributes_info[$attribute_format])) { |
|
616 | + switch ($this->_attributes_info[$attribute_format][1]) { |
|
636 | 617 | case 'T': // Text, 1-253 octets containing UTF-8 encoded ISO 10646 characters (RFC 2279). |
637 | 618 | $attribute_value = $attribute_raw_value; |
638 | 619 | break; |
@@ -690,26 +671,22 @@ discard block |
||
690 | 671 | |
691 | 672 | $this->SetPacketCodeToSend(1); // Access-Request |
692 | 673 | |
693 | - if (0 < strlen($username)) |
|
694 | - { |
|
674 | + if (0 < strlen($username)) { |
|
695 | 675 | $this->SetUsername($username); |
696 | 676 | } |
697 | 677 | |
698 | - if (0 < strlen($password)) |
|
699 | - { |
|
678 | + if (0 < strlen($password)) { |
|
700 | 679 | $this->SetPassword($password); |
701 | 680 | } |
702 | 681 | |
703 | - if ($state !== NULL) |
|
704 | - { |
|
682 | + if ($state !== NULL) { |
|
705 | 683 | $this->SetAttribute(24, $state); |
706 | - } else |
|
707 | - { |
|
684 | + } |
|
685 | + else { |
|
708 | 686 | $this->SetAttribute(6, 1); // 1=Login |
709 | 687 | } |
710 | 688 | |
711 | - if (intval($udp_timeout) > 0) |
|
712 | - { |
|
689 | + if (intval($udp_timeout) > 0) { |
|
713 | 690 | $this->SetUdpTimeout($udp_timeout); |
714 | 691 | } |
715 | 692 | |
@@ -732,23 +709,21 @@ discard block |
||
732 | 709 | |
733 | 710 | $_socket_to_server = socket_create(AF_INET, SOCK_DGRAM, 17); // UDP packet = 17 |
734 | 711 | |
735 | - if ($_socket_to_server === FALSE) |
|
736 | - { |
|
712 | + if ($_socket_to_server === FALSE) { |
|
737 | 713 | $this->_last_error_code = socket_last_error(); |
738 | 714 | $this->_last_error_message = socket_strerror($this->_last_error_code); |
739 | - } elseif (FALSE === socket_connect($_socket_to_server, $this->_ip_radius_server, $this->_authentication_port)) |
|
740 | - { |
|
715 | + } |
|
716 | + elseif (FALSE === socket_connect($_socket_to_server, $this->_ip_radius_server, $this->_authentication_port)) { |
|
741 | 717 | $this->_last_error_code = socket_last_error(); |
742 | 718 | $this->_last_error_message = socket_strerror($this->_last_error_code); |
743 | - } elseif (FALSE === socket_write($_socket_to_server, $packet_data, $packet_length)) |
|
744 | - { |
|
719 | + } |
|
720 | + elseif (FALSE === socket_write($_socket_to_server, $packet_data, $packet_length)) { |
|
745 | 721 | $this->_last_error_code = socket_last_error(); |
746 | 722 | $this->_last_error_message = socket_strerror($this->_last_error_code); |
747 | - } else |
|
748 | - { |
|
723 | + } |
|
724 | + else { |
|
749 | 725 | $this->DebugInfo('<b>Packet type '.$this->_radius_packet_to_send.' ('.$this->GetRadiusPacketInfo($this->_radius_packet_to_send).')'.' sent</b>'); |
750 | - if ($this->_debug_mode) |
|
751 | - { |
|
726 | + if ($this->_debug_mode) { |
|
752 | 727 | $readable_attributes = ''; |
753 | 728 | foreach ($this->_attributes_to_send as $one_attribute_to_send) |
754 | 729 | { |
@@ -762,10 +737,8 @@ discard block |
||
762 | 737 | |
763 | 738 | $received_packet = chr(0); |
764 | 739 | |
765 | - if (!(FALSE === socket_select($read_socket_array, $write_socket_array, $except_socket_array, $this->_udp_timeout))) |
|
766 | - { |
|
767 | - if (in_array($_socket_to_server, $read_socket_array)) |
|
768 | - { |
|
740 | + if (!(FALSE === socket_select($read_socket_array, $write_socket_array, $except_socket_array, $this->_udp_timeout))) { |
|
741 | + if (in_array($_socket_to_server, $read_socket_array)) { |
|
769 | 742 | if (FALSE === ($received_packet = @socket_read($_socket_to_server, 1024))) { |
770 | 743 | // @ used, than no error is displayed if the connection is closed by the remote host |
771 | 744 | { |
@@ -773,13 +746,13 @@ discard block |
||
773 | 746 | } |
774 | 747 | $this->_last_error_code = socket_last_error(); |
775 | 748 | $this->_last_error_message = socket_strerror($this->_last_error_code); |
776 | - } else |
|
777 | - { |
|
749 | + } |
|
750 | + else { |
|
778 | 751 | socket_close($_socket_to_server); |
779 | 752 | } |
780 | 753 | } |
781 | - } else |
|
782 | - { |
|
754 | + } |
|
755 | + else { |
|
783 | 756 | socket_close($_socket_to_server); |
784 | 757 | } |
785 | 758 | } |
@@ -788,8 +761,7 @@ discard block |
||
788 | 761 | |
789 | 762 | $this->DebugInfo('<b>Packet type '.$this->_radius_packet_received.' ('.$this->GetRadiusPacketInfo($this->_radius_packet_received).')'.' received</b>'); |
790 | 763 | |
791 | - if ($this->_radius_packet_received > 0) |
|
792 | - { |
|
764 | + if ($this->_radius_packet_received > 0) { |
|
793 | 765 | $this->_identifier_received = intval(ord(substr($received_packet, 1, 1))); |
794 | 766 | $packet_length = (intval(ord(substr($received_packet, 2, 1))) * 256) + (intval(ord(substr($received_packet, 3, 1)))); |
795 | 767 | $this->_response_authenticator = substr($received_packet, 4, 16); |
@@ -804,15 +776,14 @@ discard block |
||
804 | 776 | $attribute_value = $this->DecodeAttribute($attribute_raw_value, $attribute_type); |
805 | 777 | |
806 | 778 | $attribute_info = $this->GetAttributesInfo($attribute_type); |
807 | - if (26 == $attribute_type) |
|
808 | - { |
|
779 | + if (26 == $attribute_type) { |
|
809 | 780 | $vendor_array = $this->DecodeVendorSpecificContent($attribute_value); |
810 | 781 | foreach ($vendor_array as $vendor_one) |
811 | 782 | { |
812 | 783 | $this->DebugInfo('Attribute '.$attribute_type.' ('.$attribute_info[0].'), length '.($attribute_length - 2).', format '.$attribute_info[1].', Vendor-Id: '.$vendor_one[0].", Vendor-type: ".$vendor_one[1].", Attribute-specific: ".$vendor_one[2]); |
813 | 784 | } |
814 | - } else |
|
815 | - { |
|
785 | + } |
|
786 | + else { |
|
816 | 787 | $this->DebugInfo('Attribute '.$attribute_type.' ('.$attribute_info[0].'), length '.($attribute_length - 2).', format '.$attribute_info[1].', value <em>'.$attribute_value.'</em>'); |
817 | 788 | } |
818 | 789 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @access public |
73 | 73 | * @param string $text (default: "No value provided") |
74 | - * @return void |
|
74 | + * @return string |
|
75 | 75 | */ |
76 | 76 | public function show_cli_message ($text="No value provided") { |
77 | 77 | // array - join |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * Show GUI result |
96 | 96 | * |
97 | 97 | * @access public |
98 | - * @param mixed $class |
|
99 | - * @param mixed $text |
|
100 | - * @param mixed $popup |
|
101 | - * @param mixed $popup2 |
|
102 | - * @return void |
|
98 | + * @param string $class |
|
99 | + * @param string $text |
|
100 | + * @param boolean $popup |
|
101 | + * @param boolean $popup2 |
|
102 | + * @return string |
|
103 | 103 | */ |
104 | 104 | public function show_message ($class, $text, $popup, $popup2) { |
105 | 105 | // format if array |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Exists with exception for API |
145 | 145 | * |
146 | 146 | * @access public |
147 | - * @param mixed $content |
|
147 | + * @param string $content |
|
148 | 148 | * @return void |
149 | 149 | */ |
150 | 150 | public function throw_exception ($content) { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $this->die = $die; |
36 | 36 | |
37 | 37 | # API - throw exception |
38 | - if($this->exit_method == "exception") { |
|
38 | + if($this->exit_method == "exception") { |
|
39 | 39 | # ok, just return success |
40 | 40 | if ($class=="success") { return true; } |
41 | 41 | else { return $this->throw_exception ($text); } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * Returns all possible ping types / apps |
63 | 63 | * |
64 | 64 | * @access public |
65 | - * @return array |
|
65 | + * @return string[] |
|
66 | 66 | */ |
67 | 67 | public function ping_fetch_types () { |
68 | 68 | return array("ping", "pear", "fping"); |
@@ -152,7 +152,6 @@ discard block |
||
152 | 152 | * @param mixed $address |
153 | 153 | * @param int $count (default: 1) |
154 | 154 | * @param int $timeout (default: 1) |
155 | - * @param bool $exit (default: false) |
|
156 | 155 | * @return void |
157 | 156 | */ |
158 | 157 | public function ping_address ($address, $count=1, $timeout = 1) { |
@@ -178,7 +177,7 @@ discard block |
||
178 | 177 | * |
179 | 178 | * @access protected |
180 | 179 | * @param ip $address |
181 | - * @return void |
|
180 | + * @return null|integer |
|
182 | 181 | */ |
183 | 182 | protected function ping_address_method_ping ($address) { |
184 | 183 | # verify ping path |
@@ -276,8 +275,7 @@ discard block |
||
276 | 275 | * fping cannot be run from web, it needs root privileges to be able to open raw socket :/ |
277 | 276 | * |
278 | 277 | * @access public |
279 | - * @param mixed $subnet //CIDR |
|
280 | - * @return void |
|
278 | + * @return null|integer |
|
281 | 279 | */ |
282 | 280 | public function ping_address_method_fping ($address) { |
283 | 281 | # verify ping path |
@@ -329,7 +327,7 @@ discard block |
||
329 | 327 | * fping cannot be run from web, it needs root privileges to be able to open raw socket :/ |
330 | 328 | * |
331 | 329 | * @access public |
332 | - * @param mixed $subnet //CIDR |
|
330 | + * @param mixed $subnet_cidr //CIDR |
|
333 | 331 | * @return void |
334 | 332 | */ |
335 | 333 | public function ping_address_method_fping_subnet ($subnet_cidr, $return_result = false) { |
@@ -377,8 +375,8 @@ discard block |
||
377 | 375 | * Explains invalid error codes |
378 | 376 | * |
379 | 377 | * @access public |
380 | - * @param mixed $code |
|
381 | - * @return void |
|
378 | + * @param null|integer $code |
|
379 | + * @return string|false |
|
382 | 380 | */ |
383 | 381 | public function ping_exit_explain ($code) { |
384 | 382 | # fetch explain codes |
@@ -396,7 +394,7 @@ discard block |
||
396 | 394 | * extend if needed for future scripts |
397 | 395 | * |
398 | 396 | * @access public |
399 | - * @return void |
|
397 | + * @return string[] |
|
400 | 398 | */ |
401 | 399 | public function ping_set_exit_code_explains () { |
402 | 400 | $explain_codes[0] = "SUCCESS"; |
@@ -523,6 +521,7 @@ discard block |
||
523 | 521 | * |
524 | 522 | * @access public |
525 | 523 | * @param mixed $subnetId |
524 | + * @param boolean $die |
|
526 | 525 | * @return void |
527 | 526 | */ |
528 | 527 | public function prepare_addresses_to_discover_subnetId ($subnetId, $die) { |
@@ -431,8 +431,7 @@ discard block |
||
431 | 431 | # set datetime |
432 | 432 | $datetime = is_null($datetime) ? date("Y-m-d H:i:s") : $datetime; |
433 | 433 | # execute |
434 | - try { $this->Database->updateObject("ipaddresses", array("id"=>$id, "lastSeen"=>$datetime), "id"); } |
|
435 | - catch (Exception $e) { |
|
434 | + try { $this->Database->updateObject("ipaddresses", array("id"=>$id, "lastSeen"=>$datetime), "id"); } catch (Exception $e) { |
|
436 | 435 | !$this->debugging ? : $this->Result->show("danger", $e->getMessage(), false); |
437 | 436 | # log |
438 | 437 | !$this->debugging ? : $this->Log->write ("status_update", _('Failed to update address status'), 0 ); |
@@ -452,8 +451,7 @@ discard block |
||
452 | 451 | if ($date === false) { $date = date("Y-m-d H:i:s"); } |
453 | 452 | else { $date = $date; } |
454 | 453 | # execute |
455 | - try { $this->Database->updateObject("scanAgents", array("id"=>$id, "last_access"=>date("Y-m-d H:i:s")), "id"); } |
|
456 | - catch (Exception $e) { |
|
454 | + try { $this->Database->updateObject("scanAgents", array("id"=>$id, "last_access"=>date("Y-m-d H:i:s")), "id"); } catch (Exception $e) { |
|
457 | 455 | } |
458 | 456 | } |
459 | 457 | |
@@ -477,7 +475,7 @@ discard block |
||
477 | 475 | //failed |
478 | 476 | if (!$conn) {} |
479 | 477 | //success |
480 | - else { |
|
478 | + else { |
|
481 | 479 | $retval = 0; //set return as port if alive |
482 | 480 | fclose($conn); |
483 | 481 | break; //end foreach if success |
@@ -531,14 +529,16 @@ discard block |
||
531 | 529 | |
532 | 530 | //subnet ID is provided, fetch subnet |
533 | 531 | $subnet = $Subnets->fetch_subnet(null, $subnetId); |
534 | - if($subnet===false) { |
|
532 | + if($subnet===false) { |
|
535 | 533 | if ($die) { die(json_encode(array("status"=>1, "error"=>"Invalid subnet ID provided"))); } |
536 | 534 | else { return array(); } |
537 | 535 | } |
538 | 536 | |
539 | 537 | // we should support only up to 4094 hosts! |
540 | - if($Subnets->get_max_hosts ($subnet->mask, "IPv4")>4094 && php_sapi_name()!="cli") |
|
541 | - if ($die) { die(json_encode(array("status"=>1, "error"=>"Scanning from GUI is only available for subnets up to /20 or 4094 hosts!"))); } |
|
538 | + if($Subnets->get_max_hosts ($subnet->mask, "IPv4")>4094 && php_sapi_name()!="cli") { |
|
539 | + if ($die) { die(json_encode(array("status"=>1, "error"=>"Scanning from GUI is only available for subnets up to /20 or 4094 hosts!"))); |
|
540 | + } |
|
541 | + } |
|
542 | 542 | else { return array(); } |
543 | 543 | |
544 | 544 | # set array of addresses to scan, exclude existing! |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | $ip = $this->remove_existing_subnet_addresses ($ip, $subnetId); |
549 | 549 | |
550 | 550 | //none to scan? |
551 | - if(sizeof($ip)==0) { |
|
551 | + if(sizeof($ip)==0) { |
|
552 | 552 | if ($die) { die(json_encode(array("status"=>1, "error"=>"Didn't find any address to scan!"))); } |
553 | 553 | else { return array(); } |
554 | 554 | } |
@@ -72,7 +72,9 @@ |
||
72 | 72 | function get_string_between($string, $start, $end){ |
73 | 73 | $string = " ".$string; |
74 | 74 | $ini = strpos($string,$start); |
75 | - if ($ini == 0) return ""; |
|
75 | + if ($ini == 0) { |
|
76 | + return ""; |
|
77 | + } |
|
76 | 78 | $ini += strlen($start); |
77 | 79 | $len = strpos($string,$end,$ini) - $ini; |
78 | 80 | return substr($string,$ini,$len); |
@@ -248,7 +248,7 @@ |
||
248 | 248 | /** |
249 | 249 | * alias of stop(); |
250 | 250 | * |
251 | - * @return boolean |
|
251 | + * @return boolean|null |
|
252 | 252 | */ |
253 | 253 | public function kill( $_signal = SIGKILL, $_wait = false ) { |
254 | 254 | return $this->stop( $_signal, $_wait ); |
@@ -133,10 +133,13 @@ discard block |
||
133 | 133 | public function isAlive() { |
134 | 134 | $pid = pcntl_waitpid( $this->pid, $status, WNOHANG ); |
135 | 135 | |
136 | - if ($pid === 0) { // child is still alive |
|
136 | + if ($pid === 0) { |
|
137 | +// child is still alive |
|
137 | 138 | return true; |
138 | - } else { |
|
139 | - if (pcntl_wifexited($status) && $this->exitCode == -1) { // normal exit |
|
139 | + } |
|
140 | + else { |
|
141 | + if (pcntl_wifexited($status) && $this->exitCode == -1) { |
|
142 | +// normal exit |
|
140 | 143 | $this->exitCode = pcntl_wexitstatus($status); |
141 | 144 | } |
142 | 145 | return false; |
@@ -196,12 +199,17 @@ discard block |
||
196 | 199 | $results = null; |
197 | 200 | $pid = pcntl_fork(); |
198 | 201 | |
199 | - if( $pid == -1 ) { //error forking, no child is created |
|
202 | + if( $pid == -1 ) { |
|
203 | +//error forking, no child is created |
|
200 | 204 | throw new Exception( $this->getError( Thread::COULD_NOT_FORK ), Thread::COULD_NOT_FORK ); |
201 | - }else if ( $pid ) {// parent |
|
205 | + } |
|
206 | + else if ( $pid ) { |
|
207 | +// parent |
|
202 | 208 | $this->pid = $pid; |
203 | 209 | |
204 | - } else { // child |
|
210 | + } |
|
211 | + else { |
|
212 | +// child |
|
205 | 213 | $this->pid = posix_getpid();//pid (child) |
206 | 214 | $this->ppid = posix_getppid();//pid (parent) |
207 | 215 | |
@@ -209,13 +217,15 @@ discard block |
||
209 | 217 | $array_args = func_get_args(); |
210 | 218 | if ( !empty( $array_args ) ) { |
211 | 219 | $results = call_user_func_array( $this->runnable, $array_args ); |
212 | - }else{ |
|
220 | + } |
|
221 | + else { |
|
213 | 222 | $results = call_user_func( $this->runnable ); |
214 | 223 | } |
215 | 224 | |
216 | 225 | $pipe = "/tmp/pipe_".$this->pid;//pid is known by parent |
217 | 226 | |
218 | - if(!file_exists($pipe)) {//child talks to parent using this pipe |
|
227 | + if(!file_exists($pipe)) { |
|
228 | +//child talks to parent using this pipe |
|
219 | 229 | umask(0); |
220 | 230 | posix_mkfifo($pipe, 0600); |
221 | 231 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param bool $drop_database (default: false) |
68 | 68 | * @param bool $create_database (default: false) |
69 | 69 | * @param bool $create_grants (default: false) |
70 | - * @return void |
|
70 | + * @return boolean|null |
|
71 | 71 | */ |
72 | 72 | public function install_database ($rootuser, $rootpass, $drop_database = false, $create_database = false, $create_grants = false) { |
73 | 73 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * Execute files installation |
146 | 146 | * |
147 | 147 | * @access private |
148 | - * @return void |
|
148 | + * @return false|null |
|
149 | 149 | */ |
150 | 150 | private function install_database_execute () { |
151 | 151 | # import SCHEMA file queries |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @access public |
199 | 199 | * @param bool $redirect |
200 | - * @return void |
|
200 | + * @return boolean |
|
201 | 201 | */ |
202 | 202 | public function check_db_connection ($redirect = false) { |
203 | 203 | # try to connect |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @access public |
219 | 219 | * @param mixed $table |
220 | - * @return void |
|
220 | + * @return boolean |
|
221 | 221 | */ |
222 | 222 | public function check_table ($table, $redirect = false) { |
223 | 223 | # set query |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param mixed $adminpass |
285 | 285 | * @param mixed $siteTitle |
286 | 286 | * @param mixed $siteURL |
287 | - * @return void |
|
287 | + * @return boolean |
|
288 | 288 | */ |
289 | 289 | function postauth_update($adminpass, $siteTitle, $siteURL) { |
290 | 290 | # update Admin pass |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @access public |
302 | 302 | * @param mixed $adminpass |
303 | - * @return void |
|
303 | + * @return boolean |
|
304 | 304 | */ |
305 | 305 | public function postauth_update_admin_pass ($adminpass) { |
306 | 306 | try { $this->Database->updateObject("users", array("password"=>$adminpass, "passChange"=>"No","username"=>"Admin"), "username"); } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @access private |
315 | 315 | * @param mixed $siteTitle |
316 | 316 | * @param mixed $siteURL |
317 | - * @return void |
|
317 | + * @return boolean |
|
318 | 318 | */ |
319 | 319 | private function postauth_update_settings ($siteTitle, $siteURL) { |
320 | 320 | try { $this->Database->updateObject("settings", array("siteTitle"=>$siteTitle, "siteURL"=>$siteURL,"id"=>1), "id"); } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * Upgrade database checks and executes. |
341 | 341 | * |
342 | 342 | * @access public |
343 | - * @return void |
|
343 | + * @return null|boolean |
|
344 | 344 | */ |
345 | 345 | public function upgrade_database () { |
346 | 346 | # first check version |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * Execute database upgrade. |
362 | 362 | * |
363 | 363 | * @access private |
364 | - * @return void |
|
364 | + * @return boolean |
|
365 | 365 | */ |
366 | 366 | private function upgrade_database_execute () { |
367 | 367 | # set queries |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * Fetch all upgrade queries from DB files |
409 | 409 | * |
410 | 410 | * @access public |
411 | - * @return void |
|
411 | + * @return string |
|
412 | 412 | */ |
413 | 413 | public function get_upgrade_queries () { |
414 | 414 | // save all queries fro UPDATE.sql file |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | # set debugging |
42 | 42 | $this->set_db_params (); |
43 | 43 | # Log object |
44 | - try { $this->Database->connect(); } |
|
45 | - catch ( Exception $e ) {} |
|
44 | + try { $this->Database->connect(); } catch ( Exception $e ) {} |
|
46 | 45 | } |
47 | 46 | |
48 | 47 | |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | # set query |
110 | 109 | $query = "drop database if exists `". $this->db['name'] ."`;"; |
111 | 110 | # execute |
112 | - try { $this->Database_root->runQuery($query); } |
|
113 | - catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
111 | + try { $this->Database_root->runQuery($query); } catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
114 | 112 | } |
115 | 113 | |
116 | 114 | /** |
@@ -123,8 +121,7 @@ discard block |
||
123 | 121 | # set query |
124 | 122 | $query = "create database `". $this->db['name'] ."`;"; |
125 | 123 | # execute |
126 | - try { $this->Database_root->runQuery($query); } |
|
127 | - catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
124 | + try { $this->Database_root->runQuery($query); } catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
128 | 125 | } |
129 | 126 | |
130 | 127 | /** |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | # set query |
138 | 135 | $query = 'grant ALL on `'. $this->db['name'] .'`.* to '. $this->db['user'] .'@localhost identified by "'. $this->db['pass'] .'";'; |
139 | 136 | # execute |
140 | - try { $this->Database_root->runQuery($query); } |
|
141 | - catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
137 | + try { $this->Database_root->runQuery($query); } catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), true);} |
|
142 | 138 | } |
143 | 139 | |
144 | 140 | /** |
@@ -158,14 +154,11 @@ discard block |
||
158 | 154 | foreach($queries as $q) { |
159 | 155 | //length check |
160 | 156 | if (strlen($q)>0) { |
161 | - try { $this->Database_root->runQuery($q.";"); } |
|
162 | - catch (Exception $e) { |
|
157 | + try { $this->Database_root->runQuery($q.";"); } catch (Exception $e) { |
|
163 | 158 | //unlock tables |
164 | - try { $this->Database_root->runQuery("UNLOCK TABLES;"); } |
|
165 | - catch (Exception $e) {} |
|
159 | + try { $this->Database_root->runQuery("UNLOCK TABLES;"); } catch (Exception $e) {} |
|
166 | 160 | //drop database |
167 | - try { $this->Database_root->runQuery("drop database if exists `". $this->db['name'] ."`;"); } |
|
168 | - catch (Exception $e) { |
|
161 | + try { $this->Database_root->runQuery("drop database if exists `". $this->db['name'] ."`;"); } catch (Exception $e) { |
|
169 | 162 | $this->Result->show("danger", 'Cannot drop database: '.$e->getMessage(), true); |
170 | 163 | } |
171 | 164 | //print error |
@@ -201,8 +194,7 @@ discard block |
||
201 | 194 | */ |
202 | 195 | public function check_db_connection ($redirect = false) { |
203 | 196 | # try to connect |
204 | - try { $res = $this->Database->connect(); } |
|
205 | - catch (Exception $e) { |
|
197 | + try { $res = $this->Database->connect(); } catch (Exception $e) { |
|
206 | 198 | $this->exception = $e->getMessage(); |
207 | 199 | # redirect ? |
208 | 200 | if($redirect == true) { $this->redirect_to_install (); } |
@@ -223,10 +215,21 @@ discard block |
||
223 | 215 | # set query |
224 | 216 | $query = "SELECT COUNT(*) AS `cnt` FROM information_schema.tables WHERE table_schema = '".$this->db['name']."' AND table_name = '$table';"; |
225 | 217 | # try to fetch count |
226 | - try { $table = $this->Database->getObjectQuery($query); } |
|
227 | - catch (Exception $e) { if($redirect === true) $this->redirect_to_install (); else return false; } |
|
218 | + try { $table = $this->Database->getObjectQuery($query); } catch (Exception $e) { if($redirect === true) { |
|
219 | + $this->redirect_to_install (); |
|
220 | + } |
|
221 | + else { |
|
222 | + return false; |
|
223 | + } |
|
224 | + } |
|
228 | 225 | # redirect if it is not existing |
229 | - if($table->cnt!=1) { if($redirect === true) $this->redirect_to_install (); else return false; } |
|
226 | + if($table->cnt!=1) { if($redirect === true) { |
|
227 | + $this->redirect_to_install (); |
|
228 | + } |
|
229 | + else { |
|
230 | + return false; |
|
231 | + } |
|
232 | + } |
|
230 | 233 | # ok |
231 | 234 | return true; |
232 | 235 | } |
@@ -303,8 +306,7 @@ discard block |
||
303 | 306 | * @return void |
304 | 307 | */ |
305 | 308 | public function postauth_update_admin_pass ($adminpass) { |
306 | - try { $this->Database->updateObject("users", array("password"=>$adminpass, "passChange"=>"No","username"=>"Admin"), "username"); } |
|
307 | - catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), false); } |
|
309 | + try { $this->Database->updateObject("users", array("password"=>$adminpass, "passChange"=>"No","username"=>"Admin"), "username"); } catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), false); } |
|
308 | 310 | return true; |
309 | 311 | } |
310 | 312 | |
@@ -317,8 +319,7 @@ discard block |
||
317 | 319 | * @return void |
318 | 320 | */ |
319 | 321 | private function postauth_update_settings ($siteTitle, $siteURL) { |
320 | - try { $this->Database->updateObject("settings", array("siteTitle"=>$siteTitle, "siteURL"=>$siteURL,"id"=>1), "id"); } |
|
321 | - catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), false); } |
|
322 | + try { $this->Database->updateObject("settings", array("siteTitle"=>$siteTitle, "siteURL"=>$siteURL,"id"=>1), "id"); } catch (Exception $e) { $this->Result->show("danger", $e->getMessage(), false); } |
|
322 | 323 | return true; |
323 | 324 | } |
324 | 325 | |
@@ -378,8 +379,7 @@ discard block |
||
378 | 379 | # execute all queries |
379 | 380 | foreach($queries as $query) { |
380 | 381 | if (strlen($query)>5) { |
381 | - try { $this->Database->runQuery($query); } |
|
382 | - catch (Exception $e) { |
|
382 | + try { $this->Database->runQuery($query); } catch (Exception $e) { |
|
383 | 383 | $this->Log = new Logging ($this->Database); |
384 | 384 | # write log |
385 | 385 | $this->Log->write( "Database upgrade", $e->getMessage()."<br>query: ".$query, 2 ); |
@@ -80,7 +80,6 @@ discard block |
||
80 | 80 | * Sets header based on provided HTTP code |
81 | 81 | * |
82 | 82 | * @access private |
83 | - * @param mixed $code |
|
84 | 83 | * @return void |
85 | 84 | */ |
86 | 85 | private function set_header () { |
@@ -99,7 +98,7 @@ discard block |
||
99 | 98 | * |
100 | 99 | * @access public |
101 | 100 | * @param mixed $result |
102 | - * @return void |
|
101 | + * @return string |
|
103 | 102 | */ |
104 | 103 | public function formulate_result ($result) { |
105 | 104 | // make sure result is array |
@@ -210,7 +209,7 @@ discard block |
||
210 | 209 | * Outputs result |
211 | 210 | * |
212 | 211 | * @access private |
213 | - * @return void |
|
212 | + * @return string |
|
214 | 213 | */ |
215 | 214 | private function create_result () { |
216 | 215 | // reorder |
@@ -239,7 +238,7 @@ discard block |
||
239 | 238 | * Creates XML result |
240 | 239 | * |
241 | 240 | * @access private |
242 | - * @return void |
|
241 | + * @return string|false |
|
243 | 242 | */ |
244 | 243 | private function create_xml () { |
245 | 244 | // convert whole object to array |
@@ -329,7 +328,7 @@ discard block |
||
329 | 328 | * Creates JSON result |
330 | 329 | * |
331 | 330 | * @access private |
332 | - * @return void |
|
331 | + * @return string |
|
333 | 332 | */ |
334 | 333 | private function create_json () { |
335 | 334 | return json_encode((array) $this->result); |
@@ -270,7 +270,9 @@ discard block |
||
270 | 270 | if(strpos($key, " ")>0) { $key = str_replace(" ", "_", $key); } |
271 | 271 | |
272 | 272 | // if key is numeric append item |
273 | - if(is_numeric($key)) $key = "item".$key; |
|
273 | + if(is_numeric($key)) { |
|
274 | + $key = "item".$key; |
|
275 | + } |
|
274 | 276 | |
275 | 277 | // if array add child |
276 | 278 | if (is_array($value)) { |
@@ -300,8 +302,9 @@ discard block |
||
300 | 302 | * @license CC-BY-3.0 <http://spdx.org/licenses/CC-BY-3.0> |
301 | 303 | */ |
302 | 304 | public function xml_to_array ( $xmlObject, $out = array () ) { |
303 | - foreach ( (array) $xmlObject as $index => $node ) |
|
304 | - $out[$index] = ( is_object ( $node ) ) ? $this->xml_to_array ( $node ) : $node; |
|
305 | + foreach ( (array) $xmlObject as $index => $node ) { |
|
306 | + $out[$index] = ( is_object ( $node ) ) ? $this->xml_to_array ( $node ) : $node; |
|
307 | + } |
|
305 | 308 | |
306 | 309 | return $out; |
307 | 310 | } |
@@ -315,14 +318,18 @@ discard block |
||
315 | 318 | */ |
316 | 319 | private function object_to_array ($obj) { |
317 | 320 | // object to array |
318 | - if(is_object($obj)) $obj = (array) $obj; |
|
321 | + if(is_object($obj)) { |
|
322 | + $obj = (array) $obj; |
|
323 | + } |
|
319 | 324 | if(is_array($obj)) { |
320 | 325 | $new = array(); |
321 | 326 | foreach($obj as $key => $val) { |
322 | 327 | $new[$key] = $this->object_to_array($val); |
323 | 328 | } |
324 | 329 | } |
325 | - else $new = $obj; |
|
330 | + else { |
|
331 | + $new = $obj; |
|
332 | + } |
|
326 | 333 | return $new; |
327 | 334 | } |
328 | 335 |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * Validates users token from database |
331 | 331 | * |
332 | 332 | * @access private |
333 | - * @return void |
|
333 | + * @return boolean |
|
334 | 334 | */ |
335 | 335 | private function validate_user_token () { |
336 | 336 | // is set |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * Checks if token has expired |
413 | 413 | * |
414 | 414 | * @access private |
415 | - * @return void |
|
415 | + * @return boolean |
|
416 | 416 | */ |
417 | 417 | private function validate_token_expiration () { |
418 | 418 | return strtotime($this->token_expires) < time() ? true : false; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Fetches details about specific rack |
153 | 153 | * |
154 | 154 | * @access public |
155 | - * @param mixed $id |
|
155 | + * @param integer $id |
|
156 | 156 | * @return void |
157 | 157 | */ |
158 | 158 | public function fetch_rack_details ($id) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * Fetches all devices attached to rack |
170 | 170 | * |
171 | 171 | * @access public |
172 | - * @param mixed $id |
|
172 | + * @param integer $id |
|
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function fetch_rack_devices ($id) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * Set active rack devide. |
248 | 248 | * |
249 | 249 | * @access public |
250 | - * @param mixed $id // device id |
|
250 | + * @param boolean $id // device id |
|
251 | 251 | * @return void |
252 | 252 | */ |
253 | 253 | public function set_active_rack_device ($id) { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @access private |
385 | 385 | * @param RackContent $content |
386 | - * @param mixed $img |
|
386 | + * @param resource $img |
|
387 | 387 | * @param mixed $name |
388 | 388 | * @return void |
389 | 389 | */ |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | * getSpace function. |
502 | 502 | * |
503 | 503 | * @access public |
504 | - * @return void |
|
504 | + * @return integer |
|
505 | 505 | */ |
506 | 506 | public function getSpace() { |
507 | 507 | return $this->space; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * Checks if item is active |
544 | 544 | * |
545 | 545 | * @access public |
546 | - * @return void |
|
546 | + * @return boolean |
|
547 | 547 | */ |
548 | 548 | public function isActive() { |
549 | 549 | return $this->active; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * returns id |
615 | 615 | * |
616 | 616 | * @access public |
617 | - * @return void |
|
617 | + * @return integer |
|
618 | 618 | */ |
619 | 619 | public function getId() { |
620 | 620 | return $this->id; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * Checks if item is active |
657 | 657 | * |
658 | 658 | * @access public |
659 | - * @return void |
|
659 | + * @return boolean |
|
660 | 660 | */ |
661 | 661 | public function isActive() { |
662 | 662 | return $this->active; |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * Returns start position |
678 | 678 | * |
679 | 679 | * @access public |
680 | - * @return void |
|
680 | + * @return integer |
|
681 | 681 | */ |
682 | 682 | public function getStartLocation() { |
683 | 683 | return $this->startLocation; |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | * Gets rack size. |
699 | 699 | * |
700 | 700 | * @access public |
701 | - * @return void |
|
701 | + * @return integer |
|
702 | 702 | */ |
703 | 703 | public function getSize() { |
704 | 704 | return $this->size; |
@@ -130,7 +130,8 @@ |
||
130 | 130 | if ($this->key_size > 0) { |
131 | 131 | |
132 | 132 | $out .= ' ' . trim($this->key_data, '.') . '.'; |
133 | - } else { |
|
133 | + } |
|
134 | + else { |
|
134 | 135 | |
135 | 136 | $out .= ' .'; |
136 | 137 | } |