@@ -189,11 +189,11 @@ |
||
189 | 189 | */ |
190 | 190 | define('VAR_PATH', ROOT_PATH . 'var' . DS); |
191 | 191 | |
192 | - /** |
|
193 | - * The path to the directory of your cache files. |
|
194 | - * |
|
195 | - * This feature is available currently for database and views. |
|
196 | - */ |
|
192 | + /** |
|
193 | + * The path to the directory of your cache files. |
|
194 | + * |
|
195 | + * This feature is available currently for database and views. |
|
196 | + */ |
|
197 | 197 | define('CACHE_PATH', VAR_PATH . 'cache' . DS); |
198 | 198 | |
199 | 199 | /** |
@@ -25,103 +25,103 @@ |
||
25 | 25 | */ |
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the configuration of resources that you want to load automatically: |
|
29 | - * personals or systems libraries, configuration files, models, languages |
|
30 | - * personals functions or systems that are used often in your application |
|
31 | - * instead of loading them every time you want to use it. |
|
32 | - * Note: loading a lot of resources can decrease the performance of your application. |
|
33 | - */ |
|
28 | + * This file contains the configuration of resources that you want to load automatically: |
|
29 | + * personals or systems libraries, configuration files, models, languages |
|
30 | + * personals functions or systems that are used often in your application |
|
31 | + * instead of loading them every time you want to use it. |
|
32 | + * Note: loading a lot of resources can decrease the performance of your application. |
|
33 | + */ |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * If you have personals libraries or systems to load automatically, then list them in the following array. |
|
38 | - * For example : |
|
39 | - * |
|
40 | - * $autoload['libraries'] = array('library1', 'library2'); |
|
41 | - * |
|
42 | - * Using module: |
|
43 | - * |
|
44 | - * $autoload['libraries'] = array('module1/library1', 'module2/library1'); |
|
45 | - * |
|
46 | - * Note: Systems libraries have priority over personals libraries, |
|
47 | - * ie the loading order is as follows: it looks in the folder of the systems libraries, |
|
48 | - * if it is found, it is loaded, if not, it search in the module directories, if it is found, |
|
49 | - * it is loaded, if not will search in personals libraries folder, |
|
50 | - * before returning an error in case it does not find it. |
|
51 | - */ |
|
36 | + /** |
|
37 | + * If you have personals libraries or systems to load automatically, then list them in the following array. |
|
38 | + * For example : |
|
39 | + * |
|
40 | + * $autoload['libraries'] = array('library1', 'library2'); |
|
41 | + * |
|
42 | + * Using module: |
|
43 | + * |
|
44 | + * $autoload['libraries'] = array('module1/library1', 'module2/library1'); |
|
45 | + * |
|
46 | + * Note: Systems libraries have priority over personals libraries, |
|
47 | + * ie the loading order is as follows: it looks in the folder of the systems libraries, |
|
48 | + * if it is found, it is loaded, if not, it search in the module directories, if it is found, |
|
49 | + * it is loaded, if not will search in personals libraries folder, |
|
50 | + * before returning an error in case it does not find it. |
|
51 | + */ |
|
52 | 52 | $autoload['libraries'] = array(); |
53 | 53 | |
54 | 54 | /** |
55 | - * If you have configuration files to load automatically, then list them in the following array. |
|
56 | - * For example : |
|
57 | - * |
|
58 | - * $autoload['config'] = array('config1', 'config2'); |
|
59 | - * |
|
60 | - * Using module: |
|
61 | - * |
|
62 | - * $autoload['config'] = array('module1/config1', 'module2/config2'); |
|
63 | - * |
|
64 | - * Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder |
|
65 | - * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
66 | - * otherwise the system can not find this configuration file. |
|
67 | - * For example : |
|
68 | - * |
|
69 | - * $config['key1'] = value1; |
|
70 | - * $config['key2'] = value2; |
|
71 | - * |
|
72 | - * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
73 | - * or inside the "config" of your application modules |
|
74 | - */ |
|
55 | + * If you have configuration files to load automatically, then list them in the following array. |
|
56 | + * For example : |
|
57 | + * |
|
58 | + * $autoload['config'] = array('config1', 'config2'); |
|
59 | + * |
|
60 | + * Using module: |
|
61 | + * |
|
62 | + * $autoload['config'] = array('module1/config1', 'module2/config2'); |
|
63 | + * |
|
64 | + * Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder |
|
65 | + * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
66 | + * otherwise the system can not find this configuration file. |
|
67 | + * For example : |
|
68 | + * |
|
69 | + * $config['key1'] = value1; |
|
70 | + * $config['key2'] = value2; |
|
71 | + * |
|
72 | + * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
73 | + * or inside the "config" of your application modules |
|
74 | + */ |
|
75 | 75 | $autoload['config'] = array(); |
76 | 76 | |
77 | 77 | /** |
78 | - * If you have models to load automatically, then list them in the following array. |
|
79 | - * For example : |
|
80 | - * |
|
81 | - * $autoload['models'] = array('model1', 'model2'); |
|
82 | - * |
|
83 | - * Using module: |
|
84 | - * |
|
85 | - * $autoload['models'] = array('module1/model1', 'module2/model2'); |
|
86 | - */ |
|
78 | + * If you have models to load automatically, then list them in the following array. |
|
79 | + * For example : |
|
80 | + * |
|
81 | + * $autoload['models'] = array('model1', 'model2'); |
|
82 | + * |
|
83 | + * Using module: |
|
84 | + * |
|
85 | + * $autoload['models'] = array('module1/model1', 'module2/model2'); |
|
86 | + */ |
|
87 | 87 | $autoload['models'] = array(); |
88 | 88 | |
89 | 89 | /** |
90 | - * If you have systems or personals functions to load automatically, specify them in the following array. |
|
91 | - * For example : |
|
92 | - * |
|
93 | - * $autoload['functions'] = array('function1', 'function2'); |
|
94 | - * |
|
95 | - * Using module: |
|
96 | - * |
|
97 | - * $autoload['functions'] = array('module1/function1', 'module2/function2'); |
|
98 | - * |
|
99 | - * Note 1: Personal functions have priority over system functions, |
|
100 | - * that is to say that the order of loading is the following : it looks in the directory of the modules functions, |
|
101 | - * if it is found, it is loaded, otherwise, it looks in the directory of the personal functions, |
|
102 | - * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
103 | - * before returning an error in case he does not find it. |
|
104 | - * |
|
105 | - * Note 2: the file name must have as prefix "function_" for example "function_foo.php" then |
|
106 | - * will use: |
|
107 | - * |
|
108 | - * $autoload['functions'] = array('foo'); |
|
109 | - */ |
|
90 | + * If you have systems or personals functions to load automatically, specify them in the following array. |
|
91 | + * For example : |
|
92 | + * |
|
93 | + * $autoload['functions'] = array('function1', 'function2'); |
|
94 | + * |
|
95 | + * Using module: |
|
96 | + * |
|
97 | + * $autoload['functions'] = array('module1/function1', 'module2/function2'); |
|
98 | + * |
|
99 | + * Note 1: Personal functions have priority over system functions, |
|
100 | + * that is to say that the order of loading is the following : it looks in the directory of the modules functions, |
|
101 | + * if it is found, it is loaded, otherwise, it looks in the directory of the personal functions, |
|
102 | + * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
103 | + * before returning an error in case he does not find it. |
|
104 | + * |
|
105 | + * Note 2: the file name must have as prefix "function_" for example "function_foo.php" then |
|
106 | + * will use: |
|
107 | + * |
|
108 | + * $autoload['functions'] = array('foo'); |
|
109 | + */ |
|
110 | 110 | $autoload['functions'] = array(); |
111 | 111 | |
112 | 112 | /** |
113 | - * If you have systems or personals languages to load automatically, specify them in the following array. |
|
114 | - * For example : |
|
115 | - * |
|
116 | - * $autoload['languages'] = array('lang1', 'lang2'); |
|
117 | - * |
|
118 | - * Using module: |
|
119 | - * |
|
120 | - * $autoload['languages'] = array('module1/lang1', 'module2/lang2'); |
|
121 | - * |
|
122 | - * Note: the file name must have as prefix "lang_" for example "lang_foo.php" then |
|
123 | - * will use: |
|
124 | - * |
|
125 | - * $autoload['languages'] = array('foo'); |
|
126 | - */ |
|
113 | + * If you have systems or personals languages to load automatically, specify them in the following array. |
|
114 | + * For example : |
|
115 | + * |
|
116 | + * $autoload['languages'] = array('lang1', 'lang2'); |
|
117 | + * |
|
118 | + * Using module: |
|
119 | + * |
|
120 | + * $autoload['languages'] = array('module1/lang1', 'module2/lang2'); |
|
121 | + * |
|
122 | + * Note: the file name must have as prefix "lang_" for example "lang_foo.php" then |
|
123 | + * will use: |
|
124 | + * |
|
125 | + * $autoload['languages'] = array('foo'); |
|
126 | + */ |
|
127 | 127 | $autoload['languages'] = array(); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | class DatabaseQueryBuilder { |
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 | /** |
@@ -727,12 +727,12 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string|null |
729 | 729 | */ |
730 | - protected function buildQueryPart($property, $command = ''){ |
|
730 | + protected function buildQueryPart($property, $command = ''){ |
|
731 | 731 | if (!empty($this->{$property})) { |
732 | 732 | return $command . $this->{$property}; |
733 | 733 | } |
734 | 734 | return null; |
735 | - } |
|
735 | + } |
|
736 | 736 | |
737 | 737 | |
738 | 738 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $keysList = array(); |
411 | 411 | foreach ($keys as $k => $v) { |
412 | 412 | $v = $this->checkForNullValue($v); |
413 | - if (! is_numeric($v)) { |
|
413 | + if (!is_numeric($v)) { |
|
414 | 414 | $v = $this->connection->escape($v, $escape); |
415 | 415 | } |
416 | 416 | $keysList[] = $v; |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @return string|null |
723 | 723 | */ |
724 | - protected function buildQueryPart($property, $command = ''){ |
|
724 | + protected function buildQueryPart($property, $command = '') { |
|
725 | 725 | if (!empty($this->{$property})) { |
726 | 726 | return $command . $this->{$property}; |
727 | 727 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * @param string $clause the clause type "IS NULL", "IS NOT NULLs" |
737 | 737 | * @return object the current DatabaseQueryBuilder instance |
738 | 738 | */ |
739 | - protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL'){ |
|
739 | + protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL') { |
|
740 | 740 | if (is_array($field)) { |
741 | 741 | foreach ($field as $f) { |
742 | 742 | $this->whereIsNullAndNotNull($f, $andOr, $clause); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @return object the current instance |
756 | 756 | */ |
757 | - protected function setSelectStr($newSelect){ |
|
757 | + protected function setSelectStr($newSelect) { |
|
758 | 758 | $this->select = (($this->select == '*' || empty($this->select)) |
759 | 759 | ? $newSelect |
760 | 760 | : $this->select . ', ' . $newSelect); |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | * @return string the empty string if the value is null |
769 | 769 | * otherwise the same value will be returned |
770 | 770 | */ |
771 | - protected function checkForNullValue($value){ |
|
772 | - if(is_null($value)){ |
|
771 | + protected function checkForNullValue($value) { |
|
772 | + if (is_null($value)) { |
|
773 | 773 | return ''; |
774 | 774 | } |
775 | 775 | return $value; |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * |
797 | 797 | * @return string |
798 | 798 | */ |
799 | - protected function getWhereStrForOperator($where, $op = null, $value= null, $type = '', $escape = true) { |
|
799 | + protected function getWhereStrForOperator($where, $op = null, $value = null, $type = '', $escape = true) { |
|
800 | 800 | $w = ''; |
801 | 801 | if (!in_array((string) $op, $this->operatorList)) { |
802 | 802 | $op = $this->checkForNullValue($op); |
@@ -208,7 +208,7 @@ |
||
208 | 208 | //If is the SELECT query |
209 | 209 | $this->isSelectQuery = stristr($this->query, 'SELECT') !== false; |
210 | 210 | |
211 | - //if can use cache feature for this query |
|
211 | + //if can use cache feature for this query |
|
212 | 212 | $this->dbCacheStatus = get_config('cache_enable', false) && $this->cacheTtl > 0; |
213 | 213 | } |
214 | 214 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function getCacheContent() { |
158 | 158 | //set some attributes values |
159 | 159 | $this->setPropertiesValues(); |
160 | - if (! $this->canUseCache()) { |
|
160 | + if (!$this->canUseCache()) { |
|
161 | 161 | $this->logger->info('The cache is not enabled for this query or is not a SELECT query'); |
162 | 162 | return null; |
163 | 163 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function setCacheContent($result) { |
179 | 179 | //set some attributes values |
180 | 180 | $this->setPropertiesValues(); |
181 | - if (! $this->canUseCache()) { |
|
181 | + if (!$this->canUseCache()) { |
|
182 | 182 | $this->logger->info('The cache is not enabled for this query or is not a SELECT query'); |
183 | 183 | return null; |
184 | 184 | } |
@@ -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 |
@@ -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 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | //reset instance |
101 | 101 | $this->reset(); |
102 | 102 | |
103 | - $this->logger->debug('Begin execution of SQL query [' . $this->query .']'); |
|
103 | + $this->logger->debug('Begin execution of SQL query [' . $this->query . ']'); |
|
104 | 104 | |
105 | 105 | //for database query execution time |
106 | 106 | $benchmarkMarkerKey = $this->getBenchmarkKey(); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if ((double) $responseTime >= 1.000000) { |
118 | 118 | $this->logger->warning( |
119 | 119 | 'High response time while processing database query [' . $this->query . '].' |
120 | - . ' The response time is [' .$responseTime . '] sec.' |
|
120 | + . ' The response time is [' . $responseTime . '] sec.' |
|
121 | 121 | ); |
122 | 122 | } |
123 | 123 |
@@ -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 ...'); |
@@ -32,8 +32,8 @@ |
||
32 | 32 | <p>Required PHP version : <b>PHP >= <?php echo TNH_MIN_PHP_VERSION; ?>, PHP < <?php echo TNH_MAX_PHP_VERSION; ?></b></p> |
33 | 33 | <p>Release date : <b><?php echo TNH_RELEASE_DATE; ?></b></p> |
34 | 34 | <hr /> |
35 | - <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php';?></b> |
|
36 | - <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php';?></b> |
|
35 | + <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php'; ?></b> |
|
36 | + <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php'; ?></b> |
|
37 | 37 | </div> |
38 | 38 | </div> |
39 | 39 | </div> |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * SOFTWARE. |
29 | 29 | */ |
30 | 30 | |
31 | - class Url extends BaseClass{ |
|
31 | + class Url extends BaseClass { |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Construct new instance |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return string the final path after add suffix if configured |
152 | 152 | * otherwise the same value will be returned |
153 | 153 | */ |
154 | - protected function addSuffixInPath($path){ |
|
154 | + protected function addSuffixInPath($path) { |
|
155 | 155 | $suffix = get_config('url_suffix'); |
156 | 156 | if ($suffix && $path) { |
157 | 157 | if (strpos($path, '?') !== false) { |
@@ -128,7 +128,7 @@ |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | } |
131 | - $port = get_instance()->request->server('SERVER_PORT'); |
|
131 | + $port = get_instance()->request->server('SERVER_PORT'); |
|
132 | 132 | if ($port && !in_array($port, array(80, 443))) { |
133 | 133 | $domain .= ':' . $port; |
134 | 134 | } |