@@ -128,7 +128,7 @@ |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | } |
131 | - $port = get_instance()->request->server('SERVER_PORT'); |
|
131 | + $port = get_instance()->request->server('SERVER_PORT'); |
|
132 | 132 | |
133 | 133 | if ($port && !in_array($port, array(80, 443))) { |
134 | 134 | $domain .= ':' . $port; |
@@ -156,7 +156,7 @@ |
||
156 | 156 | return; |
157 | 157 | } |
158 | 158 | $this->logger->info('Found the registered event listener for the ' |
159 | - . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
159 | + . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
160 | 160 | foreach ($list as $listener) { |
161 | 161 | $result = call_user_func_array($listener, array($event)); |
162 | 162 | if ($eBackup->returnBack === true) { |
@@ -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) { |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | * @return string the name of the validation method |
415 | 415 | */ |
416 | 416 | protected function getRuleValidationMethod($rule) { |
417 | - $parts = explode('_', $rule); |
|
418 | - $parts = array_map('ucfirst', $parts); |
|
419 | - return 'checkRule' . implode('', $parts); |
|
417 | + $parts = explode('_', $rule); |
|
418 | + $parts = array_map('ucfirst', $parts); |
|
419 | + return 'checkRule' . implode('', $parts); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | protected function filterValidationData() { |
428 | 428 | foreach ($this->data as $key => $value ) { |
429 | 429 | if (is_string($value)) { |
430 | - $this->data[$key] = trim($value); |
|
430 | + $this->data[$key] = trim($value); |
|
431 | 431 | } else if(is_array($value)) { |
432 | 432 | $this->data[$key] = array_map('trim', $value); |
433 | 433 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | $template['field2}'] = $field2; |
475 | 475 | $template['{value2}'] = $this->getFieldValue($field2); |
476 | 476 | $template['{label2}'] = $this->getFieldLabel($field2); |
477 | - } |
|
477 | + } |
|
478 | 478 | $message = $this->messages[$rule]; |
479 | 479 | //Check for custom message |
480 | 480 | if (isset($this->customErrors[$field][$rule])) { |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | //Get the name of the method to validate this rule |
506 | 506 | $method = $this->getRuleValidationMethod($realRuleName); |
507 | 507 | if (method_exists($this, $method)) { |
508 | - call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
508 | + call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
509 | 509 | } else { |
510 | 510 | $this->forceError = true; |
511 | 511 | show_error('Invalid validaton rule "' . $realRuleName . '"'); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param string|null $paramValue the rule parameter |
598 | 598 | */ |
599 | 599 | protected function checkRuleMinLength($field, $rule, $paramValue) { |
600 | - $value = $this->getFieldValue($field); |
|
600 | + $value = $this->getFieldValue($field); |
|
601 | 601 | if (strlen($value) < $paramValue) { |
602 | 602 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
603 | 603 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param string|null $paramValue the rule parameter |
612 | 612 | */ |
613 | 613 | protected function checkRuleMaxLength($field, $rule, $paramValue) { |
614 | - $value = $this->getFieldValue($field); |
|
614 | + $value = $this->getFieldValue($field); |
|
615 | 615 | if (strlen($value) > $paramValue) { |
616 | 616 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
617 | 617 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * @param string|null $paramValue the rule parameter |
626 | 626 | */ |
627 | 627 | protected function checkRuleExactLength($field, $rule, $paramValue) { |
628 | - $value = $this->getFieldValue($field); |
|
628 | + $value = $this->getFieldValue($field); |
|
629 | 629 | if (strlen($value) != $paramValue) { |
630 | 630 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
631 | 631 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | protected function checkRuleNumeric($field, $rule, $paramValue) { |
733 | 733 | $value = $this->getFieldValue($field); |
734 | 734 | if (!is_numeric($value)) { |
735 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
735 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
736 | 736 | } |
737 | 737 | } |
738 | 738 | |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | protected function checkRuleInteger($field, $rule, $paramValue) { |
747 | 747 | $value = $this->getFieldValue($field); |
748 | 748 | if (filter_var($value, FILTER_VALIDATE_INT) === false) { |
749 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
749 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
750 | 750 | } |
751 | 751 | } |
752 | 752 | |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | protected function checkRuleIntegerNatural($field, $rule, $paramValue) { |
761 | 761 | $value = $this->getFieldValue($field); |
762 | 762 | if (filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0) { |
763 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
763 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | $format = $paramValue; |
848 | 848 | $dateValue = date_create_from_format($format, $value); |
849 | 849 | if ($dateValue === false || $dateValue->format($format) !== $value) { |
850 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
850 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | protected function checkRuleUrl($field, $rule, $paramValue) { |
892 | 892 | $value = $this->getFieldValue($field); |
893 | 893 | if (filter_var($value, FILTER_VALIDATE_URL) === false) { |
894 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
894 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | protected function checkRuleIp($field, $rule, $paramValue) { |
907 | 907 | $value = $this->getFieldValue($field); |
908 | 908 | if (filter_var($value, FILTER_VALIDATE_IP) === false) { |
909 | - $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
909 | + $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $value = $this->getFieldValue($field); |
952 | 952 | list($table, $column) = explode('.', $paramValue); |
953 | 953 | $this->database->getQueryBuilder()->from($table) |
954 | - ->where($column, $value); |
|
954 | + ->where($column, $value); |
|
955 | 955 | $this->database->get(); |
956 | 956 | if ($this->database->numRows() > 0) { |
957 | 957 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -973,8 +973,8 @@ discard block |
||
973 | 973 | list($table, $column) = explode('.', $data[0]); |
974 | 974 | list($columnKey, $valueKey) = explode('=', $data[1]); |
975 | 975 | $this->database->getQueryBuilder()->from($table) |
976 | - ->where($column, $value) |
|
977 | - ->where($columnKey, '!=', trim($valueKey)); |
|
976 | + ->where($column, $value) |
|
977 | + ->where($columnKey, '!=', trim($valueKey)); |
|
978 | 978 | $this->database->get(); |
979 | 979 | if ($this->database->numRows() > 0) { |
980 | 980 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | $value = $this->getFieldValue($field); |
995 | 995 | list($table, $column) = explode('.', $paramValue); |
996 | 996 | $this->database->getQueryBuilder()->from($table) |
997 | - ->where($column, $value); |
|
997 | + ->where($column, $value); |
|
998 | 998 | $this->database->get(); |
999 | 999 | if ($this->database->numRows() <= 0) { |
1000 | 1000 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | return $this; |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
281 | - * Get the uploade file array |
|
282 | - * @return array |
|
283 | - */ |
|
280 | + /** |
|
281 | + * Get the uploade file array |
|
282 | + * @return array |
|
283 | + */ |
|
284 | 284 | public function getUploadedFileData() { |
285 | 285 | return $this->uploadedFileData; |
286 | 286 | } |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | return $this; |
321 | 321 | } |
322 | 322 | |
323 | - /** |
|
324 | - * Get the filename |
|
325 | - * @return string |
|
326 | - */ |
|
323 | + /** |
|
324 | + * Get the filename |
|
325 | + * @return string |
|
326 | + */ |
|
327 | 327 | public function getFilename() { |
328 | 328 | return $this->filename; |
329 | 329 | } |
@@ -352,23 +352,23 @@ discard block |
||
352 | 352 | return $this; |
353 | 353 | } |
354 | 354 | |
355 | - /** |
|
356 | - * Get the max file size |
|
357 | - * @return double|int |
|
358 | - */ |
|
355 | + /** |
|
356 | + * Get the max file size |
|
357 | + * @return double|int |
|
358 | + */ |
|
359 | 359 | public function getMaxFileSize() { |
360 | 360 | return $this->maxFileSize; |
361 | 361 | } |
362 | 362 | |
363 | - /** |
|
364 | - * Append a mime type to allowed mime types |
|
365 | - * |
|
366 | - * @since 1.0 |
|
367 | - * @version 1.0.1 |
|
368 | - * @param string $mime |
|
369 | - * @return object |
|
370 | - * @method boolean setAllowMimeType |
|
371 | - */ |
|
363 | + /** |
|
364 | + * Append a mime type to allowed mime types |
|
365 | + * |
|
366 | + * @since 1.0 |
|
367 | + * @version 1.0.1 |
|
368 | + * @param string $mime |
|
369 | + * @return object |
|
370 | + * @method boolean setAllowMimeType |
|
371 | + */ |
|
372 | 372 | public function setAllowMimeType($mime) { |
373 | 373 | $this->allowedMimeTypes[] = strtolower($mime); |
374 | 374 | $this->file['allowed_mime_types'][] = strtolower($mime); |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | return $this; |
486 | 486 | } |
487 | 487 | |
488 | - /** |
|
489 | - * Get the upload function name like "copy", "move_uploaded_file" |
|
490 | - * @return string |
|
491 | - */ |
|
488 | + /** |
|
489 | + * Get the upload function name like "copy", "move_uploaded_file" |
|
490 | + * @return string |
|
491 | + */ |
|
492 | 492 | public function getUploadFunction() { |
493 | 493 | return $this->uploadFunction; |
494 | 494 | } |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | return $this; |
507 | 507 | } |
508 | 508 | |
509 | - /** |
|
510 | - * Get the allow overwriting |
|
511 | - * @return boolean |
|
512 | - */ |
|
509 | + /** |
|
510 | + * Get the allow overwriting |
|
511 | + * @return boolean |
|
512 | + */ |
|
513 | 513 | public function isAllowOverwriting() { |
514 | 514 | return $this->overwriteFile ; |
515 | 515 | } |
@@ -614,14 +614,14 @@ discard block |
||
614 | 614 | return $this->error; |
615 | 615 | } |
616 | 616 | |
617 | - /** |
|
618 | - * Retrive status of upload |
|
619 | - * |
|
620 | - * @since 1.0 |
|
621 | - * @version 1.0 |
|
622 | - * @return boolean |
|
623 | - * @method boolean getStatus |
|
624 | - */ |
|
617 | + /** |
|
618 | + * Retrive status of upload |
|
619 | + * |
|
620 | + * @since 1.0 |
|
621 | + * @version 1.0 |
|
622 | + * @return boolean |
|
623 | + * @method boolean getStatus |
|
624 | + */ |
|
625 | 625 | public function getStatus() { |
626 | 626 | return $this->file['status']; |
627 | 627 | } |
@@ -654,11 +654,11 @@ discard block |
||
654 | 654 | && is_file($file); |
655 | 655 | } |
656 | 656 | |
657 | - /** |
|
658 | - * Set the filename if is empty using the uploaded data information |
|
659 | - * |
|
660 | - * @return object the current instance |
|
661 | - */ |
|
657 | + /** |
|
658 | + * Set the filename if is empty using the uploaded data information |
|
659 | + * |
|
660 | + * @return object the current instance |
|
661 | + */ |
|
662 | 662 | protected function setFilenameUsingUploadedData() { |
663 | 663 | // set original filename if not have a new name |
664 | 664 | if (empty($this->filename)) { |
@@ -745,12 +745,12 @@ discard block |
||
745 | 745 | return true; |
746 | 746 | } |
747 | 747 | |
748 | - /** |
|
749 | - * Check the file overwritting |
|
750 | - * @since 1.0 |
|
751 | - * @version 1.0 |
|
752 | - * @return boolean |
|
753 | - */ |
|
748 | + /** |
|
749 | + * Check the file overwritting |
|
750 | + * @since 1.0 |
|
751 | + * @version 1.0 |
|
752 | + * @return boolean |
|
753 | + */ |
|
754 | 754 | protected function checkFileOverwritting() { |
755 | 755 | if ($this->fileExists($this->destinationDirectory . $this->filename)) { |
756 | 756 | return $this->overwriteFile; |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * Setting the route configuration using the configuration file |
|
281 | - * and additional configuration from param |
|
282 | - * @param array $overwriteConfig the additional configuration |
|
283 | - * to overwrite with the existing one |
|
284 | - * @param boolean $useConfigFile whether to use route configuration file |
|
285 | - * |
|
286 | - * @return object |
|
287 | - */ |
|
280 | + * Setting the route configuration using the configuration file |
|
281 | + * and additional configuration from param |
|
282 | + * @param array $overwriteConfig the additional configuration |
|
283 | + * to overwrite with the existing one |
|
284 | + * @param boolean $useConfigFile whether to use route configuration file |
|
285 | + * |
|
286 | + * @return object |
|
287 | + */ |
|
288 | 288 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
289 | 289 | $route = array(); |
290 | 290 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | //the URL like http://domain.com/module/controller/method/arg1/arg2 |
366 | 366 | if (!$this->controller) { |
367 | 367 | $this->logger->info('Cannot determine the routing information ' |
368 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
368 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
369 | 369 | //determine route parameters using the route URI param |
370 | 370 | $this->determineRouteParamsFromRequestUri(); |
371 | 371 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | - /** |
|
482 | - * Remove the URL suffix and query string values if exists |
|
483 | - * @param string $uri the route URI to process |
|
484 | - * @return string the final route uri after processed |
|
485 | - */ |
|
481 | + /** |
|
482 | + * Remove the URL suffix and query string values if exists |
|
483 | + * @param string $uri the route URI to process |
|
484 | + * @return string the final route uri after processed |
|
485 | + */ |
|
486 | 486 | protected function removeSuffixAndQueryStringFromUri($uri) { |
487 | 487 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
488 | 488 | //remove url suffix from the request URI |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $this->logger->info( |
597 | 597 | 'After loop in predefined routes configuration,' |
598 | 598 | . 'the module name is set but the controller is not set,' |
599 | - . 'so we will use module as the controller' |
|
599 | + . 'so we will use module as the controller' |
|
600 | 600 | ); |
601 | 601 | $this->controller = $this->module; |
602 | 602 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | $filename = $this->encodeUtf8($this->filterOther((string) $filename)); |
387 | 387 | if (empty($data)) { |
388 | - $data = $this->getAttachmentData($path); |
|
388 | + $data = $this->getAttachmentData($path); |
|
389 | 389 | } |
390 | 390 | $this->attachments[] = array( |
391 | 391 | 'path' => $path, |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $addresses = array(); |
427 | 427 | foreach ($pairs as $name => $email) { |
428 | 428 | if (is_numeric($name)) { |
429 | - $name = null; |
|
429 | + $name = null; |
|
430 | 430 | } |
431 | 431 | $addresses[] = $this->formatHeader($email, $name); |
432 | 432 | } |
@@ -970,10 +970,10 @@ discard block |
||
970 | 970 | return $headers; |
971 | 971 | } |
972 | 972 | |
973 | - /** |
|
974 | - * Get the attachment message for send or the simple message |
|
975 | - * @return string |
|
976 | - */ |
|
973 | + /** |
|
974 | + * Get the attachment message for send or the simple message |
|
975 | + * @return string |
|
976 | + */ |
|
977 | 977 | protected function getMessageWithAttachmentForSend() { |
978 | 978 | $message = $this->getWrapMessage(); |
979 | 979 | if ($this->hasAttachments()) { |
@@ -1010,11 +1010,11 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | protected function sendHelloCommand() { |
1012 | 1012 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
1013 | - ->getSmtpResponseCode(); |
|
1013 | + ->getSmtpResponseCode(); |
|
1014 | 1014 | if ($responseCode !== 250) { |
1015 | 1015 | //May be try with "HELO" |
1016 | 1016 | $responseCode = $this->sendCommand('HELO ' . $this->getSmtpClientHostname()) |
1017 | - ->getSmtpResponseCode(); |
|
1017 | + ->getSmtpResponseCode(); |
|
1018 | 1018 | if ($responseCode !== 250) { |
1019 | 1019 | $this->error = $this->smtpResponse; |
1020 | 1020 | return false; |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | $message = $this->getMessageWithAttachmentForSend(); |
1159 | 1159 | $headers = $this->getHeadersForSend(); |
1160 | 1160 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
1161 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1161 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1162 | 1162 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
1163 | 1163 | if (!$result) { |
1164 | 1164 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | return $result; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - /** |
|
1170 | - * Send mail using "smtp" protocol |
|
1171 | - * @return boolean |
|
1172 | - */ |
|
1169 | + /** |
|
1170 | + * Send mail using "smtp" protocol |
|
1171 | + * @return boolean |
|
1172 | + */ |
|
1173 | 1173 | protected function sendSmtp() { |
1174 | 1174 | if (!$this->smtpConnection()) { |
1175 | 1175 | return false; |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $message = $this->getMessageWithAttachmentForSend(); |
1190 | 1190 | $headers = $this->getHeadersForSend(); |
1191 | 1191 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
1192 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1192 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1193 | 1193 | |
1194 | 1194 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
1195 | 1195 | $commands = array( |
@@ -1223,17 +1223,17 @@ discard block |
||
1223 | 1223 | return empty($this->error); |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - /** |
|
1227 | - * Return the client hostname for SMTP |
|
1228 | - * |
|
1229 | - * There are only two legal types of hostname - either a fully |
|
1230 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1231 | - * (eg: "[1.2.3.4]"). |
|
1232 | - * |
|
1233 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1234 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
1235 | - * @return string |
|
1236 | - */ |
|
1226 | + /** |
|
1227 | + * Return the client hostname for SMTP |
|
1228 | + * |
|
1229 | + * There are only two legal types of hostname - either a fully |
|
1230 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1231 | + * (eg: "[1.2.3.4]"). |
|
1232 | + * |
|
1233 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1234 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
1235 | + * @return string |
|
1236 | + */ |
|
1237 | 1237 | protected function getSmtpClientHostname() { |
1238 | 1238 | $globals = &class_loader('GlobalVar', 'classes'); |
1239 | 1239 | if ($globals->server('SERVER_NAME')) { |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | */ |
135 | 135 | |
136 | 136 | /** |
137 | - * The log level |
|
138 | - * |
|
139 | - * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | - * |
|
141 | - * 'OFF' or 'NONE' = do not save log |
|
142 | - * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | - * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | - * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | - * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | - * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | - * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | - * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | - * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | - * |
|
151 | - * The default value is NONE if the config value is: null, '', 0, false |
|
152 | - * |
|
153 | - * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | - * time the log file size will increase very fast and will cost the application performance |
|
155 | - * and also the filesystem usage of your server. |
|
156 | - */ |
|
137 | + * The log level |
|
138 | + * |
|
139 | + * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | + * |
|
141 | + * 'OFF' or 'NONE' = do not save log |
|
142 | + * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | + * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | + * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | + * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | + * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | + * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | + * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | + * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | + * |
|
151 | + * The default value is NONE if the config value is: null, '', 0, false |
|
152 | + * |
|
153 | + * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | + * time the log file size will increase very fast and will cost the application performance |
|
155 | + * and also the filesystem usage of your server. |
|
156 | + */ |
|
157 | 157 | $config['log_level'] = 'NONE'; |
158 | 158 | |
159 | 159 | |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | $config['log_logger_name'] = array(); |
181 | 181 | |
182 | 182 | /** |
183 | - * The logger name custom level to use for the log |
|
184 | - * |
|
185 | - * If this config is set so means the logger level will be used to overwrite |
|
186 | - * the default log level configuration above. |
|
187 | - * |
|
188 | - * Example: |
|
189 | - * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | - * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | - * will be saved for WARNING message and above |
|
192 | - * Note: You can also use an regular expression for the logger name. |
|
193 | - * Example: |
|
194 | - * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | - * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | - */ |
|
183 | + * The logger name custom level to use for the log |
|
184 | + * |
|
185 | + * If this config is set so means the logger level will be used to overwrite |
|
186 | + * the default log level configuration above. |
|
187 | + * |
|
188 | + * Example: |
|
189 | + * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | + * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | + * will be saved for WARNING message and above |
|
192 | + * Note: You can also use an regular expression for the logger name. |
|
193 | + * Example: |
|
194 | + * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | + * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | + */ |
|
197 | 197 | $config['log_logger_name_level'] = array(); |
198 | 198 | |
199 | 199 |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | if ($init) { |
47 | 47 | $this->init(); |
48 | 48 | //@codeCoverageIgnoreStart |
49 | - if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
49 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
50 | 50 | $this->logger->warning('You are in production environment, please set ' |
51 | - . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
51 | + . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
52 | 52 | } |
53 | 53 | //@codeCoverageIgnoreEnd |
54 | 54 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (empty($this->config['base_url'])) { |
147 | 147 | if (ENVIRONMENT == 'production') { |
148 | 148 | $this->logger->warning('Application base URL is not set or invalid, please' |
149 | - . ' set application base URL to increase the application loading time'); |
|
149 | + . ' set application base URL to increase the application loading time'); |
|
150 | 150 | } |
151 | 151 | $baseUrl = null; |
152 | 152 | $protocol = 'http'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ); |
174 | 174 | } else { |
175 | 175 | $this->logger->warning('Can not determine the application ' |
176 | - . 'base URL automatically, use http://localhost as default'); |
|
176 | + . 'base URL automatically, use http://localhost as default'); |
|
177 | 177 | $baseUrl = 'http://localhost/'; |
178 | 178 | } |
179 | 179 | $this->config['base_url'] = $baseUrl; |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Return the server port using variable |
|
186 | - * |
|
187 | - * @codeCoverageIgnore |
|
188 | - * @return string |
|
189 | - */ |
|
185 | + * Return the server port using variable |
|
186 | + * |
|
187 | + * @codeCoverageIgnore |
|
188 | + * @return string |
|
189 | + */ |
|
190 | 190 | protected function getServerPort() { |
191 | 191 | $globals = & class_loader('GlobalVar', 'classes'); |
192 | 192 | $serverPort = $globals->server('SERVER_PORT'); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->log(self::DEBUG, $message); |
170 | 170 | } |
171 | 171 | |
172 | - /** |
|
172 | + /** |
|
173 | 173 | * Logs with an arbitrary level. |
174 | 174 | * |
175 | 175 | * @param integer|string $level the log level in integer or string format, |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | //NOTE: here need put the show_error() "logging" to false |
188 | 188 | //to prevent self function loop call |
189 | 189 | show_error('Invalid config log level [' . $configLogLevel . '], ' |
190 | - . 'the value must be one of the following: ' |
|
191 | - . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
192 | - , 'Log Config Error', |
|
193 | - $logging = false |
|
194 | - ); |
|
190 | + . 'the value must be one of the following: ' |
|
191 | + . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
192 | + , 'Log Config Error', |
|
193 | + $logging = false |
|
194 | + ); |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | protected function levelCanSaveLog($level) { |
262 | 262 | $result = true; |
263 | 263 | $configLogLevel = get_config('log_level'); |
264 | - //check if can save log regarding the log level configuration |
|
264 | + //check if can save log regarding the log level configuration |
|
265 | 265 | $configLevel = self::getLevelValue($configLogLevel); |
266 | 266 | if ($configLevel > $level) { |
267 | 267 | //can't log |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | //NOTE: here need put the show_error() "logging" to false |
342 | 342 | //to prevent self function loop call |
343 | 343 | show_error('Error : the log dir does not exist or is not writable', |
344 | - 'Log directory error', $logging = false); |
|
344 | + 'Log directory error', $logging = false); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $path = $logSavePath . 'logs-' . date('Y-m-d') . '.log'; |