@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * Set the value of the pagination query string |
|
| 94 | - * @param string $pQueryString the new value |
|
| 95 | - * @return object |
|
| 96 | - */ |
|
| 93 | + * Set the value of the pagination query string |
|
| 94 | + * @param string $pQueryString the new value |
|
| 95 | + * @return object |
|
| 96 | + */ |
|
| 97 | 97 | public function setPaginationQueryString($pQueryString) { |
| 98 | 98 | $this->paginationQueryString = $pQueryString; |
| 99 | 99 | return $this; |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' |
| 247 | - . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
| 247 | + . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
| 248 | 248 | return $navbar; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Build the pagination link for the first page |
|
| 254 | - * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
| 255 | - */ |
|
| 252 | + /** |
|
| 253 | + * Build the pagination link for the first page |
|
| 254 | + * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
| 255 | + */ |
|
| 256 | 256 | protected function buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber) { |
| 257 | 257 | return $this->buildPaginationLinkForFirstAndLastPage($begin, $end, $currentPageNumber, 'first'); |
| 258 | 258 | } |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Reset the form validation instance |
|
| 138 | - * |
|
| 139 | - * @return object the current instance |
|
| 140 | - */ |
|
| 136 | + /** |
|
| 137 | + * Reset the form validation instance |
|
| 138 | + * |
|
| 139 | + * @return object the current instance |
|
| 140 | + */ |
|
| 141 | 141 | public function reset() { |
| 142 | 142 | $this->rules = array(); |
| 143 | 143 | $this->labels = array(); |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | return $this; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Return the validation data |
|
| 166 | - * |
|
| 167 | - * @return array the validation data |
|
| 168 | - */ |
|
| 164 | + /** |
|
| 165 | + * Return the validation data |
|
| 166 | + * |
|
| 167 | + * @return array the validation data |
|
| 168 | + */ |
|
| 169 | 169 | public function getData() { |
| 170 | 170 | return $this->data; |
| 171 | 171 | } |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | return $this->rules; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - /** |
|
| 218 | - * Return the list of the validations rules for the given field |
|
| 219 | - * |
|
| 220 | - * @return array |
|
| 221 | - */ |
|
| 217 | + /** |
|
| 218 | + * Return the list of the validations rules for the given field |
|
| 219 | + * |
|
| 220 | + * @return array |
|
| 221 | + */ |
|
| 222 | 222 | public function getFieldRules($field) { |
| 223 | 223 | $rules = array(); |
| 224 | 224 | if (array_key_exists($field, $this->rules)) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @return string|null |
| 235 | 235 | */ |
| 236 | 236 | public function getFieldValue($field) { |
| 237 | - $value = null; |
|
| 237 | + $value = null; |
|
| 238 | 238 | if (array_key_exists($field, $this->data)) { |
| 239 | 239 | $value = $this->data[$field]; |
| 240 | 240 | } |
@@ -256,15 +256,15 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Return the list of validation errors |
|
| 261 | - * |
|
| 262 | - * @return array the errors list. |
|
| 263 | - * Format: |
|
| 264 | - * [field1] => 'error message 1', |
|
| 265 | - * [field2] => 'error message 2' |
|
| 266 | - */ |
|
| 267 | - public function getErrors() { |
|
| 259 | + /** |
|
| 260 | + * Return the list of validation errors |
|
| 261 | + * |
|
| 262 | + * @return array the errors list. |
|
| 263 | + * Format: |
|
| 264 | + * [field1] => 'error message 1', |
|
| 265 | + * [field2] => 'error message 2' |
|
| 266 | + */ |
|
| 267 | + public function getErrors() { |
|
| 268 | 268 | return $this->errors; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -347,11 +347,11 @@ discard block |
||
| 347 | 347 | return $this; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - /** |
|
| 351 | - * Set the database instance using get_instance() if is null |
|
| 352 | - * |
|
| 353 | - * @return object the current instance |
|
| 354 | - */ |
|
| 350 | + /** |
|
| 351 | + * Set the database instance using get_instance() if is null |
|
| 352 | + * |
|
| 353 | + * @return object the current instance |
|
| 354 | + */ |
|
| 355 | 355 | protected function setDatabaseFromSuperInstanceIfNotSet() { |
| 356 | 356 | if (!is_object($this->database)) { |
| 357 | 357 | $this->database = get_instance()->database; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * @param string|null $field2 the second field used in some validation rule like "matches", "not_equal" |
| 389 | 389 | * |
| 390 | 390 | */ |
| 391 | - protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 391 | + protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 392 | 392 | //if the field is not required and his value is not set don't set error |
| 393 | 393 | //but in case the field have value validate it |
| 394 | 394 | if (!$this->fieldIsRequired($field) && strlen($value) <= 0) { |
@@ -432,9 +432,9 @@ discard block |
||
| 432 | 432 | * @return string the name of the validation method |
| 433 | 433 | */ |
| 434 | 434 | protected function getRuleValidationMethod($rule) { |
| 435 | - $parts = explode('_', $rule); |
|
| 436 | - $parts = array_map('ucfirst', $parts); |
|
| 437 | - return 'checkRule' . implode('', $parts); |
|
| 435 | + $parts = explode('_', $rule); |
|
| 436 | + $parts = array_map('ucfirst', $parts); |
|
| 437 | + return 'checkRule' . implode('', $parts); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | protected function filterValidationData() { |
| 446 | 446 | foreach ($this->data as $key => $value ) { |
| 447 | 447 | if (is_string($value)) { |
| 448 | - $this->data[$key] = trim($value); |
|
| 448 | + $this->data[$key] = trim($value); |
|
| 449 | 449 | } else if(is_array($value)) { |
| 450 | 450 | $this->data[$key] = array_map('trim', $value); |
| 451 | 451 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | $template['field2}'] = $field2; |
| 493 | 493 | $template['{value2}'] = $this->getFieldValue($field2); |
| 494 | 494 | $template['{label2}'] = $this->getFieldLabel($field2); |
| 495 | - } |
|
| 495 | + } |
|
| 496 | 496 | $message = $this->messages[$rule]; |
| 497 | 497 | //Check for custom message |
| 498 | 498 | if (isset($this->customErrors[$field][$rule])) { |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | //Get the name of the method to validate this rule |
| 524 | 524 | $method = $this->getRuleValidationMethod($realRuleName); |
| 525 | 525 | if (method_exists($this, $method)) { |
| 526 | - call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 526 | + call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 527 | 527 | } else { |
| 528 | 528 | $this->forceError = true; |
| 529 | 529 | show_error('Invalid validaton rule "' . $realRuleName . '"'); |
@@ -615,14 +615,14 @@ discard block |
||
| 615 | 615 | * @param string|null $paramValue the rule parameter |
| 616 | 616 | */ |
| 617 | 617 | protected function checkRuleMinLength($field, $rule, $paramValue) { |
| 618 | - $value = $this->getFieldValue($field); |
|
| 619 | - $this->setSmpleFieldError( |
|
| 620 | - strlen($value) < $paramValue, |
|
| 621 | - $field, |
|
| 622 | - $value, |
|
| 623 | - $rule, |
|
| 624 | - $paramValue |
|
| 625 | - ); |
|
| 618 | + $value = $this->getFieldValue($field); |
|
| 619 | + $this->setSmpleFieldError( |
|
| 620 | + strlen($value) < $paramValue, |
|
| 621 | + $field, |
|
| 622 | + $value, |
|
| 623 | + $rule, |
|
| 624 | + $paramValue |
|
| 625 | + ); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | /** |
@@ -633,14 +633,14 @@ discard block |
||
| 633 | 633 | * @param string|null $paramValue the rule parameter |
| 634 | 634 | */ |
| 635 | 635 | protected function checkRuleMaxLength($field, $rule, $paramValue) { |
| 636 | - $value = $this->getFieldValue($field); |
|
| 637 | - $this->setSmpleFieldError( |
|
| 638 | - strlen($value) > $paramValue, |
|
| 639 | - $field, |
|
| 640 | - $value, |
|
| 641 | - $rule, |
|
| 642 | - $paramValue |
|
| 643 | - ); |
|
| 636 | + $value = $this->getFieldValue($field); |
|
| 637 | + $this->setSmpleFieldError( |
|
| 638 | + strlen($value) > $paramValue, |
|
| 639 | + $field, |
|
| 640 | + $value, |
|
| 641 | + $rule, |
|
| 642 | + $paramValue |
|
| 643 | + ); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /** |
@@ -651,14 +651,14 @@ discard block |
||
| 651 | 651 | * @param string|null $paramValue the rule parameter |
| 652 | 652 | */ |
| 653 | 653 | protected function checkRuleExactLength($field, $rule, $paramValue) { |
| 654 | - $value = $this->getFieldValue($field); |
|
| 655 | - $this->setSmpleFieldError( |
|
| 656 | - strlen($value) != $paramValue, |
|
| 657 | - $field, |
|
| 658 | - $value, |
|
| 659 | - $rule, |
|
| 660 | - $paramValue |
|
| 661 | - ); |
|
| 654 | + $value = $this->getFieldValue($field); |
|
| 655 | + $this->setSmpleFieldError( |
|
| 656 | + strlen($value) != $paramValue, |
|
| 657 | + $field, |
|
| 658 | + $value, |
|
| 659 | + $rule, |
|
| 660 | + $paramValue |
|
| 661 | + ); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
@@ -671,13 +671,13 @@ discard block |
||
| 671 | 671 | protected function checkRuleMatches($field, $rule, $paramValue) { |
| 672 | 672 | $value = $this->getFieldValue($field); |
| 673 | 673 | $this->setSmpleFieldError( |
| 674 | - $value != $this->getFieldValue($paramValue), |
|
| 675 | - $field, |
|
| 676 | - $value, |
|
| 677 | - $rule, |
|
| 678 | - $paramValue, |
|
| 679 | - $paramValue //field2 |
|
| 680 | - ); |
|
| 674 | + $value != $this->getFieldValue($paramValue), |
|
| 675 | + $field, |
|
| 676 | + $value, |
|
| 677 | + $rule, |
|
| 678 | + $paramValue, |
|
| 679 | + $paramValue //field2 |
|
| 680 | + ); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -690,13 +690,13 @@ discard block |
||
| 690 | 690 | protected function checkRuleNotEqual($field, $rule, $paramValue) { |
| 691 | 691 | $value = $this->getFieldValue($field); |
| 692 | 692 | $this->setSmpleFieldError( |
| 693 | - $value == $this->getFieldValue($paramValue), |
|
| 694 | - $field, |
|
| 695 | - $value, |
|
| 696 | - $rule, |
|
| 697 | - $paramValue, |
|
| 698 | - $paramValue //field2 |
|
| 699 | - ); |
|
| 693 | + $value == $this->getFieldValue($paramValue), |
|
| 694 | + $field, |
|
| 695 | + $value, |
|
| 696 | + $rule, |
|
| 697 | + $paramValue, |
|
| 698 | + $paramValue //field2 |
|
| 699 | + ); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | /** |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | protected function checkRuleMin($field, $rule, $paramValue) { |
| 710 | 710 | $value = $this->getFieldValue($field); |
| 711 | 711 | $this->setSmpleFieldError( |
| 712 | - $value < $paramValue, |
|
| 713 | - $field, |
|
| 714 | - $value, |
|
| 715 | - $rule, |
|
| 716 | - $paramValue |
|
| 717 | - ); |
|
| 712 | + $value < $paramValue, |
|
| 713 | + $field, |
|
| 714 | + $value, |
|
| 715 | + $rule, |
|
| 716 | + $paramValue |
|
| 717 | + ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | /** |
@@ -727,12 +727,12 @@ discard block |
||
| 727 | 727 | protected function checkRuleMax($field, $rule, $paramValue) { |
| 728 | 728 | $value = $this->getFieldValue($field); |
| 729 | 729 | $this->setSmpleFieldError( |
| 730 | - $value > $paramValue, |
|
| 731 | - $field, |
|
| 732 | - $value, |
|
| 733 | - $rule, |
|
| 734 | - $paramValue |
|
| 735 | - ); |
|
| 730 | + $value > $paramValue, |
|
| 731 | + $field, |
|
| 732 | + $value, |
|
| 733 | + $rule, |
|
| 734 | + $paramValue |
|
| 735 | + ); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
@@ -748,12 +748,12 @@ discard block |
||
| 748 | 748 | $betweens = explode(',', $paramValue, 2); |
| 749 | 749 | $betweens = array_map('trim', $betweens); |
| 750 | 750 | $this->setSmpleFieldError( |
| 751 | - ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 752 | - $field, |
|
| 753 | - $value, |
|
| 754 | - $rule, |
|
| 755 | - $paramValue |
|
| 756 | - ); |
|
| 751 | + ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 752 | + $field, |
|
| 753 | + $value, |
|
| 754 | + $rule, |
|
| 755 | + $paramValue |
|
| 756 | + ); |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | /** |
@@ -770,12 +770,12 @@ discard block |
||
| 770 | 770 | $list = array_map('trim', $list); |
| 771 | 771 | $paramValue = implode(',', $list); |
| 772 | 772 | $this->setSmpleFieldError( |
| 773 | - !in_array($value, $list), |
|
| 774 | - $field, |
|
| 775 | - $value, |
|
| 776 | - $rule, |
|
| 777 | - $paramValue |
|
| 778 | - ); |
|
| 773 | + !in_array($value, $list), |
|
| 774 | + $field, |
|
| 775 | + $value, |
|
| 776 | + $rule, |
|
| 777 | + $paramValue |
|
| 778 | + ); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | /** |
@@ -788,12 +788,12 @@ discard block |
||
| 788 | 788 | protected function checkRuleNumeric($field, $rule, $paramValue) { |
| 789 | 789 | $value = $this->getFieldValue($field); |
| 790 | 790 | $this->setSmpleFieldError( |
| 791 | - !is_numeric($value), |
|
| 792 | - $field, |
|
| 793 | - $value, |
|
| 794 | - $rule, |
|
| 795 | - $paramValue |
|
| 796 | - ); |
|
| 791 | + !is_numeric($value), |
|
| 792 | + $field, |
|
| 793 | + $value, |
|
| 794 | + $rule, |
|
| 795 | + $paramValue |
|
| 796 | + ); |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | /** |
@@ -805,13 +805,13 @@ discard block |
||
| 805 | 805 | */ |
| 806 | 806 | protected function checkRuleInteger($field, $rule, $paramValue) { |
| 807 | 807 | $value = $this->getFieldValue($field); |
| 808 | - $this->setSmpleFieldError( |
|
| 809 | - filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 810 | - $field, |
|
| 811 | - $value, |
|
| 812 | - $rule, |
|
| 813 | - $paramValue |
|
| 814 | - ); |
|
| 808 | + $this->setSmpleFieldError( |
|
| 809 | + filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 810 | + $field, |
|
| 811 | + $value, |
|
| 812 | + $rule, |
|
| 813 | + $paramValue |
|
| 814 | + ); |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /** |
@@ -824,12 +824,12 @@ discard block |
||
| 824 | 824 | protected function checkRuleIntegerNatural($field, $rule, $paramValue) { |
| 825 | 825 | $value = $this->getFieldValue($field); |
| 826 | 826 | $this->setSmpleFieldError( |
| 827 | - filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 828 | - $field, |
|
| 829 | - $value, |
|
| 830 | - $rule, |
|
| 831 | - $paramValue |
|
| 832 | - ); |
|
| 827 | + filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 828 | + $field, |
|
| 829 | + $value, |
|
| 830 | + $rule, |
|
| 831 | + $paramValue |
|
| 832 | + ); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | /** |
@@ -842,12 +842,12 @@ discard block |
||
| 842 | 842 | protected function checkRuleAlpha($field, $rule, $paramValue) { |
| 843 | 843 | $value = $this->getFieldValue($field); |
| 844 | 844 | $this->setSmpleFieldError( |
| 845 | - !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 846 | - $field, |
|
| 847 | - $value, |
|
| 848 | - $rule, |
|
| 849 | - $paramValue |
|
| 850 | - ); |
|
| 845 | + !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 846 | + $field, |
|
| 847 | + $value, |
|
| 848 | + $rule, |
|
| 849 | + $paramValue |
|
| 850 | + ); |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
@@ -860,12 +860,12 @@ discard block |
||
| 860 | 860 | protected function checkRuleAlphaDash($field, $rule, $paramValue) { |
| 861 | 861 | $value = $this->getFieldValue($field); |
| 862 | 862 | $this->setSmpleFieldError( |
| 863 | - !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 864 | - $field, |
|
| 865 | - $value, |
|
| 866 | - $rule, |
|
| 867 | - $paramValue |
|
| 868 | - ); |
|
| 863 | + !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 864 | + $field, |
|
| 865 | + $value, |
|
| 866 | + $rule, |
|
| 867 | + $paramValue |
|
| 868 | + ); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
@@ -878,12 +878,12 @@ discard block |
||
| 878 | 878 | protected function checkRuleAlnum($field, $rule, $paramValue) { |
| 879 | 879 | $value = $this->getFieldValue($field); |
| 880 | 880 | $this->setSmpleFieldError( |
| 881 | - !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 882 | - $field, |
|
| 883 | - $value, |
|
| 884 | - $rule, |
|
| 885 | - $paramValue |
|
| 886 | - ); |
|
| 881 | + !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 882 | + $field, |
|
| 883 | + $value, |
|
| 884 | + $rule, |
|
| 885 | + $paramValue |
|
| 886 | + ); |
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | /** |
@@ -896,12 +896,12 @@ discard block |
||
| 896 | 896 | protected function checkRuleAlnumDash($field, $rule, $paramValue) { |
| 897 | 897 | $value = $this->getFieldValue($field); |
| 898 | 898 | $this->setSmpleFieldError( |
| 899 | - !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 900 | - $field, |
|
| 901 | - $value, |
|
| 902 | - $rule, |
|
| 903 | - $paramValue |
|
| 904 | - ); |
|
| 899 | + !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 900 | + $field, |
|
| 901 | + $value, |
|
| 902 | + $rule, |
|
| 903 | + $paramValue |
|
| 904 | + ); |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | /** |
@@ -914,12 +914,12 @@ discard block |
||
| 914 | 914 | protected function checkRuleEmail($field, $rule, $paramValue) { |
| 915 | 915 | $value = $this->getFieldValue($field); |
| 916 | 916 | $this->setSmpleFieldError( |
| 917 | - filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 918 | - $field, |
|
| 919 | - $value, |
|
| 920 | - $rule, |
|
| 921 | - $paramValue |
|
| 922 | - ); |
|
| 917 | + filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 918 | + $field, |
|
| 919 | + $value, |
|
| 920 | + $rule, |
|
| 921 | + $paramValue |
|
| 922 | + ); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -935,12 +935,12 @@ discard block |
||
| 935 | 935 | $format = $paramValue; |
| 936 | 936 | $dateValue = date_create_from_format($format, $value); |
| 937 | 937 | $this->setSmpleFieldError( |
| 938 | - $dateValue === false || $dateValue->format($format) !== $value, |
|
| 939 | - $field, |
|
| 940 | - $value, |
|
| 941 | - $rule, |
|
| 942 | - $paramValue |
|
| 943 | - ); |
|
| 938 | + $dateValue === false || $dateValue->format($format) !== $value, |
|
| 939 | + $field, |
|
| 940 | + $value, |
|
| 941 | + $rule, |
|
| 942 | + $paramValue |
|
| 943 | + ); |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | /** |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | */ |
| 954 | 954 | protected function checkRuleDateBefore($field, $rule, $paramValue) { |
| 955 | 955 | $value = $this->getFieldValue($field); |
| 956 | - $this->setSmpleFieldError( |
|
| 957 | - strtotime($value) >= strtotime($paramValue), |
|
| 958 | - $field, |
|
| 959 | - $value, |
|
| 960 | - $rule, |
|
| 961 | - $paramValue |
|
| 962 | - ); |
|
| 956 | + $this->setSmpleFieldError( |
|
| 957 | + strtotime($value) >= strtotime($paramValue), |
|
| 958 | + $field, |
|
| 959 | + $value, |
|
| 960 | + $rule, |
|
| 961 | + $paramValue |
|
| 962 | + ); |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /** |
@@ -973,12 +973,12 @@ discard block |
||
| 973 | 973 | protected function checkRuleDateAfter($field, $rule, $paramValue) { |
| 974 | 974 | $value = $this->getFieldValue($field); |
| 975 | 975 | $this->setSmpleFieldError( |
| 976 | - strtotime($value) <= strtotime($paramValue), |
|
| 977 | - $field, |
|
| 978 | - $value, |
|
| 979 | - $rule, |
|
| 980 | - $paramValue |
|
| 981 | - ); |
|
| 976 | + strtotime($value) <= strtotime($paramValue), |
|
| 977 | + $field, |
|
| 978 | + $value, |
|
| 979 | + $rule, |
|
| 980 | + $paramValue |
|
| 981 | + ); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /** |
@@ -991,12 +991,12 @@ discard block |
||
| 991 | 991 | protected function checkRuleUrl($field, $rule, $paramValue) { |
| 992 | 992 | $value = $this->getFieldValue($field); |
| 993 | 993 | $this->setSmpleFieldError( |
| 994 | - filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 995 | - $field, |
|
| 996 | - $value, |
|
| 997 | - $rule, |
|
| 998 | - $paramValue |
|
| 999 | - ); |
|
| 994 | + filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 995 | + $field, |
|
| 996 | + $value, |
|
| 997 | + $rule, |
|
| 998 | + $paramValue |
|
| 999 | + ); |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | /** |
@@ -1010,12 +1010,12 @@ discard block |
||
| 1010 | 1010 | protected function checkRuleIp($field, $rule, $paramValue) { |
| 1011 | 1011 | $value = $this->getFieldValue($field); |
| 1012 | 1012 | $this->setSmpleFieldError( |
| 1013 | - filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 1014 | - $field, |
|
| 1015 | - $value, |
|
| 1016 | - $rule, |
|
| 1017 | - $paramValue |
|
| 1018 | - ); |
|
| 1013 | + filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 1014 | + $field, |
|
| 1015 | + $value, |
|
| 1016 | + $rule, |
|
| 1017 | + $paramValue |
|
| 1018 | + ); |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | /** |
@@ -1028,12 +1028,12 @@ discard block |
||
| 1028 | 1028 | protected function checkRuleIpv4($field, $rule, $paramValue) { |
| 1029 | 1029 | $value = $this->getFieldValue($field); |
| 1030 | 1030 | $this->setSmpleFieldError( |
| 1031 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 1032 | - $field, |
|
| 1033 | - $value, |
|
| 1034 | - $rule, |
|
| 1035 | - $paramValue |
|
| 1036 | - ); |
|
| 1031 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 1032 | + $field, |
|
| 1033 | + $value, |
|
| 1034 | + $rule, |
|
| 1035 | + $paramValue |
|
| 1036 | + ); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | /** |
@@ -1046,12 +1046,12 @@ discard block |
||
| 1046 | 1046 | protected function checkRuleIpv6($field, $rule, $paramValue) { |
| 1047 | 1047 | $value = $this->getFieldValue($field); |
| 1048 | 1048 | $this->setSmpleFieldError( |
| 1049 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1050 | - $field, |
|
| 1051 | - $value, |
|
| 1052 | - $rule, |
|
| 1053 | - $paramValue |
|
| 1054 | - ); |
|
| 1049 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1050 | + $field, |
|
| 1051 | + $value, |
|
| 1052 | + $rule, |
|
| 1053 | + $paramValue |
|
| 1054 | + ); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | /** |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | $value = $this->getFieldValue($field); |
| 1068 | 1068 | list($table, $column) = explode('.', $paramValue); |
| 1069 | 1069 | $this->database->getQueryBuilder()->from($table) |
| 1070 | - ->where($column, $value); |
|
| 1070 | + ->where($column, $value); |
|
| 1071 | 1071 | $this->database->get(); |
| 1072 | 1072 | if ($this->database->numRows() > 0) { |
| 1073 | 1073 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1089,8 +1089,8 @@ discard block |
||
| 1089 | 1089 | list($table, $column) = explode('.', $data[0]); |
| 1090 | 1090 | list($columnKey, $valueKey) = explode('=', $data[1]); |
| 1091 | 1091 | $this->database->getQueryBuilder()->from($table) |
| 1092 | - ->where($column, $value) |
|
| 1093 | - ->where($columnKey, '!=', trim($valueKey)); |
|
| 1092 | + ->where($column, $value) |
|
| 1093 | + ->where($columnKey, '!=', trim($valueKey)); |
|
| 1094 | 1094 | $this->database->get(); |
| 1095 | 1095 | if ($this->database->numRows() > 0) { |
| 1096 | 1096 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | $value = $this->getFieldValue($field); |
| 1111 | 1111 | list($table, $column) = explode('.', $paramValue); |
| 1112 | 1112 | $this->database->getQueryBuilder()->from($table) |
| 1113 | - ->where($column, $value); |
|
| 1113 | + ->where($column, $value); |
|
| 1114 | 1114 | $this->database->get(); |
| 1115 | 1115 | if ($this->database->numRows() <= 0) { |
| 1116 | 1116 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1127,13 +1127,13 @@ discard block |
||
| 1127 | 1127 | */ |
| 1128 | 1128 | protected function checkRuleRegex($field, $rule, $paramValue) { |
| 1129 | 1129 | $value = $this->getFieldValue($field); |
| 1130 | - $this->setSmpleFieldError( |
|
| 1131 | - !preg_match($paramValue, $value), |
|
| 1132 | - $field, |
|
| 1133 | - $value, |
|
| 1134 | - $rule, |
|
| 1135 | - $paramValue |
|
| 1136 | - ); |
|
| 1130 | + $this->setSmpleFieldError( |
|
| 1131 | + !preg_match($paramValue, $value), |
|
| 1132 | + $field, |
|
| 1133 | + $value, |
|
| 1134 | + $rule, |
|
| 1135 | + $paramValue |
|
| 1136 | + ); |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1155,12 +1155,12 @@ discard block |
||
| 1155 | 1155 | $value = $this->getFieldValue($field); |
| 1156 | 1156 | if (is_callable($paramValue)) { |
| 1157 | 1157 | $this->setSmpleFieldError( |
| 1158 | - call_user_func_array($paramValue, array($value)) === false, |
|
| 1159 | - $field, |
|
| 1160 | - $value, |
|
| 1161 | - $rule, |
|
| 1162 | - $paramValue |
|
| 1163 | - ); |
|
| 1158 | + call_user_func_array($paramValue, array($value)) === false, |
|
| 1159 | + $field, |
|
| 1160 | + $value, |
|
| 1161 | + $rule, |
|
| 1162 | + $paramValue |
|
| 1163 | + ); |
|
| 1164 | 1164 | } else{ |
| 1165 | 1165 | $this->forceError = true; |
| 1166 | 1166 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
@@ -443,10 +443,10 @@ discard block |
||
| 443 | 443 | * @return object the current instance |
| 444 | 444 | */ |
| 445 | 445 | protected function filterValidationData() { |
| 446 | - foreach ($this->data as $key => $value ) { |
|
| 446 | + foreach ($this->data as $key => $value) { |
|
| 447 | 447 | if (is_string($value)) { |
| 448 | 448 | $this->data[$key] = trim($value); |
| 449 | - } else if(is_array($value)) { |
|
| 449 | + } else if (is_array($value)) { |
|
| 450 | 450 | $this->data[$key] = array_map('trim', $value); |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | $rule, |
| 1162 | 1162 | $paramValue |
| 1163 | 1163 | ); |
| 1164 | - } else{ |
|
| 1164 | + } else { |
|
| 1165 | 1165 | $this->forceError = true; |
| 1166 | 1166 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
| 1167 | 1167 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
| 2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
| 3 | 3 | /** |
| 4 | 4 | * TNH Framework |
| 5 | 5 | * |
@@ -28,68 +28,68 @@ discard block |
||
| 28 | 28 | * SOFTWARE. |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - class Browser { |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * List of know platforms |
|
| 35 | - * @var array |
|
| 36 | - */ |
|
| 37 | - private $platforms = array( |
|
| 38 | - '/windows nt 10/i' => 'Windows 10', |
|
| 39 | - '/windows phone 10/i' => 'Windows Phone 10', |
|
| 40 | - '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 41 | - '/windows phone 8/i' => 'Windows Phone 8', |
|
| 42 | - '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 43 | - '/windows nt 6.2/i' => 'Windows 8', |
|
| 44 | - '/windows nt 6.1/i' => 'Windows 7', |
|
| 45 | - '/windows nt 6.0/i' => 'Windows Vista', |
|
| 46 | - '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 47 | - '/windows nt 5.1/i' => 'Windows XP', |
|
| 48 | - '/windows xp/i' => 'Windows XP', |
|
| 49 | - '/windows nt 5.0/i' => 'Windows 2000', |
|
| 50 | - '/windows me/i' => 'Windows ME', |
|
| 51 | - '/win98/i' => 'Windows 98', |
|
| 52 | - '/win95/i' => 'Windows 95', |
|
| 53 | - '/win16/i' => 'Windows 3.11', |
|
| 54 | - '/ipad/i' => 'iPad', |
|
| 31 | + class Browser { |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * List of know platforms |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | + private $platforms = array( |
|
| 38 | + '/windows nt 10/i' => 'Windows 10', |
|
| 39 | + '/windows phone 10/i' => 'Windows Phone 10', |
|
| 40 | + '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 41 | + '/windows phone 8/i' => 'Windows Phone 8', |
|
| 42 | + '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 43 | + '/windows nt 6.2/i' => 'Windows 8', |
|
| 44 | + '/windows nt 6.1/i' => 'Windows 7', |
|
| 45 | + '/windows nt 6.0/i' => 'Windows Vista', |
|
| 46 | + '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 47 | + '/windows nt 5.1/i' => 'Windows XP', |
|
| 48 | + '/windows xp/i' => 'Windows XP', |
|
| 49 | + '/windows nt 5.0/i' => 'Windows 2000', |
|
| 50 | + '/windows me/i' => 'Windows ME', |
|
| 51 | + '/win98/i' => 'Windows 98', |
|
| 52 | + '/win95/i' => 'Windows 95', |
|
| 53 | + '/win16/i' => 'Windows 3.11', |
|
| 54 | + '/ipad/i' => 'iPad', |
|
| 55 | 55 | '/ipod/i' => 'iPod', |
| 56 | 56 | '/iphone/i' => 'iPhone', |
| 57 | 57 | '/macintosh|mac os x/i' => 'Mac OS X', |
| 58 | - '/mac_powerpc/i' => 'Mac OS 9', |
|
| 59 | - '/android/i' => 'Android', |
|
| 60 | - '/ubuntu/i' => 'Ubuntu', |
|
| 61 | - '/linux/i' => 'Linux', |
|
| 62 | - '/blackberry/i' => 'BlackBerry', |
|
| 63 | - '/webos/i' => 'Mobile' |
|
| 64 | - ); |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * List of know browsers |
|
| 68 | - * @var array |
|
| 69 | - */ |
|
| 70 | - private $browsers = array( |
|
| 71 | - '/mobile/i' => 'Handheld Browser', |
|
| 72 | - '/msie/i' => 'Internet Explorer', |
|
| 73 | - '/firefox/i' => 'Firefox', |
|
| 74 | - '/chrome/i' => 'Chrome', |
|
| 75 | - '/safari/i' => 'Safari', |
|
| 76 | - '/edge/i' => 'Edge', |
|
| 77 | - '/opera/i' => 'Opera', |
|
| 78 | - '/netscape/i' => 'Netscape', |
|
| 79 | - '/maxthon/i' => 'Maxthon', |
|
| 80 | - '/konqueror/i' => 'Konqueror' |
|
| 81 | - ); |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Agent string |
|
| 85 | - * @var string |
|
| 86 | - */ |
|
| 87 | - private $agent = ''; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Browser name |
|
| 91 | - * @var string |
|
| 92 | - */ |
|
| 58 | + '/mac_powerpc/i' => 'Mac OS 9', |
|
| 59 | + '/android/i' => 'Android', |
|
| 60 | + '/ubuntu/i' => 'Ubuntu', |
|
| 61 | + '/linux/i' => 'Linux', |
|
| 62 | + '/blackberry/i' => 'BlackBerry', |
|
| 63 | + '/webos/i' => 'Mobile' |
|
| 64 | + ); |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * List of know browsers |
|
| 68 | + * @var array |
|
| 69 | + */ |
|
| 70 | + private $browsers = array( |
|
| 71 | + '/mobile/i' => 'Handheld Browser', |
|
| 72 | + '/msie/i' => 'Internet Explorer', |
|
| 73 | + '/firefox/i' => 'Firefox', |
|
| 74 | + '/chrome/i' => 'Chrome', |
|
| 75 | + '/safari/i' => 'Safari', |
|
| 76 | + '/edge/i' => 'Edge', |
|
| 77 | + '/opera/i' => 'Opera', |
|
| 78 | + '/netscape/i' => 'Netscape', |
|
| 79 | + '/maxthon/i' => 'Maxthon', |
|
| 80 | + '/konqueror/i' => 'Konqueror' |
|
| 81 | + ); |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Agent string |
|
| 85 | + * @var string |
|
| 86 | + */ |
|
| 87 | + private $agent = ''; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Browser name |
|
| 91 | + * @var string |
|
| 92 | + */ |
|
| 93 | 93 | private $browserName = ''; |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private $isFacebook = false; |
| 130 | 130 | |
| 131 | - /** |
|
| 131 | + /** |
|
| 132 | 132 | * Class constructor |
| 133 | 133 | */ |
| 134 | 134 | public function __construct($userAgent = '') { |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | return $this->isFacebook; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Returns a formatted string with a summary of the details of the browser. |
|
| 236 | - * @codeCoverageIgnore |
|
| 237 | - * |
|
| 238 | - * @return string formatted string with a summary of the browser |
|
| 239 | - */ |
|
| 234 | + /** |
|
| 235 | + * Returns a formatted string with a summary of the details of the browser. |
|
| 236 | + * @codeCoverageIgnore |
|
| 237 | + * |
|
| 238 | + * @return string formatted string with a summary of the browser |
|
| 239 | + */ |
|
| 240 | 240 | public function __toString() { |
| 241 | 241 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
| 242 | 242 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -248,70 +248,70 @@ discard block |
||
| 248 | 248 | /** |
| 249 | 249 | * Determine the user's platform |
| 250 | 250 | */ |
| 251 | - protected function checkPlatform() { |
|
| 252 | - foreach ($this->platforms as $regex => $value) { |
|
| 253 | - if (preg_match($regex, $this->agent) ) { |
|
| 254 | - $this->platform = $value; |
|
| 255 | - break; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 251 | + protected function checkPlatform() { |
|
| 252 | + foreach ($this->platforms as $regex => $value) { |
|
| 253 | + if (preg_match($regex, $this->agent) ) { |
|
| 254 | + $this->platform = $value; |
|
| 255 | + break; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | 261 | * Routine to determine the browser type |
| 262 | 262 | */ |
| 263 | - protected function checkBrowser() { |
|
| 264 | - foreach ($this->browsers as $regex => $value) { |
|
| 265 | - if (preg_match($regex, $this->agent ) ) { |
|
| 266 | - $this->browserName = $value; |
|
| 267 | - break; |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 263 | + protected function checkBrowser() { |
|
| 264 | + foreach ($this->browsers as $regex => $value) { |
|
| 265 | + if (preg_match($regex, $this->agent ) ) { |
|
| 266 | + $this->browserName = $value; |
|
| 267 | + break; |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | 273 | * Routine to determine the browser version |
| 274 | 274 | */ |
| 275 | - protected function checkBrowserVersion(){ |
|
| 276 | - $detected = $this->getBrowser(); |
|
| 277 | - $detect = array_search($detected, $this->browsers); |
|
| 278 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
| 279 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 280 | - if (preg_match_all($regex, $this->agent, $matches)) { |
|
| 281 | - $found = array_search($browser, $matches['browser']); |
|
| 282 | - $this->version = $matches['version'][$found]; |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - /** |
|
| 275 | + protected function checkBrowserVersion(){ |
|
| 276 | + $detected = $this->getBrowser(); |
|
| 277 | + $detect = array_search($detected, $this->browsers); |
|
| 278 | + $browser = str_replace(array('/i','/'), '', $detect); |
|
| 279 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 280 | + if (preg_match_all($regex, $this->agent, $matches)) { |
|
| 281 | + $found = array_search($browser, $matches['browser']); |
|
| 282 | + $this->version = $matches['version'][$found]; |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | 287 | * Determine if the browser is Mobile or not |
| 288 | 288 | */ |
| 289 | - protected function checkMobile() { |
|
| 290 | - if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
| 289 | + protected function checkMobile() { |
|
| 290 | + if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
| 291 | 291 | . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
| 292 | - $this->isMobile = true; |
|
| 293 | - } |
|
| 294 | - } |
|
| 292 | + $this->isMobile = true; |
|
| 293 | + } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - /** |
|
| 296 | + /** |
|
| 297 | 297 | * Determine if the browser is Tablet or not |
| 298 | 298 | */ |
| 299 | - protected function checkTablet() { |
|
| 300 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
| 301 | - $this->isTablet = true; |
|
| 302 | - } |
|
| 303 | - } |
|
| 299 | + protected function checkTablet() { |
|
| 300 | + if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
| 301 | + $this->isTablet = true; |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - /** |
|
| 305 | + /** |
|
| 306 | 306 | * Determine if the browser is Robot or not |
| 307 | 307 | */ |
| 308 | - protected function checkBot() { |
|
| 309 | - if (preg_match('/bot/i', $this->agent) ) { |
|
| 310 | - $this->isRobot = true; |
|
| 311 | - } |
|
| 312 | - } |
|
| 308 | + protected function checkBot() { |
|
| 309 | + if (preg_match('/bot/i', $this->agent) ) { |
|
| 310 | + $this->isRobot = true; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - /** |
|
| 314 | + /** |
|
| 315 | 315 | * Detect if URL is loaded from FacebookExternalHit |
| 316 | 316 | */ |
| 317 | 317 | protected function checkFacebook() { |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
| 327 | - /** |
|
| 328 | - * Protected routine to calculate and determine what |
|
| 329 | - * the browser is in use (including platform) |
|
| 330 | - */ |
|
| 327 | + /** |
|
| 328 | + * Protected routine to calculate and determine what |
|
| 329 | + * the browser is in use (including platform) |
|
| 330 | + */ |
|
| 331 | 331 | protected function determine() { |
| 332 | 332 | $this->checkPlatform(); |
| 333 | 333 | $this->checkBrowser(); |
@@ -338,4 +338,4 @@ discard block |
||
| 338 | 338 | $this->checkFacebook(); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - } |
|
| 341 | + } |
|
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * Reset all properties |
| 145 | 145 | */ |
| 146 | 146 | public function reset() { |
| 147 | - $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
| 147 | + $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
| 148 | 148 | $this->browserName = 'unknown'; |
| 149 | 149 | $this->version = 'unknown'; |
| 150 | 150 | $this->platform = 'unknown'; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | protected function checkPlatform() { |
| 252 | 252 | foreach ($this->platforms as $regex => $value) { |
| 253 | - if (preg_match($regex, $this->agent) ) { |
|
| 253 | + if (preg_match($regex, $this->agent)) { |
|
| 254 | 254 | $this->platform = $value; |
| 255 | 255 | break; |
| 256 | 256 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function checkBrowser() { |
| 264 | 264 | foreach ($this->browsers as $regex => $value) { |
| 265 | - if (preg_match($regex, $this->agent ) ) { |
|
| 265 | + if (preg_match($regex, $this->agent)) { |
|
| 266 | 266 | $this->browserName = $value; |
| 267 | 267 | break; |
| 268 | 268 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | /** |
| 273 | 273 | * Routine to determine the browser version |
| 274 | 274 | */ |
| 275 | - protected function checkBrowserVersion(){ |
|
| 275 | + protected function checkBrowserVersion() { |
|
| 276 | 276 | $detected = $this->getBrowser(); |
| 277 | 277 | $detect = array_search($detected, $this->browsers); |
| 278 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
| 278 | + $browser = str_replace(array('/i', '/'), '', $detect); |
|
| 279 | 279 | $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
| 280 | 280 | if (preg_match_all($regex, $this->agent, $matches)) { |
| 281 | 281 | $found = array_search($browser, $matches['browser']); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | protected function checkMobile() { |
| 290 | 290 | if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
| 291 | - . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
|
| 291 | + . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent)) { |
|
| 292 | 292 | $this->isMobile = true; |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * Determine if the browser is Tablet or not |
| 298 | 298 | */ |
| 299 | 299 | protected function checkTablet() { |
| 300 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
| 300 | + if (preg_match('/tablet|ipad/i', $this->agent)) { |
|
| 301 | 301 | $this->isTablet = true; |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * Determine if the browser is Robot or not |
| 307 | 307 | */ |
| 308 | 308 | protected function checkBot() { |
| 309 | - if (preg_match('/bot/i', $this->agent) ) { |
|
| 309 | + if (preg_match('/bot/i', $this->agent)) { |
|
| 310 | 310 | $this->isRobot = true; |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | if (stristr($this->agent, 'FacebookExternalHit')) { |
| 319 | 319 | $this->isRobot = true; |
| 320 | 320 | $this->isFacebook = true; |
| 321 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
| 321 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
| 322 | 322 | $this->isFacebook = true; |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -318,7 +318,7 @@ |
||
| 318 | 318 | if (stristr($this->agent, 'FacebookExternalHit')) { |
| 319 | 319 | $this->isRobot = true; |
| 320 | 320 | $this->isFacebook = true; |
| 321 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
| 321 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
| 322 | 322 | $this->isFacebook = true; |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | if ($cookieLang && $this->isValid($cookieLang)) { |
| 80 | 80 | $this->current = $cookieLang; |
| 81 | 81 | $this->logger->info('Language from cookie [' . $cfgKey . '] is valid so ' |
| 82 | - .'we will set the language using the cookie value [' . $cookieLang . ']'); |
|
| 82 | + .'we will set the language using the cookie value [' . $cookieLang . ']'); |
|
| 83 | 83 | } else { |
| 84 | 84 | $this->logger->info('Language from cookie [' . $cfgKey . '] is not set, use the default value [' . $this->getDefault() . ']'); |
| 85 | 85 | $this->current = $this->getDefault(); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $moduleConfigPath = get_instance()->module->findConfigFullPath($filename, $module); |
| 220 | 220 | if ($moduleConfigPath) { |
| 221 | 221 | $this->logger->info('Found config [' . $filename . '] from module [' . $module . '], ' |
| 222 | - . 'the file path is [' . $moduleConfigPath . '] we will used it'); |
|
| 222 | + . 'the file path is [' . $moduleConfigPath . '] we will used it'); |
|
| 223 | 223 | $configFilePath = $moduleConfigPath; |
| 224 | 224 | } else { |
| 225 | 225 | $this->logger->info('Cannot find config [' . $filename . '] from modules using the default location'); |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $moduleLibraryPath = get_instance()->module->findLibraryFullPath($class, $module); |
| 480 | 480 | if ($moduleLibraryPath) { |
| 481 | 481 | $this->logger->info('Found library [' . $class . '] from module [' . $module . '], the ' |
| 482 | - . 'file path is [' . $moduleLibraryPath . '] we will used it'); |
|
| 482 | + . 'file path is [' . $moduleLibraryPath . '] we will used it'); |
|
| 483 | 483 | $libraryFilePath = $moduleLibraryPath; |
| 484 | 484 | } else { |
| 485 | 485 | $this->logger->info('Cannot find library [' . $class . '] from modules using the default location'); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @param string $appLang the application language, only if type = "language" |
| 336 | 336 | * @return string|null the full file path |
| 337 | 337 | */ |
| 338 | - protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
|
| 338 | + protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null) { |
|
| 339 | 339 | //Default to "function" |
| 340 | 340 | $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
| 341 | 341 | if ($type == 'language') { |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @param string|null $module the module if is not null will return it |
| 360 | 360 | * @return string|null |
| 361 | 361 | */ |
| 362 | - protected function getModuleFromSuperController($module){ |
|
| 362 | + protected function getModuleFromSuperController($module) { |
|
| 363 | 363 | $obj = & get_instance(); |
| 364 | 364 | if (!$module && !empty($obj->moduleName)) { |
| 365 | 365 | $module = $obj->moduleName; |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * DB session handler model class |
|
| 33 | - */ |
|
| 32 | + * DB session handler model class |
|
| 33 | + */ |
|
| 34 | 34 | abstract class DBSessionHandlerModel extends Model { |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @example |
| 42 | 42 | * array( |
| 43 | - * 'sid' => '', //VARCHAR(100) Note: this a primary key |
|
| 44 | - * 'sdata' => '', //TEXT |
|
| 45 | - * 'stime' => '', //unix timestamp (INT|BIGINT) |
|
| 46 | - * 'shost' => '', //VARCHAR(255) |
|
| 47 | - * 'sip' => '', //VARCHAR(128) |
|
| 48 | - * 'sbrowser' => '', //VARCHAR(255) |
|
| 49 | - * 'skey' => '' //VARCHAR(255) |
|
| 50 | - * ); |
|
| 43 | + * 'sid' => '', //VARCHAR(100) Note: this a primary key |
|
| 44 | + * 'sdata' => '', //TEXT |
|
| 45 | + * 'stime' => '', //unix timestamp (INT|BIGINT) |
|
| 46 | + * 'shost' => '', //VARCHAR(255) |
|
| 47 | + * 'sip' => '', //VARCHAR(128) |
|
| 48 | + * 'sbrowser' => '', //VARCHAR(255) |
|
| 49 | + * 'skey' => '' //VARCHAR(255) |
|
| 50 | + * ); |
|
| 51 | 51 | */ |
| 52 | 52 | protected $sessionTableColumns = array(); |
| 53 | 53 | |