@@ -225,15 +225,15 @@ |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' |
| 228 | - . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
| 228 | + . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
| 229 | 229 | return $navbar; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Build the pagination link for the first page |
|
| 235 | - * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
| 236 | - */ |
|
| 233 | + /** |
|
| 234 | + * Build the pagination link for the first page |
|
| 235 | + * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
| 236 | + */ |
|
| 237 | 237 | protected function buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber) { |
| 238 | 238 | return $this->buildPaginationLinkForFirstAndLastPage($begin, $end, $currentPageNumber, 'first'); |
| 239 | 239 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Reset the form validation instance |
|
| 129 | - * |
|
| 130 | - * @return object the current instance |
|
| 131 | - */ |
|
| 127 | + /** |
|
| 128 | + * Reset the form validation instance |
|
| 129 | + * |
|
| 130 | + * @return object the current instance |
|
| 131 | + */ |
|
| 132 | 132 | public function reset() { |
| 133 | 133 | $this->rules = array(); |
| 134 | 134 | $this->labels = array(); |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Return the validation data |
|
| 157 | - * |
|
| 158 | - * @return array the validation data |
|
| 159 | - */ |
|
| 155 | + /** |
|
| 156 | + * Return the validation data |
|
| 157 | + * |
|
| 158 | + * @return array the validation data |
|
| 159 | + */ |
|
| 160 | 160 | public function getData() { |
| 161 | 161 | return $this->data; |
| 162 | 162 | } |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | return $this->rules; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Return the list of the validations rules for the given field |
|
| 210 | - * |
|
| 211 | - * @return array |
|
| 212 | - */ |
|
| 208 | + /** |
|
| 209 | + * Return the list of the validations rules for the given field |
|
| 210 | + * |
|
| 211 | + * @return array |
|
| 212 | + */ |
|
| 213 | 213 | public function getFieldRules($field) { |
| 214 | 214 | $rules = array(); |
| 215 | 215 | if (array_key_exists($field, $this->rules)) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @return string|null |
| 226 | 226 | */ |
| 227 | 227 | public function getFieldValue($field) { |
| 228 | - $value = null; |
|
| 228 | + $value = null; |
|
| 229 | 229 | if (array_key_exists($field, $this->data)) { |
| 230 | 230 | $value = $this->data[$field]; |
| 231 | 231 | } |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Return the list of validation errors |
|
| 252 | - * |
|
| 253 | - * @return array the errors list. |
|
| 254 | - * Format: |
|
| 255 | - * [field1] => 'error message 1', |
|
| 256 | - * [field2] => 'error message 2' |
|
| 257 | - */ |
|
| 258 | - public function getErrors() { |
|
| 250 | + /** |
|
| 251 | + * Return the list of validation errors |
|
| 252 | + * |
|
| 253 | + * @return array the errors list. |
|
| 254 | + * Format: |
|
| 255 | + * [field1] => 'error message 1', |
|
| 256 | + * [field2] => 'error message 2' |
|
| 257 | + */ |
|
| 258 | + public function getErrors() { |
|
| 259 | 259 | return $this->errors; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * @param string|null $field2 the second field used in some validation rule like "matches", "not_equal" |
| 349 | 349 | * |
| 350 | 350 | */ |
| 351 | - protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 351 | + protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 352 | 352 | //if the field is not required and his value is not set don't set error |
| 353 | 353 | //but in case the field have value validate it |
| 354 | 354 | if (!$this->fieldIsRequired($field) && strlen($value) <= 0) { |
@@ -392,9 +392,9 @@ discard block |
||
| 392 | 392 | * @return string the name of the validation method |
| 393 | 393 | */ |
| 394 | 394 | protected function getRuleValidationMethod($rule) { |
| 395 | - $parts = explode('_', $rule); |
|
| 396 | - $parts = array_map('ucfirst', $parts); |
|
| 397 | - return 'checkRule' . implode('', $parts); |
|
| 395 | + $parts = explode('_', $rule); |
|
| 396 | + $parts = array_map('ucfirst', $parts); |
|
| 397 | + return 'checkRule' . implode('', $parts); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | protected function filterValidationData() { |
| 406 | 406 | foreach ($this->data as $key => $value ) { |
| 407 | 407 | if (is_string($value)) { |
| 408 | - $this->data[$key] = trim($value); |
|
| 408 | + $this->data[$key] = trim($value); |
|
| 409 | 409 | } else if(is_array($value)) { |
| 410 | 410 | $this->data[$key] = array_map('trim', $value); |
| 411 | 411 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $template['field2}'] = $field2; |
| 453 | 453 | $template['{value2}'] = $this->getFieldValue($field2); |
| 454 | 454 | $template['{label2}'] = $this->getFieldLabel($field2); |
| 455 | - } |
|
| 455 | + } |
|
| 456 | 456 | $message = $this->messages[$rule]; |
| 457 | 457 | //Check for custom message |
| 458 | 458 | if (isset($this->customErrors[$field][$rule])) { |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | //Get the name of the method to validate this rule |
| 484 | 484 | $method = $this->getRuleValidationMethod($realRuleName); |
| 485 | 485 | if (method_exists($this, $method)) { |
| 486 | - call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 486 | + call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 487 | 487 | } else { |
| 488 | 488 | $this->forceError = true; |
| 489 | 489 | show_error('Invalid validaton rule "' . $realRuleName . '"'); |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | * @param string|null $paramValue the rule parameter |
| 576 | 576 | */ |
| 577 | 577 | protected function checkRuleMinLength($field, $rule, $paramValue) { |
| 578 | - $value = $this->getFieldValue($field); |
|
| 579 | - $this->setSimpleFieldError( |
|
| 580 | - strlen($value) < $paramValue, |
|
| 581 | - $field, |
|
| 582 | - $value, |
|
| 583 | - $rule, |
|
| 584 | - $paramValue |
|
| 585 | - ); |
|
| 578 | + $value = $this->getFieldValue($field); |
|
| 579 | + $this->setSimpleFieldError( |
|
| 580 | + strlen($value) < $paramValue, |
|
| 581 | + $field, |
|
| 582 | + $value, |
|
| 583 | + $rule, |
|
| 584 | + $paramValue |
|
| 585 | + ); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
@@ -593,14 +593,14 @@ discard block |
||
| 593 | 593 | * @param string|null $paramValue the rule parameter |
| 594 | 594 | */ |
| 595 | 595 | protected function checkRuleMaxLength($field, $rule, $paramValue) { |
| 596 | - $value = $this->getFieldValue($field); |
|
| 597 | - $this->setSimpleFieldError( |
|
| 598 | - strlen($value) > $paramValue, |
|
| 599 | - $field, |
|
| 600 | - $value, |
|
| 601 | - $rule, |
|
| 602 | - $paramValue |
|
| 603 | - ); |
|
| 596 | + $value = $this->getFieldValue($field); |
|
| 597 | + $this->setSimpleFieldError( |
|
| 598 | + strlen($value) > $paramValue, |
|
| 599 | + $field, |
|
| 600 | + $value, |
|
| 601 | + $rule, |
|
| 602 | + $paramValue |
|
| 603 | + ); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | /** |
@@ -611,14 +611,14 @@ discard block |
||
| 611 | 611 | * @param string|null $paramValue the rule parameter |
| 612 | 612 | */ |
| 613 | 613 | protected function checkRuleExactLength($field, $rule, $paramValue) { |
| 614 | - $value = $this->getFieldValue($field); |
|
| 615 | - $this->setSimpleFieldError( |
|
| 616 | - strlen($value) != $paramValue, |
|
| 617 | - $field, |
|
| 618 | - $value, |
|
| 619 | - $rule, |
|
| 620 | - $paramValue |
|
| 621 | - ); |
|
| 614 | + $value = $this->getFieldValue($field); |
|
| 615 | + $this->setSimpleFieldError( |
|
| 616 | + strlen($value) != $paramValue, |
|
| 617 | + $field, |
|
| 618 | + $value, |
|
| 619 | + $rule, |
|
| 620 | + $paramValue |
|
| 621 | + ); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | /** |
@@ -631,13 +631,13 @@ discard block |
||
| 631 | 631 | protected function checkRuleMatches($field, $rule, $paramValue) { |
| 632 | 632 | $value = $this->getFieldValue($field); |
| 633 | 633 | $this->setSimpleFieldError( |
| 634 | - $value != $this->getFieldValue($paramValue), |
|
| 635 | - $field, |
|
| 636 | - $value, |
|
| 637 | - $rule, |
|
| 638 | - $paramValue, |
|
| 639 | - $paramValue //field2 |
|
| 640 | - ); |
|
| 634 | + $value != $this->getFieldValue($paramValue), |
|
| 635 | + $field, |
|
| 636 | + $value, |
|
| 637 | + $rule, |
|
| 638 | + $paramValue, |
|
| 639 | + $paramValue //field2 |
|
| 640 | + ); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | /** |
@@ -650,13 +650,13 @@ discard block |
||
| 650 | 650 | protected function checkRuleNotEqual($field, $rule, $paramValue) { |
| 651 | 651 | $value = $this->getFieldValue($field); |
| 652 | 652 | $this->setSimpleFieldError( |
| 653 | - $value == $this->getFieldValue($paramValue), |
|
| 654 | - $field, |
|
| 655 | - $value, |
|
| 656 | - $rule, |
|
| 657 | - $paramValue, |
|
| 658 | - $paramValue //field2 |
|
| 659 | - ); |
|
| 653 | + $value == $this->getFieldValue($paramValue), |
|
| 654 | + $field, |
|
| 655 | + $value, |
|
| 656 | + $rule, |
|
| 657 | + $paramValue, |
|
| 658 | + $paramValue //field2 |
|
| 659 | + ); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /** |
@@ -669,12 +669,12 @@ discard block |
||
| 669 | 669 | protected function checkRuleMin($field, $rule, $paramValue) { |
| 670 | 670 | $value = $this->getFieldValue($field); |
| 671 | 671 | $this->setSimpleFieldError( |
| 672 | - $value < $paramValue, |
|
| 673 | - $field, |
|
| 674 | - $value, |
|
| 675 | - $rule, |
|
| 676 | - $paramValue |
|
| 677 | - ); |
|
| 672 | + $value < $paramValue, |
|
| 673 | + $field, |
|
| 674 | + $value, |
|
| 675 | + $rule, |
|
| 676 | + $paramValue |
|
| 677 | + ); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -687,12 +687,12 @@ discard block |
||
| 687 | 687 | protected function checkRuleMax($field, $rule, $paramValue) { |
| 688 | 688 | $value = $this->getFieldValue($field); |
| 689 | 689 | $this->setSimpleFieldError( |
| 690 | - $value > $paramValue, |
|
| 691 | - $field, |
|
| 692 | - $value, |
|
| 693 | - $rule, |
|
| 694 | - $paramValue |
|
| 695 | - ); |
|
| 690 | + $value > $paramValue, |
|
| 691 | + $field, |
|
| 692 | + $value, |
|
| 693 | + $rule, |
|
| 694 | + $paramValue |
|
| 695 | + ); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | $betweens = explode(',', $paramValue, 2); |
| 709 | 709 | $betweens = array_map('trim', $betweens); |
| 710 | 710 | $this->setSimpleFieldError( |
| 711 | - ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 712 | - $field, |
|
| 713 | - $value, |
|
| 714 | - $rule, |
|
| 715 | - $paramValue |
|
| 716 | - ); |
|
| 711 | + ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 712 | + $field, |
|
| 713 | + $value, |
|
| 714 | + $rule, |
|
| 715 | + $paramValue |
|
| 716 | + ); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -730,12 +730,12 @@ discard block |
||
| 730 | 730 | $list = array_map('trim', $list); |
| 731 | 731 | $paramValue = implode(',', $list); |
| 732 | 732 | $this->setSimpleFieldError( |
| 733 | - !in_array($value, $list), |
|
| 734 | - $field, |
|
| 735 | - $value, |
|
| 736 | - $rule, |
|
| 737 | - $paramValue |
|
| 738 | - ); |
|
| 733 | + !in_array($value, $list), |
|
| 734 | + $field, |
|
| 735 | + $value, |
|
| 736 | + $rule, |
|
| 737 | + $paramValue |
|
| 738 | + ); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -748,12 +748,12 @@ discard block |
||
| 748 | 748 | protected function checkRuleNumeric($field, $rule, $paramValue) { |
| 749 | 749 | $value = $this->getFieldValue($field); |
| 750 | 750 | $this->setSimpleFieldError( |
| 751 | - !is_numeric($value), |
|
| 752 | - $field, |
|
| 753 | - $value, |
|
| 754 | - $rule, |
|
| 755 | - $paramValue |
|
| 756 | - ); |
|
| 751 | + !is_numeric($value), |
|
| 752 | + $field, |
|
| 753 | + $value, |
|
| 754 | + $rule, |
|
| 755 | + $paramValue |
|
| 756 | + ); |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | /** |
@@ -765,13 +765,13 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | protected function checkRuleInteger($field, $rule, $paramValue) { |
| 767 | 767 | $value = $this->getFieldValue($field); |
| 768 | - $this->setSimpleFieldError( |
|
| 769 | - filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 770 | - $field, |
|
| 771 | - $value, |
|
| 772 | - $rule, |
|
| 773 | - $paramValue |
|
| 774 | - ); |
|
| 768 | + $this->setSimpleFieldError( |
|
| 769 | + filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 770 | + $field, |
|
| 771 | + $value, |
|
| 772 | + $rule, |
|
| 773 | + $paramValue |
|
| 774 | + ); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | /** |
@@ -784,12 +784,12 @@ discard block |
||
| 784 | 784 | protected function checkRuleIntegerNatural($field, $rule, $paramValue) { |
| 785 | 785 | $value = $this->getFieldValue($field); |
| 786 | 786 | $this->setSimpleFieldError( |
| 787 | - filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 788 | - $field, |
|
| 789 | - $value, |
|
| 790 | - $rule, |
|
| 791 | - $paramValue |
|
| 792 | - ); |
|
| 787 | + filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 788 | + $field, |
|
| 789 | + $value, |
|
| 790 | + $rule, |
|
| 791 | + $paramValue |
|
| 792 | + ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | /** |
@@ -802,12 +802,12 @@ discard block |
||
| 802 | 802 | protected function checkRuleAlpha($field, $rule, $paramValue) { |
| 803 | 803 | $value = $this->getFieldValue($field); |
| 804 | 804 | $this->setSimpleFieldError( |
| 805 | - !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 806 | - $field, |
|
| 807 | - $value, |
|
| 808 | - $rule, |
|
| 809 | - $paramValue |
|
| 810 | - ); |
|
| 805 | + !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 806 | + $field, |
|
| 807 | + $value, |
|
| 808 | + $rule, |
|
| 809 | + $paramValue |
|
| 810 | + ); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -820,12 +820,12 @@ discard block |
||
| 820 | 820 | protected function checkRuleAlphaDash($field, $rule, $paramValue) { |
| 821 | 821 | $value = $this->getFieldValue($field); |
| 822 | 822 | $this->setSimpleFieldError( |
| 823 | - !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 824 | - $field, |
|
| 825 | - $value, |
|
| 826 | - $rule, |
|
| 827 | - $paramValue |
|
| 828 | - ); |
|
| 823 | + !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 824 | + $field, |
|
| 825 | + $value, |
|
| 826 | + $rule, |
|
| 827 | + $paramValue |
|
| 828 | + ); |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | /** |
@@ -838,12 +838,12 @@ discard block |
||
| 838 | 838 | protected function checkRuleAlnum($field, $rule, $paramValue) { |
| 839 | 839 | $value = $this->getFieldValue($field); |
| 840 | 840 | $this->setSimpleFieldError( |
| 841 | - !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 842 | - $field, |
|
| 843 | - $value, |
|
| 844 | - $rule, |
|
| 845 | - $paramValue |
|
| 846 | - ); |
|
| 841 | + !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 842 | + $field, |
|
| 843 | + $value, |
|
| 844 | + $rule, |
|
| 845 | + $paramValue |
|
| 846 | + ); |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | /** |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | protected function checkRuleAlnumDash($field, $rule, $paramValue) { |
| 857 | 857 | $value = $this->getFieldValue($field); |
| 858 | 858 | $this->setSimpleFieldError( |
| 859 | - !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 860 | - $field, |
|
| 861 | - $value, |
|
| 862 | - $rule, |
|
| 863 | - $paramValue |
|
| 864 | - ); |
|
| 859 | + !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 860 | + $field, |
|
| 861 | + $value, |
|
| 862 | + $rule, |
|
| 863 | + $paramValue |
|
| 864 | + ); |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | /** |
@@ -874,12 +874,12 @@ discard block |
||
| 874 | 874 | protected function checkRuleEmail($field, $rule, $paramValue) { |
| 875 | 875 | $value = $this->getFieldValue($field); |
| 876 | 876 | $this->setSimpleFieldError( |
| 877 | - filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 878 | - $field, |
|
| 879 | - $value, |
|
| 880 | - $rule, |
|
| 881 | - $paramValue |
|
| 882 | - ); |
|
| 877 | + filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 878 | + $field, |
|
| 879 | + $value, |
|
| 880 | + $rule, |
|
| 881 | + $paramValue |
|
| 882 | + ); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | /** |
@@ -895,12 +895,12 @@ discard block |
||
| 895 | 895 | $format = $paramValue; |
| 896 | 896 | $dateValue = date_create_from_format($format, $value); |
| 897 | 897 | $this->setSimpleFieldError( |
| 898 | - $dateValue === false || $dateValue->format($format) !== $value, |
|
| 899 | - $field, |
|
| 900 | - $value, |
|
| 901 | - $rule, |
|
| 902 | - $paramValue |
|
| 903 | - ); |
|
| 898 | + $dateValue === false || $dateValue->format($format) !== $value, |
|
| 899 | + $field, |
|
| 900 | + $value, |
|
| 901 | + $rule, |
|
| 902 | + $paramValue |
|
| 903 | + ); |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -913,13 +913,13 @@ discard block |
||
| 913 | 913 | */ |
| 914 | 914 | protected function checkRuleDateBefore($field, $rule, $paramValue) { |
| 915 | 915 | $value = $this->getFieldValue($field); |
| 916 | - $this->setSimpleFieldError( |
|
| 917 | - strtotime($value) >= strtotime($paramValue), |
|
| 918 | - $field, |
|
| 919 | - $value, |
|
| 920 | - $rule, |
|
| 921 | - $paramValue |
|
| 922 | - ); |
|
| 916 | + $this->setSimpleFieldError( |
|
| 917 | + strtotime($value) >= strtotime($paramValue), |
|
| 918 | + $field, |
|
| 919 | + $value, |
|
| 920 | + $rule, |
|
| 921 | + $paramValue |
|
| 922 | + ); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -933,12 +933,12 @@ discard block |
||
| 933 | 933 | protected function checkRuleDateAfter($field, $rule, $paramValue) { |
| 934 | 934 | $value = $this->getFieldValue($field); |
| 935 | 935 | $this->setSimpleFieldError( |
| 936 | - strtotime($value) <= strtotime($paramValue), |
|
| 937 | - $field, |
|
| 938 | - $value, |
|
| 939 | - $rule, |
|
| 940 | - $paramValue |
|
| 941 | - ); |
|
| 936 | + strtotime($value) <= strtotime($paramValue), |
|
| 937 | + $field, |
|
| 938 | + $value, |
|
| 939 | + $rule, |
|
| 940 | + $paramValue |
|
| 941 | + ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | /** |
@@ -951,12 +951,12 @@ discard block |
||
| 951 | 951 | protected function checkRuleUrl($field, $rule, $paramValue) { |
| 952 | 952 | $value = $this->getFieldValue($field); |
| 953 | 953 | $this->setSimpleFieldError( |
| 954 | - filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 955 | - $field, |
|
| 956 | - $value, |
|
| 957 | - $rule, |
|
| 958 | - $paramValue |
|
| 959 | - ); |
|
| 954 | + filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 955 | + $field, |
|
| 956 | + $value, |
|
| 957 | + $rule, |
|
| 958 | + $paramValue |
|
| 959 | + ); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -970,12 +970,12 @@ discard block |
||
| 970 | 970 | protected function checkRuleIp($field, $rule, $paramValue) { |
| 971 | 971 | $value = $this->getFieldValue($field); |
| 972 | 972 | $this->setSimpleFieldError( |
| 973 | - filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 974 | - $field, |
|
| 975 | - $value, |
|
| 976 | - $rule, |
|
| 977 | - $paramValue |
|
| 978 | - ); |
|
| 973 | + filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 974 | + $field, |
|
| 975 | + $value, |
|
| 976 | + $rule, |
|
| 977 | + $paramValue |
|
| 978 | + ); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
@@ -988,12 +988,12 @@ discard block |
||
| 988 | 988 | protected function checkRuleIpv4($field, $rule, $paramValue) { |
| 989 | 989 | $value = $this->getFieldValue($field); |
| 990 | 990 | $this->setSimpleFieldError( |
| 991 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 992 | - $field, |
|
| 993 | - $value, |
|
| 994 | - $rule, |
|
| 995 | - $paramValue |
|
| 996 | - ); |
|
| 991 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 992 | + $field, |
|
| 993 | + $value, |
|
| 994 | + $rule, |
|
| 995 | + $paramValue |
|
| 996 | + ); |
|
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | /** |
@@ -1006,12 +1006,12 @@ discard block |
||
| 1006 | 1006 | protected function checkRuleIpv6($field, $rule, $paramValue) { |
| 1007 | 1007 | $value = $this->getFieldValue($field); |
| 1008 | 1008 | $this->setSimpleFieldError( |
| 1009 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1010 | - $field, |
|
| 1011 | - $value, |
|
| 1012 | - $rule, |
|
| 1013 | - $paramValue |
|
| 1014 | - ); |
|
| 1009 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1010 | + $field, |
|
| 1011 | + $value, |
|
| 1012 | + $rule, |
|
| 1013 | + $paramValue |
|
| 1014 | + ); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | /** |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | $value = $this->getFieldValue($field); |
| 1031 | 1031 | list($table, $column) = explode('.', $paramValue); |
| 1032 | 1032 | $obj->database->getQueryBuilder()->from($table) |
| 1033 | - ->where($column, $value); |
|
| 1033 | + ->where($column, $value); |
|
| 1034 | 1034 | $obj->database->get(); |
| 1035 | 1035 | if ($obj->database->numRows() > 0) { |
| 1036 | 1036 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1055,8 +1055,8 @@ discard block |
||
| 1055 | 1055 | list($table, $column) = explode('.', $data[0]); |
| 1056 | 1056 | list($columnKey, $valueKey) = explode('=', $data[1]); |
| 1057 | 1057 | $obj->database->getQueryBuilder()->from($table) |
| 1058 | - ->where($column, $value) |
|
| 1059 | - ->where($columnKey, '!=', trim($valueKey)); |
|
| 1058 | + ->where($column, $value) |
|
| 1059 | + ->where($columnKey, '!=', trim($valueKey)); |
|
| 1060 | 1060 | $obj->database->get(); |
| 1061 | 1061 | if ($obj->database->numRows() > 0) { |
| 1062 | 1062 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | $value = $this->getFieldValue($field); |
| 1080 | 1080 | list($table, $column) = explode('.', $paramValue); |
| 1081 | 1081 | $obj->database->getQueryBuilder()->from($table) |
| 1082 | - ->where($column, $value); |
|
| 1082 | + ->where($column, $value); |
|
| 1083 | 1083 | $obj->database->get(); |
| 1084 | 1084 | if ($obj->database->numRows() <= 0) { |
| 1085 | 1085 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1096,13 +1096,13 @@ discard block |
||
| 1096 | 1096 | */ |
| 1097 | 1097 | protected function checkRuleRegex($field, $rule, $paramValue) { |
| 1098 | 1098 | $value = $this->getFieldValue($field); |
| 1099 | - $this->setSimpleFieldError( |
|
| 1100 | - !preg_match($paramValue, $value), |
|
| 1101 | - $field, |
|
| 1102 | - $value, |
|
| 1103 | - $rule, |
|
| 1104 | - $paramValue |
|
| 1105 | - ); |
|
| 1099 | + $this->setSimpleFieldError( |
|
| 1100 | + !preg_match($paramValue, $value), |
|
| 1101 | + $field, |
|
| 1102 | + $value, |
|
| 1103 | + $rule, |
|
| 1104 | + $paramValue |
|
| 1105 | + ); |
|
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | /** |
@@ -1124,12 +1124,12 @@ discard block |
||
| 1124 | 1124 | $value = $this->getFieldValue($field); |
| 1125 | 1125 | if (is_callable($paramValue)) { |
| 1126 | 1126 | $this->setSimpleFieldError( |
| 1127 | - call_user_func_array($paramValue, array($value)) === false, |
|
| 1128 | - $field, |
|
| 1129 | - $value, |
|
| 1130 | - $rule, |
|
| 1131 | - $paramValue |
|
| 1132 | - ); |
|
| 1127 | + call_user_func_array($paramValue, array($value)) === false, |
|
| 1128 | + $field, |
|
| 1129 | + $value, |
|
| 1130 | + $rule, |
|
| 1131 | + $paramValue |
|
| 1132 | + ); |
|
| 1133 | 1133 | } else{ |
| 1134 | 1134 | $this->forceError = true; |
| 1135 | 1135 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
@@ -316,15 +316,15 @@ discard block |
||
| 316 | 316 | return $this; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - /** |
|
| 320 | - * Append a mime type to allowed mime types |
|
| 321 | - * |
|
| 322 | - * @since 1.0 |
|
| 323 | - * @version 1.0.1 |
|
| 324 | - * @param string $mime |
|
| 325 | - * @return object |
|
| 326 | - * @method boolean setAllowMimeType |
|
| 327 | - */ |
|
| 319 | + /** |
|
| 320 | + * Append a mime type to allowed mime types |
|
| 321 | + * |
|
| 322 | + * @since 1.0 |
|
| 323 | + * @version 1.0.1 |
|
| 324 | + * @param string $mime |
|
| 325 | + * @return object |
|
| 326 | + * @method boolean setAllowMimeType |
|
| 327 | + */ |
|
| 328 | 328 | public function setAllowMimeType($mime) { |
| 329 | 329 | $this->allowedMimeTypes[] = strtolower($mime); |
| 330 | 330 | $this->file['allowed_mime_types'][] = strtolower($mime); |
@@ -438,10 +438,10 @@ discard block |
||
| 438 | 438 | return $this; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - /** |
|
| 442 | - * Get the allow overwriting |
|
| 443 | - * @return boolean |
|
| 444 | - */ |
|
| 441 | + /** |
|
| 442 | + * Get the allow overwriting |
|
| 443 | + * @return boolean |
|
| 444 | + */ |
|
| 445 | 445 | public function isAllowOverwriting() { |
| 446 | 446 | return $this->overwriteFile ; |
| 447 | 447 | } |
@@ -532,14 +532,14 @@ discard block |
||
| 532 | 532 | return $this->error; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - /** |
|
| 536 | - * Retrive status of upload |
|
| 537 | - * |
|
| 538 | - * @since 1.0 |
|
| 539 | - * @version 1.0 |
|
| 540 | - * @return boolean |
|
| 541 | - * @method boolean getStatus |
|
| 542 | - */ |
|
| 535 | + /** |
|
| 536 | + * Retrive status of upload |
|
| 537 | + * |
|
| 538 | + * @since 1.0 |
|
| 539 | + * @version 1.0 |
|
| 540 | + * @return boolean |
|
| 541 | + * @method boolean getStatus |
|
| 542 | + */ |
|
| 543 | 543 | public function getStatus() { |
| 544 | 544 | return $this->file['status']; |
| 545 | 545 | } |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | && is_file($file); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - /** |
|
| 576 | - * Set the filename if is empty using the uploaded data information |
|
| 577 | - * |
|
| 578 | - * @return object the current instance |
|
| 579 | - */ |
|
| 575 | + /** |
|
| 576 | + * Set the filename if is empty using the uploaded data information |
|
| 577 | + * |
|
| 578 | + * @return object the current instance |
|
| 579 | + */ |
|
| 580 | 580 | protected function setFilenameUsingUploadedData() { |
| 581 | 581 | // set original filename if not have a new name |
| 582 | 582 | if (empty($this->filename)) { |
@@ -660,12 +660,12 @@ discard block |
||
| 660 | 660 | return $this->maxFileSize >= $size; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - /** |
|
| 664 | - * Check the file overwritting |
|
| 665 | - * @since 1.0 |
|
| 666 | - * @version 1.0 |
|
| 667 | - * @return boolean |
|
| 668 | - */ |
|
| 663 | + /** |
|
| 664 | + * Check the file overwritting |
|
| 665 | + * @since 1.0 |
|
| 666 | + * @version 1.0 |
|
| 667 | + * @return boolean |
|
| 668 | + */ |
|
| 669 | 669 | protected function checkFileOverwritting() { |
| 670 | 670 | if ($this->fileExists($this->destinationDirectory . $this->filename)) { |
| 671 | 671 | return $this->overwriteFile; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $addresses = array(); |
| 348 | 348 | foreach ($pairs as $name => $email) { |
| 349 | 349 | if (is_numeric($name)) { |
| 350 | - $name = null; |
|
| 350 | + $name = null; |
|
| 351 | 351 | } |
| 352 | 352 | $addresses[] = $this->formatHeader($email, $name); |
| 353 | 353 | } |
@@ -738,10 +738,10 @@ discard block |
||
| 738 | 738 | return $headers; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - /** |
|
| 742 | - * Get the attachment message for send or the simple message |
|
| 743 | - * @return string |
|
| 744 | - */ |
|
| 741 | + /** |
|
| 742 | + * Get the attachment message for send or the simple message |
|
| 743 | + * @return string |
|
| 744 | + */ |
|
| 745 | 745 | protected function getMessageWithAttachmentForSend() { |
| 746 | 746 | $message = wordwrap($this->message, $this->wrap); |
| 747 | 747 | if ($this->hasAttachments()) { |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | */ |
| 772 | 772 | protected function sendHelloCommand() { |
| 773 | 773 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
| 774 | - ->getSmtpResponseCode(); |
|
| 774 | + ->getSmtpResponseCode(); |
|
| 775 | 775 | if ($responseCode !== 250) { |
| 776 | 776 | $this->error = $this->smtpResponse; |
| 777 | 777 | return false; |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | $message = $this->getMessageWithAttachmentForSend(); |
| 919 | 919 | $headers = $this->getHeadersForSend(); |
| 920 | 920 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
| 921 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
| 921 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
| 922 | 922 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
| 923 | 923 | if (!$result) { |
| 924 | 924 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | return $result; |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | - /** |
|
| 930 | - * Send mail using "smtp" protocol |
|
| 931 | - * @return boolean |
|
| 932 | - */ |
|
| 929 | + /** |
|
| 930 | + * Send mail using "smtp" protocol |
|
| 931 | + * @return boolean |
|
| 932 | + */ |
|
| 933 | 933 | protected function sendSmtp() { |
| 934 | 934 | if (!$this->smtpConnection()) { |
| 935 | 935 | return false; |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | $message = $this->getMessageWithAttachmentForSend(); |
| 940 | 940 | $headers = $this->getHeadersForSend(); |
| 941 | 941 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
| 942 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
| 942 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
| 943 | 943 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
| 944 | 944 | $commands = array( |
| 945 | 945 | 'mail_from' => array('MAIL FROM: <' . $this->from . '>', 'MAIL_FROM', 250), |
@@ -990,17 +990,17 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | |
| 993 | - /** |
|
| 994 | - * Return the client hostname for SMTP |
|
| 995 | - * |
|
| 996 | - * There are only two legal types of hostname - either a fully |
|
| 997 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
| 998 | - * (eg: "[1.2.3.4]"). |
|
| 999 | - * |
|
| 1000 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
| 1001 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
| 1002 | - * @return string |
|
| 1003 | - */ |
|
| 993 | + /** |
|
| 994 | + * Return the client hostname for SMTP |
|
| 995 | + * |
|
| 996 | + * There are only two legal types of hostname - either a fully |
|
| 997 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
| 998 | + * (eg: "[1.2.3.4]"). |
|
| 999 | + * |
|
| 1000 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
| 1001 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
| 1002 | + * @return string |
|
| 1003 | + */ |
|
| 1004 | 1004 | protected function getSmtpClientHostname() { |
| 1005 | 1005 | $globals = &class_loader('GlobalVar', 'classes'); |
| 1006 | 1006 | if ($globals->server('SERVER_NAME')) { |