@@ -288,10 +288,10 @@ discard block |
||
| 288 | 288 | return $this; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - /** |
|
| 292 | - * Get the uploade file array |
|
| 293 | - * @return array |
|
| 294 | - */ |
|
| 291 | + /** |
|
| 292 | + * Get the uploade file array |
|
| 293 | + * @return array |
|
| 294 | + */ |
|
| 295 | 295 | public function getUploadedFileData() { |
| 296 | 296 | return $this->uploadedFileData; |
| 297 | 297 | } |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | return $this; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - /** |
|
| 335 | - * Get the filename |
|
| 336 | - * @return string |
|
| 337 | - */ |
|
| 334 | + /** |
|
| 335 | + * Get the filename |
|
| 336 | + * @return string |
|
| 337 | + */ |
|
| 338 | 338 | public function getFilename() { |
| 339 | 339 | return $this->filename; |
| 340 | 340 | } |
@@ -363,23 +363,23 @@ discard block |
||
| 363 | 363 | return $this; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - /** |
|
| 367 | - * Get the max file size |
|
| 368 | - * @return double|int |
|
| 369 | - */ |
|
| 366 | + /** |
|
| 367 | + * Get the max file size |
|
| 368 | + * @return double|int |
|
| 369 | + */ |
|
| 370 | 370 | public function getMaxFileSize() { |
| 371 | 371 | return $this->maxFileSize; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - /** |
|
| 375 | - * Append a mime type to allowed mime types |
|
| 376 | - * |
|
| 377 | - * @since 1.0 |
|
| 378 | - * @version 1.0.1 |
|
| 379 | - * @param string $mime |
|
| 380 | - * @return object |
|
| 381 | - * @method boolean setAllowMimeType |
|
| 382 | - */ |
|
| 374 | + /** |
|
| 375 | + * Append a mime type to allowed mime types |
|
| 376 | + * |
|
| 377 | + * @since 1.0 |
|
| 378 | + * @version 1.0.1 |
|
| 379 | + * @param string $mime |
|
| 380 | + * @return object |
|
| 381 | + * @method boolean setAllowMimeType |
|
| 382 | + */ |
|
| 383 | 383 | public function setAllowMimeType($mime) { |
| 384 | 384 | if (!empty($mime) && is_string($mime)) { |
| 385 | 385 | $this->allowedMimeTypes[] = strtolower($mime); |
@@ -500,10 +500,10 @@ discard block |
||
| 500 | 500 | return $this; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - /** |
|
| 504 | - * Get the upload function name like "copy", "move_uploaded_file" |
|
| 505 | - * @return string |
|
| 506 | - */ |
|
| 503 | + /** |
|
| 504 | + * Get the upload function name like "copy", "move_uploaded_file" |
|
| 505 | + * @return string |
|
| 506 | + */ |
|
| 507 | 507 | public function getUploadFunction() { |
| 508 | 508 | return $this->uploadFunction; |
| 509 | 509 | } |
@@ -521,10 +521,10 @@ discard block |
||
| 521 | 521 | return $this; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - /** |
|
| 525 | - * Get the allow overwriting |
|
| 526 | - * @return boolean |
|
| 527 | - */ |
|
| 524 | + /** |
|
| 525 | + * Get the allow overwriting |
|
| 526 | + * @return boolean |
|
| 527 | + */ |
|
| 528 | 528 | public function isAllowOverwriting() { |
| 529 | 529 | return $this->overwriteFile ; |
| 530 | 530 | } |
@@ -646,14 +646,14 @@ discard block |
||
| 646 | 646 | return $this->error; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - /** |
|
| 650 | - * Retrive status of upload |
|
| 651 | - * |
|
| 652 | - * @since 1.0 |
|
| 653 | - * @version 1.0 |
|
| 654 | - * @return boolean |
|
| 655 | - * @method boolean getStatus |
|
| 656 | - */ |
|
| 649 | + /** |
|
| 650 | + * Retrive status of upload |
|
| 651 | + * |
|
| 652 | + * @since 1.0 |
|
| 653 | + * @version 1.0 |
|
| 654 | + * @return boolean |
|
| 655 | + * @method boolean getStatus |
|
| 656 | + */ |
|
| 657 | 657 | public function getStatus() { |
| 658 | 658 | return $this->file['status']; |
| 659 | 659 | } |
@@ -200,17 +200,17 @@ |
||
| 200 | 200 | die(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Function defined for PHP error message handling |
|
| 205 | - * |
|
| 206 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
| 207 | - * @param string $errstr the error message |
|
| 208 | - * @param string $errfile the file where the error occurred |
|
| 209 | - * @param int $errline the line number where the error occurred |
|
| 210 | - * @codeCoverageIgnore |
|
| 211 | - * |
|
| 212 | - * @return boolean |
|
| 213 | - */ |
|
| 203 | + /** |
|
| 204 | + * Function defined for PHP error message handling |
|
| 205 | + * |
|
| 206 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
| 207 | + * @param string $errstr the error message |
|
| 208 | + * @param string $errfile the file where the error occurred |
|
| 209 | + * @param int $errline the line number where the error occurred |
|
| 210 | + * @codeCoverageIgnore |
|
| 211 | + * |
|
| 212 | + * @return boolean |
|
| 213 | + */ |
|
| 214 | 214 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
| 215 | 215 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
| 216 | 216 | if ($isError) { |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | parent::__construct(); |
| 46 | 46 | if ($init) { |
| 47 | 47 | $this->init(); |
| 48 | - if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
| 48 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
| 49 | 49 | $this->logger->warning('You are in production environment, please set ' |
| 50 | - . 'log level to WARNING, ERROR, FATAL to increase the application performance'); |
|
| 50 | + . 'log level to WARNING, ERROR, FATAL to increase the application performance'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -175,17 +175,17 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * Return the server port using variable |
|
| 179 | - * |
|
| 180 | - * @codeCoverageIgnore |
|
| 181 | - * @return string |
|
| 182 | - */ |
|
| 178 | + * Return the server port using variable |
|
| 179 | + * |
|
| 180 | + * @codeCoverageIgnore |
|
| 181 | + * @return string |
|
| 182 | + */ |
|
| 183 | 183 | protected function getServerPort() { |
| 184 | 184 | $globals = & class_loader('GlobalVar', 'classes'); |
| 185 | 185 | $serverPortValue = $globals->server('SERVER_PORT'); |
| 186 | 186 | $serverPort = 80; |
| 187 | 187 | if ($serverPortValue) { |
| 188 | - $serverPort = $serverPortValue; |
|
| 188 | + $serverPort = $serverPortValue; |
|
| 189 | 189 | } |
| 190 | 190 | $port = ''; |
| 191 | 191 | if ((is_https() && $serverPort != 443) || (!is_https() && $serverPort != 80)) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Construct new ApcCache instance |
| 35 | 35 | */ |
| 36 | - public function __construct() { |
|
| 36 | + public function __construct() { |
|
| 37 | 37 | parent::__construct(); |
| 38 | 38 | if (!$this->isSupported()) { |
| 39 | 39 | show_error('The cache for APC[u] driver is not available. Check if APC[u] extension is loaded and enabled.'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function set($key, $data, $ttl = 0) { |
| 80 | 80 | $expire = time() + $ttl; |
| 81 | 81 | $this->logger->debug('Setting cache data for key [' . $key . '], time to live [' . $ttl . '], ' |
| 82 | - . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
| 82 | + . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
| 83 | 83 | $result = apc_store($key, $data, $ttl); |
| 84 | 84 | if ($result === false) { |
| 85 | 85 | $this->logger->error('Can not save cache data for the key [' . $key . '], return false'); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } else { |
| 190 | 190 | $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] using the default location'); |
| 191 | 191 | } |
| 192 | - if (!$path) { |
|
| 192 | + if (!$path) { |
|
| 193 | 193 | $path = $this->getDefaultFilePathForView($viewFile); |
| 194 | 194 | } |
| 195 | 195 | $this->logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | return $this->finalPageContent; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Set the final page to be rendered |
|
| 294 | - * @param string $finalPage the content of the final page |
|
| 295 | - * |
|
| 296 | - * @return object |
|
| 297 | - */ |
|
| 292 | + /** |
|
| 293 | + * Set the final page to be rendered |
|
| 294 | + * @param string $finalPage the content of the final page |
|
| 295 | + * |
|
| 296 | + * @return object |
|
| 297 | + */ |
|
| 298 | 298 | public function setFinalPageContent($finalPage) { |
| 299 | 299 | $this->finalPageContent = $finalPage; |
| 300 | 300 | return $this; |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | |
| 374 | - /** |
|
| 375 | - * Return the default full file path for view |
|
| 376 | - * @param string $file the filename |
|
| 377 | - * |
|
| 378 | - * @return string|null the full file path |
|
| 379 | - */ |
|
| 374 | + /** |
|
| 375 | + * Return the default full file path for view |
|
| 376 | + * @param string $file the filename |
|
| 377 | + * |
|
| 378 | + * @return string|null the full file path |
|
| 379 | + */ |
|
| 380 | 380 | protected function getDefaultFilePathForView($file){ |
| 381 | 381 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
| 382 | 382 | $fullFilePath = null; |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
| 410 | 410 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
| 411 | 411 | $this->logger->info('The cache page content is not yet expire for the ' |
| 412 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 412 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 413 | 413 | $this->sendHeaders(304); |
| 414 | 414 | return true; |
| 415 | 415 | } |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | protected function sendCachePageContentToBrowser(&$cache) { |
| 426 | 426 | $this->logger->info('The cache page content is expired or the browser does ' |
| 427 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 428 | - . 'send cache headers to tell the browser'); |
|
| 427 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 428 | + . 'send cache headers to tell the browser'); |
|
| 429 | 429 | $this->sendHeaders(200); |
| 430 | 430 | //current page cache key |
| 431 | 431 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -564,18 +564,18 @@ discard block |
||
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - /** |
|
| 568 | - * Set the mandory headers, like security, etc. |
|
| 569 | - */ |
|
| 567 | + /** |
|
| 568 | + * Set the mandory headers, like security, etc. |
|
| 569 | + */ |
|
| 570 | 570 | protected function setRequiredHeaders() { |
| 571 | 571 | $requiredHeaders = array( |
| 572 | 572 | 'X-XSS-Protection' => '1; mode=block', |
| 573 | 573 | 'X-Frame-Options' => 'SAMEORIGIN' |
| 574 | 574 | ); |
| 575 | 575 | foreach ($requiredHeaders as $key => $value) { |
| 576 | - if (!isset($this->headers[$key])) { |
|
| 576 | + if (!isset($this->headers[$key])) { |
|
| 577 | 577 | $this->headers[$key] = $value; |
| 578 | - } |
|
| 578 | + } |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -64,8 +64,8 @@ |
||
| 64 | 64 | public function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false) { |
| 65 | 65 | if (headers_sent()) { |
| 66 | 66 | show_error('There exists a cookie that we wanted to create that we couldn\'t ' |
| 67 | - . 'because headers was already sent. Make sure to do this first ' |
|
| 68 | - . 'before outputing anything.'); |
|
| 67 | + . 'because headers was already sent. Make sure to do this first ' |
|
| 68 | + . 'before outputing anything.'); |
|
| 69 | 69 | } |
| 70 | 70 | $timestamp = $expire; |
| 71 | 71 | if ($expire) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @codeCoverageIgnore |
| 95 | 95 | */ |
| 96 | - private function startAppSession() { |
|
| 96 | + private function startAppSession() { |
|
| 97 | 97 | //$_SESSION is not available on cli mode |
| 98 | 98 | if (!IS_CLI) { |
| 99 | 99 | //set session params |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @codeCoverageIgnore |
| 144 | 144 | */ |
| 145 | 145 | private function setAppSessionConfig() { |
| 146 | - //the default is to store in the files |
|
| 146 | + //the default is to store in the files |
|
| 147 | 147 | $sessionHandler = $this->config->get('session_handler', 'files'); |
| 148 | 148 | $this->logger->info('Session handler: ' . $sessionHandler); |
| 149 | 149 | if ($sessionHandler == 'files') { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | class Model { |
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * This model's default database table. |
| 35 | 35 | * @var string the name of table |
| 36 | 36 | */ |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | if ($db !== null) { |
| 174 | 174 | $this->setDb($db); |
| 175 | 175 | } else { |
| 176 | - /** |
|
| 177 | - * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
| 178 | - * to prevent duplication |
|
| 179 | - */ |
|
| 180 | - $obj = & get_instance(); |
|
| 181 | - $this->setDb(clone $obj->database); |
|
| 176 | + /** |
|
| 177 | + * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
| 178 | + * to prevent duplication |
|
| 179 | + */ |
|
| 180 | + $obj = & get_instance(); |
|
| 181 | + $this->setDb(clone $obj->database); |
|
| 182 | 182 | } |
| 183 | 183 | array_unshift($this->beforeCreateCallbacks, 'removeProtectedTableColumns'); |
| 184 | 184 | array_unshift($this->beforeUpdateCallbacks, 'removeProtectedTableColumns'); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | * Only get deleted rows on the next call |
| 624 | 624 | * |
| 625 | 625 | * @return object the current instance |
| 626 | - */ |
|
| 626 | + */ |
|
| 627 | 627 | public function onlyRecordDeleted() { |
| 628 | 628 | $this->returnOnlyRecordDeleted = true; |
| 629 | 629 | return $this; |
@@ -649,8 +649,8 @@ discard block |
||
| 649 | 649 | * @return array the data after add field for updated time |
| 650 | 650 | */ |
| 651 | 651 | public function updatedAt($row) { |
| 652 | - $row['updated_at'] = date('Y-m-d H:i:s'); |
|
| 653 | - return $row; |
|
| 652 | + $row['updated_at'] = date('Y-m-d H:i:s'); |
|
| 653 | + return $row; |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | /** |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | public function removeProtectedTableColumns($row) { |
| 697 | 697 | foreach ($this->protectedTableColumns as $attr) { |
| 698 | - if (isset($row[$attr])) { |
|
| 698 | + if (isset($row[$attr])) { |
|
| 699 | 699 | unset($row[$attr]); |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -818,23 +818,23 @@ discard block |
||
| 818 | 818 | return false; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - /** |
|
| 822 | - * Get the record return type array or object |
|
| 823 | - * |
|
| 824 | - * @return string|boolean |
|
| 825 | - */ |
|
| 821 | + /** |
|
| 822 | + * Get the record return type array or object |
|
| 823 | + * |
|
| 824 | + * @return string|boolean |
|
| 825 | + */ |
|
| 826 | 826 | protected function getReturnType(){ |
| 827 | 827 | $type = false; |
| 828 | 828 | if ($this->temporaryReturnRecordType == 'array') { |
| 829 | - $type = 'array'; |
|
| 829 | + $type = 'array'; |
|
| 830 | 830 | } |
| 831 | 831 | return $type; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - /** |
|
| 835 | - * Check if soft delete is enable setting the condition |
|
| 836 | - * @return object the current instance |
|
| 837 | - */ |
|
| 834 | + /** |
|
| 835 | + * Check if soft delete is enable setting the condition |
|
| 836 | + * @return object the current instance |
|
| 837 | + */ |
|
| 838 | 838 | protected function checkForSoftDelete(){ |
| 839 | 839 | if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) { |
| 840 | 840 | $this->getQueryBuilder()->where( |
@@ -845,16 +845,16 @@ discard block |
||
| 845 | 845 | return $this; |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - /** |
|
| 849 | - * Relate for "manyToOne" and "oneToMany" |
|
| 850 | - * |
|
| 851 | - * @param string $relationship the name of relation |
|
| 852 | - * @param string|array $options the model and primary key values |
|
| 853 | - * @param object|array $row the row to update |
|
| 854 | - * @param string $type the type can be "manyToOne", "oneToMany" |
|
| 855 | - * |
|
| 856 | - * @return array|object the final row values |
|
| 857 | - */ |
|
| 848 | + /** |
|
| 849 | + * Relate for "manyToOne" and "oneToMany" |
|
| 850 | + * |
|
| 851 | + * @param string $relationship the name of relation |
|
| 852 | + * @param string|array $options the model and primary key values |
|
| 853 | + * @param object|array $row the row to update |
|
| 854 | + * @param string $type the type can be "manyToOne", "oneToMany" |
|
| 855 | + * |
|
| 856 | + * @return array|object the final row values |
|
| 857 | + */ |
|
| 858 | 858 | protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){ |
| 859 | 859 | if (in_array($relationship, $this->withs)) { |
| 860 | 860 | get_instance()->loader->model($options['model'], $relationship . '_model'); |