@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | //record the class instance |
93 | 93 | $classes[$class] = isset($params) ? new $class($params) : new $class(); |
94 | - return $classes[$class]; |
|
94 | + return $classes[$class]; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | die(); |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Function defined for PHP error message handling |
|
184 | - * |
|
185 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
186 | - * @param string $errstr the error message |
|
187 | - * @param string $errfile the file where the error occurred |
|
188 | - * @param int $errline the line number where the error occurred |
|
189 | - * @codeCoverageIgnore |
|
190 | - * |
|
191 | - * @return boolean |
|
192 | - */ |
|
182 | + /** |
|
183 | + * Function defined for PHP error message handling |
|
184 | + * |
|
185 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
186 | + * @param string $errstr the error message |
|
187 | + * @param string $errfile the file where the error occurred |
|
188 | + * @param int $errline the line number where the error occurred |
|
189 | + * @codeCoverageIgnore |
|
190 | + * |
|
191 | + * @return boolean |
|
192 | + */ |
|
193 | 193 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
194 | 194 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
195 | 195 | if ($isError) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | E_RECOVERABLE_ERROR => 'Catchable Fatal Error' |
213 | 213 | ); |
214 | 214 | if (isset($errorsType[$errno])) { |
215 | - $errorType = $errorsType[$errno]; |
|
215 | + $errorType = $errorsType[$errno]; |
|
216 | 216 | } |
217 | 217 | $errorText = 'An error is occurred in the file ' . $errfile . ' at line ' . $errline . ' raison : ' . $errstr; |
218 | 218 | if ((error_reporting() & $errno) !== $errno) { |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $addresses = array(); |
396 | 396 | foreach ($pairs as $name => $email) { |
397 | 397 | if (is_numeric($name)) { |
398 | - $name = null; |
|
398 | + $name = null; |
|
399 | 399 | } |
400 | 400 | $addresses[] = $this->formatHeader($email, $name); |
401 | 401 | } |
@@ -837,10 +837,10 @@ discard block |
||
837 | 837 | return $headers; |
838 | 838 | } |
839 | 839 | |
840 | - /** |
|
841 | - * Get the attachment message for send or the simple message |
|
842 | - * @return string |
|
843 | - */ |
|
840 | + /** |
|
841 | + * Get the attachment message for send or the simple message |
|
842 | + * @return string |
|
843 | + */ |
|
844 | 844 | protected function getMessageWithAttachmentForSend() { |
845 | 845 | $message = $this->getWrapMessage(); |
846 | 846 | if ($this->hasAttachments()) { |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | */ |
871 | 871 | protected function sendHelloCommand() { |
872 | 872 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
873 | - ->getSmtpResponseCode(); |
|
873 | + ->getSmtpResponseCode(); |
|
874 | 874 | if ($responseCode !== 250) { |
875 | 875 | $this->error = $this->smtpResponse; |
876 | 876 | return false; |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | $message = $this->getMessageWithAttachmentForSend(); |
1018 | 1018 | $headers = $this->getHeadersForSend(); |
1019 | 1019 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
1020 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1020 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1021 | 1021 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
1022 | 1022 | if (!$result) { |
1023 | 1023 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -1025,10 +1025,10 @@ discard block |
||
1025 | 1025 | return $result; |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - /** |
|
1029 | - * Send mail using "smtp" protocol |
|
1030 | - * @return boolean |
|
1031 | - */ |
|
1028 | + /** |
|
1029 | + * Send mail using "smtp" protocol |
|
1030 | + * @return boolean |
|
1031 | + */ |
|
1032 | 1032 | protected function sendSmtp() { |
1033 | 1033 | if (!$this->smtpConnection()) { |
1034 | 1034 | return false; |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | $message = $this->getMessageWithAttachmentForSend(); |
1039 | 1039 | $headers = $this->getHeadersForSend(); |
1040 | 1040 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
1041 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1041 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1042 | 1042 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
1043 | 1043 | $commands = array( |
1044 | 1044 | 'mail_from' => array('MAIL FROM: <' . $this->from . '>', 'MAIL_FROM', 250), |
@@ -1089,17 +1089,17 @@ discard block |
||
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | |
1092 | - /** |
|
1093 | - * Return the client hostname for SMTP |
|
1094 | - * |
|
1095 | - * There are only two legal types of hostname - either a fully |
|
1096 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1097 | - * (eg: "[1.2.3.4]"). |
|
1098 | - * |
|
1099 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1100 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
1101 | - * @return string |
|
1102 | - */ |
|
1092 | + /** |
|
1093 | + * Return the client hostname for SMTP |
|
1094 | + * |
|
1095 | + * There are only two legal types of hostname - either a fully |
|
1096 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1097 | + * (eg: "[1.2.3.4]"). |
|
1098 | + * |
|
1099 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1100 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
1101 | + * @return string |
|
1102 | + */ |
|
1103 | 1103 | protected function getSmtpClientHostname() { |
1104 | 1104 | $globals = &class_loader('GlobalVar', 'classes'); |
1105 | 1105 | if ($globals->server('SERVER_NAME')) { |
@@ -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'); |
@@ -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 |
@@ -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', 'notice'))) { |
|
49 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'notice'))) { |
|
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'); |
@@ -276,14 +276,14 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
279 | - * Setting the route configuration using the configuration file |
|
280 | - * and additional configuration from param |
|
281 | - * @param array $overwriteConfig the additional configuration |
|
282 | - * to overwrite with the existing one |
|
283 | - * @param boolean $useConfigFile whether to use route configuration file |
|
284 | - * |
|
285 | - * @return object |
|
286 | - */ |
|
279 | + * Setting the route configuration using the configuration file |
|
280 | + * and additional configuration from param |
|
281 | + * @param array $overwriteConfig the additional configuration |
|
282 | + * to overwrite with the existing one |
|
283 | + * @param boolean $useConfigFile whether to use route configuration file |
|
284 | + * |
|
285 | + * @return object |
|
286 | + */ |
|
287 | 287 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
288 | 288 | $route = array(); |
289 | 289 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | //the URL like http://domain.com/module/controller/method/arg1/arg2/argn |
365 | 365 | if (!$this->controller) { |
366 | 366 | $this->logger->info('Cannot determine the routing information ' |
367 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
367 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
368 | 368 | //determine route parameters using the route URI param |
369 | 369 | $this->determineRouteParamsFromRequestUri(); |
370 | 370 | } |
@@ -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 |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $this->logger->info( |
599 | 599 | 'After loop in predefined routes configuration,' |
600 | 600 | . 'the module name is set but the controller is not set,' |
601 | - . 'so we will use module as the controller' |
|
601 | + . 'so we will use module as the controller' |
|
602 | 602 | ); |
603 | 603 | $this->controller = $this->module; |
604 | 604 | } |
@@ -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 | if ($port && !in_array($port, array(80, 443))) { |
133 | 133 | $domain .= ':' . $port; |
134 | 134 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] ' |
186 | 186 | . 'using the default location'); |
187 | 187 | } |
188 | - if (!$path) { |
|
188 | + if (!$path) { |
|
189 | 189 | $path = $this->getDefaultFilePathForView($viewFile); |
190 | 190 | } |
191 | 191 | $this->logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | return $this->finalPageContent; |
262 | 262 | } |
263 | 263 | |
264 | - /** |
|
265 | - * Set the final page to be rendered |
|
266 | - * @param string $finalPage the content of the final page |
|
267 | - * |
|
268 | - * @return object |
|
269 | - */ |
|
264 | + /** |
|
265 | + * Set the final page to be rendered |
|
266 | + * @param string $finalPage the content of the final page |
|
267 | + * |
|
268 | + * @return object |
|
269 | + */ |
|
270 | 270 | public function setFinalPageContent($finalPage) { |
271 | 271 | $this->finalPageContent = $finalPage; |
272 | 272 | return $this; |
@@ -339,12 +339,12 @@ discard block |
||
339 | 339 | //@codeCoverageIgnoreEnd |
340 | 340 | } |
341 | 341 | |
342 | - /** |
|
343 | - * Dispatch the FINAL_VIEW_READY event |
|
344 | - * |
|
345 | - * @return string|null the final view content after processing by each listener |
|
346 | - * if they exists otherwise the same content will be returned |
|
347 | - */ |
|
342 | + /** |
|
343 | + * Dispatch the FINAL_VIEW_READY event |
|
344 | + * |
|
345 | + * @return string|null the final view content after processing by each listener |
|
346 | + * if they exists otherwise the same content will be returned |
|
347 | + */ |
|
348 | 348 | protected function dispatchFinalViewEvent() { |
349 | 349 | //dispatch |
350 | 350 | $event = get_instance()->eventdispatcher->dispatch( |
@@ -388,12 +388,12 @@ discard block |
||
388 | 388 | && (bool) ini_get('zlib.output_compression') === false; |
389 | 389 | } |
390 | 390 | |
391 | - /** |
|
392 | - * Return the default full file path for view |
|
393 | - * @param string $file the filename |
|
394 | - * |
|
395 | - * @return string|null the full file path |
|
396 | - */ |
|
391 | + /** |
|
392 | + * Return the default full file path for view |
|
393 | + * @param string $file the filename |
|
394 | + * |
|
395 | + * @return string|null the full file path |
|
396 | + */ |
|
397 | 397 | protected function getDefaultFilePathForView($file){ |
398 | 398 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
399 | 399 | $fullFilePath = null; |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
427 | 427 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
428 | 428 | $this->logger->info('The cache page content is not yet expire for the ' |
429 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
429 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
430 | 430 | $this->sendHeaders(304); |
431 | 431 | return true; |
432 | 432 | } |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | */ |
442 | 442 | protected function sendCachePageContentToBrowser(&$cache) { |
443 | 443 | $this->logger->info('The cache page content is expired or the browser does ' |
444 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
445 | - . 'send cache headers to tell the browser'); |
|
444 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
445 | + . 'send cache headers to tell the browser'); |
|
446 | 446 | $this->sendHeaders(200); |
447 | 447 | //current page cache key |
448 | 448 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -581,18 +581,18 @@ discard block |
||
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | - /** |
|
585 | - * Set the mandory headers, like security, etc. |
|
586 | - */ |
|
584 | + /** |
|
585 | + * Set the mandory headers, like security, etc. |
|
586 | + */ |
|
587 | 587 | protected function setRequiredHeaders() { |
588 | 588 | $requiredHeaders = array( |
589 | 589 | 'X-XSS-Protection' => '1; mode=block', |
590 | 590 | 'X-Frame-Options' => 'SAMEORIGIN' |
591 | 591 | ); |
592 | 592 | foreach ($requiredHeaders as $key => $value) { |
593 | - if (!isset($this->headers[$key])) { |
|
593 | + if (!isset($this->headers[$key])) { |
|
594 | 594 | $this->headers[$key] = $value; |
595 | - } |
|
595 | + } |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |