@@ -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 | + } |
@@ -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'); |
@@ -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 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Register controllers autoload function |
145 | 145 | */ |
146 | - spl_autoload_register('autoload_controller'); |
|
146 | + spl_autoload_register('autoload_controller'); |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * 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->info('The module [' .$name. '] already added skipping.'); |
|
62 | - return $this; |
|
61 | + $this->logger->info('The module [' .$name. '] already added skipping.'); |
|
62 | + return $this; |
|
63 | 63 | } |
64 | 64 | $this->list[] = $name; |
65 | 65 | return $this; |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $this->list = array(); |
91 | 91 | } |
92 | 92 | |
93 | - /** |
|
94 | - * Get the list of module loaded |
|
95 | - * @return array the module list |
|
96 | - */ |
|
93 | + /** |
|
94 | + * Get the list of module loaded |
|
95 | + * @return array the module list |
|
96 | + */ |
|
97 | 97 | public function getModuleList() { |
98 | 98 | return $this->list; |
99 | 99 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->logger->debug('Check if the application contains the modules ...'); |
241 | 241 | $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR); |
242 | 242 | if ($dirList !== false) { |
243 | - $this->list = array_map('basename', $dirList); |
|
243 | + $this->list = array_map('basename', $dirList); |
|
244 | 244 | } |
245 | 245 | if (!empty($this->list)) { |
246 | 246 | $this->logger->info('The application contains the module below [' . implode(', ', $this->list) . ']'); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $filePath = MODULE_PATH . $module . DS . $type . DS . $classFile; |
264 | 264 | if (file_exists($filePath)) { |
265 | 265 | $this->logger->info('Found class [' . $class . '] in module [' . $module . '] ' |
266 | - . 'for [' . $type . '] the file path is [' . $filePath . ']'); |
|
266 | + . 'for [' . $type . '] the file path is [' . $filePath . ']'); |
|
267 | 267 | return $filePath; |
268 | 268 | } |
269 | 269 | $this->logger->info('Class [' . $class . '] does not exist in the module [' . $module . '] for [' . $type . ']'); |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | */ |
43 | 43 | private $driver = null; |
44 | 44 | |
45 | - /** |
|
46 | - * The database hostname |
|
47 | - * @var string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The database hostname |
|
47 | + * @var string |
|
48 | + */ |
|
49 | 49 | private $hostname = null; |
50 | 50 | |
51 | - /** |
|
52 | - * The database port |
|
53 | - * @var integer |
|
54 | - */ |
|
51 | + /** |
|
52 | + * The database port |
|
53 | + * @var integer |
|
54 | + */ |
|
55 | 55 | private $port = null; |
56 | 56 | |
57 | - /** |
|
58 | - * The database username |
|
59 | - * @var string |
|
60 | - */ |
|
57 | + /** |
|
58 | + * The database username |
|
59 | + * @var string |
|
60 | + */ |
|
61 | 61 | private $username = null; |
62 | 62 | |
63 | - /** |
|
64 | - * The database password |
|
65 | - * @var string |
|
66 | - */ |
|
63 | + /** |
|
64 | + * The database password |
|
65 | + * @var string |
|
66 | + */ |
|
67 | 67 | private $password = null; |
68 | 68 | |
69 | 69 | /** |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | private $databaseName = null; |
74 | 74 | |
75 | - /** |
|
76 | - * The database charset |
|
77 | - * @var string |
|
78 | - */ |
|
75 | + /** |
|
76 | + * The database charset |
|
77 | + * @var string |
|
78 | + */ |
|
79 | 79 | private $charset = null; |
80 | 80 | |
81 | 81 | /** |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | */ |
85 | 85 | private $collation = null; |
86 | 86 | |
87 | - /** |
|
88 | - * The database tables prefix |
|
89 | - * @var string |
|
90 | - */ |
|
87 | + /** |
|
88 | + * The database tables prefix |
|
89 | + * @var string |
|
90 | + */ |
|
91 | 91 | private $prefix = null; |
92 | 92 | |
93 | 93 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * This is method is used to connect to database |
|
119 | - * |
|
120 | - * @return boolean true in case of successfully connection false if error |
|
121 | - */ |
|
117 | + /** |
|
118 | + * This is method is used to connect to database |
|
119 | + * |
|
120 | + * @return boolean true in case of successfully connection false if error |
|
121 | + */ |
|
122 | 122 | public function connect() { |
123 | 123 | try { |
124 | 124 | $options = array( |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $this->populatePropertiesFromConfig(); |
415 | 415 | |
416 | 416 | if (!empty($this->config)) { |
417 | - //For logging |
|
417 | + //For logging |
|
418 | 418 | $configInfo = $this->config; |
419 | 419 | //Hide password from log |
420 | 420 | $configInfo['password'] = string_hidden($this->getPassword()); |
@@ -423,11 +423,10 @@ discard block |
||
423 | 423 | return $this; |
424 | 424 | } |
425 | 425 | |
426 | - /** |
|
427 | - * Get the database configuration using the configuration file |
|
428 | - |
|
429 | - * @return array the database configuration from file |
|
430 | - */ |
|
426 | + /** |
|
427 | + * Get the database configuration using the configuration file |
|
428 | + * @return array the database configuration from file |
|
429 | + */ |
|
431 | 430 | public function getDatabaseConfigFromFile() { |
432 | 431 | $db = array(); |
433 | 432 | if (file_exists(CONFIG_PATH . 'database.php')) { |
@@ -437,11 +436,11 @@ discard block |
||
437 | 436 | return $db; |
438 | 437 | } |
439 | 438 | |
440 | - /** |
|
441 | - * Update the properties using the current database configuration |
|
442 | - * |
|
443 | - * @return object the current instance |
|
444 | - */ |
|
439 | + /** |
|
440 | + * Update the properties using the current database configuration |
|
441 | + * |
|
442 | + * @return object the current instance |
|
443 | + */ |
|
445 | 444 | protected function populatePropertiesFromConfig() { |
446 | 445 | foreach ($this->config as $key => $value) { |
447 | 446 | $setter = 'set' . ucfirst($key); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function __construct(DatabaseConnection $connection = null) { |
113 | 113 | parent::__construct(); |
114 | - if ($connection !== null) { |
|
114 | + if ($connection !== null) { |
|
115 | 115 | $this->connection = $connection; |
116 | 116 | } |
117 | 117 | } |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | $this->queryCount++; |
386 | 386 | |
387 | 387 | $queryResult = $this->queryRunner->setQuery($query) |
388 | - ->setReturnType($returnAsList) |
|
389 | - ->setReturnAsArray($returnAsArray) |
|
390 | - ->execute(); |
|
388 | + ->setReturnType($returnAsList) |
|
389 | + ->setReturnAsArray($returnAsArray) |
|
390 | + ->execute(); |
|
391 | 391 | |
392 | 392 | if (is_object($queryResult)) { |
393 | 393 | $this->result = $queryResult->getResult(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] ' |
191 | 191 | . 'using the default location'); |
192 | 192 | } |
193 | - if (!$path) { |
|
193 | + if (!$path) { |
|
194 | 194 | $path = $this->getDefaultFilePathForView($viewFile); |
195 | 195 | } |
196 | 196 | $this->logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | return $this->finalPageContent; |
267 | 267 | } |
268 | 268 | |
269 | - /** |
|
270 | - * Set the final page to be rendered |
|
271 | - * @param string $finalPage the content of the final page |
|
272 | - * |
|
273 | - * @return object |
|
274 | - */ |
|
269 | + /** |
|
270 | + * Set the final page to be rendered |
|
271 | + * @param string $finalPage the content of the final page |
|
272 | + * |
|
273 | + * @return object |
|
274 | + */ |
|
275 | 275 | public function setFinalPageContent($finalPage) { |
276 | 276 | $this->finalPageContent = $finalPage; |
277 | 277 | return $this; |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
348 | - * Dispatch the FINAL_VIEW_READY event |
|
349 | - * |
|
350 | - * @return string|null the final view content after processing by each listener |
|
351 | - * if they exists otherwise the same content will be returned |
|
352 | - */ |
|
348 | + * Dispatch the FINAL_VIEW_READY event |
|
349 | + * |
|
350 | + * @return string|null the final view content after processing by each listener |
|
351 | + * if they exists otherwise the same content will be returned |
|
352 | + */ |
|
353 | 353 | protected function dispatchFinalViewEvent() { |
354 | 354 | //dispatch |
355 | 355 | $event = get_instance()->eventdispatcher->dispatch( |
@@ -383,12 +383,12 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | |
386 | - /** |
|
387 | - * Return the default full file path for view |
|
388 | - * @param string $file the filename |
|
389 | - * |
|
390 | - * @return string|null the full file path |
|
391 | - */ |
|
386 | + /** |
|
387 | + * Return the default full file path for view |
|
388 | + * @param string $file the filename |
|
389 | + * |
|
390 | + * @return string|null the full file path |
|
391 | + */ |
|
392 | 392 | protected function getDefaultFilePathForView($file){ |
393 | 393 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
394 | 394 | $fullFilePath = null; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
422 | 422 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
423 | 423 | $this->logger->info('The cache page content is not yet expire for the ' |
424 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
424 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
425 | 425 | $this->sendHeaders(304); |
426 | 426 | return true; |
427 | 427 | } |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | */ |
437 | 437 | protected function sendCachePageContentToBrowser(&$cache) { |
438 | 438 | $this->logger->info('The cache page content is expired or the browser does ' |
439 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
440 | - . 'send cache headers to tell the browser'); |
|
439 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
440 | + . 'send cache headers to tell the browser'); |
|
441 | 441 | $this->sendHeaders(200); |
442 | 442 | //current page cache key |
443 | 443 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -576,18 +576,18 @@ discard block |
||
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
579 | - /** |
|
580 | - * Set the mandory headers, like security, etc. |
|
581 | - */ |
|
579 | + /** |
|
580 | + * Set the mandory headers, like security, etc. |
|
581 | + */ |
|
582 | 582 | protected function setRequiredHeaders() { |
583 | 583 | $requiredHeaders = array( |
584 | 584 | 'X-XSS-Protection' => '1; mode=block', |
585 | 585 | 'X-Frame-Options' => 'SAMEORIGIN' |
586 | 586 | ); |
587 | 587 | foreach ($requiredHeaders as $key => $value) { |
588 | - if (!isset($this->headers[$key])) { |
|
588 | + if (!isset($this->headers[$key])) { |
|
589 | 589 | $this->headers[$key] = $value; |
590 | - } |
|
590 | + } |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | } |