@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * Display point level icon before user name when point system is enabled. |
13 | 13 | * */ |
14 | 14 | // return unless before_display_content |
15 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
15 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
16 | 16 | { |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | -require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php'); |
|
20 | +require_once(_XE_PATH_.'addons/point_level_icon/point_level_icon.lib.php'); |
|
21 | 21 | |
22 | 22 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); |
23 | -if($temp_output) |
|
23 | +if ($temp_output) |
|
24 | 24 | { |
25 | 25 | $output = $temp_output; |
26 | 26 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | { |
6 | 6 | exit(); |
7 | 7 | } |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | * @author NAVER ([email protected]) |
12 | 12 | * @brief Add-on to resize images in the body |
13 | 13 | */ |
14 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler()) |
|
14 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler()) |
|
15 | 15 | { |
16 | - if(Mobile::isFromMobilePhone()) |
|
16 | + if (Mobile::isFromMobilePhone()) |
|
17 | 17 | { |
18 | 18 | Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true); |
19 | 19 | } |
@@ -16,8 +16,7 @@ |
||
16 | 16 | if(Mobile::isFromMobilePhone()) |
17 | 17 | { |
18 | 18 | Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true); |
19 | - } |
|
20 | - else |
|
19 | + } else |
|
21 | 20 | { |
22 | 21 | Context::loadJavascriptPlugin('ui'); |
23 | 22 | Context::loadFile(array('./addons/resize_image/js/resize_image.min.js', 'body', '', null), true); |
@@ -63,37 +63,30 @@ |
||
63 | 63 | if($info->use_object_cache == 'apc') |
64 | 64 | { |
65 | 65 | $type = 'apc'; |
66 | - } |
|
67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
66 | + } else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
68 | 67 | { |
69 | 68 | $type = 'memcache'; |
70 | 69 | $url = $info->use_object_cache; |
71 | - } |
|
72 | - else if($info->use_object_cache == 'wincache') |
|
70 | + } else if($info->use_object_cache == 'wincache') |
|
73 | 71 | { |
74 | 72 | $type = 'wincache'; |
75 | - } |
|
76 | - else if($info->use_object_cache == 'file') |
|
73 | + } else if($info->use_object_cache == 'file') |
|
77 | 74 | { |
78 | 75 | $type = 'file'; |
79 | - } |
|
80 | - else if($always_use_file) |
|
76 | + } else if($always_use_file) |
|
81 | 77 | { |
82 | 78 | $type = 'file'; |
83 | 79 | } |
84 | - } |
|
85 | - else if($target == 'template') |
|
80 | + } else if($target == 'template') |
|
86 | 81 | { |
87 | 82 | if($info->use_template_cache == 'apc') |
88 | 83 | { |
89 | 84 | $type = 'apc'; |
90 | - } |
|
91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
85 | + } else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
92 | 86 | { |
93 | 87 | $type = 'memcache'; |
94 | 88 | $url = $info->use_template_cache; |
95 | - } |
|
96 | - else if($info->use_template_cache == 'wincache') |
|
89 | + } else if($info->use_template_cache == 'wincache') |
|
97 | 90 | { |
98 | 91 | $type = 'wincache'; |
99 | 92 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $key Cache key |
149 | 149 | * @param int $modified_time Unix time of data modified. |
150 | 150 | * If stored time is older then modified time, return false. |
151 | - * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
151 | + * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
152 | 152 | */ |
153 | 153 | function get($key, $modified_time = 0) |
154 | 154 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param string $key Cache key |
298 | 298 | * @param int $modified_time Unix time of data modified. |
299 | 299 | * If stored time is older then modified time, return false. |
300 | - * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
300 | + * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
301 | 301 | */ |
302 | 302 | function get($key, $modified_time = 0) |
303 | 303 | { |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function &getInstance($target = 'object', $info = null, $always_use_file = false) |
32 | 32 | { |
33 | - $cache_handler_key = $target . ($always_use_file ? '_file' : ''); |
|
34 | - if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
33 | + $cache_handler_key = $target.($always_use_file ? '_file' : ''); |
|
34 | + if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
35 | 35 | { |
36 | 36 | $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file); |
37 | 37 | } |
@@ -51,61 +51,61 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function CacheHandler($target, $info = null, $always_use_file = false) |
53 | 53 | { |
54 | - if(!$info) |
|
54 | + if (!$info) |
|
55 | 55 | { |
56 | 56 | $info = Context::getDBInfo(); |
57 | 57 | } |
58 | 58 | |
59 | - if($info) |
|
59 | + if ($info) |
|
60 | 60 | { |
61 | - if($target == 'object') |
|
61 | + if ($target == 'object') |
|
62 | 62 | { |
63 | - if($info->use_object_cache == 'apc') |
|
63 | + if ($info->use_object_cache == 'apc') |
|
64 | 64 | { |
65 | 65 | $type = 'apc'; |
66 | 66 | } |
67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
67 | + else if (substr($info->use_object_cache, 0, 8) == 'memcache') |
|
68 | 68 | { |
69 | 69 | $type = 'memcache'; |
70 | 70 | $url = $info->use_object_cache; |
71 | 71 | } |
72 | - else if($info->use_object_cache == 'wincache') |
|
72 | + else if ($info->use_object_cache == 'wincache') |
|
73 | 73 | { |
74 | 74 | $type = 'wincache'; |
75 | 75 | } |
76 | - else if($info->use_object_cache == 'file') |
|
76 | + else if ($info->use_object_cache == 'file') |
|
77 | 77 | { |
78 | 78 | $type = 'file'; |
79 | 79 | } |
80 | - else if($always_use_file) |
|
80 | + else if ($always_use_file) |
|
81 | 81 | { |
82 | 82 | $type = 'file'; |
83 | 83 | } |
84 | 84 | } |
85 | - else if($target == 'template') |
|
85 | + else if ($target == 'template') |
|
86 | 86 | { |
87 | - if($info->use_template_cache == 'apc') |
|
87 | + if ($info->use_template_cache == 'apc') |
|
88 | 88 | { |
89 | 89 | $type = 'apc'; |
90 | 90 | } |
91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
91 | + else if (substr($info->use_template_cache, 0, 8) == 'memcache') |
|
92 | 92 | { |
93 | 93 | $type = 'memcache'; |
94 | 94 | $url = $info->use_template_cache; |
95 | 95 | } |
96 | - else if($info->use_template_cache == 'wincache') |
|
96 | + else if ($info->use_template_cache == 'wincache') |
|
97 | 97 | { |
98 | 98 | $type = 'wincache'; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if($type) |
|
102 | + if ($type) |
|
103 | 103 | { |
104 | - $class = 'Cache' . ucfirst($type); |
|
104 | + $class = 'Cache'.ucfirst($type); |
|
105 | 105 | include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); |
106 | 106 | $this->handler = call_user_func(array($class, 'getInstance'), $url); |
107 | 107 | $this->keyGroupVersions = $this->handler->get('key_group_versions', 0); |
108 | - if(!$this->keyGroupVersions) |
|
108 | + if (!$this->keyGroupVersions) |
|
109 | 109 | { |
110 | 110 | $this->keyGroupVersions = array(); |
111 | 111 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function isSupport() |
123 | 123 | { |
124 | - if($this->handler && $this->handler->isSupport()) |
|
124 | + if ($this->handler && $this->handler->isSupport()) |
|
125 | 125 | { |
126 | 126 | return true; |
127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $key = str_replace('/', ':', $key); |
141 | 141 | |
142 | - return __XE_VERSION__ . ':' . $key; |
|
142 | + return __XE_VERSION__.':'.$key; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function get($key, $modified_time = 0) |
154 | 154 | { |
155 | - if(!$this->handler) |
|
155 | + if (!$this->handler) |
|
156 | 156 | { |
157 | 157 | return false; |
158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function put($key, $obj, $valid_time = 0) |
176 | 176 | { |
177 | - if(!$this->handler && !$key) |
|
177 | + if (!$this->handler && !$key) |
|
178 | 178 | { |
179 | 179 | return false; |
180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | function delete($key) |
194 | 194 | { |
195 | - if(!$this->handler) |
|
195 | + if (!$this->handler) |
|
196 | 196 | { |
197 | 197 | return false; |
198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | function isValid($key, $modified_time = 0) |
214 | 214 | { |
215 | - if(!$this->handler) |
|
215 | + if (!$this->handler) |
|
216 | 216 | { |
217 | 217 | return false; |
218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | function truncate() |
231 | 231 | { |
232 | - if(!$this->handler) |
|
232 | + if (!$this->handler) |
|
233 | 233 | { |
234 | 234 | return false; |
235 | 235 | } |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function getGroupKey($keyGroupName, $key) |
257 | 257 | { |
258 | - if(!$this->keyGroupVersions[$keyGroupName]) |
|
258 | + if (!$this->keyGroupVersions[$keyGroupName]) |
|
259 | 259 | { |
260 | 260 | $this->keyGroupVersions[$keyGroupName] = 1; |
261 | 261 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
262 | 262 | } |
263 | 263 | |
264 | - return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key; |
|
264 | + return 'cache_group_'.$this->keyGroupVersions[$keyGroupName].':'.$keyGroupName.':'.$key; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -1094,7 +1094,7 @@ |
||
1094 | 1094 | */ |
1095 | 1095 | function convertEncodingStr($str) |
1096 | 1096 | { |
1097 | - if(!$str) return null; |
|
1097 | + if(!$str) return null; |
|
1098 | 1098 | $obj = new stdClass(); |
1099 | 1099 | $obj->str = $str; |
1100 | 1100 | $obj = self::convertEncoding($obj); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * returns static context object (Singleton). It's to use Context without declaration of an object |
159 | 159 | * |
160 | - * @return object Instance |
|
160 | + * @return Context Instance |
|
161 | 161 | */ |
162 | 162 | function &getInstance() |
163 | 163 | { |
@@ -886,6 +886,7 @@ discard block |
||
886 | 886 | * Evaluation of xml language file |
887 | 887 | * |
888 | 888 | * @param string Path of the language file |
889 | + * @param string $path |
|
889 | 890 | * @return void |
890 | 891 | */ |
891 | 892 | function _evalxmlLang($path) |
@@ -1025,7 +1026,7 @@ discard block |
||
1025 | 1026 | /** |
1026 | 1027 | * Convert strings of variables in $source_object into UTF-8 |
1027 | 1028 | * |
1028 | - * @param object $source_obj Conatins strings to convert |
|
1029 | + * @param stdClass $source_obj Conatins strings to convert |
|
1029 | 1030 | * @return object converted object |
1030 | 1031 | */ |
1031 | 1032 | function convertEncoding($source_obj) |
@@ -1063,11 +1064,11 @@ discard block |
||
1063 | 1064 | /** |
1064 | 1065 | * Check flag |
1065 | 1066 | * |
1066 | - * @param mixed $val |
|
1067 | + * @param boolean $val |
|
1067 | 1068 | * @param string $key |
1068 | 1069 | * @param mixed $charset charset |
1069 | 1070 | * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 |
1070 | - * @return void |
|
1071 | + * @return null|boolean |
|
1071 | 1072 | */ |
1072 | 1073 | function checkConvertFlag(&$val, $key = null, $charset = null) |
1073 | 1074 | { |
@@ -1385,7 +1386,7 @@ discard block |
||
1385 | 1386 | * @see Cast variables, such as _srl, page, and cpage, into interger |
1386 | 1387 | * @param string $key Variable key |
1387 | 1388 | * @param string $val Variable value |
1388 | - * @param string $do_stripslashes Whether to strip slashes |
|
1389 | + * @param integer $do_stripslashes Whether to strip slashes |
|
1389 | 1390 | * @return mixed filtered value. Type are string or array |
1390 | 1391 | */ |
1391 | 1392 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
@@ -1920,7 +1921,7 @@ discard block |
||
1920 | 1921 | * |
1921 | 1922 | * @param string $key Key |
1922 | 1923 | * @param mixed $val Value |
1923 | - * @param mixed $set_to_get_vars If not FALSE, Set to get vars. |
|
1924 | + * @param integer $set_to_get_vars If not FALSE, Set to get vars. |
|
1924 | 1925 | * @return void |
1925 | 1926 | */ |
1926 | 1927 | function set($key, $val, $set_to_get_vars = 0) |
@@ -1962,7 +1963,7 @@ discard block |
||
1962 | 1963 | /** |
1963 | 1964 | * Get one more vars in object vars with given arguments(key1, key2, key3,...) |
1964 | 1965 | * |
1965 | - * @return object |
|
1966 | + * @return null|stdClass |
|
1966 | 1967 | */ |
1967 | 1968 | function gets() |
1968 | 1969 | { |
@@ -2035,7 +2036,7 @@ discard block |
||
2035 | 2036 | /** |
2036 | 2037 | * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js |
2037 | 2038 | * |
2038 | - * @param string $action act name |
|
2039 | + * @param string[] $action_array |
|
2039 | 2040 | * @return void |
2040 | 2041 | */ |
2041 | 2042 | function addSSLActions($action_array) |
@@ -2206,7 +2207,7 @@ discard block |
||
2206 | 2207 | * @param string $file File name with path |
2207 | 2208 | * @param string $optimized optimized (That seems to not use) |
2208 | 2209 | * @param string $targetie target IE |
2209 | - * @param string $index index |
|
2210 | + * @param integer $index index |
|
2210 | 2211 | * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>) |
2211 | 2212 | * @param bool $isRuleset Use ruleset |
2212 | 2213 | * @param string $autoPath If path not readed, set the path automatically. |
@@ -2316,7 +2317,7 @@ discard block |
||
2316 | 2317 | * @param string $optimized optimized (That seems to not use) |
2317 | 2318 | * @param string $media Media query |
2318 | 2319 | * @param string $targetie target IE |
2319 | - * @param string $index index |
|
2320 | + * @param integer $index index |
|
2320 | 2321 | * @return void |
2321 | 2322 | * |
2322 | 2323 | */ |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | function &getInstance() |
163 | 163 | { |
164 | 164 | static $theInstance = null; |
165 | - if(!$theInstance) |
|
165 | + if (!$theInstance) |
|
166 | 166 | { |
167 | 167 | $theInstance = new Context(); |
168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | |
183 | 183 | // include ssl action cache file |
184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
185 | - if(is_readable($this->sslActionCacheFile)) |
|
185 | + if (is_readable($this->sslActionCacheFile)) |
|
186 | 186 | { |
187 | 187 | require($this->sslActionCacheFile); |
188 | - if(isset($sslActions)) |
|
188 | + if (isset($sslActions)) |
|
189 | 189 | { |
190 | 190 | $this->ssl_actions = $sslActions; |
191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | function init() |
202 | 202 | { |
203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
205 | 205 | { |
206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
207 | 207 | |
208 | 208 | // If content is not XML JSON, unset |
209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
210 | 210 | { |
211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | $this->_setUploadedArgument(); |
229 | 229 | |
230 | 230 | $this->loadDBInfo(); |
231 | - if($this->db_info->use_sitelock == 'Y') |
|
231 | + if ($this->db_info->use_sitelock == 'Y') |
|
232 | 232 | { |
233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
234 | 234 | |
235 | - if(!IpFilter::filter($whitelist)) |
|
235 | + if (!IpFilter::filter($whitelist)) |
|
236 | 236 | { |
237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
243 | 243 | |
244 | 244 | header("HTTP/1.1 403 Forbidden"); |
245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
246 | 246 | { |
247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
248 | 248 | } |
249 | 249 | else |
250 | 250 | { |
251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
252 | 252 | } |
253 | 253 | exit; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | 257 | // If XE is installed, get virtual site information |
258 | - if(self::isInstalled()) |
|
258 | + if (self::isInstalled()) |
|
259 | 259 | { |
260 | 260 | $oModuleModel = getModel('module'); |
261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
262 | 262 | |
263 | - if(!isset($site_module_info)) |
|
263 | + if (!isset($site_module_info)) |
|
264 | 264 | { |
265 | 265 | $site_module_info = new stdClass(); |
266 | 266 | } |
267 | 267 | |
268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
270 | 270 | { |
271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
272 | 272 | } |
273 | 273 | |
274 | 274 | $this->set('site_module_info', $site_module_info); |
275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
276 | 276 | { |
277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
278 | 278 | } |
279 | 279 | |
280 | - if(!isset($this->db_info)) |
|
280 | + if (!isset($this->db_info)) |
|
281 | 281 | { |
282 | 282 | $this->db_info = new stdClass(); |
283 | 283 | } |
284 | 284 | |
285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
286 | - if(!$this->db_info->lang_type) |
|
286 | + if (!$this->db_info->lang_type) |
|
287 | 287 | { |
288 | 288 | $this->db_info->lang_type = 'en'; |
289 | 289 | } |
290 | - if(!$this->db_info->use_db_session) |
|
290 | + if (!$this->db_info->use_db_session) |
|
291 | 291 | { |
292 | 292 | $this->db_info->use_db_session = 'N'; |
293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
297 | 297 | $lang_supported = $this->loadLangSelected(); |
298 | 298 | |
299 | 299 | // Retrieve language type set in user's cookie |
300 | - if($this->lang_type = $this->get('l')) |
|
300 | + if ($this->lang_type = $this->get('l')) |
|
301 | 301 | { |
302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
303 | 303 | { |
304 | 304 | saveCookie('lang_type', $this->lang_type, false, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
305 | 305 | } |
306 | 306 | } |
307 | - elseif($_COOKIE['lang_type']) |
|
307 | + elseif ($_COOKIE['lang_type']) |
|
308 | 308 | { |
309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
310 | 310 | } |
311 | 311 | |
312 | 312 | // If it's not exists, follow default language type set in db_info |
313 | - if(!$this->lang_type) |
|
313 | + if (!$this->lang_type) |
|
314 | 314 | { |
315 | 315 | $this->lang_type = $this->db_info->lang_type; |
316 | 316 | } |
317 | 317 | |
318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
319 | - if(!$this->lang_type) |
|
319 | + if (!$this->lang_type) |
|
320 | 320 | { |
321 | 321 | $this->lang_type = 'en'; |
322 | 322 | } |
323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
324 | 324 | { |
325 | 325 | $this->lang_type = 'en'; |
326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | $this->setLangType($this->lang_type); |
330 | 330 | |
331 | 331 | // load module module's language file according to language setting |
332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
333 | 333 | |
334 | 334 | // set session handler |
335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
336 | 336 | { |
337 | 337 | $oSessionModel = getModel('session'); |
338 | 338 | $oSessionController = getController('session'); |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | ); |
342 | 342 | } |
343 | 343 | |
344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
345 | - if($this->db_info->disable_cookie_secure !== 'Y') |
|
344 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
345 | + if ($this->db_info->disable_cookie_secure !== 'Y') |
|
346 | 346 | { |
347 | 347 | ini_set('session.cookie_httponly', true); |
348 | 348 | ini_set('session.cookie_secure', Context::getSslStatus() === 'always'); |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | session_start(); |
351 | 351 | |
352 | 352 | // set authentication information in Context and session |
353 | - if(self::isInstalled()) |
|
353 | + if (self::isInstalled()) |
|
354 | 354 | { |
355 | - if($this->db_info->disable_csrf_token !== 'Y') |
|
355 | + if ($this->db_info->disable_csrf_token !== 'Y') |
|
356 | 356 | { |
357 | - if(!$_SESSION['csrf_token']) |
|
357 | + if (!$_SESSION['csrf_token']) |
|
358 | 358 | { |
359 | 359 | $_SESSION['csrf_token'] = Password::createSecureSalt(40); |
360 | 360 | } |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | $oMemberModel = getModel('member'); |
367 | 367 | $oMemberController = getController('member'); |
368 | 368 | |
369 | - if($oMemberController && $oMemberModel) |
|
369 | + if ($oMemberController && $oMemberModel) |
|
370 | 370 | { |
371 | 371 | // if signed in, validate it. |
372 | - if($oMemberModel->isLogged()) |
|
372 | + if ($oMemberModel->isLogged()) |
|
373 | 373 | { |
374 | 374 | $oMemberController->setSessionInfo(); |
375 | 375 | } |
376 | 376 | // check auto sign-in |
377 | - elseif($_COOKIE['xeak']) |
|
377 | + elseif ($_COOKIE['xeak']) |
|
378 | 378 | { |
379 | 379 | $oMemberController->doAutologin(); |
380 | 380 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | // load common language file |
388 | 388 | $this->lang = &$GLOBALS['lang']; |
389 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
389 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
390 | 390 | |
391 | 391 | // check if using rewrite module |
392 | 392 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -394,28 +394,28 @@ discard block |
||
394 | 394 | // set locations for javascript use |
395 | 395 | $url = array(); |
396 | 396 | $current_url = self::getRequestUri(); |
397 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
397 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
398 | 398 | { |
399 | - if($this->get_vars) |
|
399 | + if ($this->get_vars) |
|
400 | 400 | { |
401 | 401 | $url = array(); |
402 | - foreach($this->get_vars as $key => $val) |
|
402 | + foreach ($this->get_vars as $key => $val) |
|
403 | 403 | { |
404 | - if(is_array($val) && count($val) > 0) |
|
404 | + if (is_array($val) && count($val) > 0) |
|
405 | 405 | { |
406 | - foreach($val as $k => $v) |
|
406 | + foreach ($val as $k => $v) |
|
407 | 407 | { |
408 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
408 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
409 | 409 | } |
410 | 410 | } |
411 | - elseif($val) |
|
411 | + elseif ($val) |
|
412 | 412 | { |
413 | - $url[] = $key . '=' . urlencode($val); |
|
413 | + $url[] = $key.'='.urlencode($val); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | 417 | $current_url = self::getRequestUri(); |
418 | - if($url) $current_url .= '?' . join('&', $url); |
|
418 | + if ($url) $current_url .= '?'.join('&', $url); |
|
419 | 419 | } |
420 | 420 | else |
421 | 421 | { |
@@ -430,12 +430,12 @@ discard block |
||
430 | 430 | $this->set('current_url', $current_url); |
431 | 431 | $this->set('request_uri', self::getRequestUri()); |
432 | 432 | |
433 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
433 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
434 | 434 | { |
435 | 435 | $this->set('current_url', self::decodeIdna($current_url)); |
436 | 436 | } |
437 | 437 | |
438 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
438 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
439 | 439 | { |
440 | 440 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
441 | 441 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | { |
461 | 461 | $self = self::getInstance(); |
462 | 462 | |
463 | - if(!$self->isInstalled()) |
|
463 | + if (!$self->isInstalled()) |
|
464 | 464 | { |
465 | 465 | return; |
466 | 466 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | ob_end_clean(); |
471 | 471 | |
472 | 472 | // If master_db information does not exist, the config file needs to be updated |
473 | - if(!isset($db_info->master_db)) |
|
473 | + if (!isset($db_info->master_db)) |
|
474 | 474 | { |
475 | 475 | $db_info->master_db = array(); |
476 | 476 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
489 | 489 | unset($db_info->db_table_prefix); |
490 | 490 | |
491 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
491 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
492 | 492 | { |
493 | 493 | $db_info->master_db["db_table_prefix"] .= '_'; |
494 | 494 | } |
@@ -500,42 +500,42 @@ discard block |
||
500 | 500 | $oInstallController->makeConfigFile(); |
501 | 501 | } |
502 | 502 | |
503 | - if(!$db_info->use_prepared_statements) |
|
503 | + if (!$db_info->use_prepared_statements) |
|
504 | 504 | { |
505 | 505 | $db_info->use_prepared_statements = 'Y'; |
506 | 506 | } |
507 | 507 | |
508 | - if(!$db_info->time_zone) |
|
508 | + if (!$db_info->time_zone) |
|
509 | 509 | $db_info->time_zone = date('O'); |
510 | 510 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
511 | 511 | |
512 | - if($db_info->qmail_compatibility != 'Y') |
|
512 | + if ($db_info->qmail_compatibility != 'Y') |
|
513 | 513 | $db_info->qmail_compatibility = 'N'; |
514 | 514 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
515 | 515 | |
516 | - if(!$db_info->use_db_session) |
|
516 | + if (!$db_info->use_db_session) |
|
517 | 517 | $db_info->use_db_session = 'N'; |
518 | - if(!$db_info->use_ssl) |
|
518 | + if (!$db_info->use_ssl) |
|
519 | 519 | $db_info->use_ssl = 'none'; |
520 | 520 | $this->set('_use_ssl', $db_info->use_ssl); |
521 | 521 | |
522 | 522 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
523 | 523 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
524 | 524 | |
525 | - if(!$db_info->sitelock_whitelist) { |
|
525 | + if (!$db_info->sitelock_whitelist) { |
|
526 | 526 | $db_info->sitelock_whitelist = '127.0.0.1'; |
527 | 527 | } |
528 | 528 | |
529 | - if(is_string($db_info->sitelock_whitelist)) { |
|
529 | + if (is_string($db_info->sitelock_whitelist)) { |
|
530 | 530 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
531 | 531 | } |
532 | 532 | |
533 | - if(!$db_info->disable_cookie_secure) |
|
533 | + if (!$db_info->disable_cookie_secure) |
|
534 | 534 | { |
535 | 535 | $db_info->disable_cookie_secure = 'Y'; |
536 | 536 | } |
537 | 537 | |
538 | - if(!$db_info->disable_csrf_token) |
|
538 | + if (!$db_info->disable_csrf_token) |
|
539 | 539 | { |
540 | 540 | $db_info->disable_csrf_token = 'Y'; |
541 | 541 | } |
@@ -607,10 +607,10 @@ discard block |
||
607 | 607 | function loadLangSupported() |
608 | 608 | { |
609 | 609 | static $lang_supported = null; |
610 | - if(!$lang_supported) |
|
610 | + if (!$lang_supported) |
|
611 | 611 | { |
612 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
613 | - foreach($langs as $val) |
|
612 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
613 | + foreach ($langs as $val) |
|
614 | 614 | { |
615 | 615 | list($lang_prefix, $lang_text) = explode(',', $val); |
616 | 616 | $lang_text = trim($lang_text); |
@@ -628,17 +628,17 @@ discard block |
||
628 | 628 | function loadLangSelected() |
629 | 629 | { |
630 | 630 | static $lang_selected = null; |
631 | - if(!$lang_selected) |
|
631 | + if (!$lang_selected) |
|
632 | 632 | { |
633 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
634 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
635 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
633 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
634 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
635 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
636 | 636 | { |
637 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
637 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
638 | 638 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
639 | 639 | } |
640 | 640 | |
641 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
641 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
642 | 642 | { |
643 | 643 | $buff = FileHandler::readFile($orig_lang_file); |
644 | 644 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | else |
648 | 648 | { |
649 | 649 | $langs = file($selected_lang_file); |
650 | - foreach($langs as $val) |
|
650 | + foreach ($langs as $val) |
|
651 | 651 | { |
652 | 652 | list($lang_prefix, $lang_text) = explode(',', $val); |
653 | 653 | $lang_text = trim($lang_text); |
@@ -666,56 +666,56 @@ discard block |
||
666 | 666 | function checkSSO() |
667 | 667 | { |
668 | 668 | // pass if it's not GET request or XE is not yet installed |
669 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
669 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
670 | 670 | { |
671 | 671 | return TRUE; |
672 | 672 | } |
673 | 673 | $checkActList = array('rss' => 1, 'atom' => 1); |
674 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
674 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
675 | 675 | { |
676 | 676 | return TRUE; |
677 | 677 | } |
678 | 678 | |
679 | 679 | // pass if default URL is not set |
680 | 680 | $default_url = trim($this->db_info->default_url); |
681 | - if(!$default_url) |
|
681 | + if (!$default_url) |
|
682 | 682 | { |
683 | 683 | return TRUE; |
684 | 684 | } |
685 | 685 | |
686 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
686 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
687 | 687 | { |
688 | 688 | $default_url .= '/'; |
689 | 689 | } |
690 | 690 | |
691 | 691 | // for sites recieving SSO valdiation |
692 | - if($default_url == self::getRequestUri()) |
|
692 | + if ($default_url == self::getRequestUri()) |
|
693 | 693 | { |
694 | - if(self::get('url')) |
|
694 | + if (self::get('url')) |
|
695 | 695 | { |
696 | 696 | $url = base64_decode(self::get('url')); |
697 | 697 | $url_info = parse_url($url); |
698 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
698 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
699 | 699 | { |
700 | 700 | echo self::get('lang')->msg_invalid_request; |
701 | 701 | return false; |
702 | 702 | } |
703 | 703 | |
704 | 704 | $oModuleModel = getModel('module'); |
705 | - $domain = $url_info['host'] . $url_info['path']; |
|
706 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
705 | + $domain = $url_info['host'].$url_info['path']; |
|
706 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
707 | 707 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
708 | 708 | |
709 | - if($site_info->site_srl) |
|
709 | + if ($site_info->site_srl) |
|
710 | 710 | { |
711 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
712 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
711 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
712 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
713 | 713 | } |
714 | 714 | else |
715 | 715 | { |
716 | 716 | $redirect_url = $url; |
717 | 717 | } |
718 | - header('location:' . $redirect_url); |
|
718 | + header('location:'.$redirect_url); |
|
719 | 719 | |
720 | 720 | return FALSE; |
721 | 721 | } |
@@ -724,9 +724,9 @@ discard block |
||
724 | 724 | else |
725 | 725 | { |
726 | 726 | // result handling : set session_name() |
727 | - if($session_name = self::get('SSOID')) |
|
727 | + if ($session_name = self::get('SSOID')) |
|
728 | 728 | { |
729 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
729 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
730 | 730 | { |
731 | 731 | echo self::get('lang')->msg_invalid_request; |
732 | 732 | return false; |
@@ -735,17 +735,17 @@ discard block |
||
735 | 735 | saveCookie(session_name(), $session_name, true); |
736 | 736 | |
737 | 737 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
738 | - header('location:' . $url); |
|
738 | + header('location:'.$url); |
|
739 | 739 | return FALSE; |
740 | 740 | // send SSO request |
741 | 741 | } |
742 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
742 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
743 | 743 | { |
744 | 744 | saveCookie('sso', md5(self::getRequestUri()), true); |
745 | 745 | $origin_url = self::getRequestUrl(); |
746 | 746 | $origin_sig = Password::createSignature($origin_url); |
747 | 747 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
748 | - header('location:' . $url); |
|
748 | + header('location:'.$url); |
|
749 | 749 | return FALSE; |
750 | 750 | } |
751 | 751 | } |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | { |
773 | 773 | $self = self::getInstance(); |
774 | 774 | |
775 | - if(!$self->isFTPRegisted()) |
|
775 | + if (!$self->isFTPRegisted()) |
|
776 | 776 | { |
777 | 777 | return null; |
778 | 778 | } |
@@ -790,15 +790,15 @@ discard block |
||
790 | 790 | */ |
791 | 791 | function addBrowserTitle($site_title) |
792 | 792 | { |
793 | - if(!$site_title) |
|
793 | + if (!$site_title) |
|
794 | 794 | { |
795 | 795 | return; |
796 | 796 | } |
797 | 797 | $self = self::getInstance(); |
798 | 798 | |
799 | - if($self->site_title) |
|
799 | + if ($self->site_title) |
|
800 | 800 | { |
801 | - $self->site_title .= ' - ' . $site_title; |
|
801 | + $self->site_title .= ' - '.$site_title; |
|
802 | 802 | } |
803 | 803 | else |
804 | 804 | { |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | */ |
815 | 815 | function setBrowserTitle($site_title) |
816 | 816 | { |
817 | - if(!$site_title) |
|
817 | + if (!$site_title) |
|
818 | 818 | { |
819 | 819 | return; |
820 | 820 | } |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | $oModuleModel = getModel('module'); |
847 | 847 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
848 | 848 | |
849 | - if(isset($moduleConfig->siteTitle)) |
|
849 | + if (isset($moduleConfig->siteTitle)) |
|
850 | 850 | { |
851 | 851 | return $moduleConfig->siteTitle; |
852 | 852 | } |
@@ -873,30 +873,30 @@ discard block |
||
873 | 873 | global $lang; |
874 | 874 | |
875 | 875 | $self = self::getInstance(); |
876 | - if(!$self->lang_type) |
|
876 | + if (!$self->lang_type) |
|
877 | 877 | { |
878 | 878 | return; |
879 | 879 | } |
880 | - if(!is_object($lang)) |
|
880 | + if (!is_object($lang)) |
|
881 | 881 | { |
882 | 882 | $lang = new stdClass; |
883 | 883 | } |
884 | 884 | |
885 | - if(!($filename = $self->_loadXmlLang($path))) |
|
885 | + if (!($filename = $self->_loadXmlLang($path))) |
|
886 | 886 | { |
887 | 887 | $filename = $self->_loadPhpLang($path); |
888 | 888 | } |
889 | 889 | |
890 | - if(!is_array($self->loaded_lang_files)) |
|
890 | + if (!is_array($self->loaded_lang_files)) |
|
891 | 891 | { |
892 | 892 | $self->loaded_lang_files = array(); |
893 | 893 | } |
894 | - if(in_array($filename, $self->loaded_lang_files)) |
|
894 | + if (in_array($filename, $self->loaded_lang_files)) |
|
895 | 895 | { |
896 | 896 | return; |
897 | 897 | } |
898 | 898 | |
899 | - if($filename && is_readable($filename)) |
|
899 | + if ($filename && is_readable($filename)) |
|
900 | 900 | { |
901 | 901 | $self->loaded_lang_files[] = $filename; |
902 | 902 | include($filename); |
@@ -917,24 +917,24 @@ discard block |
||
917 | 917 | { |
918 | 918 | global $lang; |
919 | 919 | |
920 | - if(!$path) return; |
|
920 | + if (!$path) return; |
|
921 | 921 | |
922 | - $_path = 'eval://' . $path; |
|
922 | + $_path = 'eval://'.$path; |
|
923 | 923 | |
924 | - if(in_array($_path, $this->loaded_lang_files)) |
|
924 | + if (in_array($_path, $this->loaded_lang_files)) |
|
925 | 925 | { |
926 | 926 | return; |
927 | 927 | } |
928 | 928 | |
929 | - if(substr_compare($path, '/', -1) !== 0) |
|
929 | + if (substr_compare($path, '/', -1) !== 0) |
|
930 | 930 | { |
931 | 931 | $path .= '/'; |
932 | 932 | } |
933 | 933 | |
934 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
934 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
935 | 935 | $content = $oXmlLangParser->getCompileContent(); |
936 | 936 | |
937 | - if($content) |
|
937 | + if ($content) |
|
938 | 938 | { |
939 | 939 | $this->loaded_lang_files[] = $_path; |
940 | 940 | eval($content); |
@@ -949,9 +949,9 @@ discard block |
||
949 | 949 | */ |
950 | 950 | function _loadXmlLang($path) |
951 | 951 | { |
952 | - if(!$path) return; |
|
952 | + if (!$path) return; |
|
953 | 953 | |
954 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
954 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
955 | 955 | return $oXmlLangParser->compile(); |
956 | 956 | } |
957 | 957 | |
@@ -963,22 +963,22 @@ discard block |
||
963 | 963 | */ |
964 | 964 | function _loadPhpLang($path) |
965 | 965 | { |
966 | - if(!$path) return; |
|
966 | + if (!$path) return; |
|
967 | 967 | |
968 | - if(substr_compare($path, '/', -1) !== 0) |
|
968 | + if (substr_compare($path, '/', -1) !== 0) |
|
969 | 969 | { |
970 | 970 | $path .= '/'; |
971 | 971 | } |
972 | - $path_tpl = $path . '%s.lang.php'; |
|
972 | + $path_tpl = $path.'%s.lang.php'; |
|
973 | 973 | $file = sprintf($path_tpl, $this->lang_type); |
974 | 974 | |
975 | 975 | $langs = array('ko', 'en'); // this will be configurable. |
976 | - while(!is_readable($file) && $langs[0]) |
|
976 | + while (!is_readable($file) && $langs[0]) |
|
977 | 977 | { |
978 | 978 | $file = sprintf($path_tpl, array_shift($langs)); |
979 | 979 | } |
980 | 980 | |
981 | - if(!is_readable($file)) |
|
981 | + if (!is_readable($file)) |
|
982 | 982 | { |
983 | 983 | return FALSE; |
984 | 984 | } |
@@ -1020,11 +1020,11 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | function getLang($code) |
1022 | 1022 | { |
1023 | - if(!$code) |
|
1023 | + if (!$code) |
|
1024 | 1024 | { |
1025 | 1025 | return; |
1026 | 1026 | } |
1027 | - if($GLOBALS['lang']->{$code}) |
|
1027 | + if ($GLOBALS['lang']->{$code}) |
|
1028 | 1028 | { |
1029 | 1029 | return $GLOBALS['lang']->{$code}; |
1030 | 1030 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | function setLang($code, $val) |
1042 | 1042 | { |
1043 | - if(!isset($GLOBALS['lang'])) |
|
1043 | + if (!isset($GLOBALS['lang'])) |
|
1044 | 1044 | { |
1045 | 1045 | $GLOBALS['lang'] = new stdClass(); |
1046 | 1046 | } |
@@ -1065,17 +1065,17 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | $obj = clone $source_obj; |
1067 | 1067 | |
1068 | - foreach($charset_list as $charset) |
|
1068 | + foreach ($charset_list as $charset) |
|
1069 | 1069 | { |
1070 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
1070 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
1071 | 1071 | $flag = self::checkConvertFlag($flag = TRUE); |
1072 | - if($flag) |
|
1072 | + if ($flag) |
|
1073 | 1073 | { |
1074 | - if($charset == 'UTF-8') |
|
1074 | + if ($charset == 'UTF-8') |
|
1075 | 1075 | { |
1076 | 1076 | return $obj; |
1077 | 1077 | } |
1078 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
1078 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
1079 | 1079 | return $obj; |
1080 | 1080 | } |
1081 | 1081 | } |
@@ -1094,11 +1094,11 @@ discard block |
||
1094 | 1094 | function checkConvertFlag(&$val, $key = null, $charset = null) |
1095 | 1095 | { |
1096 | 1096 | static $flag = TRUE; |
1097 | - if($charset) |
|
1097 | + if ($charset) |
|
1098 | 1098 | { |
1099 | - if(is_array($val)) |
|
1100 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
1101 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
1099 | + if (is_array($val)) |
|
1100 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
1101 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
1102 | 1102 | else $flag = FALSE; |
1103 | 1103 | } |
1104 | 1104 | else |
@@ -1122,9 +1122,9 @@ discard block |
||
1122 | 1122 | { |
1123 | 1123 | if (is_array($val)) |
1124 | 1124 | { |
1125 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
1125 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
1126 | 1126 | } |
1127 | - else $val = iconv($charset,'UTF-8',$val); |
|
1127 | + else $val = iconv($charset, 'UTF-8', $val); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | /** |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | */ |
1136 | 1136 | function convertEncodingStr($str) |
1137 | 1137 | { |
1138 | - if(!$str) return null; |
|
1138 | + if (!$str) return null; |
|
1139 | 1139 | $obj = new stdClass(); |
1140 | 1140 | $obj->str = $str; |
1141 | 1141 | $obj = self::convertEncoding($obj); |
@@ -1144,9 +1144,9 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | function decodeIdna($domain) |
1146 | 1146 | { |
1147 | - if(strpos($domain, 'xn--') !== FALSE) |
|
1147 | + if (strpos($domain, 'xn--') !== FALSE) |
|
1148 | 1148 | { |
1149 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1149 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1150 | 1150 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1151 | 1151 | $domain = $IDN->decode($domain); |
1152 | 1152 | } |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | { |
1178 | 1178 | $self = self::getInstance(); |
1179 | 1179 | |
1180 | - if($self->response_method) |
|
1180 | + if ($self->response_method) |
|
1181 | 1181 | { |
1182 | 1182 | return $self->response_method; |
1183 | 1183 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
1218 | 1218 | |
1219 | 1219 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
1220 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1220 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1221 | 1221 | { |
1222 | 1222 | $this->isSuccessInit = FALSE; |
1223 | 1223 | } |
@@ -1230,30 +1230,30 @@ discard block |
||
1230 | 1230 | */ |
1231 | 1231 | function _setRequestArgument() |
1232 | 1232 | { |
1233 | - if(!count($_REQUEST)) |
|
1233 | + if (!count($_REQUEST)) |
|
1234 | 1234 | { |
1235 | 1235 | return; |
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | $requestMethod = $this->getRequestMethod(); |
1239 | - foreach($_REQUEST as $key => $val) |
|
1239 | + foreach ($_REQUEST as $key => $val) |
|
1240 | 1240 | { |
1241 | - if($val === '' || self::get($key)) |
|
1241 | + if ($val === '' || self::get($key)) |
|
1242 | 1242 | { |
1243 | 1243 | continue; |
1244 | 1244 | } |
1245 | 1245 | $key = htmlentities($key); |
1246 | 1246 | $val = $this->_filterRequestVar($key, $val); |
1247 | 1247 | |
1248 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
1248 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
1249 | 1249 | { |
1250 | 1250 | $set_to_vars = TRUE; |
1251 | 1251 | } |
1252 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
1252 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
1253 | 1253 | { |
1254 | 1254 | $set_to_vars = TRUE; |
1255 | 1255 | } |
1256 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1256 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1257 | 1257 | { |
1258 | 1258 | $set_to_vars = TRUE; |
1259 | 1259 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | $set_to_vars = FALSE; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - if($set_to_vars) |
|
1265 | + if ($set_to_vars) |
|
1266 | 1266 | { |
1267 | 1267 | $this->_recursiveCheckVar($val); |
1268 | 1268 | } |
@@ -1273,20 +1273,20 @@ discard block |
||
1273 | 1273 | |
1274 | 1274 | function _recursiveCheckVar($val) |
1275 | 1275 | { |
1276 | - if(is_string($val)) |
|
1276 | + if (is_string($val)) |
|
1277 | 1277 | { |
1278 | - foreach($this->patterns as $pattern) |
|
1278 | + foreach ($this->patterns as $pattern) |
|
1279 | 1279 | { |
1280 | - if(preg_match($pattern, $val)) |
|
1280 | + if (preg_match($pattern, $val)) |
|
1281 | 1281 | { |
1282 | 1282 | $this->isSuccessInit = FALSE; |
1283 | 1283 | return; |
1284 | 1284 | } |
1285 | 1285 | } |
1286 | 1286 | } |
1287 | - else if(is_array($val)) |
|
1287 | + else if (is_array($val)) |
|
1288 | 1288 | { |
1289 | - foreach($val as $val2) |
|
1289 | + foreach ($val as $val2) |
|
1290 | 1290 | { |
1291 | 1291 | $this->_recursiveCheckVar($val2); |
1292 | 1292 | } |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | */ |
1301 | 1301 | function _setJSONRequestArgument() |
1302 | 1302 | { |
1303 | - if($this->getRequestMethod() != 'JSON') |
|
1303 | + if ($this->getRequestMethod() != 'JSON') |
|
1304 | 1304 | { |
1305 | 1305 | return; |
1306 | 1306 | } |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | $params = array(); |
1309 | 1309 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
1310 | 1310 | |
1311 | - foreach($params as $key => $val) |
|
1311 | + foreach ($params as $key => $val) |
|
1312 | 1312 | { |
1313 | 1313 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
1314 | 1314 | } |
@@ -1321,13 +1321,13 @@ discard block |
||
1321 | 1321 | */ |
1322 | 1322 | function _setXmlRpcArgument() |
1323 | 1323 | { |
1324 | - if($this->getRequestMethod() != 'XMLRPC') |
|
1324 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
1325 | 1325 | { |
1326 | 1326 | return; |
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
1330 | - if(Security::detectingXEE($xml)) |
|
1330 | + if (Security::detectingXEE($xml)) |
|
1331 | 1331 | { |
1332 | 1332 | header("HTTP/1.0 400 Bad Request"); |
1333 | 1333 | exit; |
@@ -1339,12 +1339,12 @@ discard block |
||
1339 | 1339 | $params = $xml_obj->methodcall->params; |
1340 | 1340 | unset($params->node_name, $params->attrs, $params->body); |
1341 | 1341 | |
1342 | - if(!count(get_object_vars($params))) |
|
1342 | + if (!count(get_object_vars($params))) |
|
1343 | 1343 | { |
1344 | 1344 | return; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | - foreach($params as $key => $val) |
|
1347 | + foreach ($params as $key => $val) |
|
1348 | 1348 | { |
1349 | 1349 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
1350 | 1350 | } |
@@ -1359,10 +1359,10 @@ discard block |
||
1359 | 1359 | */ |
1360 | 1360 | function _filterXmlVars($key, $val) |
1361 | 1361 | { |
1362 | - if(is_array($val)) |
|
1362 | + if (is_array($val)) |
|
1363 | 1363 | { |
1364 | 1364 | $stack = array(); |
1365 | - foreach($val as $k => $v) |
|
1365 | + foreach ($val as $k => $v) |
|
1366 | 1366 | { |
1367 | 1367 | $stack[$k] = $this->_filterXmlVars($k, $v); |
1368 | 1368 | } |
@@ -1372,20 +1372,20 @@ discard block |
||
1372 | 1372 | |
1373 | 1373 | $body = $val->body; |
1374 | 1374 | unset($val->node_name, $val->attrs, $val->body); |
1375 | - if(!count(get_object_vars($val))) |
|
1375 | + if (!count(get_object_vars($val))) |
|
1376 | 1376 | { |
1377 | 1377 | return $this->_filterRequestVar($key, $body, 0); |
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | $stack = new stdClass(); |
1381 | - foreach($val as $k => $v) |
|
1381 | + foreach ($val as $k => $v) |
|
1382 | 1382 | { |
1383 | 1383 | $output = $this->_filterXmlVars($k, $v); |
1384 | - if(is_object($v) && $v->attrs->type == 'array') |
|
1384 | + if (is_object($v) && $v->attrs->type == 'array') |
|
1385 | 1385 | { |
1386 | 1386 | $output = array($output); |
1387 | 1387 | } |
1388 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1388 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1389 | 1389 | { |
1390 | 1390 | return $output; |
1391 | 1391 | } |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | $stack->{$k} = $output; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - if(!count(get_object_vars($stack))) |
|
1396 | + if (!count(get_object_vars($stack))) |
|
1397 | 1397 | { |
1398 | 1398 | return NULL; |
1399 | 1399 | } |
@@ -1412,32 +1412,32 @@ discard block |
||
1412 | 1412 | */ |
1413 | 1413 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
1414 | 1414 | { |
1415 | - if(!($isArray = is_array($val))) |
|
1415 | + if (!($isArray = is_array($val))) |
|
1416 | 1416 | { |
1417 | 1417 | $val = array($val); |
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | $result = array(); |
1421 | - foreach($val as $k => $v) |
|
1421 | + foreach ($val as $k => $v) |
|
1422 | 1422 | { |
1423 | 1423 | $k = htmlentities($k); |
1424 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1424 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1425 | 1425 | { |
1426 | 1426 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
1427 | 1427 | } |
1428 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
1428 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
1429 | 1429 | { |
1430 | 1430 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1431 | 1431 | } |
1432 | - elseif($key === 'vid') |
|
1432 | + elseif ($key === 'vid') |
|
1433 | 1433 | { |
1434 | 1434 | $result[$k] = urlencode($v); |
1435 | 1435 | } |
1436 | - elseif($key === 'xe_validator_id') |
|
1436 | + elseif ($key === 'xe_validator_id') |
|
1437 | 1437 | { |
1438 | 1438 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1439 | 1439 | } |
1440 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1440 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1441 | 1441 | { |
1442 | 1442 | unset($result[$k]); |
1443 | 1443 | } |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | { |
1446 | 1446 | $result[$k] = $v; |
1447 | 1447 | |
1448 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1448 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1449 | 1449 | { |
1450 | 1450 | if (is_array($result[$k])) |
1451 | 1451 | { |
@@ -1457,7 +1457,7 @@ discard block |
||
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | |
1460 | - if(is_array($result[$k])) |
|
1460 | + if (is_array($result[$k])) |
|
1461 | 1461 | { |
1462 | 1462 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
1463 | 1463 | } |
@@ -1489,17 +1489,17 @@ discard block |
||
1489 | 1489 | */ |
1490 | 1490 | function _setUploadedArgument() |
1491 | 1491 | { |
1492 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1492 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1493 | 1493 | { |
1494 | 1494 | return; |
1495 | 1495 | } |
1496 | 1496 | |
1497 | - foreach($_FILES as $key => $val) |
|
1497 | + foreach ($_FILES as $key => $val) |
|
1498 | 1498 | { |
1499 | 1499 | $tmp_name = $val['tmp_name']; |
1500 | - if(!is_array($tmp_name)) |
|
1500 | + if (!is_array($tmp_name)) |
|
1501 | 1501 | { |
1502 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1502 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1503 | 1503 | { |
1504 | 1504 | continue; |
1505 | 1505 | } |
@@ -1512,9 +1512,9 @@ discard block |
||
1512 | 1512 | $files = array(); |
1513 | 1513 | $count_files = count($tmp_name); |
1514 | 1514 | |
1515 | - for($i = 0; $i < $count_files; $i++) |
|
1515 | + for ($i = 0; $i < $count_files; $i++) |
|
1516 | 1516 | { |
1517 | - if($val['size'][$i] > 0) |
|
1517 | + if ($val['size'][$i] > 0) |
|
1518 | 1518 | { |
1519 | 1519 | $file = array(); |
1520 | 1520 | $file['name'] = $val['name'][$i]; |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | $files[] = $file; |
1526 | 1526 | } |
1527 | 1527 | } |
1528 | - if($files) $this->set($key, $files, TRUE); |
|
1528 | + if ($files) $this->set($key, $files, TRUE); |
|
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | } |
@@ -1547,16 +1547,16 @@ discard block |
||
1547 | 1547 | function getRequestUrl() |
1548 | 1548 | { |
1549 | 1549 | static $url = null; |
1550 | - if(is_null($url)) |
|
1550 | + if (is_null($url)) |
|
1551 | 1551 | { |
1552 | 1552 | $url = self::getRequestUri(); |
1553 | - if(count($_GET) > 0) |
|
1553 | + if (count($_GET) > 0) |
|
1554 | 1554 | { |
1555 | - foreach($_GET as $key => $val) |
|
1555 | + foreach ($_GET as $key => $val) |
|
1556 | 1556 | { |
1557 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1557 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1558 | 1558 | } |
1559 | - $url .= '?' . join('&', $vars); |
|
1559 | + $url .= '?'.join('&', $vars); |
|
1560 | 1560 | } |
1561 | 1561 | } |
1562 | 1562 | return $url; |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | $self = self::getInstance(); |
1572 | 1572 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
1573 | 1573 | |
1574 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1574 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1575 | 1575 | { |
1576 | 1576 | unset($js_callback_func); |
1577 | 1577 | unset($_GET['xe_js_callback']); |
@@ -1599,22 +1599,22 @@ discard block |
||
1599 | 1599 | $self = self::getInstance(); |
1600 | 1600 | |
1601 | 1601 | // retrieve virtual site information |
1602 | - if(is_null($site_module_info)) |
|
1602 | + if (is_null($site_module_info)) |
|
1603 | 1603 | { |
1604 | 1604 | $site_module_info = self::get('site_module_info'); |
1605 | 1605 | } |
1606 | 1606 | |
1607 | 1607 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
1608 | - if($domain && isSiteID($domain)) |
|
1608 | + if ($domain && isSiteID($domain)) |
|
1609 | 1609 | { |
1610 | 1610 | $vid = $domain; |
1611 | 1611 | $domain = ''; |
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | // If $domain, $vid are not set, use current site information |
1615 | - if(!$domain && !$vid) |
|
1615 | + if (!$domain && !$vid) |
|
1616 | 1616 | { |
1617 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1617 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1618 | 1618 | { |
1619 | 1619 | $vid = $site_module_info->domain; |
1620 | 1620 | } |
@@ -1625,21 +1625,21 @@ discard block |
||
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
1628 | - if($domain) |
|
1628 | + if ($domain) |
|
1629 | 1629 | { |
1630 | 1630 | $domain_info = parse_url($domain); |
1631 | - if(is_null($current_info)) |
|
1631 | + if (is_null($current_info)) |
|
1632 | 1632 | { |
1633 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
1633 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
1634 | 1634 | } |
1635 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
1635 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
1636 | 1636 | { |
1637 | 1637 | unset($domain); |
1638 | 1638 | } |
1639 | 1639 | else |
1640 | 1640 | { |
1641 | 1641 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
1642 | - if(substr_compare($domain, '/', -1) !== 0) |
|
1642 | + if (substr_compare($domain, '/', -1) !== 0) |
|
1643 | 1643 | { |
1644 | 1644 | $domain .= '/'; |
1645 | 1645 | } |
@@ -1649,41 +1649,41 @@ discard block |
||
1649 | 1649 | $get_vars = array(); |
1650 | 1650 | |
1651 | 1651 | // If there is no GET variables or first argument is '' to reset variables |
1652 | - if(!$self->get_vars || $args_list[0] == '') |
|
1652 | + if (!$self->get_vars || $args_list[0] == '') |
|
1653 | 1653 | { |
1654 | 1654 | // rearrange args_list |
1655 | - if(is_array($args_list) && $args_list[0] == '') |
|
1655 | + if (is_array($args_list) && $args_list[0] == '') |
|
1656 | 1656 | { |
1657 | 1657 | array_shift($args_list); |
1658 | 1658 | } |
1659 | 1659 | } |
1660 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1660 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1661 | 1661 | { |
1662 | 1662 | // Otherwise, make GET variables into array |
1663 | 1663 | $get_vars = get_object_vars($self->get_vars); |
1664 | 1664 | } |
1665 | 1665 | else |
1666 | 1666 | { |
1667 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
1668 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
1669 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
1670 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
1671 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
1672 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1673 | - if($get_vars['act'] == 'IS') |
|
1667 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
1668 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
1669 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
1670 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
1671 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
1672 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1673 | + if ($get_vars['act'] == 'IS') |
|
1674 | 1674 | { |
1675 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1675 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1676 | 1676 | } |
1677 | 1677 | } |
1678 | 1678 | |
1679 | 1679 | // arrange args_list |
1680 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1680 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1681 | 1681 | { |
1682 | 1682 | $key = $args_list[$i]; |
1683 | 1683 | $val = trim($args_list[$i + 1]); |
1684 | 1684 | |
1685 | 1685 | // If value is not set, remove the key |
1686 | - if(!isset($val) || !strlen($val)) |
|
1686 | + if (!isset($val) || !strlen($val)) |
|
1687 | 1687 | { |
1688 | 1688 | unset($get_vars[$key]); |
1689 | 1689 | continue; |
@@ -1694,7 +1694,7 @@ discard block |
||
1694 | 1694 | |
1695 | 1695 | // remove vid, rnd |
1696 | 1696 | unset($get_vars['rnd']); |
1697 | - if($vid) |
|
1697 | + if ($vid) |
|
1698 | 1698 | { |
1699 | 1699 | $get_vars['vid'] = $vid; |
1700 | 1700 | } |
@@ -1711,17 +1711,17 @@ discard block |
||
1711 | 1711 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
1712 | 1712 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
1713 | 1713 | ); |
1714 | - if($act_alias[$act]) |
|
1714 | + if ($act_alias[$act]) |
|
1715 | 1715 | { |
1716 | 1716 | $get_vars['act'] = $act_alias[$act]; |
1717 | 1717 | } |
1718 | 1718 | |
1719 | 1719 | // organize URL |
1720 | 1720 | $query = ''; |
1721 | - if(count($get_vars) > 0) |
|
1721 | + if (count($get_vars) > 0) |
|
1722 | 1722 | { |
1723 | 1723 | // if using rewrite mod |
1724 | - if($self->allow_rewrite) |
|
1724 | + if ($self->allow_rewrite) |
|
1725 | 1725 | { |
1726 | 1726 | $var_keys = array_keys($get_vars); |
1727 | 1727 | sort($var_keys); |
@@ -1741,8 +1741,8 @@ discard block |
||
1741 | 1741 | 'vid' => $vid, |
1742 | 1742 | 'mid' => $mid, |
1743 | 1743 | 'mid.vid' => "$vid/$mid", |
1744 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
1745 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
1744 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
1745 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
1746 | 1746 | 'document_srl' => $srl, |
1747 | 1747 | 'document_srl.mid' => "$mid/$srl", |
1748 | 1748 | 'document_srl.vid' => "$vid/$srl", |
@@ -1759,66 +1759,66 @@ discard block |
||
1759 | 1759 | $query = $target_map[$target]; |
1760 | 1760 | } |
1761 | 1761 | |
1762 | - if(!$query) |
|
1762 | + if (!$query) |
|
1763 | 1763 | { |
1764 | 1764 | $queries = array(); |
1765 | - foreach($get_vars as $key => $val) |
|
1765 | + foreach ($get_vars as $key => $val) |
|
1766 | 1766 | { |
1767 | - if(is_array($val) && count($val) > 0) |
|
1767 | + if (is_array($val) && count($val) > 0) |
|
1768 | 1768 | { |
1769 | - foreach($val as $k => $v) |
|
1769 | + foreach ($val as $k => $v) |
|
1770 | 1770 | { |
1771 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
1771 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
1772 | 1772 | } |
1773 | 1773 | } |
1774 | - elseif(!is_array($val)) |
|
1774 | + elseif (!is_array($val)) |
|
1775 | 1775 | { |
1776 | - $queries[] = $key . '=' . urlencode($val); |
|
1776 | + $queries[] = $key.'='.urlencode($val); |
|
1777 | 1777 | } |
1778 | 1778 | } |
1779 | - if(count($queries) > 0) |
|
1779 | + if (count($queries) > 0) |
|
1780 | 1780 | { |
1781 | - $query = 'index.php?' . join('&', $queries); |
|
1781 | + $query = 'index.php?'.join('&', $queries); |
|
1782 | 1782 | } |
1783 | 1783 | } |
1784 | 1784 | } |
1785 | 1785 | |
1786 | 1786 | // If using SSL always |
1787 | 1787 | $_use_ssl = $self->get('_use_ssl'); |
1788 | - if($_use_ssl == 'always') |
|
1788 | + if ($_use_ssl == 'always') |
|
1789 | 1789 | { |
1790 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1790 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1791 | 1791 | // optional SSL use |
1792 | 1792 | } |
1793 | - elseif($_use_ssl == 'optional') |
|
1793 | + elseif ($_use_ssl == 'optional') |
|
1794 | 1794 | { |
1795 | 1795 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
1796 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
1796 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
1797 | 1797 | // no SSL |
1798 | 1798 | } |
1799 | 1799 | else |
1800 | 1800 | { |
1801 | 1801 | // currently on SSL but target is not based on SSL |
1802 | - if($_SERVER['HTTPS'] == 'on') |
|
1802 | + if ($_SERVER['HTTPS'] == 'on') |
|
1803 | 1803 | { |
1804 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1804 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1805 | 1805 | } |
1806 | - else if($domain) // if $domain is set |
|
1806 | + else if ($domain) // if $domain is set |
|
1807 | 1807 | { |
1808 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
1808 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
1809 | 1809 | } |
1810 | 1810 | else |
1811 | 1811 | { |
1812 | - $query = getScriptPath() . $query; |
|
1812 | + $query = getScriptPath().$query; |
|
1813 | 1813 | } |
1814 | 1814 | } |
1815 | 1815 | |
1816 | - if(!$encode) |
|
1816 | + if (!$encode) |
|
1817 | 1817 | { |
1818 | 1818 | return $query; |
1819 | 1819 | } |
1820 | 1820 | |
1821 | - if(!$autoEncode) |
|
1821 | + if (!$autoEncode) |
|
1822 | 1822 | { |
1823 | 1823 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1824 | 1824 | } |
@@ -1827,16 +1827,16 @@ discard block |
||
1827 | 1827 | $encode_queries = array(); |
1828 | 1828 | $parsedUrl = parse_url($query); |
1829 | 1829 | parse_str($parsedUrl['query'], $output); |
1830 | - foreach($output as $key => $value) |
|
1830 | + foreach ($output as $key => $value) |
|
1831 | 1831 | { |
1832 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1832 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1833 | 1833 | { |
1834 | 1834 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
1835 | 1835 | } |
1836 | - $encode_queries[] = $key . '=' . $value; |
|
1836 | + $encode_queries[] = $key.'='.$value; |
|
1837 | 1837 | } |
1838 | 1838 | |
1839 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1839 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | /** |
@@ -1851,17 +1851,17 @@ discard block |
||
1851 | 1851 | static $url = array(); |
1852 | 1852 | |
1853 | 1853 | // Check HTTP Request |
1854 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1854 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1855 | 1855 | { |
1856 | 1856 | return; |
1857 | 1857 | } |
1858 | 1858 | |
1859 | - if(self::get('_use_ssl') == 'always') |
|
1859 | + if (self::get('_use_ssl') == 'always') |
|
1860 | 1860 | { |
1861 | 1861 | $ssl_mode = ENFORCE_SSL; |
1862 | 1862 | } |
1863 | 1863 | |
1864 | - if($domain) |
|
1864 | + if ($domain) |
|
1865 | 1865 | { |
1866 | 1866 | $domain_key = md5($domain); |
1867 | 1867 | } |
@@ -1870,14 +1870,14 @@ discard block |
||
1870 | 1870 | $domain_key = 'default'; |
1871 | 1871 | } |
1872 | 1872 | |
1873 | - if(isset($url[$ssl_mode][$domain_key])) |
|
1873 | + if (isset($url[$ssl_mode][$domain_key])) |
|
1874 | 1874 | { |
1875 | 1875 | return $url[$ssl_mode][$domain_key]; |
1876 | 1876 | } |
1877 | 1877 | |
1878 | 1878 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
1879 | 1879 | |
1880 | - switch($ssl_mode) |
|
1880 | + switch ($ssl_mode) |
|
1881 | 1881 | { |
1882 | 1882 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
1883 | 1883 | break; |
@@ -1887,34 +1887,34 @@ discard block |
||
1887 | 1887 | break; |
1888 | 1888 | } |
1889 | 1889 | |
1890 | - if($domain) |
|
1890 | + if ($domain) |
|
1891 | 1891 | { |
1892 | 1892 | $target_url = trim($domain); |
1893 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
1893 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
1894 | 1894 | { |
1895 | - $target_url.= '/'; |
|
1895 | + $target_url .= '/'; |
|
1896 | 1896 | } |
1897 | 1897 | } |
1898 | 1898 | else |
1899 | 1899 | { |
1900 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
1900 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | - $url_info = parse_url('http://' . $target_url); |
|
1903 | + $url_info = parse_url('http://'.$target_url); |
|
1904 | 1904 | |
1905 | - if($current_use_ssl != $use_ssl) |
|
1905 | + if ($current_use_ssl != $use_ssl) |
|
1906 | 1906 | { |
1907 | 1907 | unset($url_info['port']); |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - if($use_ssl) |
|
1910 | + if ($use_ssl) |
|
1911 | 1911 | { |
1912 | 1912 | $port = self::get('_https_port'); |
1913 | - if($port && $port != 443) |
|
1913 | + if ($port && $port != 443) |
|
1914 | 1914 | { |
1915 | 1915 | $url_info['port'] = $port; |
1916 | 1916 | } |
1917 | - elseif($url_info['port'] == 443) |
|
1917 | + elseif ($url_info['port'] == 443) |
|
1918 | 1918 | { |
1919 | 1919 | unset($url_info['port']); |
1920 | 1920 | } |
@@ -1922,17 +1922,17 @@ discard block |
||
1922 | 1922 | else |
1923 | 1923 | { |
1924 | 1924 | $port = self::get('_http_port'); |
1925 | - if($port && $port != 80) |
|
1925 | + if ($port && $port != 80) |
|
1926 | 1926 | { |
1927 | 1927 | $url_info['port'] = $port; |
1928 | 1928 | } |
1929 | - elseif($url_info['port'] == 80) |
|
1929 | + elseif ($url_info['port'] == 80) |
|
1930 | 1930 | { |
1931 | 1931 | unset($url_info['port']); |
1932 | 1932 | } |
1933 | 1933 | } |
1934 | 1934 | |
1935 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
1935 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
1936 | 1936 | |
1937 | 1937 | return $url[$ssl_mode][$domain_key]; |
1938 | 1938 | } |
@@ -1949,16 +1949,16 @@ discard block |
||
1949 | 1949 | { |
1950 | 1950 | $self = self::getInstance(); |
1951 | 1951 | $self->context->{$key} = $val; |
1952 | - if($set_to_get_vars === FALSE) |
|
1952 | + if ($set_to_get_vars === FALSE) |
|
1953 | 1953 | { |
1954 | 1954 | return; |
1955 | 1955 | } |
1956 | - if($val === NULL || $val === '') |
|
1956 | + if ($val === NULL || $val === '') |
|
1957 | 1957 | { |
1958 | 1958 | unset($self->get_vars->{$key}); |
1959 | 1959 | return; |
1960 | 1960 | } |
1961 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
1961 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
1962 | 1962 | { |
1963 | 1963 | $self->get_vars->{$key} = $val; |
1964 | 1964 | } |
@@ -1974,7 +1974,7 @@ discard block |
||
1974 | 1974 | { |
1975 | 1975 | $self = self::getInstance(); |
1976 | 1976 | |
1977 | - if(!isset($self->context->{$key})) |
|
1977 | + if (!isset($self->context->{$key})) |
|
1978 | 1978 | { |
1979 | 1979 | return null; |
1980 | 1980 | } |
@@ -1989,7 +1989,7 @@ discard block |
||
1989 | 1989 | function gets() |
1990 | 1990 | { |
1991 | 1991 | $num_args = func_num_args(); |
1992 | - if($num_args < 1) |
|
1992 | + if ($num_args < 1) |
|
1993 | 1993 | { |
1994 | 1994 | return; |
1995 | 1995 | } |
@@ -1997,7 +1997,7 @@ discard block |
||
1997 | 1997 | |
1998 | 1998 | $args_list = func_get_args(); |
1999 | 1999 | $output = new stdClass(); |
2000 | - foreach($args_list as $v) |
|
2000 | + foreach ($args_list as $v) |
|
2001 | 2001 | { |
2002 | 2002 | $output->{$v} = $self->get($v); |
2003 | 2003 | } |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | function getRequestVars() |
2024 | 2024 | { |
2025 | 2025 | $self = self::getInstance(); |
2026 | - if($self->get_vars) |
|
2026 | + if ($self->get_vars) |
|
2027 | 2027 | { |
2028 | 2028 | return clone($self->get_vars); |
2029 | 2029 | } |
@@ -2040,13 +2040,13 @@ discard block |
||
2040 | 2040 | { |
2041 | 2041 | $self = self::getInstance(); |
2042 | 2042 | |
2043 | - if(!is_readable($self->sslActionCacheFile)) |
|
2043 | + if (!is_readable($self->sslActionCacheFile)) |
|
2044 | 2044 | { |
2045 | 2045 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2046 | 2046 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2047 | 2047 | } |
2048 | 2048 | |
2049 | - if(!isset($self->ssl_actions[$action])) |
|
2049 | + if (!isset($self->ssl_actions[$action])) |
|
2050 | 2050 | { |
2051 | 2051 | $self->ssl_actions[$action] = 1; |
2052 | 2052 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2064,16 +2064,16 @@ discard block |
||
2064 | 2064 | { |
2065 | 2065 | $self = self::getInstance(); |
2066 | 2066 | |
2067 | - if(!is_readable($self->sslActionCacheFile)) |
|
2067 | + if (!is_readable($self->sslActionCacheFile)) |
|
2068 | 2068 | { |
2069 | 2069 | unset($self->ssl_actions); |
2070 | 2070 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2071 | 2071 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - foreach($action_array as $action) |
|
2074 | + foreach ($action_array as $action) |
|
2075 | 2075 | { |
2076 | - if(!isset($self->ssl_actions[$action])) |
|
2076 | + if (!isset($self->ssl_actions[$action])) |
|
2077 | 2077 | { |
2078 | 2078 | $self->ssl_actions[$action] = 1; |
2079 | 2079 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | { |
2093 | 2093 | $self = self::getInstance(); |
2094 | 2094 | |
2095 | - if($self->isExistsSSLAction($action)) |
|
2095 | + if ($self->isExistsSSLAction($action)) |
|
2096 | 2096 | { |
2097 | 2097 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
2098 | 2098 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | function getSSLActions() |
2110 | 2110 | { |
2111 | 2111 | $self = self::getInstance(); |
2112 | - if($self->getSslStatus() == 'optional') |
|
2112 | + if ($self->getSslStatus() == 'optional') |
|
2113 | 2113 | { |
2114 | 2114 | return $self->ssl_actions; |
2115 | 2115 | } |
@@ -2136,12 +2136,12 @@ discard block |
||
2136 | 2136 | */ |
2137 | 2137 | function normalizeFilePath($file) |
2138 | 2138 | { |
2139 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2139 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2140 | 2140 | { |
2141 | - $file = './' . $file; |
|
2141 | + $file = './'.$file; |
|
2142 | 2142 | } |
2143 | 2143 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
2144 | - while(strpos($file, '/../') !== FALSE) |
|
2144 | + while (strpos($file, '/../') !== FALSE) |
|
2145 | 2145 | { |
2146 | 2146 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
2147 | 2147 | } |
@@ -2160,13 +2160,13 @@ discard block |
||
2160 | 2160 | { |
2161 | 2161 | $file = self::normalizeFilePath($file); |
2162 | 2162 | $script_path = getScriptPath(); |
2163 | - if(strpos($file, './') === 0) |
|
2163 | + if (strpos($file, './') === 0) |
|
2164 | 2164 | { |
2165 | - $file = $script_path . substr($file, 2); |
|
2165 | + $file = $script_path.substr($file, 2); |
|
2166 | 2166 | } |
2167 | - elseif(strpos($file, '../') === 0) |
|
2167 | + elseif (strpos($file, '../') === 0) |
|
2168 | 2168 | { |
2169 | - $file = self::normalizeFilePath($script_path . $file); |
|
2169 | + $file = self::normalizeFilePath($script_path.$file); |
|
2170 | 2170 | } |
2171 | 2171 | |
2172 | 2172 | return $file; |
@@ -2236,12 +2236,12 @@ discard block |
||
2236 | 2236 | */ |
2237 | 2237 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
2238 | 2238 | { |
2239 | - if($isRuleset) |
|
2239 | + if ($isRuleset) |
|
2240 | 2240 | { |
2241 | - if(strpos($file, '#') !== FALSE) |
|
2241 | + if (strpos($file, '#') !== FALSE) |
|
2242 | 2242 | { |
2243 | 2243 | $file = str_replace('#', '', $file); |
2244 | - if(!is_readable($file)) |
|
2244 | + if (!is_readable($file)) |
|
2245 | 2245 | { |
2246 | 2246 | $file = $autoPath; |
2247 | 2247 | } |
@@ -2306,9 +2306,9 @@ discard block |
||
2306 | 2306 | ksort($files); |
2307 | 2307 | $files = array_values($files); |
2308 | 2308 | $filenames = array(); |
2309 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
2309 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
2310 | 2310 | { |
2311 | - if(in_array($files[$i]['file'], $filenames)) |
|
2311 | + if (in_array($files[$i]['file'], $filenames)) |
|
2312 | 2312 | { |
2313 | 2313 | unset($files[$i]); |
2314 | 2314 | } |
@@ -2393,14 +2393,14 @@ discard block |
||
2393 | 2393 | */ |
2394 | 2394 | function getJavascriptPluginInfo($pluginName) |
2395 | 2395 | { |
2396 | - if($plugin_name == 'ui.datepicker') |
|
2396 | + if ($plugin_name == 'ui.datepicker') |
|
2397 | 2397 | { |
2398 | 2398 | $plugin_name = 'ui'; |
2399 | 2399 | } |
2400 | 2400 | |
2401 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
2402 | - $info_file = $plugin_path . 'plugin.load'; |
|
2403 | - if(!is_readable($info_file)) |
|
2401 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
2402 | + $info_file = $plugin_path.'plugin.load'; |
|
2403 | + if (!is_readable($info_file)) |
|
2404 | 2404 | { |
2405 | 2405 | return; |
2406 | 2406 | } |
@@ -2410,32 +2410,32 @@ discard block |
||
2410 | 2410 | $result->jsList = array(); |
2411 | 2411 | $result->cssList = array(); |
2412 | 2412 | |
2413 | - foreach($list as $filename) |
|
2413 | + foreach ($list as $filename) |
|
2414 | 2414 | { |
2415 | 2415 | $filename = trim($filename); |
2416 | - if(!$filename) |
|
2416 | + if (!$filename) |
|
2417 | 2417 | { |
2418 | 2418 | continue; |
2419 | 2419 | } |
2420 | 2420 | |
2421 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2421 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2422 | 2422 | { |
2423 | 2423 | $filename = substr($filename, 2); |
2424 | 2424 | } |
2425 | 2425 | |
2426 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2426 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2427 | 2427 | { |
2428 | - $result->jsList[] = $plugin_path . $filename; |
|
2428 | + $result->jsList[] = $plugin_path.$filename; |
|
2429 | 2429 | } |
2430 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
2430 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
2431 | 2431 | { |
2432 | - $result->cssList[] = $plugin_path . $filename; |
|
2432 | + $result->cssList[] = $plugin_path.$filename; |
|
2433 | 2433 | } |
2434 | 2434 | } |
2435 | 2435 | |
2436 | - if(is_dir($plugin_path . 'lang')) |
|
2436 | + if (is_dir($plugin_path.'lang')) |
|
2437 | 2437 | { |
2438 | - $result->langPath = $plugin_path . 'lang'; |
|
2438 | + $result->langPath = $plugin_path.'lang'; |
|
2439 | 2439 | } |
2440 | 2440 | |
2441 | 2441 | return $result; |
@@ -2451,50 +2451,50 @@ discard block |
||
2451 | 2451 | static $loaded_plugins = array(); |
2452 | 2452 | |
2453 | 2453 | $self = self::getInstance(); |
2454 | - if($plugin_name == 'ui.datepicker') |
|
2454 | + if ($plugin_name == 'ui.datepicker') |
|
2455 | 2455 | { |
2456 | 2456 | $plugin_name = 'ui'; |
2457 | 2457 | } |
2458 | 2458 | |
2459 | - if($loaded_plugins[$plugin_name]) |
|
2459 | + if ($loaded_plugins[$plugin_name]) |
|
2460 | 2460 | { |
2461 | 2461 | return; |
2462 | 2462 | } |
2463 | 2463 | $loaded_plugins[$plugin_name] = TRUE; |
2464 | 2464 | |
2465 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
2466 | - $info_file = $plugin_path . 'plugin.load'; |
|
2467 | - if(!is_readable($info_file)) |
|
2465 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
2466 | + $info_file = $plugin_path.'plugin.load'; |
|
2467 | + if (!is_readable($info_file)) |
|
2468 | 2468 | { |
2469 | 2469 | return; |
2470 | 2470 | } |
2471 | 2471 | |
2472 | 2472 | $list = file($info_file); |
2473 | - foreach($list as $filename) |
|
2473 | + foreach ($list as $filename) |
|
2474 | 2474 | { |
2475 | 2475 | $filename = trim($filename); |
2476 | - if(!$filename) |
|
2476 | + if (!$filename) |
|
2477 | 2477 | { |
2478 | 2478 | continue; |
2479 | 2479 | } |
2480 | 2480 | |
2481 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2481 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2482 | 2482 | { |
2483 | 2483 | $filename = substr($filename, 2); |
2484 | 2484 | } |
2485 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2485 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2486 | 2486 | { |
2487 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
2487 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
2488 | 2488 | } |
2489 | - if(substr_compare($filename, '.css', -4) === 0) |
|
2489 | + if (substr_compare($filename, '.css', -4) === 0) |
|
2490 | 2490 | { |
2491 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
2491 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
2492 | 2492 | } |
2493 | 2493 | } |
2494 | 2494 | |
2495 | - if(is_dir($plugin_path . 'lang')) |
|
2495 | + if (is_dir($plugin_path.'lang')) |
|
2496 | 2496 | { |
2497 | - $self->loadLang($plugin_path . 'lang'); |
|
2497 | + $self->loadLang($plugin_path.'lang'); |
|
2498 | 2498 | } |
2499 | 2499 | } |
2500 | 2500 | |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | function addHtmlHeader($header) |
2508 | 2508 | { |
2509 | 2509 | $self = self::getInstance(); |
2510 | - $self->html_header .= "\n" . $header; |
|
2510 | + $self->html_header .= "\n".$header; |
|
2511 | 2511 | } |
2512 | 2512 | |
2513 | 2513 | function clearHtmlHeader() |
@@ -2559,7 +2559,7 @@ discard block |
||
2559 | 2559 | function addBodyHeader($header) |
2560 | 2560 | { |
2561 | 2561 | $self = self::getInstance(); |
2562 | - $self->body_header .= "\n" . $header; |
|
2562 | + $self->body_header .= "\n".$header; |
|
2563 | 2563 | } |
2564 | 2564 | |
2565 | 2565 | /** |
@@ -2581,7 +2581,7 @@ discard block |
||
2581 | 2581 | function addHtmlFooter($footer) |
2582 | 2582 | { |
2583 | 2583 | $self = self::getInstance(); |
2584 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
2584 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
2585 | 2585 | } |
2586 | 2586 | |
2587 | 2587 | /** |
@@ -2602,7 +2602,7 @@ discard block |
||
2602 | 2602 | */ |
2603 | 2603 | function getConfigFile() |
2604 | 2604 | { |
2605 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
2605 | + return _XE_PATH_.'files/config/db.config.php'; |
|
2606 | 2606 | } |
2607 | 2607 | |
2608 | 2608 | /** |
@@ -2612,7 +2612,7 @@ discard block |
||
2612 | 2612 | */ |
2613 | 2613 | function getFTPConfigFile() |
2614 | 2614 | { |
2615 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
2615 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | /** |
@@ -2664,14 +2664,14 @@ discard block |
||
2664 | 2664 | $_path = explode('/', $path); |
2665 | 2665 | $_base = explode('/', $base_url); |
2666 | 2666 | |
2667 | - if(!$_base[count($_base) - 1]) |
|
2667 | + if (!$_base[count($_base) - 1]) |
|
2668 | 2668 | { |
2669 | 2669 | array_pop($_base); |
2670 | 2670 | } |
2671 | 2671 | |
2672 | - foreach($_xe as $idx => $dir) |
|
2672 | + foreach ($_xe as $idx => $dir) |
|
2673 | 2673 | { |
2674 | - if($_path[0] != $dir) |
|
2674 | + if ($_path[0] != $dir) |
|
2675 | 2675 | { |
2676 | 2676 | break; |
2677 | 2677 | } |
@@ -2679,9 +2679,9 @@ discard block |
||
2679 | 2679 | } |
2680 | 2680 | |
2681 | 2681 | $idx = count($_xe) - $idx - 1; |
2682 | - while($idx--) |
|
2682 | + while ($idx--) |
|
2683 | 2683 | { |
2684 | - if(count($_base) > 0) |
|
2684 | + if (count($_base) > 0) |
|
2685 | 2685 | { |
2686 | 2686 | array_shift($_base); |
2687 | 2687 | } |
@@ -2691,13 +2691,13 @@ discard block |
||
2691 | 2691 | } |
2692 | 2692 | } |
2693 | 2693 | |
2694 | - if(count($_base) > 0) |
|
2694 | + if (count($_base) > 0) |
|
2695 | 2695 | { |
2696 | 2696 | array_unshift($_path, join('/', $_base)); |
2697 | 2697 | } |
2698 | 2698 | |
2699 | - $path = '/' . join('/', $_path); |
|
2700 | - if(substr_compare($path, '/', -1) !== 0) |
|
2699 | + $path = '/'.join('/', $_path); |
|
2700 | + if (substr_compare($path, '/', -1) !== 0) |
|
2701 | 2701 | { |
2702 | 2702 | $path .= '/'; |
2703 | 2703 | } |
@@ -2712,13 +2712,13 @@ discard block |
||
2712 | 2712 | { |
2713 | 2713 | $self = self::getInstance(); |
2714 | 2714 | |
2715 | - if(!is_array($self->meta_tags)) |
|
2715 | + if (!is_array($self->meta_tags)) |
|
2716 | 2716 | { |
2717 | 2717 | $self->meta_tags = array(); |
2718 | 2718 | } |
2719 | 2719 | |
2720 | 2720 | $ret = array(); |
2721 | - foreach($self->meta_tags as $key => $val) |
|
2721 | + foreach ($self->meta_tags as $key => $val) |
|
2722 | 2722 | { |
2723 | 2723 | list($name, $is_http_equiv) = explode("\t", $key); |
2724 | 2724 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2738,7 +2738,7 @@ discard block |
||
2738 | 2738 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
2739 | 2739 | { |
2740 | 2740 | $self = self::getInstance(); |
2741 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
2741 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
2742 | 2742 | } |
2743 | 2743 | |
2744 | 2744 | } |
@@ -230,7 +230,9 @@ discard block |
||
230 | 230 | $this->loadDBInfo(); |
231 | 231 | if($this->db_info->use_sitelock == 'Y') |
232 | 232 | { |
233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
233 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
235 | + } |
|
234 | 236 | |
235 | 237 | if(!IpFilter::filter($whitelist)) |
236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
246 | 248 | { |
247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
248 | - } |
|
249 | - else |
|
250 | + } else |
|
250 | 251 | { |
251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
303 | 304 | { |
304 | 305 | saveCookie('lang_type', $this->lang_type, false, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
305 | 306 | } |
306 | - } |
|
307 | - elseif($_COOKIE['lang_type']) |
|
307 | + } elseif($_COOKIE['lang_type']) |
|
308 | 308 | { |
309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
310 | 310 | } |
@@ -341,7 +341,9 @@ discard block |
||
341 | 341 | ); |
342 | 342 | } |
343 | 343 | |
344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
344 | + if($sess = $_POST[session_name()]) { |
|
345 | + session_id($sess); |
|
346 | + } |
|
345 | 347 | if($this->db_info->disable_cookie_secure !== 'Y') |
346 | 348 | { |
347 | 349 | ini_set('session.cookie_httponly', true); |
@@ -407,22 +409,21 @@ discard block |
||
407 | 409 | { |
408 | 410 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
409 | 411 | } |
410 | - } |
|
411 | - elseif($val) |
|
412 | + } elseif($val) |
|
412 | 413 | { |
413 | 414 | $url[] = $key . '=' . urlencode($val); |
414 | 415 | } |
415 | 416 | } |
416 | 417 | |
417 | 418 | $current_url = self::getRequestUri(); |
418 | - if($url) $current_url .= '?' . join('&', $url); |
|
419 | - } |
|
420 | - else |
|
419 | + if($url) { |
|
420 | + $current_url .= '?' . join('&', $url); |
|
421 | + } |
|
422 | + } else |
|
421 | 423 | { |
422 | 424 | $current_url = $this->getUrl(); |
423 | 425 | } |
424 | - } |
|
425 | - else |
|
426 | + } else |
|
426 | 427 | { |
427 | 428 | $current_url = self::getRequestUri(); |
428 | 429 | } |
@@ -505,18 +506,22 @@ discard block |
||
505 | 506 | $db_info->use_prepared_statements = 'Y'; |
506 | 507 | } |
507 | 508 | |
508 | - if(!$db_info->time_zone) |
|
509 | - $db_info->time_zone = date('O'); |
|
509 | + if(!$db_info->time_zone) { |
|
510 | + $db_info->time_zone = date('O'); |
|
511 | + } |
|
510 | 512 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
511 | 513 | |
512 | - if($db_info->qmail_compatibility != 'Y') |
|
513 | - $db_info->qmail_compatibility = 'N'; |
|
514 | + if($db_info->qmail_compatibility != 'Y') { |
|
515 | + $db_info->qmail_compatibility = 'N'; |
|
516 | + } |
|
514 | 517 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
515 | 518 | |
516 | - if(!$db_info->use_db_session) |
|
517 | - $db_info->use_db_session = 'N'; |
|
518 | - if(!$db_info->use_ssl) |
|
519 | - $db_info->use_ssl = 'none'; |
|
519 | + if(!$db_info->use_db_session) { |
|
520 | + $db_info->use_db_session = 'N'; |
|
521 | + } |
|
522 | + if(!$db_info->use_ssl) { |
|
523 | + $db_info->use_ssl = 'none'; |
|
524 | + } |
|
520 | 525 | $this->set('_use_ssl', $db_info->use_ssl); |
521 | 526 | |
522 | 527 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -643,8 +648,7 @@ discard block |
||
643 | 648 | $buff = FileHandler::readFile($orig_lang_file); |
644 | 649 | FileHandler::writeFile($selected_lang_file, $buff); |
645 | 650 | $lang_selected = self::loadLangSupported(); |
646 | - } |
|
647 | - else |
|
651 | + } else |
|
648 | 652 | { |
649 | 653 | $langs = file($selected_lang_file); |
650 | 654 | foreach($langs as $val) |
@@ -703,15 +707,16 @@ discard block |
||
703 | 707 | |
704 | 708 | $oModuleModel = getModel('module'); |
705 | 709 | $domain = $url_info['host'] . $url_info['path']; |
706 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
710 | + if(substr_compare($domain, '/', -1) === 0) { |
|
711 | + $domain = substr($domain, 0, -1); |
|
712 | + } |
|
707 | 713 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
708 | 714 | |
709 | 715 | if($site_info->site_srl) |
710 | 716 | { |
711 | 717 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
712 | 718 | $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
713 | - } |
|
714 | - else |
|
719 | + } else |
|
715 | 720 | { |
716 | 721 | $redirect_url = $url; |
717 | 722 | } |
@@ -720,8 +725,7 @@ discard block |
||
720 | 725 | return FALSE; |
721 | 726 | } |
722 | 727 | // for sites requesting SSO validation |
723 | - } |
|
724 | - else |
|
728 | + } else |
|
725 | 729 | { |
726 | 730 | // result handling : set session_name() |
727 | 731 | if($session_name = self::get('SSOID')) |
@@ -738,8 +742,7 @@ discard block |
||
738 | 742 | header('location:' . $url); |
739 | 743 | return FALSE; |
740 | 744 | // send SSO request |
741 | - } |
|
742 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
745 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
743 | 746 | { |
744 | 747 | saveCookie('sso', md5(self::getRequestUri()), true); |
745 | 748 | $origin_url = self::getRequestUrl(); |
@@ -799,8 +802,7 @@ discard block |
||
799 | 802 | if($self->site_title) |
800 | 803 | { |
801 | 804 | $self->site_title .= ' - ' . $site_title; |
802 | - } |
|
803 | - else |
|
805 | + } else |
|
804 | 806 | { |
805 | 807 | $self->site_title = $site_title; |
806 | 808 | } |
@@ -900,8 +902,7 @@ discard block |
||
900 | 902 | { |
901 | 903 | $self->loaded_lang_files[] = $filename; |
902 | 904 | include($filename); |
903 | - } |
|
904 | - else |
|
905 | + } else |
|
905 | 906 | { |
906 | 907 | $self->_evalxmlLang($path); |
907 | 908 | } |
@@ -917,7 +918,9 @@ discard block |
||
917 | 918 | { |
918 | 919 | global $lang; |
919 | 920 | |
920 | - if(!$path) return; |
|
921 | + if(!$path) { |
|
922 | + return; |
|
923 | + } |
|
921 | 924 | |
922 | 925 | $_path = 'eval://' . $path; |
923 | 926 | |
@@ -949,7 +952,9 @@ discard block |
||
949 | 952 | */ |
950 | 953 | function _loadXmlLang($path) |
951 | 954 | { |
952 | - if(!$path) return; |
|
955 | + if(!$path) { |
|
956 | + return; |
|
957 | + } |
|
953 | 958 | |
954 | 959 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
955 | 960 | return $oXmlLangParser->compile(); |
@@ -963,7 +968,9 @@ discard block |
||
963 | 968 | */ |
964 | 969 | function _loadPhpLang($path) |
965 | 970 | { |
966 | - if(!$path) return; |
|
971 | + if(!$path) { |
|
972 | + return; |
|
973 | + } |
|
967 | 974 | |
968 | 975 | if(substr_compare($path, '/', -1) !== 0) |
969 | 976 | { |
@@ -1096,12 +1103,14 @@ discard block |
||
1096 | 1103 | static $flag = TRUE; |
1097 | 1104 | if($charset) |
1098 | 1105 | { |
1099 | - if(is_array($val)) |
|
1100 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
1101 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
1102 | - else $flag = FALSE; |
|
1103 | - } |
|
1104 | - else |
|
1106 | + if(is_array($val)) { |
|
1107 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
1108 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
1109 | + $flag = FALSE; |
|
1110 | + } else { |
|
1111 | + $flag = FALSE; |
|
1112 | + } |
|
1113 | + } else |
|
1105 | 1114 | { |
1106 | 1115 | $return = $flag; |
1107 | 1116 | $flag = TRUE; |
@@ -1123,8 +1132,9 @@ discard block |
||
1123 | 1132 | if (is_array($val)) |
1124 | 1133 | { |
1125 | 1134 | array_walk($val,'Context::doConvertEncoding',$charset); |
1135 | + } else { |
|
1136 | + $val = iconv($charset,'UTF-8',$val); |
|
1126 | 1137 | } |
1127 | - else $val = iconv($charset,'UTF-8',$val); |
|
1128 | 1138 | } |
1129 | 1139 | |
1130 | 1140 | /** |
@@ -1135,7 +1145,9 @@ discard block |
||
1135 | 1145 | */ |
1136 | 1146 | function convertEncodingStr($str) |
1137 | 1147 | { |
1138 | - if(!$str) return null; |
|
1148 | + if(!$str) { |
|
1149 | + return null; |
|
1150 | + } |
|
1139 | 1151 | $obj = new stdClass(); |
1140 | 1152 | $obj->str = $str; |
1141 | 1153 | $obj = self::convertEncoding($obj); |
@@ -1248,16 +1260,13 @@ discard block |
||
1248 | 1260 | if($requestMethod == 'GET' && isset($_GET[$key])) |
1249 | 1261 | { |
1250 | 1262 | $set_to_vars = TRUE; |
1251 | - } |
|
1252 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
1263 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
1253 | 1264 | { |
1254 | 1265 | $set_to_vars = TRUE; |
1255 | - } |
|
1256 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1266 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1257 | 1267 | { |
1258 | 1268 | $set_to_vars = TRUE; |
1259 | - } |
|
1260 | - else |
|
1269 | + } else |
|
1261 | 1270 | { |
1262 | 1271 | $set_to_vars = FALSE; |
1263 | 1272 | } |
@@ -1283,8 +1292,7 @@ discard block |
||
1283 | 1292 | return; |
1284 | 1293 | } |
1285 | 1294 | } |
1286 | - } |
|
1287 | - else if(is_array($val)) |
|
1295 | + } else if(is_array($val)) |
|
1288 | 1296 | { |
1289 | 1297 | foreach($val as $val2) |
1290 | 1298 | { |
@@ -1424,24 +1432,19 @@ discard block |
||
1424 | 1432 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
1425 | 1433 | { |
1426 | 1434 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
1427 | - } |
|
1428 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
1435 | + } elseif($key === 'mid' || $key === 'search_keyword') |
|
1429 | 1436 | { |
1430 | 1437 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1431 | - } |
|
1432 | - elseif($key === 'vid') |
|
1438 | + } elseif($key === 'vid') |
|
1433 | 1439 | { |
1434 | 1440 | $result[$k] = urlencode($v); |
1435 | - } |
|
1436 | - elseif($key === 'xe_validator_id') |
|
1441 | + } elseif($key === 'xe_validator_id') |
|
1437 | 1442 | { |
1438 | 1443 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1439 | - } |
|
1440 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1444 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1441 | 1445 | { |
1442 | 1446 | unset($result[$k]); |
1443 | - } |
|
1444 | - else |
|
1447 | + } else |
|
1445 | 1448 | { |
1446 | 1449 | $result[$k] = $v; |
1447 | 1450 | |
@@ -1450,8 +1453,7 @@ discard block |
||
1450 | 1453 | if (is_array($result[$k])) |
1451 | 1454 | { |
1452 | 1455 | array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); |
1453 | - } |
|
1454 | - else |
|
1456 | + } else |
|
1455 | 1457 | { |
1456 | 1458 | $result[$k] = stripslashes($result[$k]); |
1457 | 1459 | } |
@@ -1460,8 +1462,7 @@ discard block |
||
1460 | 1462 | if(is_array($result[$k])) |
1461 | 1463 | { |
1462 | 1464 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
1463 | - } |
|
1464 | - else |
|
1465 | + } else |
|
1465 | 1466 | { |
1466 | 1467 | $result[$k] = trim($result[$k]); |
1467 | 1468 | } |
@@ -1506,8 +1507,7 @@ discard block |
||
1506 | 1507 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1507 | 1508 | $this->set($key, $val, TRUE); |
1508 | 1509 | $this->is_uploaded = TRUE; |
1509 | - } |
|
1510 | - else |
|
1510 | + } else |
|
1511 | 1511 | { |
1512 | 1512 | $files = array(); |
1513 | 1513 | $count_files = count($tmp_name); |
@@ -1525,7 +1525,9 @@ discard block |
||
1525 | 1525 | $files[] = $file; |
1526 | 1526 | } |
1527 | 1527 | } |
1528 | - if($files) $this->set($key, $files, TRUE); |
|
1528 | + if($files) { |
|
1529 | + $this->set($key, $files, TRUE); |
|
1530 | + } |
|
1529 | 1531 | } |
1530 | 1532 | } |
1531 | 1533 | } |
@@ -1617,8 +1619,7 @@ discard block |
||
1617 | 1619 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
1618 | 1620 | { |
1619 | 1621 | $vid = $site_module_info->domain; |
1620 | - } |
|
1621 | - else |
|
1622 | + } else |
|
1622 | 1623 | { |
1623 | 1624 | $domain = $site_module_info->domain; |
1624 | 1625 | } |
@@ -1635,8 +1636,7 @@ discard block |
||
1635 | 1636 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
1636 | 1637 | { |
1637 | 1638 | unset($domain); |
1638 | - } |
|
1639 | - else |
|
1639 | + } else |
|
1640 | 1640 | { |
1641 | 1641 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
1642 | 1642 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1656,23 +1656,35 @@ discard block |
||
1656 | 1656 | { |
1657 | 1657 | array_shift($args_list); |
1658 | 1658 | } |
1659 | - } |
|
1660 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1659 | + } elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1661 | 1660 | { |
1662 | 1661 | // Otherwise, make GET variables into array |
1663 | 1662 | $get_vars = get_object_vars($self->get_vars); |
1664 | - } |
|
1665 | - else |
|
1663 | + } else |
|
1666 | 1664 | { |
1667 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
1668 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
1669 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
1670 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
1671 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
1672 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1665 | + if(!!$self->get_vars->module) { |
|
1666 | + $get_vars['module'] = $self->get_vars->module; |
|
1667 | + } |
|
1668 | + if(!!$self->get_vars->mid) { |
|
1669 | + $get_vars['mid'] = $self->get_vars->mid; |
|
1670 | + } |
|
1671 | + if(!!$self->get_vars->act) { |
|
1672 | + $get_vars['act'] = $self->get_vars->act; |
|
1673 | + } |
|
1674 | + if(!!$self->get_vars->page) { |
|
1675 | + $get_vars['page'] = $self->get_vars->page; |
|
1676 | + } |
|
1677 | + if(!!$self->get_vars->search_target) { |
|
1678 | + $get_vars['search_target'] = $self->get_vars->search_target; |
|
1679 | + } |
|
1680 | + if(!!$self->get_vars->search_keyword) { |
|
1681 | + $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1682 | + } |
|
1673 | 1683 | if($get_vars['act'] == 'IS') |
1674 | 1684 | { |
1675 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1685 | + if(!!$self->get_vars->is_keyword) { |
|
1686 | + $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1687 | + } |
|
1676 | 1688 | } |
1677 | 1689 | } |
1678 | 1690 | |
@@ -1697,8 +1709,7 @@ discard block |
||
1697 | 1709 | if($vid) |
1698 | 1710 | { |
1699 | 1711 | $get_vars['vid'] = $vid; |
1700 | - } |
|
1701 | - else |
|
1712 | + } else |
|
1702 | 1713 | { |
1703 | 1714 | unset($get_vars['vid']); |
1704 | 1715 | } |
@@ -1770,8 +1781,7 @@ discard block |
||
1770 | 1781 | { |
1771 | 1782 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
1772 | 1783 | } |
1773 | - } |
|
1774 | - elseif(!is_array($val)) |
|
1784 | + } elseif(!is_array($val)) |
|
1775 | 1785 | { |
1776 | 1786 | $queries[] = $key . '=' . urlencode($val); |
1777 | 1787 | } |
@@ -1789,25 +1799,23 @@ discard block |
||
1789 | 1799 | { |
1790 | 1800 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
1791 | 1801 | // optional SSL use |
1792 | - } |
|
1793 | - elseif($_use_ssl == 'optional') |
|
1802 | + } elseif($_use_ssl == 'optional') |
|
1794 | 1803 | { |
1795 | 1804 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
1796 | 1805 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
1797 | 1806 | // no SSL |
1798 | - } |
|
1799 | - else |
|
1807 | + } else |
|
1800 | 1808 | { |
1801 | 1809 | // currently on SSL but target is not based on SSL |
1802 | 1810 | if($_SERVER['HTTPS'] == 'on') |
1803 | 1811 | { |
1804 | 1812 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
1805 | - } |
|
1806 | - else if($domain) // if $domain is set |
|
1813 | + } else if($domain) { |
|
1814 | + // if $domain is set |
|
1807 | 1815 | { |
1808 | 1816 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
1809 | 1817 | } |
1810 | - else |
|
1818 | + } else |
|
1811 | 1819 | { |
1812 | 1820 | $query = getScriptPath() . $query; |
1813 | 1821 | } |
@@ -1864,8 +1872,7 @@ discard block |
||
1864 | 1872 | if($domain) |
1865 | 1873 | { |
1866 | 1874 | $domain_key = md5($domain); |
1867 | - } |
|
1868 | - else |
|
1875 | + } else |
|
1869 | 1876 | { |
1870 | 1877 | $domain_key = 'default'; |
1871 | 1878 | } |
@@ -1894,8 +1901,7 @@ discard block |
||
1894 | 1901 | { |
1895 | 1902 | $target_url.= '/'; |
1896 | 1903 | } |
1897 | - } |
|
1898 | - else |
|
1904 | + } else |
|
1899 | 1905 | { |
1900 | 1906 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
1901 | 1907 | } |
@@ -1913,20 +1919,17 @@ discard block |
||
1913 | 1919 | if($port && $port != 443) |
1914 | 1920 | { |
1915 | 1921 | $url_info['port'] = $port; |
1916 | - } |
|
1917 | - elseif($url_info['port'] == 443) |
|
1922 | + } elseif($url_info['port'] == 443) |
|
1918 | 1923 | { |
1919 | 1924 | unset($url_info['port']); |
1920 | 1925 | } |
1921 | - } |
|
1922 | - else |
|
1926 | + } else |
|
1923 | 1927 | { |
1924 | 1928 | $port = self::get('_http_port'); |
1925 | 1929 | if($port && $port != 80) |
1926 | 1930 | { |
1927 | 1931 | $url_info['port'] = $port; |
1928 | - } |
|
1929 | - elseif($url_info['port'] == 80) |
|
1932 | + } elseif($url_info['port'] == 80) |
|
1930 | 1933 | { |
1931 | 1934 | unset($url_info['port']); |
1932 | 1935 | } |
@@ -2163,8 +2166,7 @@ discard block |
||
2163 | 2166 | if(strpos($file, './') === 0) |
2164 | 2167 | { |
2165 | 2168 | $file = $script_path . substr($file, 2); |
2166 | - } |
|
2167 | - elseif(strpos($file, '../') === 0) |
|
2169 | + } elseif(strpos($file, '../') === 0) |
|
2168 | 2170 | { |
2169 | 2171 | $file = self::normalizeFilePath($script_path . $file); |
2170 | 2172 | } |
@@ -2426,8 +2428,7 @@ discard block |
||
2426 | 2428 | if(substr_compare($filename, '.js', -3) === 0) |
2427 | 2429 | { |
2428 | 2430 | $result->jsList[] = $plugin_path . $filename; |
2429 | - } |
|
2430 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
2431 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
2431 | 2432 | { |
2432 | 2433 | $result->cssList[] = $plugin_path . $filename; |
2433 | 2434 | } |
@@ -2684,8 +2685,7 @@ discard block |
||
2684 | 2685 | if(count($_base) > 0) |
2685 | 2686 | { |
2686 | 2687 | array_shift($_base); |
2687 | - } |
|
2688 | - else |
|
2688 | + } else |
|
2689 | 2689 | { |
2690 | 2690 | array_unshift($_base, '..'); |
2691 | 2691 | } |
@@ -470,7 +470,7 @@ |
||
470 | 470 | * set query debug log |
471 | 471 | * @param array $log values set query debug |
472 | 472 | * @return void |
473 | - */ |
|
473 | + */ |
|
474 | 474 | function setQueryLog($log) |
475 | 475 | { |
476 | 476 | $GLOBALS['__db_queries__'][] = $log; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | /** |
492 | 492 | * Returns object of error info |
493 | - * @return object object of error |
|
493 | + * @return BaseObject object of error |
|
494 | 494 | */ |
495 | 495 | function getError() |
496 | 496 | { |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * Returns counter cache data |
668 | 668 | * @param array|string $tables tables to get data |
669 | 669 | * @param string $condition condition to get data |
670 | - * @return int count of cache data |
|
670 | + * @return boolean count of cache data |
|
671 | 671 | */ |
672 | 672 | function getCountCache($tables, $condition) |
673 | 673 | { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @param array|string $tables tables to save data |
728 | 728 | * @param string $condition condition to save data |
729 | 729 | * @param int $count count of cache data to save |
730 | - * @return void |
|
730 | + * @return boolean |
|
731 | 731 | */ |
732 | 732 | function putCountCache($tables, $condition, $count = 0) |
733 | 733 | { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | |
810 | 810 | /** |
811 | 811 | * Return select query string |
812 | - * @param object $query |
|
812 | + * @param BaseObject $query |
|
813 | 813 | * @param boolean $with_values |
814 | 814 | * @return string |
815 | 815 | */ |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | |
904 | 904 | /** |
905 | 905 | * Return delete query string |
906 | - * @param object $query |
|
906 | + * @param BaseObject $query |
|
907 | 907 | * @param boolean $with_values |
908 | 908 | * @param boolean $with_priority |
909 | 909 | * @return string |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | |
936 | 936 | /** |
937 | 937 | * Return update query string |
938 | - * @param object $query |
|
938 | + * @param BaseObject $query |
|
939 | 939 | * @param boolean $with_values |
940 | 940 | * @param boolean $with_priority |
941 | 941 | * @return string |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | |
968 | 968 | /** |
969 | 969 | * Return insert query string |
970 | - * @param object $query |
|
970 | + * @param BaseObject $query |
|
971 | 971 | * @param boolean $with_values |
972 | 972 | * @param boolean $with_priority |
973 | 973 | * @return string |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * DB Connect |
1239 | 1239 | * this method is protected |
1240 | 1240 | * @param array $connection |
1241 | - * @return void |
|
1241 | + * @return resource |
|
1242 | 1242 | */ |
1243 | 1243 | function __connect($connection) |
1244 | 1244 | { |
@@ -141,24 +141,24 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function getInstance($db_type = NULL) |
143 | 143 | { |
144 | - if(!$db_type) |
|
144 | + if (!$db_type) |
|
145 | 145 | { |
146 | 146 | $db_type = Context::getDBType(); |
147 | 147 | } |
148 | - if(!$db_type && Context::isInstalled()) |
|
148 | + if (!$db_type && Context::isInstalled()) |
|
149 | 149 | { |
150 | 150 | return new BaseObject(-1, 'msg_db_not_setted'); |
151 | 151 | } |
152 | 152 | |
153 | - if(!isset($GLOBALS['__DB__'])) |
|
153 | + if (!isset($GLOBALS['__DB__'])) |
|
154 | 154 | { |
155 | 155 | $GLOBALS['__DB__'] = array(); |
156 | 156 | } |
157 | - if(!isset($GLOBALS['__DB__'][$db_type])) |
|
157 | + if (!isset($GLOBALS['__DB__'][$db_type])) |
|
158 | 158 | { |
159 | - $class_name = 'DB' . ucfirst($db_type); |
|
160 | - $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; |
|
161 | - if(!file_exists($class_file)) |
|
159 | + $class_name = 'DB'.ucfirst($db_type); |
|
160 | + $class_file = _XE_PATH_."classes/db/$class_name.class.php"; |
|
161 | + if (!file_exists($class_file)) |
|
162 | 162 | { |
163 | 163 | return new BaseObject(-1, 'msg_db_not_setted'); |
164 | 164 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function DB() |
189 | 189 | { |
190 | - $this->count_cache_path = _XE_PATH_ . $this->count_cache_path; |
|
191 | - $this->cache_file = _XE_PATH_ . $this->cache_file; |
|
190 | + $this->count_cache_path = _XE_PATH_.$this->count_cache_path; |
|
191 | + $this->cache_file = _XE_PATH_.$this->cache_file; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public static function getEnableList() |
212 | 212 | { |
213 | - if(!self::$supported_list) |
|
213 | + if (!self::$supported_list) |
|
214 | 214 | { |
215 | 215 | $oDB = new DB(); |
216 | 216 | self::$supported_list = $oDB->_getSupportedList(); |
217 | 217 | } |
218 | 218 | |
219 | 219 | $enableList = array(); |
220 | - if(is_array(self::$supported_list)) |
|
220 | + if (is_array(self::$supported_list)) |
|
221 | 221 | { |
222 | - foreach(self::$supported_list AS $key => $value) |
|
222 | + foreach (self::$supported_list AS $key => $value) |
|
223 | 223 | { |
224 | - if($value->enable) |
|
224 | + if ($value->enable) |
|
225 | 225 | { |
226 | 226 | $enableList[] = $value; |
227 | 227 | } |
@@ -237,18 +237,18 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public static function getDisableList() |
239 | 239 | { |
240 | - if(!self::$supported_list) |
|
240 | + if (!self::$supported_list) |
|
241 | 241 | { |
242 | 242 | $oDB = new DB(); |
243 | 243 | self::$supported_list = $oDB->_getSupportedList(); |
244 | 244 | } |
245 | 245 | |
246 | 246 | $disableList = array(); |
247 | - if(is_array(self::$supported_list)) |
|
247 | + if (is_array(self::$supported_list)) |
|
248 | 248 | { |
249 | - foreach(self::$supported_list AS $key => $value) |
|
249 | + foreach (self::$supported_list AS $key => $value) |
|
250 | 250 | { |
251 | - if(!$value->enable) |
|
251 | + if (!$value->enable) |
|
252 | 252 | { |
253 | 253 | $disableList[] = $value; |
254 | 254 | } |
@@ -265,24 +265,24 @@ discard block |
||
265 | 265 | function _getSupportedList() |
266 | 266 | { |
267 | 267 | static $get_supported_list = ''; |
268 | - if(is_array($get_supported_list)) |
|
268 | + if (is_array($get_supported_list)) |
|
269 | 269 | { |
270 | 270 | self::$supported_list = $get_supported_list; |
271 | 271 | return self::$supported_list; |
272 | 272 | } |
273 | 273 | $get_supported_list = array(); |
274 | - $db_classes_path = _XE_PATH_ . "classes/db/"; |
|
274 | + $db_classes_path = _XE_PATH_."classes/db/"; |
|
275 | 275 | $filter = "/^DB([^\.]+)\.class\.php/i"; |
276 | 276 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); |
277 | 277 | |
278 | 278 | // after creating instance of class, check is supported |
279 | - for($i = 0; $i < count($supported_list); $i++) |
|
279 | + for ($i = 0; $i < count($supported_list); $i++) |
|
280 | 280 | { |
281 | 281 | $db_type = $supported_list[$i]; |
282 | 282 | |
283 | 283 | $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); |
284 | - $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); |
|
285 | - if(!file_exists($class_file)) |
|
284 | + $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name); |
|
285 | + if (!file_exists($class_file)) |
|
286 | 286 | { |
287 | 287 | continue; |
288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | require_once($class_file); |
292 | 292 | $oDB = new $class_name(FALSE); |
293 | 293 | |
294 | - if(!$oDB) |
|
294 | + if (!$oDB) |
|
295 | 295 | { |
296 | 296 | continue; |
297 | 297 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function _sortDBMS($a, $b) |
317 | 317 | { |
318 | - if(!isset($this->priority_dbms[$a->db_type])) |
|
318 | + if (!isset($this->priority_dbms[$a->db_type])) |
|
319 | 319 | { |
320 | 320 | $priority_a = 0; |
321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $priority_a = $this->priority_dbms[$a->db_type]; |
325 | 325 | } |
326 | 326 | |
327 | - if(!isset($this->priority_dbms[$b->db_type])) |
|
327 | + if (!isset($this->priority_dbms[$b->db_type])) |
|
328 | 328 | { |
329 | 329 | $priority_b = 0; |
330 | 330 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $priority_b = $this->priority_dbms[$b->db_type]; |
334 | 334 | } |
335 | 335 | |
336 | - if($priority_a == $priority_b) |
|
336 | + if ($priority_a == $priority_b) |
|
337 | 337 | { |
338 | 338 | return 0; |
339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | */ |
360 | 360 | function isConnected($type = 'master', $indx = 0) |
361 | 361 | { |
362 | - if($type == 'master') |
|
362 | + if ($type == 'master') |
|
363 | 363 | { |
364 | 364 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
365 | 365 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | function actFinish() |
390 | 390 | { |
391 | - if(!$this->query) |
|
391 | + if (!$this->query) |
|
392 | 392 | { |
393 | 393 | return; |
394 | 394 | } |
@@ -409,14 +409,14 @@ discard block |
||
409 | 409 | |
410 | 410 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); |
411 | 411 | |
412 | - foreach($bt as $no => $call) |
|
412 | + foreach ($bt as $no => $call) |
|
413 | 413 | { |
414 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
414 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
415 | 415 | { |
416 | 416 | $call_no = $no; |
417 | 417 | $call_no++; |
418 | 418 | $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; |
419 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); |
|
419 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); |
|
420 | 420 | $call_no++; |
421 | 421 | $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; |
422 | 422 | break; |
@@ -424,22 +424,22 @@ discard block |
||
424 | 424 | } |
425 | 425 | |
426 | 426 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) |
427 | - if($this->isError()) |
|
427 | + if ($this->isError()) |
|
428 | 428 | { |
429 | 429 | $log['result'] = 'Failed'; |
430 | 430 | $log['errno'] = $this->errno; |
431 | 431 | $log['errstr'] = $this->errstr; |
432 | 432 | |
433 | - if(__DEBUG_DB_OUTPUT__ == 1) |
|
433 | + if (__DEBUG_DB_OUTPUT__ == 1) |
|
434 | 434 | { |
435 | - $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; |
|
435 | + $debug_file = _XE_PATH_."files/_debug_db_query.php"; |
|
436 | 436 | $buff = array(); |
437 | - if(!file_exists($debug_file)) |
|
437 | + if (!file_exists($debug_file)) |
|
438 | 438 | { |
439 | - $buff[] = '<?php exit(); ?' . '>'; |
|
439 | + $buff[] = '<?php exit(); ?'.'>'; |
|
440 | 440 | } |
441 | 441 | $buff[] = print_r($log, TRUE); |
442 | - @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
|
442 | + @file_put_contents($log_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | else |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $log_args = new stdClass; |
453 | 453 | $log_args->query = $this->query; |
454 | 454 | $log_args->query_id = $this->query_id; |
455 | - $log_args->caller = $log['called_method'] . '() in ' . $log['called_file']; |
|
455 | + $log_args->caller = $log['called_method'].'() in '.$log['called_file']; |
|
456 | 456 | $log_args->connection = $log['connection']; |
457 | 457 | writeSlowlog('query', $elapsed_time, $log_args); |
458 | 458 | } |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | { |
511 | 511 | static $cache_file = array(); |
512 | 512 | |
513 | - if(!$query_id) |
|
513 | + if (!$query_id) |
|
514 | 514 | { |
515 | 515 | return new BaseObject(-1, 'msg_invalid_queryid'); |
516 | 516 | } |
517 | - if(!$this->db_type) |
|
517 | + if (!$this->db_type) |
|
518 | 518 | { |
519 | 519 | return; |
520 | 520 | } |
@@ -523,20 +523,20 @@ discard block |
||
523 | 523 | |
524 | 524 | $this->query_id = $query_id; |
525 | 525 | |
526 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
526 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
527 | 527 | { |
528 | 528 | $id_args = explode('.', $query_id); |
529 | - if(count($id_args) == 2) |
|
529 | + if (count($id_args) == 2) |
|
530 | 530 | { |
531 | 531 | $target = 'modules'; |
532 | 532 | $module = $id_args[0]; |
533 | 533 | $id = $id_args[1]; |
534 | 534 | } |
535 | - elseif(count($id_args) == 3) |
|
535 | + elseif (count($id_args) == 3) |
|
536 | 536 | { |
537 | 537 | $target = $id_args[0]; |
538 | 538 | $typeList = array('addons' => 1, 'widgets' => 1); |
539 | - if(!isset($typeList[$target])) |
|
539 | + if (!isset($typeList[$target])) |
|
540 | 540 | { |
541 | 541 | $this->actDBClassFinish(); |
542 | 542 | return; |
@@ -544,14 +544,14 @@ discard block |
||
544 | 544 | $module = $id_args[1]; |
545 | 545 | $id = $id_args[2]; |
546 | 546 | } |
547 | - if(!$target || !$module || !$id) |
|
547 | + if (!$target || !$module || !$id) |
|
548 | 548 | { |
549 | 549 | $this->actDBClassFinish(); |
550 | 550 | return new BaseObject(-1, 'msg_invalid_queryid'); |
551 | 551 | } |
552 | 552 | |
553 | 553 | $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); |
554 | - if(!file_exists($xml_file)) |
|
554 | + if (!file_exists($xml_file)) |
|
555 | 555 | { |
556 | 556 | $this->actDBClassFinish(); |
557 | 557 | return new BaseObject(-1, 'msg_invalid_queryid'); |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); |
580 | 580 | |
581 | 581 | $cache_time = -1; |
582 | - if(file_exists($cache_file)) |
|
582 | + if (file_exists($cache_file)) |
|
583 | 583 | { |
584 | 584 | $cache_time = filemtime($cache_file); |
585 | 585 | } |
586 | 586 | |
587 | 587 | // if there is no cache file or is not new, find original xml query file and parse it |
588 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
588 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php')) |
|
589 | 589 | { |
590 | 590 | $oParser = new XmlQueryParser(); |
591 | 591 | $oParser->parse($query_id, $xml_file, $cache_file); |
@@ -606,27 +606,27 @@ discard block |
||
606 | 606 | { |
607 | 607 | global $lang; |
608 | 608 | |
609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
609 | + if (!in_array($type, array('master', 'slave'))) $type = 'slave'; |
|
610 | 610 | |
611 | - if(!file_exists($cache_file)) |
|
611 | + if (!file_exists($cache_file)) |
|
612 | 612 | { |
613 | 613 | return new BaseObject(-1, 'msg_invalid_queryid'); |
614 | 614 | } |
615 | 615 | |
616 | - if($source_args) |
|
616 | + if ($source_args) |
|
617 | 617 | { |
618 | 618 | $args = clone $source_args; |
619 | 619 | } |
620 | 620 | |
621 | 621 | $output = include($cache_file); |
622 | 622 | |
623 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
623 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
624 | 624 | { |
625 | 625 | return $output; |
626 | 626 | } |
627 | 627 | |
628 | 628 | // execute appropriate query |
629 | - switch($output->getAction()) |
|
629 | + switch ($output->getAction()) |
|
630 | 630 | { |
631 | 631 | case 'insert' : |
632 | 632 | case 'insert-select' : |
@@ -649,11 +649,11 @@ discard block |
||
649 | 649 | break; |
650 | 650 | } |
651 | 651 | |
652 | - if($this->isError()) |
|
652 | + if ($this->isError()) |
|
653 | 653 | { |
654 | 654 | $output = $this->getError(); |
655 | 655 | } |
656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
656 | + else if (!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
657 | 657 | { |
658 | 658 | $output = new BaseObject(); |
659 | 659 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | */ |
800 | 800 | function dropTable($table_name) |
801 | 801 | { |
802 | - if(!$table_name) |
|
802 | + if (!$table_name) |
|
803 | 803 | { |
804 | 804 | return; |
805 | 805 | } |
@@ -816,59 +816,59 @@ discard block |
||
816 | 816 | function getSelectSql($query, $with_values = TRUE) |
817 | 817 | { |
818 | 818 | $select = $query->getSelectString($with_values); |
819 | - if($select == '') |
|
819 | + if ($select == '') |
|
820 | 820 | { |
821 | 821 | return new BaseObject(-1, "Invalid query"); |
822 | 822 | } |
823 | - $select = 'SELECT ' . $select; |
|
823 | + $select = 'SELECT '.$select; |
|
824 | 824 | |
825 | 825 | $from = $query->getFromString($with_values); |
826 | - if($from == '') |
|
826 | + if ($from == '') |
|
827 | 827 | { |
828 | 828 | return new BaseObject(-1, "Invalid query"); |
829 | 829 | } |
830 | - $from = ' FROM ' . $from; |
|
830 | + $from = ' FROM '.$from; |
|
831 | 831 | |
832 | 832 | $where = $query->getWhereString($with_values); |
833 | - if($where != '') |
|
833 | + if ($where != '') |
|
834 | 834 | { |
835 | - $where = ' WHERE ' . $where; |
|
835 | + $where = ' WHERE '.$where; |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | $tableObjects = $query->getTables(); |
839 | 839 | $index_hint_list = ''; |
840 | - foreach($tableObjects as $tableObject) |
|
840 | + foreach ($tableObjects as $tableObject) |
|
841 | 841 | { |
842 | - if(is_a($tableObject, 'CubridTableWithHint')) |
|
842 | + if (is_a($tableObject, 'CubridTableWithHint')) |
|
843 | 843 | { |
844 | - $index_hint_list .= $tableObject->getIndexHintString() . ', '; |
|
844 | + $index_hint_list .= $tableObject->getIndexHintString().', '; |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | $index_hint_list = substr($index_hint_list, 0, -2); |
848 | - if($index_hint_list != '') |
|
848 | + if ($index_hint_list != '') |
|
849 | 849 | { |
850 | - $index_hint_list = 'USING INDEX ' . $index_hint_list; |
|
850 | + $index_hint_list = 'USING INDEX '.$index_hint_list; |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | $groupBy = $query->getGroupByString(); |
854 | - if($groupBy != '') |
|
854 | + if ($groupBy != '') |
|
855 | 855 | { |
856 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
856 | + $groupBy = ' GROUP BY '.$groupBy; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | $orderBy = $query->getOrderByString(); |
860 | - if($orderBy != '') |
|
860 | + if ($orderBy != '') |
|
861 | 861 | { |
862 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
862 | + $orderBy = ' ORDER BY '.$orderBy; |
|
863 | 863 | } |
864 | 864 | |
865 | 865 | $limit = $query->getLimitString(); |
866 | - if($limit != '') |
|
866 | + if ($limit != '') |
|
867 | 867 | { |
868 | - $limit = ' LIMIT ' . $limit; |
|
868 | + $limit = ' LIMIT '.$limit; |
|
869 | 869 | } |
870 | 870 | |
871 | - return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
871 | + return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | /** |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | { |
887 | 887 | $new_update_columns = array(); |
888 | 888 | $click_count_columns = $queryObject->getClickCountColumns(); |
889 | - foreach($click_count_columns as $click_count_column) |
|
889 | + foreach ($click_count_columns as $click_count_column) |
|
890 | 890 | { |
891 | 891 | $click_count_column_name = $click_count_column->column_name; |
892 | 892 | |
@@ -918,16 +918,16 @@ discard block |
||
918 | 918 | $sql .= $tables[0]->getAlias(); |
919 | 919 | |
920 | 920 | $from = $query->getFromString($with_values); |
921 | - if($from == '') |
|
921 | + if ($from == '') |
|
922 | 922 | { |
923 | 923 | return new BaseObject(-1, "Invalid query"); |
924 | 924 | } |
925 | - $sql .= ' FROM ' . $from; |
|
925 | + $sql .= ' FROM '.$from; |
|
926 | 926 | |
927 | 927 | $where = $query->getWhereString($with_values); |
928 | - if($where != '') |
|
928 | + if ($where != '') |
|
929 | 929 | { |
930 | - $sql .= ' WHERE ' . $where; |
|
930 | + $sql .= ' WHERE '.$where; |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | return $sql; |
@@ -943,26 +943,26 @@ discard block |
||
943 | 943 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) |
944 | 944 | { |
945 | 945 | $columnsList = $query->getUpdateString($with_values); |
946 | - if($columnsList == '') |
|
946 | + if ($columnsList == '') |
|
947 | 947 | { |
948 | 948 | return new BaseObject(-1, "Invalid query"); |
949 | 949 | } |
950 | 950 | |
951 | 951 | $tables = $query->getFromString($with_values); |
952 | - if($tables == '') |
|
952 | + if ($tables == '') |
|
953 | 953 | { |
954 | 954 | return new BaseObject(-1, "Invalid query"); |
955 | 955 | } |
956 | 956 | |
957 | 957 | $where = $query->getWhereString($with_values); |
958 | - if($where != '') |
|
958 | + if ($where != '') |
|
959 | 959 | { |
960 | - $where = ' WHERE ' . $where; |
|
960 | + $where = ' WHERE '.$where; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | $priority = $with_priority ? $query->getPriority() : ''; |
964 | 964 | |
965 | - return "UPDATE $priority $tables SET $columnsList " . $where; |
|
965 | + return "UPDATE $priority $tables SET $columnsList ".$where; |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /** |
@@ -1000,27 +1000,27 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | function _getConnection($type = 'master', $indx = NULL) |
1002 | 1002 | { |
1003 | - if($type == 'master') |
|
1003 | + if ($type == 'master') |
|
1004 | 1004 | { |
1005 | - if(!$this->master_db['is_connected']) |
|
1005 | + if (!$this->master_db['is_connected']) |
|
1006 | 1006 | { |
1007 | 1007 | $this->_connect($type); |
1008 | 1008 | } |
1009 | - $this->connection = 'Master ' . $this->master_db['db_hostname']; |
|
1009 | + $this->connection = 'Master '.$this->master_db['db_hostname']; |
|
1010 | 1010 | return $this->master_db["resource"]; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if($indx === NULL) |
|
1013 | + if ($indx === NULL) |
|
1014 | 1014 | { |
1015 | 1015 | $indx = $this->_getSlaveConnectionStringIndex($type); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - if(!$this->slave_db[$indx]['is_connected']) |
|
1018 | + if (!$this->slave_db[$indx]['is_connected']) |
|
1019 | 1019 | { |
1020 | 1020 | $this->_connect($type, $indx); |
1021 | 1021 | } |
1022 | 1022 | |
1023 | - $this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname']; |
|
1023 | + $this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname']; |
|
1024 | 1024 | return $this->slave_db[$indx]["resource"]; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1030,11 +1030,11 @@ discard block |
||
1030 | 1030 | */ |
1031 | 1031 | function _dbInfoExists() |
1032 | 1032 | { |
1033 | - if(!$this->master_db) |
|
1033 | + if (!$this->master_db) |
|
1034 | 1034 | { |
1035 | 1035 | return FALSE; |
1036 | 1036 | } |
1037 | - if(count($this->slave_db) === 0) |
|
1037 | + if (count($this->slave_db) === 0) |
|
1038 | 1038 | { |
1039 | 1039 | return FALSE; |
1040 | 1040 | } |
@@ -1060,12 +1060,12 @@ discard block |
||
1060 | 1060 | */ |
1061 | 1061 | function close($type = 'master', $indx = 0) |
1062 | 1062 | { |
1063 | - if(!$this->isConnected($type, $indx)) |
|
1063 | + if (!$this->isConnected($type, $indx)) |
|
1064 | 1064 | { |
1065 | 1065 | return; |
1066 | 1066 | } |
1067 | 1067 | |
1068 | - if($type == 'master') |
|
1068 | + if ($type == 'master') |
|
1069 | 1069 | { |
1070 | 1070 | $connection = &$this->master_db; |
1071 | 1071 | } |
@@ -1096,12 +1096,12 @@ discard block |
||
1096 | 1096 | */ |
1097 | 1097 | function begin() |
1098 | 1098 | { |
1099 | - if(!$this->isConnected()) |
|
1099 | + if (!$this->isConnected()) |
|
1100 | 1100 | { |
1101 | 1101 | return; |
1102 | 1102 | } |
1103 | 1103 | |
1104 | - if($this->_begin($this->transactionNestedLevel)) |
|
1104 | + if ($this->_begin($this->transactionNestedLevel)) |
|
1105 | 1105 | { |
1106 | 1106 | $this->transaction_started = TRUE; |
1107 | 1107 | $this->transactionNestedLevel++; |
@@ -1124,15 +1124,15 @@ discard block |
||
1124 | 1124 | */ |
1125 | 1125 | function rollback() |
1126 | 1126 | { |
1127 | - if(!$this->isConnected() || !$this->transaction_started) |
|
1127 | + if (!$this->isConnected() || !$this->transaction_started) |
|
1128 | 1128 | { |
1129 | 1129 | return; |
1130 | 1130 | } |
1131 | - if($this->_rollback($this->transactionNestedLevel)) |
|
1131 | + if ($this->_rollback($this->transactionNestedLevel)) |
|
1132 | 1132 | { |
1133 | 1133 | $this->transactionNestedLevel--; |
1134 | 1134 | |
1135 | - if(!$this->transactionNestedLevel) |
|
1135 | + if (!$this->transactionNestedLevel) |
|
1136 | 1136 | { |
1137 | 1137 | $this->transaction_started = FALSE; |
1138 | 1138 | } |
@@ -1156,11 +1156,11 @@ discard block |
||
1156 | 1156 | */ |
1157 | 1157 | function commit($force = FALSE) |
1158 | 1158 | { |
1159 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
1159 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
1160 | 1160 | { |
1161 | 1161 | return; |
1162 | 1162 | } |
1163 | - if($this->transactionNestedLevel == 1 && $this->_commit()) |
|
1163 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) |
|
1164 | 1164 | { |
1165 | 1165 | $this->transaction_started = FALSE; |
1166 | 1166 | $this->transactionNestedLevel = 0; |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | */ |
1193 | 1193 | function _query($query, $connection = NULL) |
1194 | 1194 | { |
1195 | - if($connection == NULL) |
|
1195 | + if ($connection == NULL) |
|
1196 | 1196 | { |
1197 | 1197 | $connection = $this->_getConnection('master'); |
1198 | 1198 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | { |
1218 | 1218 | $db_info = Context::getDBInfo(); |
1219 | 1219 | $this->master_db = $db_info->master_db; |
1220 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
1220 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
1221 | 1221 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] |
1222 | 1222 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] |
1223 | 1223 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] |
@@ -1265,18 +1265,18 @@ discard block |
||
1265 | 1265 | */ |
1266 | 1266 | function _connect($type = 'master', $indx = 0) |
1267 | 1267 | { |
1268 | - if($this->isConnected($type, $indx)) |
|
1268 | + if ($this->isConnected($type, $indx)) |
|
1269 | 1269 | { |
1270 | 1270 | return; |
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | // Ignore if no DB information exists |
1274 | - if(!$this->_dbInfoExists()) |
|
1274 | + if (!$this->_dbInfoExists()) |
|
1275 | 1275 | { |
1276 | 1276 | return; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - if($type == 'master') |
|
1279 | + if ($type == 'master') |
|
1280 | 1280 | { |
1281 | 1281 | $connection = &$this->master_db; |
1282 | 1282 | } |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | $result = $this->__connect($connection); |
1289 | - if($result === NULL || $result === FALSE) |
|
1289 | + if ($result === NULL || $result === FALSE) |
|
1290 | 1290 | { |
1291 | 1291 | $connection["is_connected"] = FALSE; |
1292 | 1292 | return; |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | $connection["is_connected"] = TRUE; |
1298 | 1298 | |
1299 | 1299 | // Save connection info for db logs |
1300 | - $this->connection = ucfirst($type) . ' ' . $connection["db_hostname"]; |
|
1300 | + $this->connection = ucfirst($type).' '.$connection["db_hostname"]; |
|
1301 | 1301 | |
1302 | 1302 | // regist $this->close callback |
1303 | 1303 | register_shutdown_function(array($this, "close")); |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | */ |
1323 | 1323 | function actDBClassFinish() |
1324 | 1324 | { |
1325 | - if(!$this->query) |
|
1325 | + if (!$this->query) |
|
1326 | 1326 | { |
1327 | 1327 | return; |
1328 | 1328 | } |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | function getParser($force = FALSE) |
1346 | 1346 | { |
1347 | 1347 | static $dbParser = NULL; |
1348 | - if(!$dbParser || $force) |
|
1348 | + if (!$dbParser || $force) |
|
1349 | 1349 | { |
1350 | 1350 | $oDB = DB::getInstance(); |
1351 | 1351 | $dbParser = $oDB->getParser(); |
@@ -318,8 +318,7 @@ discard block |
||
318 | 318 | if(!isset($this->priority_dbms[$a->db_type])) |
319 | 319 | { |
320 | 320 | $priority_a = 0; |
321 | - } |
|
322 | - else |
|
321 | + } else |
|
323 | 322 | { |
324 | 323 | $priority_a = $this->priority_dbms[$a->db_type]; |
325 | 324 | } |
@@ -327,8 +326,7 @@ discard block |
||
327 | 326 | if(!isset($this->priority_dbms[$b->db_type])) |
328 | 327 | { |
329 | 328 | $priority_b = 0; |
330 | - } |
|
331 | - else |
|
329 | + } else |
|
332 | 330 | { |
333 | 331 | $priority_b = $this->priority_dbms[$b->db_type]; |
334 | 332 | } |
@@ -362,8 +360,7 @@ discard block |
||
362 | 360 | if($type == 'master') |
363 | 361 | { |
364 | 362 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
365 | - } |
|
366 | - else |
|
363 | + } else |
|
367 | 364 | { |
368 | 365 | return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE; |
369 | 366 | } |
@@ -441,8 +438,7 @@ discard block |
||
441 | 438 | $buff[] = print_r($log, TRUE); |
442 | 439 | @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
443 | 440 | } |
444 | - } |
|
445 | - else |
|
441 | + } else |
|
446 | 442 | { |
447 | 443 | $log['result'] = 'Success'; |
448 | 444 | } |
@@ -531,8 +527,7 @@ discard block |
||
531 | 527 | $target = 'modules'; |
532 | 528 | $module = $id_args[0]; |
533 | 529 | $id = $id_args[1]; |
534 | - } |
|
535 | - elseif(count($id_args) == 3) |
|
530 | + } elseif(count($id_args) == 3) |
|
536 | 531 | { |
537 | 532 | $target = $id_args[0]; |
538 | 533 | $typeList = array('addons' => 1, 'widgets' => 1); |
@@ -606,7 +601,9 @@ discard block |
||
606 | 601 | { |
607 | 602 | global $lang; |
608 | 603 | |
609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
604 | + if(!in_array($type, array('master','slave'))) { |
|
605 | + $type = 'slave'; |
|
606 | + } |
|
610 | 607 | |
611 | 608 | if(!file_exists($cache_file)) |
612 | 609 | { |
@@ -652,8 +649,7 @@ discard block |
||
652 | 649 | if($this->isError()) |
653 | 650 | { |
654 | 651 | $output = $this->getError(); |
655 | - } |
|
656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
652 | + } else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
657 | 653 | { |
658 | 654 | $output = new BaseObject(); |
659 | 655 | } |
@@ -1068,8 +1064,7 @@ discard block |
||
1068 | 1064 | if($type == 'master') |
1069 | 1065 | { |
1070 | 1066 | $connection = &$this->master_db; |
1071 | - } |
|
1072 | - else |
|
1067 | + } else |
|
1073 | 1068 | { |
1074 | 1069 | $connection = &$this->slave_db[$indx]; |
1075 | 1070 | } |
@@ -1164,8 +1159,7 @@ discard block |
||
1164 | 1159 | { |
1165 | 1160 | $this->transaction_started = FALSE; |
1166 | 1161 | $this->transactionNestedLevel = 0; |
1167 | - } |
|
1168 | - else |
|
1162 | + } else |
|
1169 | 1163 | { |
1170 | 1164 | $this->transactionNestedLevel--; |
1171 | 1165 | } |
@@ -1225,8 +1219,7 @@ discard block |
||
1225 | 1219 | ) |
1226 | 1220 | { |
1227 | 1221 | $this->slave_db[0] = &$this->master_db; |
1228 | - } |
|
1229 | - else |
|
1222 | + } else |
|
1230 | 1223 | { |
1231 | 1224 | $this->slave_db = $db_info->slave_db; |
1232 | 1225 | } |
@@ -1279,8 +1272,7 @@ discard block |
||
1279 | 1272 | if($type == 'master') |
1280 | 1273 | { |
1281 | 1274 | $connection = &$this->master_db; |
1282 | - } |
|
1283 | - else |
|
1275 | + } else |
|
1284 | 1276 | { |
1285 | 1277 | $connection = &$this->slave_db[$indx]; |
1286 | 1278 | } |
@@ -42,8 +42,7 @@ |
||
42 | 42 | if(count($this->conditions) === 0) |
43 | 43 | { |
44 | 44 | $this->_show = false; |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | $this->_show = true; |
49 | 48 | } |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | function ConditionGroup($conditions, $pipe = "") |
33 | 33 | { |
34 | 34 | $this->conditions = array(); |
35 | - foreach($conditions as $condition) |
|
35 | + foreach ($conditions as $condition) |
|
36 | 36 | { |
37 | - if($condition->show()) |
|
37 | + if ($condition->show()) |
|
38 | 38 | { |
39 | 39 | $this->conditions[] = $condition; |
40 | 40 | } |
41 | 41 | } |
42 | - if(count($this->conditions) === 0) |
|
42 | + if (count($this->conditions) === 0) |
|
43 | 43 | { |
44 | 44 | $this->_show = false; |
45 | 45 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | function setPipe($pipe) |
60 | 60 | { |
61 | - if($this->pipe !== $pipe) |
|
61 | + if ($this->pipe !== $pipe) |
|
62 | 62 | { |
63 | 63 | $this->_group = null; |
64 | 64 | } |
@@ -72,24 +72,24 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function toString($with_value = true) |
74 | 74 | { |
75 | - if(!isset($this->_group)) |
|
75 | + if (!isset($this->_group)) |
|
76 | 76 | { |
77 | 77 | $cond_indx = 0; |
78 | 78 | $group = ''; |
79 | 79 | |
80 | - foreach($this->conditions as $condition) |
|
80 | + foreach ($this->conditions as $condition) |
|
81 | 81 | { |
82 | - if($cond_indx === 0) |
|
82 | + if ($cond_indx === 0) |
|
83 | 83 | { |
84 | 84 | $condition->setPipe(""); |
85 | 85 | } |
86 | - $group .= $condition->toString($with_value) . ' '; |
|
86 | + $group .= $condition->toString($with_value).' '; |
|
87 | 87 | $cond_indx++; |
88 | 88 | } |
89 | 89 | |
90 | - if($this->pipe !== "" && trim($group) !== '') |
|
90 | + if ($this->pipe !== "" && trim($group) !== '') |
|
91 | 91 | { |
92 | - $group = $this->pipe . ' (' . $group . ')'; |
|
92 | + $group = $this->pipe.' ('.$group.')'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->_group = $group; |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | function getArguments() |
105 | 105 | { |
106 | 106 | $args = array(); |
107 | - foreach($this->conditions as $condition) |
|
107 | + foreach ($this->conditions as $condition) |
|
108 | 108 | { |
109 | 109 | $arg = $condition->getArgument(); |
110 | - if($arg) |
|
110 | + if ($arg) |
|
111 | 111 | { |
112 | 112 | $args[] = $arg; |
113 | 113 | } |
@@ -30,8 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | function getArgument() |
32 | 32 | { |
33 | - if(!$this->show()) |
|
34 | - return; |
|
33 | + if(!$this->show()) { |
|
34 | + return; |
|
35 | + } |
|
35 | 36 | return $this->argument; |
36 | 37 | } |
37 | 38 | |
@@ -55,15 +56,13 @@ discard block |
||
55 | 56 | $q = substr($q, 0, -1); |
56 | 57 | } |
57 | 58 | $q = '(' . $q . ')'; |
58 | - } |
|
59 | - else |
|
59 | + } else |
|
60 | 60 | { |
61 | 61 | // Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string |
62 | 62 | if($this->argument->isColumnName()) |
63 | 63 | { |
64 | 64 | $q = $value; |
65 | - } |
|
66 | - else |
|
65 | + } else |
|
67 | 66 | { |
68 | 67 | $q = '?'; |
69 | 68 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function ConditionWithArgument($column_name, $argument, $operation, $pipe = "") |
21 | 21 | { |
22 | - if($argument === null) |
|
22 | + if ($argument === null) |
|
23 | 23 | { |
24 | 24 | $this->_show = false; |
25 | 25 | return; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | function getArgument() |
32 | 32 | { |
33 | - if(!$this->show()) |
|
33 | + if (!$this->show()) |
|
34 | 34 | return; |
35 | 35 | return $this->argument; |
36 | 36 | } |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | { |
44 | 44 | $value = $this->argument->getUnescapedValue(); |
45 | 45 | |
46 | - if(is_array($value)) |
|
46 | + if (is_array($value)) |
|
47 | 47 | { |
48 | 48 | $q = ''; |
49 | - foreach($value as $v) |
|
49 | + foreach ($value as $v) |
|
50 | 50 | { |
51 | 51 | $q .= '?,'; |
52 | 52 | } |
53 | - if($q !== '') |
|
53 | + if ($q !== '') |
|
54 | 54 | { |
55 | 55 | $q = substr($q, 0, -1); |
56 | 56 | } |
57 | - $q = '(' . $q . ')'; |
|
57 | + $q = '('.$q.')'; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | 61 | // Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string |
62 | - if($this->argument->isColumnName()) |
|
62 | + if ($this->argument->isColumnName()) |
|
63 | 63 | { |
64 | 64 | $q = $value; |
65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $q = '?'; |
69 | 69 | } |
70 | 70 | } |
71 | - return $this->pipe . ' ' . $this->getConditionPart($q); |
|
71 | + return $this->pipe.' '.$this->getConditionPart($q); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function show() |
78 | 78 | { |
79 | - if(!isset($this->_show)) |
|
79 | + if (!isset($this->_show)) |
|
80 | 80 | { |
81 | - if(!$this->argument->isValid()) |
|
81 | + if (!$this->argument->isValid()) |
|
82 | 82 | { |
83 | 83 | $this->_show = false; |
84 | 84 | } |
85 | - if($this->_value === '\'\'') |
|
85 | + if ($this->_value === '\'\'') |
|
86 | 86 | { |
87 | 87 | $this->_show = false; |
88 | 88 | } |
89 | - if(!isset($this->_show)) |
|
89 | + if (!isset($this->_show)) |
|
90 | 90 | { |
91 | 91 | return parent::show(); |
92 | 92 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::SelectExpression($column_name, $alias); |
29 | 29 | |
30 | - if(!is_bool($click_count)) |
|
30 | + if (!is_bool($click_count)) |
|
31 | 31 | { |
32 | 32 | // error_log("Click_count value for $column_name was not boolean", 0); |
33 | 33 | $this->click_count = false; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | function getExpression() |
48 | 48 | { |
49 | 49 | $db_type = Context::getDBType(); |
50 | - if($db_type == 'cubrid') |
|
50 | + if ($db_type == 'cubrid') |
|
51 | 51 | { |
52 | 52 | return "INCR($this->column_name)"; |
53 | 53 | } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | if($db_type == 'cubrid') |
51 | 51 | { |
52 | 52 | return "INCR($this->column_name)"; |
53 | - } |
|
54 | - else |
|
53 | + } else |
|
55 | 54 | { |
56 | 55 | return "$this->column_name"; |
57 | 56 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | function getValue($with_values = true) |
33 | 33 | { |
34 | - if($with_values) |
|
34 | + if ($with_values) |
|
35 | 35 | { |
36 | 36 | return $this->argument->getValue(); |
37 | 37 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | |
41 | 41 | function show() |
42 | 42 | { |
43 | - if(!$this->argument) |
|
43 | + if (!$this->argument) |
|
44 | 44 | { |
45 | 45 | return false; |
46 | 46 | } |
47 | 47 | $value = $this->argument->getValue(); |
48 | - if(!isset($value)) |
|
48 | + if (!isset($value)) |
|
49 | 49 | { |
50 | 50 | return false; |
51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function getArguments() |
61 | 61 | { |
62 | - if($this->argument) |
|
62 | + if ($this->argument) |
|
63 | 63 | { |
64 | 64 | return array($this->argument); |
65 | 65 | } |
@@ -62,8 +62,7 @@ |
||
62 | 62 | if($this->argument) |
63 | 63 | { |
64 | 64 | return array($this->argument); |
65 | - } |
|
66 | - else |
|
65 | + } else |
|
67 | 66 | { |
68 | 67 | return array(); |
69 | 68 | } |