@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | return $this->removeVars($_ENV, $key); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - /** |
|
| 238 | - * Get the value from $GLOBALS for given key. if the key is empty will return all values |
|
| 239 | - * @see GlobalVar::getVars |
|
| 240 | - */ |
|
| 237 | + /** |
|
| 238 | + * Get the value from $GLOBALS for given key. if the key is empty will return all values |
|
| 239 | + * @see GlobalVar::getVars |
|
| 240 | + */ |
|
| 241 | 241 | public function globals($key = null, $xss = true) { |
| 242 | 242 | return $this->getVars($GLOBALS, $key, $xss); |
| 243 | 243 | } |
@@ -259,16 +259,16 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will |
|
| 264 | - * set the current super variable value by this. |
|
| 265 | - * @param array $var the super global variable to use, can be "$_POST", "$_GET", etc. |
|
| 266 | - * @param string|array $key the item key to be set or array if need set the current global variable |
|
| 267 | - * by this value |
|
| 268 | - * @param mixed $value the value to set if $key is not an array |
|
| 269 | - * |
|
| 270 | - * @return object the current instance |
|
| 271 | - */ |
|
| 262 | + /** |
|
| 263 | + * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will |
|
| 264 | + * set the current super variable value by this. |
|
| 265 | + * @param array $var the super global variable to use, can be "$_POST", "$_GET", etc. |
|
| 266 | + * @param string|array $key the item key to be set or array if need set the current global variable |
|
| 267 | + * by this value |
|
| 268 | + * @param mixed $value the value to set if $key is not an array |
|
| 269 | + * |
|
| 270 | + * @return object the current instance |
|
| 271 | + */ |
|
| 272 | 272 | protected function setVars(&$var, $key, $value = null) { |
| 273 | 273 | if (is_array($key)) { |
| 274 | 274 | //set all |
@@ -207,10 +207,10 @@ |
||
| 207 | 207 | return $this; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * Return the instance of session. |
|
| 212 | - * @return object the session instance |
|
| 213 | - */ |
|
| 210 | + /** |
|
| 211 | + * Return the instance of session. |
|
| 212 | + * @return object the session instance |
|
| 213 | + */ |
|
| 214 | 214 | public function getSession() { |
| 215 | 215 | return $this->session; |
| 216 | 216 | } |
@@ -311,7 +311,7 @@ |
||
| 311 | 311 | protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
| 312 | 312 | $searchDir = null; |
| 313 | 313 | if ($type == 'function') { |
| 314 | - $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
|
| 314 | + $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
|
| 315 | 315 | } |
| 316 | 316 | else if ($type == 'language') { |
| 317 | 317 | $searchDir = array(APP_LANG_PATH, CORE_LANG_PATH); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->logger->debug('Check if the application contains the modules ...'); |
| 47 | 47 | $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR); |
| 48 | 48 | if ($dirList !== false) { |
| 49 | - $this->list = array_map('basename', $dirList); |
|
| 49 | + $this->list = array_map('basename', $dirList); |
|
| 50 | 50 | } |
| 51 | 51 | if (!empty($this->list)) { |
| 52 | 52 | $this->logger->info('The application contains the module below [' . implode(', ', $this->list) . ']'); |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function add($name) { |
| 63 | 63 | if (in_array($name, $this->list)) { |
| 64 | - $this->logger->info('The module [' .$name. '] already added skipping.'); |
|
| 65 | - return $this; |
|
| 64 | + $this->logger->info('The module [' .$name. '] already added skipping.'); |
|
| 65 | + return $this; |
|
| 66 | 66 | } |
| 67 | 67 | $this->list[] = $name; |
| 68 | 68 | return $this; |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | $this->list = array(); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Get the list of module loaded |
|
| 98 | - * @return array the module list |
|
| 99 | - */ |
|
| 96 | + /** |
|
| 97 | + * Get the list of module loaded |
|
| 98 | + * @return array the module list |
|
| 99 | + */ |
|
| 100 | 100 | public function getModuleList() { |
| 101 | 101 | return $this->list; |
| 102 | 102 | } |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | |
| 31 | 31 | class DatabaseQueryRunner extends BaseClass { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The DatabaseConnection instance |
|
| 35 | - * @var object |
|
| 36 | - */ |
|
| 33 | + /** |
|
| 34 | + * The DatabaseConnection instance |
|
| 35 | + * @var object |
|
| 36 | + */ |
|
| 37 | 37 | private $connection = null; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -98,10 +98,10 @@ |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * This method is used to check the whitelist IP address access |
|
| 102 | - * |
|
| 103 | - * @return boolean |
|
| 104 | - */ |
|
| 101 | + * This method is used to check the whitelist IP address access |
|
| 102 | + * |
|
| 103 | + * @return boolean |
|
| 104 | + */ |
|
| 105 | 105 | public function checkWhiteListIpAccess() { |
| 106 | 106 | $this->logger->debug('Validation of the IP address access ...'); |
| 107 | 107 | $this->logger->debug('Check if whitelist IP access is enabled in the configuration ...'); |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | class Assets extends BaseClass { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Construct new instance |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * Construct new instance |
|
| 49 | + */ |
|
| 50 | 50 | public function __construct() { |
| 51 | 51 | parent::__construct(); |
| 52 | 52 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | $filename = $this->encodeUtf8($this->filterOther((string) $filename)); |
| 288 | 288 | if (empty($data)) { |
| 289 | - $data = $this->getAttachmentData($path); |
|
| 289 | + $data = $this->getAttachmentData($path); |
|
| 290 | 290 | } |
| 291 | 291 | $this->attachments[] = array( |
| 292 | 292 | 'path' => $path, |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $addresses = array(); |
| 350 | 350 | foreach ($pairs as $name => $email) { |
| 351 | 351 | if (is_numeric($name)) { |
| 352 | - $name = null; |
|
| 352 | + $name = null; |
|
| 353 | 353 | } |
| 354 | 354 | $addresses[] = $this->formatHeader($email, $name); |
| 355 | 355 | } |
@@ -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 = '') { |
@@ -255,12 +255,12 @@ discard block |
||
| 255 | 255 | return $this->isFacebook; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * Returns a formatted string with a summary of the details of the browser. |
|
| 260 | - * @codeCoverageIgnore |
|
| 261 | - * |
|
| 262 | - * @return string formatted string with a summary of the browser |
|
| 263 | - */ |
|
| 258 | + /** |
|
| 259 | + * Returns a formatted string with a summary of the details of the browser. |
|
| 260 | + * @codeCoverageIgnore |
|
| 261 | + * |
|
| 262 | + * @return string formatted string with a summary of the browser |
|
| 263 | + */ |
|
| 264 | 264 | public function __toString() { |
| 265 | 265 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
| 266 | 266 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -304,70 +304,70 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * Determine the user's platform |
| 306 | 306 | */ |
| 307 | - protected function checkPlatform() { |
|
| 308 | - foreach ($this->platforms as $regex => $value) { |
|
| 309 | - if (preg_match($regex, $this->agent) ) { |
|
| 310 | - $this->setPlatform($value); |
|
| 311 | - break; |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - } |
|
| 307 | + protected function checkPlatform() { |
|
| 308 | + foreach ($this->platforms as $regex => $value) { |
|
| 309 | + if (preg_match($regex, $this->agent) ) { |
|
| 310 | + $this->setPlatform($value); |
|
| 311 | + break; |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - /** |
|
| 316 | + /** |
|
| 317 | 317 | * Routine to determine the browser type |
| 318 | 318 | */ |
| 319 | - protected function checkBrowser() { |
|
| 320 | - foreach ($this->browsers as $regex => $value) { |
|
| 321 | - if (preg_match($regex, $this->agent ) ) { |
|
| 322 | - $this->setBrowser($value); |
|
| 323 | - break; |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - } |
|
| 319 | + protected function checkBrowser() { |
|
| 320 | + foreach ($this->browsers as $regex => $value) { |
|
| 321 | + if (preg_match($regex, $this->agent ) ) { |
|
| 322 | + $this->setBrowser($value); |
|
| 323 | + break; |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | - /** |
|
| 328 | + /** |
|
| 329 | 329 | * Routine to determine the browser version |
| 330 | 330 | */ |
| 331 | - protected function checkBrowserVersion(){ |
|
| 332 | - $detected = $this->getBrowser(); |
|
| 333 | - $detect = array_search($detected, $this->browsers); |
|
| 334 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
| 335 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 336 | - if (preg_match_all($regex, $this->agent, $matches)) { |
|
| 337 | - $found = array_search($browser, $matches['browser']); |
|
| 338 | - $this->setVersion($matches['version'][$found]); |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - /** |
|
| 331 | + protected function checkBrowserVersion(){ |
|
| 332 | + $detected = $this->getBrowser(); |
|
| 333 | + $detect = array_search($detected, $this->browsers); |
|
| 334 | + $browser = str_replace(array('/i','/'), '', $detect); |
|
| 335 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 336 | + if (preg_match_all($regex, $this->agent, $matches)) { |
|
| 337 | + $found = array_search($browser, $matches['browser']); |
|
| 338 | + $this->setVersion($matches['version'][$found]); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | 343 | * Determine if the browser is Mobile or not |
| 344 | 344 | */ |
| 345 | - protected function checkMobile() { |
|
| 346 | - if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
| 345 | + protected function checkMobile() { |
|
| 346 | + if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
| 347 | 347 | . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
| 348 | - $this->setMobile(true); |
|
| 349 | - } |
|
| 350 | - } |
|
| 348 | + $this->setMobile(true); |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - /** |
|
| 352 | + /** |
|
| 353 | 353 | * Determine if the browser is Tablet or not |
| 354 | 354 | */ |
| 355 | - protected function checkTablet() { |
|
| 356 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
| 357 | - $this->setTablet(true); |
|
| 358 | - } |
|
| 359 | - } |
|
| 355 | + protected function checkTablet() { |
|
| 356 | + if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
| 357 | + $this->setTablet(true); |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - /** |
|
| 361 | + /** |
|
| 362 | 362 | * Determine if the browser is Robot or not |
| 363 | 363 | */ |
| 364 | - protected function checkBot() { |
|
| 365 | - if (preg_match('/bot/i', $this->agent) ) { |
|
| 366 | - $this->setRobot(true); |
|
| 367 | - } |
|
| 368 | - } |
|
| 364 | + protected function checkBot() { |
|
| 365 | + if (preg_match('/bot/i', $this->agent) ) { |
|
| 366 | + $this->setRobot(true); |
|
| 367 | + } |
|
| 368 | + } |
|
| 369 | 369 | |
| 370 | - /** |
|
| 370 | + /** |
|
| 371 | 371 | * Detect if URL is loaded from FacebookExternalHit |
| 372 | 372 | */ |
| 373 | 373 | protected function checkFacebook() { |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | |
| 383 | - /** |
|
| 384 | - * Protected routine to calculate and determine what |
|
| 385 | - * the browser is in use (including platform) |
|
| 386 | - */ |
|
| 383 | + /** |
|
| 384 | + * Protected routine to calculate and determine what |
|
| 385 | + * the browser is in use (including platform) |
|
| 386 | + */ |
|
| 387 | 387 | protected function determine() { |
| 388 | 388 | $this->checkPlatform(); |
| 389 | 389 | $this->checkBrowser(); |
@@ -394,4 +394,4 @@ discard block |
||
| 394 | 394 | $this->checkFacebook(); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - } |
|
| 397 | + } |
|