@@ -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 | |
@@ -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'); |
@@ -318,7 +318,7 @@ |
||
| 318 | 318 | * Get some parameters need like ip address, hostname, browser info, etc. |
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | - protected function getSessionDataParams(){ |
|
| 321 | + protected function getSessionDataParams() { |
|
| 322 | 322 | $this->OBJ->loader->functions('user_agent'); |
| 323 | 323 | $this->OBJ->loader->library('Browser'); |
| 324 | 324 | |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | $this->log(self::DEBUG, $message); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Logs with an arbitrary level. |
|
| 185 | - * |
|
| 186 | - * @param integer|string $level the log level in integer or string format, |
|
| 187 | - * if is string will convert into integer. |
|
| 188 | - * @param string $message the log message to be saved |
|
| 189 | - */ |
|
| 183 | + /** |
|
| 184 | + * Logs with an arbitrary level. |
|
| 185 | + * |
|
| 186 | + * @param integer|string $level the log level in integer or string format, |
|
| 187 | + * if is string will convert into integer. |
|
| 188 | + * @param string $message the log message to be saved |
|
| 189 | + */ |
|
| 190 | 190 | public function log($level, $message) { |
| 191 | 191 | $configLogLevel = get_config('log_level'); |
| 192 | 192 | if (!$configLogLevel) { |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | //NOTE: here need put the show_error() "logging" to false |
| 199 | 199 | //to prevent self function loop call |
| 200 | 200 | show_error('Invalid config log level [' . $configLogLevel . '], ' |
| 201 | - . 'the value must be one of the following: ' |
|
| 202 | - . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
| 203 | - , 'Log Config Error', |
|
| 204 | - $logging = false |
|
| 205 | - ); |
|
| 201 | + . 'the value must be one of the following: ' |
|
| 202 | + . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
| 203 | + , 'Log Config Error', |
|
| 204 | + $logging = false |
|
| 205 | + ); |
|
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | protected function levelCanSaveLog($level) { |
| 272 | 272 | $result = true; |
| 273 | 273 | $configLogLevel = get_config('log_level'); |
| 274 | - //check if can save log regarding the log level configuration |
|
| 274 | + //check if can save log regarding the log level configuration |
|
| 275 | 275 | $configLevel = self::getLevelValue($configLogLevel); |
| 276 | 276 | if ($configLevel > $level) { |
| 277 | 277 | //can't log |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | //NOTE: here need put the show_error() "logging" to false |
| 352 | 352 | //to prevent self function loop call |
| 353 | 353 | show_error('Error : the log dir does not exist or is not writable', |
| 354 | - 'Log directory error', $logging = false); |
|
| 354 | + 'Log directory error', $logging = false); |
|
| 355 | 355 | } |
| 356 | 356 | return $logSavePath . 'logs-' . date('Y-m-d') . '.log'; |
| 357 | 357 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | protected function getLogDebugBacktraceInfo() { |
| 318 | 318 | $dtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 319 | 319 | $i = 0; |
| 320 | - while ($dtrace[$i]['file'] == __FILE__ ) { |
|
| 320 | + while ($dtrace[$i]['file'] == __FILE__) { |
|
| 321 | 321 | $i++; |
| 322 | 322 | } |
| 323 | 323 | $fileInfo = $dtrace[$i]; |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | if (isset($fileInfo['line'])) { |
| 334 | 334 | $line = $fileInfo['line']; |
| 335 | 335 | } |
| 336 | - if (isset($dtrace[$i+1]['function'])) { |
|
| 337 | - $function = $dtrace[$i+1]['function']; |
|
| 336 | + if (isset($dtrace[$i + 1]['function'])) { |
|
| 337 | + $function = $dtrace[$i + 1]['function']; |
|
| 338 | 338 | } |
| 339 | - if (isset($dtrace[$i+1]['class'])) { |
|
| 340 | - $class = $dtrace[$i+1]['class']; |
|
| 339 | + if (isset($dtrace[$i + 1]['class'])) { |
|
| 340 | + $class = $dtrace[$i + 1]['class']; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return array( |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | */ |
| 138 | 138 | $TIMEZONE = get_config('server_timezone', 'UTC'); |
| 139 | 139 | if (!date_default_timezone_set($TIMEZONE)) { |
| 140 | - show_error('Invalid server timezone configuration "' .$TIMEZONE. '"'); |
|
| 140 | + show_error('Invalid server timezone configuration "' . $TIMEZONE . '"'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -1,32 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | defined('ROOT_PATH') || exit('Access denied'); |
| 3 | - /** |
|
| 4 | - * TNH Framework |
|
| 5 | - * |
|
| 6 | - * A simple PHP framework using HMVC architecture |
|
| 7 | - * |
|
| 8 | - * This content is released under the MIT License (MIT) |
|
| 9 | - * |
|
| 10 | - * Copyright (c) 2017 TNH Framework |
|
| 11 | - * |
|
| 12 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 13 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 14 | - * in the Software without restriction, including without limitation the rights |
|
| 15 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 16 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 17 | - * furnished to do so, subject to the following conditions: |
|
| 18 | - * |
|
| 19 | - * The above copyright notice and this permission notice shall be included in all |
|
| 20 | - * copies or substantial portions of the Software. |
|
| 21 | - * |
|
| 22 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 23 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 24 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 25 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 26 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 27 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
| 28 | - * SOFTWARE. |
|
| 29 | - */ |
|
| 3 | + /** |
|
| 4 | + * TNH Framework |
|
| 5 | + * |
|
| 6 | + * A simple PHP framework using HMVC architecture |
|
| 7 | + * |
|
| 8 | + * This content is released under the MIT License (MIT) |
|
| 9 | + * |
|
| 10 | + * Copyright (c) 2017 TNH Framework |
|
| 11 | + * |
|
| 12 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 13 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 14 | + * in the Software without restriction, including without limitation the rights |
|
| 15 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 16 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 17 | + * furnished to do so, subject to the following conditions: |
|
| 18 | + * |
|
| 19 | + * The above copyright notice and this permission notice shall be included in all |
|
| 20 | + * copies or substantial portions of the Software. |
|
| 21 | + * |
|
| 22 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 23 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 24 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 25 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 26 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 27 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
| 28 | + * SOFTWARE. |
|
| 29 | + */ |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @file bootstrap.php |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | . '] please install a PHP version that is compatible.', 'PHP Error environment'); |
| 94 | 94 | } |
| 95 | 95 | $LOGGER->info('PHP version [' . phpversion() . '] is OK [REQUIRED MINIMUM: ' . TNH_MIN_PHP_VERSION |
| 96 | - . ', REQUIRED MAXIMUM: ' . TNH_MAX_PHP_VERSION . '] application can work without any issue'); |
|
| 96 | + . ', REQUIRED MAXIMUM: ' . TNH_MAX_PHP_VERSION . '] application can work without any issue'); |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Setting of the PHP error message handling function |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /** |
| 156 | 156 | * Register controllers autoload function |
| 157 | 157 | */ |
| 158 | - spl_autoload_register('autoload_controller'); |
|
| 158 | + spl_autoload_register('autoload_controller'); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Loading Security class |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function add($name) { |
| 60 | 60 | if (in_array($name, $this->list)) { |
| 61 | - $this->logger->warning('The module [' .$name. '] already added skipping.'); |
|
| 62 | - return $this; |
|
| 61 | + $this->logger->warning('The module [' .$name. '] already added skipping.'); |
|
| 62 | + return $this; |
|
| 63 | 63 | } |
| 64 | 64 | $this->list[] = $name; |
| 65 | 65 | return $this; |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | $this->list = array(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Get the list of module loaded |
|
| 96 | - * @return array the module list |
|
| 97 | - */ |
|
| 94 | + /** |
|
| 95 | + * Get the list of module loaded |
|
| 96 | + * @return array the module list |
|
| 97 | + */ |
|
| 98 | 98 | public function getModuleList() { |
| 99 | 99 | return $this->list; |
| 100 | 100 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $this->logger->debug('Check if the application contains the modules ...'); |
| 242 | 242 | $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR); |
| 243 | 243 | if ($dirList !== false) { |
| 244 | - $this->list = array_map('basename', $dirList); |
|
| 244 | + $this->list = array_map('basename', $dirList); |
|
| 245 | 245 | } |
| 246 | 246 | if (!empty($this->list)) { |
| 247 | 247 | $this->logger->info('The application contains the module below [' . implode(', ', $this->list) . ']'); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $filePath = MODULE_PATH . $module . DS . $type . DS . $classFile; |
| 265 | 265 | if (file_exists($filePath)) { |
| 266 | 266 | $this->logger->info('Found class [' . $class . '] in module [' . $module . '] ' |
| 267 | - . 'for [' . $type . '] the file path is [' . $filePath . ']'); |
|
| 267 | + . 'for [' . $type . '] the file path is [' . $filePath . ']'); |
|
| 268 | 268 | return $filePath; |
| 269 | 269 | } |
| 270 | 270 | $this->logger->info('Class [' . $class . '] does not exist in the module [' . $module . '] for [' . $type . ']'); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function add($name) { |
| 60 | 60 | if (in_array($name, $this->list)) { |
| 61 | - $this->logger->warning('The module [' .$name. '] already added skipping.'); |
|
| 61 | + $this->logger->warning('The module [' . $name . '] already added skipping.'); |
|
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | 64 | $this->list[] = $name; |