@@ -275,6 +275,9 @@ |
||
275 | 275 | exit(); |
276 | 276 | } |
277 | 277 | |
278 | + /** |
|
279 | + * @param string $string |
|
280 | + */ |
|
278 | 281 | function createCaptchaAudio($string) |
279 | 282 | { |
280 | 283 | $data = ''; |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -74,8 +76,7 @@ discard block |
||
74 | 76 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
75 | 77 | $ModuleHandler->_setInputValueToSession(); |
76 | 78 | } |
77 | - } |
|
78 | - else |
|
79 | + } else |
|
79 | 80 | { |
80 | 81 | Context::addHtmlHeader('<script> |
81 | 82 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -205,8 +206,7 @@ discard block |
||
205 | 206 | |
206 | 207 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
207 | 208 | imagecolortransparent($im[$i + 1], $background_color); |
208 | - } |
|
209 | - else |
|
209 | + } else |
|
210 | 210 | { |
211 | 211 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
212 | 212 | } |
@@ -304,7 +304,9 @@ discard block |
||
304 | 304 | |
305 | 305 | function compareCaptcha() |
306 | 306 | { |
307 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
307 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
308 | + return true; |
|
309 | + } |
|
308 | 310 | |
309 | 311 | if($_SESSION['captcha_authed']) |
310 | 312 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if (!defined("__XE__")) exit(); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @file captcha.addon.php |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @brief Captcha for a particular action |
10 | 10 | * English alphabets and voice verification added |
11 | 11 | * */ |
12 | -if(!class_exists('AddonCaptcha', false)) |
|
12 | +if (!class_exists('AddonCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | class AddonCaptcha |
15 | 15 | { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function before_module_proc() |
26 | 26 | { |
27 | - if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
27 | + if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
28 | 28 | { |
29 | 29 | unset($_SESSION['captcha_authed']); |
30 | 30 | } |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | function before_module_init(&$ModuleHandler) |
34 | 34 | { |
35 | 35 | $logged_info = Context::get('logged_info'); |
36 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
36 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
37 | 37 | { |
38 | 38 | return false; |
39 | 39 | } |
40 | - if($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
40 | + if ($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
41 | 41 | { |
42 | 42 | return false; |
43 | 43 | } |
44 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
44 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
45 | 45 | { |
46 | 46 | $_SESSION['captcha_authed'] = false; |
47 | 47 | } |
48 | - if($_SESSION['captcha_authed']) |
|
48 | + if ($_SESSION['captcha_authed']) |
|
49 | 49 | { |
50 | 50 | return false; |
51 | 51 | } |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); |
56 | 56 | |
57 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
57 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
58 | 58 | { |
59 | - if($type == 'inline') |
|
59 | + if ($type == 'inline') |
|
60 | 60 | { |
61 | - if(!$this->compareCaptcha()) |
|
61 | + if (!$this->compareCaptcha()) |
|
62 | 62 | { |
63 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
63 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
64 | 64 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
65 | 65 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
66 | 66 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | Context::addHtmlHeader('<script> |
74 | 74 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
75 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
75 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
76 | 76 | </script>'); |
77 | 77 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | 81 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
82 | - if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
82 | + if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
83 | 83 | { |
84 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
84 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
85 | 85 | $ModuleHandler->error = "captcha_denied"; |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | function createKeyword() |
92 | 92 | { |
93 | 93 | $type = Context::get('captchaType'); |
94 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
94 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
95 | 95 | { |
96 | 96 | return; |
97 | 97 | } |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | |
105 | 105 | function before_module_init_setCaptchaSession() |
106 | 106 | { |
107 | - if($_SESSION['captcha_authed']) |
|
107 | + if ($_SESSION['captcha_authed']) |
|
108 | 108 | { |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | // Load language files |
112 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
112 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
113 | 113 | // Generate keywords |
114 | 114 | $this->createKeyword(); |
115 | 115 | |
116 | 116 | $target = Context::getLang('target_captcha'); |
117 | 117 | header("Content-Type: text/xml; charset=UTF-8"); |
118 | 118 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
119 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
119 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
120 | 120 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
121 | 121 | header("Cache-Control: post-check=0, pre-check=0", false); |
122 | 122 | header("Pragma: no-cache"); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | function before_module_init_captchaImage() |
135 | 135 | { |
136 | - if($_SESSION['captcha_authed']) |
|
136 | + if ($_SESSION['captcha_authed']) |
|
137 | 137 | { |
138 | 138 | return false; |
139 | 139 | } |
140 | - if(Context::get('renew')) |
|
140 | + if (Context::get('renew')) |
|
141 | 141 | { |
142 | 142 | $this->createKeyword(); |
143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | function createCaptchaImage($string) |
160 | 160 | { |
161 | 161 | $arr = array(); |
162 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
162 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
163 | 163 | { |
164 | 164 | $arr[] = $string{$i}; |
165 | 165 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | shuffle($deg); |
182 | 182 | |
183 | 183 | // Create an image for each letter |
184 | - foreach($arr as $i => $str) |
|
184 | + foreach ($arr as $i => $str) |
|
185 | 185 | { |
186 | 186 | $im[$i + 1] = @imagecreate($w, $h); |
187 | 187 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $ran = range(1, 20); |
192 | 192 | shuffle($ran); |
193 | 193 | |
194 | - if(function_exists('imagerotate')) |
|
194 | + if (function_exists('imagerotate')) |
|
195 | 195 | { |
196 | 196 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
197 | 197 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // Combine images of each character |
209 | - for($i = 1, $c = count($im); $i<$c; $i++) |
|
209 | + for ($i = 1, $c = count($im); $i < $c; $i++) |
|
210 | 210 | { |
211 | 211 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
212 | 212 | imagedestroy($im[$i]); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
219 | 219 | imagedestroy($im[0]); |
220 | 220 | |
221 | - if(function_exists('imageantialias')) |
|
221 | + if (function_exists('imageantialias')) |
|
222 | 222 | { |
223 | 223 | imageantialias($big, true); |
224 | 224 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $h = $h * $big_count; |
231 | 231 | $d = array_pop($deg); |
232 | 232 | |
233 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
233 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
234 | 234 | { |
235 | 235 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
236 | 236 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $x = range(0, ($w - 10)); |
239 | 239 | shuffle($x); |
240 | 240 | |
241 | - for($i = 0; $i < 200; $i++) |
|
241 | + for ($i = 0; $i < 200; $i++) |
|
242 | 242 | { |
243 | 243 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
244 | 244 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | function before_module_init_captchaAudio() |
250 | 250 | { |
251 | - if($_SESSION['captcha_authed']) |
|
251 | + if ($_SESSION['captcha_authed']) |
|
252 | 252 | { |
253 | 253 | return false; |
254 | 254 | } |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
261 | 261 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
262 | 262 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
263 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
264 | - header('Content-Length: ' . strlen($data)); |
|
263 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
264 | + header('Content-Length: '.strlen($data)); |
|
265 | 265 | |
266 | 266 | echo $data; |
267 | 267 | Context::close(); |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | { |
273 | 273 | $data = ''; |
274 | 274 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
275 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
275 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
276 | 276 | { |
277 | 277 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
278 | 278 | |
279 | 279 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
280 | 280 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
281 | 281 | |
282 | - for($j = $start; $j < $datalen; $j+=64) |
|
282 | + for ($j = $start; $j < $datalen; $j += 64) |
|
283 | 283 | { |
284 | 284 | $ch = ord($_data{$j}); |
285 | - if($ch < 9 || $ch > 119) |
|
285 | + if ($ch < 9 || $ch > 119) |
|
286 | 286 | { |
287 | 287 | continue; |
288 | 288 | } |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | |
298 | 298 | function compareCaptcha() |
299 | 299 | { |
300 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
300 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
301 | 301 | |
302 | - if($_SESSION['captcha_authed']) |
|
302 | + if ($_SESSION['captcha_authed']) |
|
303 | 303 | { |
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
307 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
308 | 308 | { |
309 | 309 | $_SESSION['captcha_authed'] = true; |
310 | 310 | return true; |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | |
318 | 318 | function before_module_init_captchaCompare() |
319 | 319 | { |
320 | - if(!$this->compareCaptcha()) |
|
320 | + if (!$this->compareCaptcha()) |
|
321 | 321 | { |
322 | 322 | return false; |
323 | 323 | } |
324 | 324 | |
325 | 325 | header("Content-Type: text/xml; charset=UTF-8"); |
326 | 326 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
327 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
327 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
328 | 328 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
329 | 329 | header("Cache-Control: post-check=0, pre-check=0", false); |
330 | 330 | header("Pragma: no-cache"); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | unset($_SESSION['captcha_authed']); |
340 | 340 | $this->createKeyword(); |
341 | 341 | |
342 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
342 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
343 | 343 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
344 | 344 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
345 | 345 | |
@@ -377,18 +377,18 @@ discard block |
||
377 | 377 | |
378 | 378 | $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__']; |
379 | 379 | |
380 | -if(method_exists($oAddonCaptcha, $called_position)) |
|
380 | +if (method_exists($oAddonCaptcha, $called_position)) |
|
381 | 381 | { |
382 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
382 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
383 | 383 | { |
384 | 384 | return false; |
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | 388 | $addon_act = Context::get('captcha_action'); |
389 | -if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) |
|
389 | +if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act)) |
|
390 | 390 | { |
391 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
391 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
392 | 392 | { |
393 | 393 | return false; |
394 | 394 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Return whether support or not support cache |
57 | 57 | * |
58 | - * @return true |
|
58 | + * @return boolean |
|
59 | 59 | */ |
60 | 60 | function isSupport() |
61 | 61 | { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * Truncate all existing variables at the cache |
166 | 166 | * |
167 | - * @return bool Returns true on success or false on failure. |
|
167 | + * @return boolean|null Returns true on success or false on failure. |
|
168 | 168 | */ |
169 | 169 | function truncate() |
170 | 170 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance() |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheFile__']) |
|
26 | + if (!$GLOBALS['__CacheFile__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); |
29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function CacheFile() |
39 | 39 | { |
40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; |
|
40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; |
|
41 | 41 | FileHandler::makeDir($this->cache_dir); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getCacheFileName($key) |
51 | 51 | { |
52 | - return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php'; |
|
52 | + return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $content = array(); |
77 | 77 | $content[] = '<?php'; |
78 | 78 | $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; |
79 | - $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; |
|
79 | + $content[] = 'return \''.addslashes(serialize($obj)).'\';'; |
|
80 | 80 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); |
81 | - if(function_exists('opcache_invalidate')) |
|
81 | + if (function_exists('opcache_invalidate')) |
|
82 | 82 | { |
83 | 83 | @opcache_invalidate($cache_file, true); |
84 | 84 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | { |
96 | 96 | $cache_file = $this->getCacheFileName($key); |
97 | 97 | |
98 | - if(file_exists($cache_file)) |
|
98 | + if (file_exists($cache_file)) |
|
99 | 99 | { |
100 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
100 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
101 | 101 | { |
102 | 102 | FileHandler::removeFile($cache_file); |
103 | 103 | return false; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function get($key, $modified_time = 0) |
120 | 120 | { |
121 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
121 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
122 | 122 | { |
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
126 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
127 | 127 | { |
128 | 128 | FileHandler::removeFile($cache_file); |
129 | 129 | return false; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function _delete($_key) |
144 | 144 | { |
145 | 145 | $cache_file = $this->getCacheFileName($_key); |
146 | - if(function_exists('opcache_invalidate')) |
|
146 | + if (function_exists('opcache_invalidate')) |
|
147 | 147 | { |
148 | 148 | @opcache_invalidate($cache_file, true); |
149 | 149 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | * opt : notnull, default, size\n |
132 | 132 | * index : primary key, index, unique\n |
133 | 133 | * @param string $xml_doc xml schema contents |
134 | - * @return void|object |
|
134 | + * @return null|false |
|
135 | 135 | */ |
136 | 136 | function _createTable($xml_doc) |
137 | 137 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function DBMysql_innodb($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | { |
56 | 56 | $connection = $this->_getConnection('master'); |
57 | 57 | |
58 | - if(!$transactionLevel) |
|
58 | + if (!$transactionLevel) |
|
59 | 59 | { |
60 | 60 | $this->_query("START TRANSACTION", $connection); |
61 | 61 | } |
62 | 62 | else |
63 | 63 | { |
64 | - $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
|
64 | + $this->_query("SAVEPOINT SP".$transactionLevel, $connection); |
|
65 | 65 | } |
66 | 66 | return true; |
67 | 67 | } |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | |
78 | 78 | $point = $transactionLevel - 1; |
79 | 79 | |
80 | - if($point) |
|
80 | + if ($point) |
|
81 | 81 | { |
82 | - $this->_query("ROLLBACK TO SP" . $point, $connection); |
|
82 | + $this->_query("ROLLBACK TO SP".$point, $connection); |
|
83 | 83 | } |
84 | 84 | else |
85 | 85 | { |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | */ |
110 | 110 | function __query($query, $connection) |
111 | 111 | { |
112 | - if(!$connection) |
|
112 | + if (!$connection) |
|
113 | 113 | { |
114 | 114 | exit('XE cannot handle DB connection.'); |
115 | 115 | } |
116 | 116 | // Run the query statement |
117 | 117 | $result = @mysql_query($query, $connection); |
118 | 118 | // Error Check |
119 | - if(mysql_error($connection)) |
|
119 | + if (mysql_error($connection)) |
|
120 | 120 | { |
121 | 121 | $this->setError(mysql_errno($connection), mysql_error($connection)); |
122 | 122 | } |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | $xml_obj = $oXml->parse($xml_doc); |
141 | 141 | // Create a table schema |
142 | 142 | $table_name = $xml_obj->table->attrs->name; |
143 | - if($this->isTableExists($table_name)) |
|
143 | + if ($this->isTableExists($table_name)) |
|
144 | 144 | { |
145 | 145 | return; |
146 | 146 | } |
147 | - $table_name = $this->prefix . $table_name; |
|
147 | + $table_name = $this->prefix.$table_name; |
|
148 | 148 | |
149 | - if(!is_array($xml_obj->table->column)) |
|
149 | + if (!is_array($xml_obj->table->column)) |
|
150 | 150 | { |
151 | 151 | $columns[] = $xml_obj->table->column; |
152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $columns = $xml_obj->table->column; |
156 | 156 | } |
157 | 157 | |
158 | - foreach($columns as $column) |
|
158 | + foreach ($columns as $column) |
|
159 | 159 | { |
160 | 160 | $name = $column->attrs->name; |
161 | 161 | $type = $column->attrs->type; |
@@ -167,47 +167,47 @@ discard block |
||
167 | 167 | $default = $column->attrs->default; |
168 | 168 | $auto_increment = $column->attrs->auto_increment; |
169 | 169 | |
170 | - $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
170 | + $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
171 | 171 | |
172 | - if($primary_key) |
|
172 | + if ($primary_key) |
|
173 | 173 | { |
174 | 174 | $primary_list[] = $name; |
175 | 175 | } |
176 | - else if($unique) |
|
176 | + else if ($unique) |
|
177 | 177 | { |
178 | 178 | $unique_list[$unique][] = $name; |
179 | 179 | } |
180 | - else if($index) |
|
180 | + else if ($index) |
|
181 | 181 | { |
182 | 182 | $index_list[$index][] = $name; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - if(count($primary_list)) |
|
186 | + if (count($primary_list)) |
|
187 | 187 | { |
188 | - $column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); |
|
188 | + $column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); |
|
189 | 189 | } |
190 | 190 | |
191 | - if(count($unique_list)) |
|
191 | + if (count($unique_list)) |
|
192 | 192 | { |
193 | - foreach($unique_list as $key => $val) |
|
193 | + foreach ($unique_list as $key => $val) |
|
194 | 194 | { |
195 | - $column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
195 | + $column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if(count($index_list)) |
|
199 | + if (count($index_list)) |
|
200 | 200 | { |
201 | - foreach($index_list as $key => $val) |
|
201 | + foreach ($index_list as $key => $val) |
|
202 | 202 | { |
203 | - $column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
203 | + $column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | 207 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"); |
208 | 208 | |
209 | 209 | $output = $this->_query($schema); |
210 | - if(!$output) |
|
210 | + if (!$output) |
|
211 | 211 | { |
212 | 212 | return false; |
213 | 213 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | function DBMysql_innodb($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if($auto_connect) { |
|
27 | + $this->_connect(); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
@@ -58,8 +60,7 @@ discard block |
||
58 | 60 | if(!$transactionLevel) |
59 | 61 | { |
60 | 62 | $this->_query("START TRANSACTION", $connection); |
61 | - } |
|
62 | - else |
|
63 | + } else |
|
63 | 64 | { |
64 | 65 | $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
65 | 66 | } |
@@ -80,8 +81,7 @@ discard block |
||
80 | 81 | if($point) |
81 | 82 | { |
82 | 83 | $this->_query("ROLLBACK TO SP" . $point, $connection); |
83 | - } |
|
84 | - else |
|
84 | + } else |
|
85 | 85 | { |
86 | 86 | $this->_query("ROLLBACK", $connection); |
87 | 87 | } |
@@ -149,8 +149,7 @@ discard block |
||
149 | 149 | if(!is_array($xml_obj->table->column)) |
150 | 150 | { |
151 | 151 | $columns[] = $xml_obj->table->column; |
152 | - } |
|
153 | - else |
|
152 | + } else |
|
154 | 153 | { |
155 | 154 | $columns = $xml_obj->table->column; |
156 | 155 | } |
@@ -172,12 +171,10 @@ discard block |
||
172 | 171 | if($primary_key) |
173 | 172 | { |
174 | 173 | $primary_list[] = $name; |
175 | - } |
|
176 | - else if($unique) |
|
174 | + } else if($unique) |
|
177 | 175 | { |
178 | 176 | $unique_list[$unique][] = $name; |
179 | - } |
|
180 | - else if($index) |
|
177 | + } else if($index) |
|
181 | 178 | { |
182 | 179 | $index_list[$index][] = $name; |
183 | 180 | } |
@@ -97,6 +97,9 @@ |
||
97 | 97 | return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $pipe |
|
102 | + */ |
|
100 | 103 | function setPipe($pipe) |
101 | 104 | { |
102 | 105 | $this->pipe = $pipe; |
@@ -66,12 +66,10 @@ discard block |
||
66 | 66 | if(!$this->show()) |
67 | 67 | { |
68 | 68 | $this->_value_to_string = ''; |
69 | - } |
|
70 | - else if($withValue) |
|
69 | + } else if($withValue) |
|
71 | 70 | { |
72 | 71 | $this->_value_to_string = $this->toStringWithValue(); |
73 | - } |
|
74 | - else |
|
72 | + } else |
|
75 | 73 | { |
76 | 74 | $this->_value_to_string = $this->toStringWithoutValue(); |
77 | 75 | } |
@@ -112,8 +110,7 @@ discard block |
||
112 | 110 | if(is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
113 | 111 | { |
114 | 112 | $this->_show = false; |
115 | - } |
|
116 | - else |
|
113 | + } else |
|
117 | 114 | { |
118 | 115 | $this->_show = true; |
119 | 116 | switch($this->operation) |
@@ -209,10 +206,11 @@ discard block |
||
209 | 206 | case 'like_prefix' : |
210 | 207 | case 'like' : |
211 | 208 | if(defined('__CUBRID_VERSION__') |
212 | - && __CUBRID_VERSION__ >= '8.4.1') |
|
213 | - return $name . ' rlike ' . $value; |
|
214 | - else |
|
215 | - return $name . ' like ' . $value; |
|
209 | + && __CUBRID_VERSION__ >= '8.4.1') { |
|
210 | + return $name . ' rlike ' . $value; |
|
211 | + } else { |
|
212 | + return $name . ' like ' . $value; |
|
213 | + } |
|
216 | 214 | break; |
217 | 215 | case 'notlike_tail' : |
218 | 216 | case 'notlike_prefix' : |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function toString($withValue = true) |
63 | 63 | { |
64 | - if(!isset($this->_value_to_string)) |
|
64 | + if (!isset($this->_value_to_string)) |
|
65 | 65 | { |
66 | - if(!$this->show()) |
|
66 | + if (!$this->show()) |
|
67 | 67 | { |
68 | 68 | $this->_value_to_string = ''; |
69 | 69 | } |
70 | - else if($withValue) |
|
70 | + else if ($withValue) |
|
71 | 71 | { |
72 | 72 | $this->_value_to_string = $this->toStringWithValue(); |
73 | 73 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function toStringWithoutValue() |
87 | 87 | { |
88 | - return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
|
88 | + return $this->pipe.' '.$this->getConditionPart($this->_value); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function toStringWithValue() |
96 | 96 | { |
97 | - return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
|
97 | + return $this->pipe.' '.$this->getConditionPart($this->_value); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function setPipe($pipe) |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function show() |
109 | 109 | { |
110 | - if(!isset($this->_show)) |
|
110 | + if (!isset($this->_show)) |
|
111 | 111 | { |
112 | - if(is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
|
112 | + if (is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
|
113 | 113 | { |
114 | 114 | $this->_show = false; |
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | 118 | $this->_show = true; |
119 | - switch($this->operation) |
|
119 | + switch ($this->operation) |
|
120 | 120 | { |
121 | 121 | case 'equal' : |
122 | 122 | case 'more' : |
@@ -138,30 +138,30 @@ discard block |
||
138 | 138 | case 'not': |
139 | 139 | case 'notequal' : |
140 | 140 | // if variable is not set or is not string or number, return |
141 | - if(!isset($this->_value)) |
|
141 | + if (!isset($this->_value)) |
|
142 | 142 | { |
143 | 143 | $this->_show = false; |
144 | 144 | break; |
145 | 145 | } |
146 | - if($this->_value === '') |
|
146 | + if ($this->_value === '') |
|
147 | 147 | { |
148 | 148 | $this->_show = false; |
149 | 149 | break; |
150 | 150 | } |
151 | 151 | $tmpArray = array('string' => 1, 'integer' => 1); |
152 | - if(!isset($tmpArray[gettype($this->_value)])) |
|
152 | + if (!isset($tmpArray[gettype($this->_value)])) |
|
153 | 153 | { |
154 | 154 | $this->_show = false; |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | break; |
158 | 158 | case 'between' : |
159 | - if(!is_array($this->_value)) |
|
159 | + if (!is_array($this->_value)) |
|
160 | 160 | { |
161 | 161 | $this->_show = false; |
162 | 162 | break; |
163 | 163 | } |
164 | - if(count($this->_value) != 2) |
|
164 | + if (count($this->_value) != 2) |
|
165 | 165 | { |
166 | 166 | $this->_show = false; |
167 | 167 | break; |
@@ -188,67 +188,67 @@ discard block |
||
188 | 188 | $name = $this->column_name; |
189 | 189 | $operation = $this->operation; |
190 | 190 | |
191 | - switch($operation) |
|
191 | + switch ($operation) |
|
192 | 192 | { |
193 | 193 | case 'equal' : |
194 | - return $name . ' = ' . $value; |
|
194 | + return $name.' = '.$value; |
|
195 | 195 | break; |
196 | 196 | case 'more' : |
197 | - return $name . ' >= ' . $value; |
|
197 | + return $name.' >= '.$value; |
|
198 | 198 | break; |
199 | 199 | case 'excess' : |
200 | - return $name . ' > ' . $value; |
|
200 | + return $name.' > '.$value; |
|
201 | 201 | break; |
202 | 202 | case 'less' : |
203 | - return $name . ' <= ' . $value; |
|
203 | + return $name.' <= '.$value; |
|
204 | 204 | break; |
205 | 205 | case 'below' : |
206 | - return $name . ' < ' . $value; |
|
206 | + return $name.' < '.$value; |
|
207 | 207 | break; |
208 | 208 | case 'like_tail' : |
209 | 209 | case 'like_prefix' : |
210 | 210 | case 'like' : |
211 | - if(defined('__CUBRID_VERSION__') |
|
211 | + if (defined('__CUBRID_VERSION__') |
|
212 | 212 | && __CUBRID_VERSION__ >= '8.4.1') |
213 | - return $name . ' rlike ' . $value; |
|
213 | + return $name.' rlike '.$value; |
|
214 | 214 | else |
215 | - return $name . ' like ' . $value; |
|
215 | + return $name.' like '.$value; |
|
216 | 216 | break; |
217 | 217 | case 'notlike_tail' : |
218 | 218 | case 'notlike_prefix' : |
219 | 219 | case 'notlike' : |
220 | - return $name . ' not like ' . $value; |
|
220 | + return $name.' not like '.$value; |
|
221 | 221 | break; |
222 | 222 | case 'in' : |
223 | - return $name . ' in ' . $value; |
|
223 | + return $name.' in '.$value; |
|
224 | 224 | break; |
225 | 225 | case 'notin' : |
226 | 226 | case 'not_in' : |
227 | - return $name . ' not in ' . $value; |
|
227 | + return $name.' not in '.$value; |
|
228 | 228 | break; |
229 | 229 | case 'notequal' : |
230 | - return $name . ' <> ' . $value; |
|
230 | + return $name.' <> '.$value; |
|
231 | 231 | break; |
232 | 232 | case 'notnull' : |
233 | - return $name . ' is not null'; |
|
233 | + return $name.' is not null'; |
|
234 | 234 | break; |
235 | 235 | case 'null' : |
236 | - return $name . ' is null'; |
|
236 | + return $name.' is null'; |
|
237 | 237 | break; |
238 | 238 | case 'and' : |
239 | - return $name . ' & ' . $value; |
|
239 | + return $name.' & '.$value; |
|
240 | 240 | break; |
241 | 241 | case 'or' : |
242 | - return $name . ' | ' . $value; |
|
242 | + return $name.' | '.$value; |
|
243 | 243 | break; |
244 | 244 | case 'xor' : |
245 | - return $name . ' ^ ' . $value; |
|
245 | + return $name.' ^ '.$value; |
|
246 | 246 | break; |
247 | 247 | case 'not' : |
248 | - return $name . ' ~ ' . $value; |
|
248 | + return $name.' ~ '.$value; |
|
249 | 249 | break; |
250 | 250 | case 'between' : |
251 | - return $name . ' between ' . $value[0] . ' and ' . $value[1]; |
|
251 | + return $name.' between '.$value[0].' and '.$value[1]; |
|
252 | 252 | break; |
253 | 253 | } |
254 | 254 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | /** |
13 | 13 | * constructor |
14 | 14 | * @param string $column_name |
15 | - * @param mixed $argument |
|
15 | + * @param integer $argument |
|
16 | 16 | * @param string $operation |
17 | 17 | * @param string $pipe |
18 | - * @return void |
|
18 | + * @return boolean |
|
19 | 19 | */ |
20 | 20 | function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = "") |
21 | 21 | { |
@@ -28,8 +28,7 @@ |
||
28 | 28 | $argument = implode($argument, ','); |
29 | 29 | } |
30 | 30 | $this->_value = '(' . $argument . ')'; |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | $this->_value = $argument; |
35 | 34 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | { |
22 | 22 | parent::Condition($column_name, $argument, $operation, $pipe); |
23 | 23 | $tmpArray = array('in' => 1, 'notin' => 1, 'not_in' => 1); |
24 | - if(isset($tmpArray[$operation])) |
|
24 | + if (isset($tmpArray[$operation])) |
|
25 | 25 | { |
26 | - if(is_array($argument)) |
|
26 | + if (is_array($argument)) |
|
27 | 27 | { |
28 | 28 | $argument = implode($argument, ','); |
29 | 29 | } |
30 | - $this->_value = '(' . $argument . ')'; |
|
30 | + $this->_value = '('.$argument.')'; |
|
31 | 31 | } |
32 | 32 | else |
33 | 33 | { |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** |
21 | 21 | * constructor |
22 | 22 | * @param string $column_name |
23 | - * @param object $argument |
|
23 | + * @param Argument $argument |
|
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function UpdateExpression($column_name, $argument) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function getExpression($with_value = true) |
37 | 37 | { |
38 | - if($with_value) |
|
38 | + if ($with_value) |
|
39 | 39 | { |
40 | 40 | return $this->getExpressionWithValue(); |
41 | 41 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $value = $this->argument->getValue(); |
52 | 52 | $operation = $this->argument->getColumnOperation(); |
53 | - if(isset($operation)) |
|
53 | + if (isset($operation)) |
|
54 | 54 | { |
55 | 55 | return "$this->column_name = $this->column_name $operation $value"; |
56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function getExpressionWithoutValue() |
66 | 66 | { |
67 | 67 | $operation = $this->argument->getColumnOperation(); |
68 | - if(isset($operation)) |
|
68 | + if (isset($operation)) |
|
69 | 69 | { |
70 | 70 | return "$this->column_name = $this->column_name $operation ?"; |
71 | 71 | } |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | { |
77 | 77 | // TODO Escape value according to column type instead of variable type |
78 | 78 | $value = $this->argument->getValue(); |
79 | - if(!is_numeric($value)) |
|
79 | + if (!is_numeric($value)) |
|
80 | 80 | { |
81 | - return "'" . $value . "'"; |
|
81 | + return "'".$value."'"; |
|
82 | 82 | } |
83 | 83 | return $value; |
84 | 84 | } |
85 | 85 | |
86 | 86 | function show() |
87 | 87 | { |
88 | - if(!$this->argument) |
|
88 | + if (!$this->argument) |
|
89 | 89 | { |
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | $value = $this->argument->getValue(); |
93 | - if(!isset($value)) |
|
93 | + if (!isset($value)) |
|
94 | 94 | { |
95 | 95 | return false; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | function getArguments() |
106 | 106 | { |
107 | - if($this->argument) |
|
107 | + if ($this->argument) |
|
108 | 108 | { |
109 | 109 | return array($this->argument); |
110 | 110 | } |
@@ -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 | } |
@@ -251,6 +251,9 @@ |
||
251 | 251 | return $this->orderby; |
252 | 252 | } |
253 | 253 | |
254 | + /** |
|
255 | + * @param integer $limit |
|
256 | + */ |
|
254 | 257 | function setLimit($limit = NULL) |
255 | 258 | { |
256 | 259 | if(!isset($limit)) |
@@ -378,8 +378,7 @@ discard block |
||
378 | 378 | if($column->isSubquery()) |
379 | 379 | { |
380 | 380 | $select[] = $column->toString($with_values) . ' as ' . $column->getAlias(); |
381 | - } |
|
382 | - else |
|
381 | + } else |
|
383 | 382 | { |
384 | 383 | $select[] = $column->getExpression($with_values); |
385 | 384 | } |
@@ -403,7 +402,9 @@ discard block |
||
403 | 402 | } |
404 | 403 | } |
405 | 404 | |
406 | - if(!$update) return; |
|
405 | + if(!$update) { |
|
406 | + return; |
|
407 | + } |
|
407 | 408 | return trim(implode($update, ', ')); |
408 | 409 | } |
409 | 410 | |
@@ -465,8 +466,7 @@ discard block |
||
465 | 466 | if($table->isJoinTable() || !$simple_table_count) |
466 | 467 | { |
467 | 468 | $from .= $table->toString($with_values) . ' '; |
468 | - } |
|
469 | - else |
|
469 | + } else |
|
470 | 470 | { |
471 | 471 | $from .= ', ' . $table->toString($with_values) . ' '; |
472 | 472 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->action = $action; |
109 | 109 | $this->priority = $priority; |
110 | 110 | |
111 | - if(!isset($tables)) |
|
111 | + if (!isset($tables)) |
|
112 | 112 | { |
113 | 113 | return; |
114 | 114 | } |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | function setColumnList($columnList) |
145 | 145 | { |
146 | 146 | $this->columnList = $columnList; |
147 | - if(count($this->columnList) > 0) |
|
147 | + if (count($this->columnList) > 0) |
|
148 | 148 | { |
149 | 149 | $selectColumns = array(); |
150 | 150 | $dbParser = DB::getParser(); |
151 | 151 | |
152 | - foreach($this->columnList as $columnName) |
|
152 | + foreach ($this->columnList as $columnName) |
|
153 | 153 | { |
154 | 154 | $columnName = $dbParser->escapeColumn($columnName); |
155 | 155 | $selectColumns[] = new SelectExpression($columnName); |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | |
162 | 162 | function setColumns($columns) |
163 | 163 | { |
164 | - if(!isset($columns) || count($columns) === 0) |
|
164 | + if (!isset($columns) || count($columns) === 0) |
|
165 | 165 | { |
166 | 166 | $this->columns = array(new StarExpression()); |
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - if(!is_array($columns)) |
|
170 | + if (!is_array($columns)) |
|
171 | 171 | { |
172 | 172 | $columns = array($columns); |
173 | 173 | } |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | |
178 | 178 | function setTables($tables) |
179 | 179 | { |
180 | - if(!isset($tables) || count($tables) === 0) |
|
180 | + if (!isset($tables) || count($tables) === 0) |
|
181 | 181 | { |
182 | 182 | $this->setError(TRUE); |
183 | 183 | $this->setMessage("You must provide at least one table for the query."); |
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | - if(!is_array($tables)) |
|
187 | + if (!is_array($tables)) |
|
188 | 188 | { |
189 | 189 | $tables = array($tables); |
190 | 190 | } |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | function setConditions($conditions) |
201 | 201 | { |
202 | 202 | $this->conditions = array(); |
203 | - if(!isset($conditions) || count($conditions) === 0) |
|
203 | + if (!isset($conditions) || count($conditions) === 0) |
|
204 | 204 | { |
205 | 205 | return; |
206 | 206 | } |
207 | - if(!is_array($conditions)) |
|
207 | + if (!is_array($conditions)) |
|
208 | 208 | { |
209 | 209 | $conditions = array($conditions); |
210 | 210 | } |
211 | 211 | |
212 | - foreach($conditions as $conditionGroup) |
|
212 | + foreach ($conditions as $conditionGroup) |
|
213 | 213 | { |
214 | - if($conditionGroup->show()) |
|
214 | + if ($conditionGroup->show()) |
|
215 | 215 | { |
216 | 216 | $this->conditions[] = $conditionGroup; |
217 | 217 | } |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | |
221 | 221 | function setGroups($groups) |
222 | 222 | { |
223 | - if(!isset($groups) || count($groups) === 0) |
|
223 | + if (!isset($groups) || count($groups) === 0) |
|
224 | 224 | { |
225 | 225 | return; |
226 | 226 | } |
227 | - if(!is_array($groups)) |
|
227 | + if (!is_array($groups)) |
|
228 | 228 | { |
229 | 229 | $groups = array($groups); |
230 | 230 | } |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | |
235 | 235 | function setOrder($order) |
236 | 236 | { |
237 | - if(!isset($order) || count($order) === 0) |
|
237 | + if (!isset($order) || count($order) === 0) |
|
238 | 238 | { |
239 | 239 | return; |
240 | 240 | } |
241 | - if(!is_array($order)) |
|
241 | + if (!is_array($order)) |
|
242 | 242 | { |
243 | 243 | $order = array($order); |
244 | 244 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | function setLimit($limit = NULL) |
255 | 255 | { |
256 | - if(!isset($limit)) |
|
256 | + if (!isset($limit)) |
|
257 | 257 | { |
258 | 258 | return; |
259 | 259 | } |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | function getClickCountColumns() |
355 | 355 | { |
356 | 356 | $click_count_columns = array(); |
357 | - foreach($this->columns as $column) |
|
357 | + foreach ($this->columns as $column) |
|
358 | 358 | { |
359 | - if($column->show() && is_a($column, 'ClickCountExpression')) |
|
359 | + if ($column->show() && is_a($column, 'ClickCountExpression')) |
|
360 | 360 | { |
361 | 361 | $click_count_columns[] = $column; |
362 | 362 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function getSelectString($with_values = TRUE) |
373 | 373 | { |
374 | - foreach($this->columns as $column) |
|
374 | + foreach ($this->columns as $column) |
|
375 | 375 | { |
376 | - if($column->show()) |
|
376 | + if ($column->show()) |
|
377 | 377 | { |
378 | - if($column->isSubquery()) |
|
378 | + if ($column->isSubquery()) |
|
379 | 379 | { |
380 | - $select[] = $column->toString($with_values) . ' as ' . $column->getAlias(); |
|
380 | + $select[] = $column->toString($with_values).' as '.$column->getAlias(); |
|
381 | 381 | } |
382 | 382 | else |
383 | 383 | { |
@@ -395,15 +395,15 @@ discard block |
||
395 | 395 | */ |
396 | 396 | function getUpdateString($with_values = TRUE) |
397 | 397 | { |
398 | - foreach($this->columns as $column) |
|
398 | + foreach ($this->columns as $column) |
|
399 | 399 | { |
400 | - if($column->show()) |
|
400 | + if ($column->show()) |
|
401 | 401 | { |
402 | 402 | $update[] = $column->getExpression($with_values); |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | - if(!$update) return; |
|
406 | + if (!$update) return; |
|
407 | 407 | return trim(implode($update, ', ')); |
408 | 408 | } |
409 | 409 | |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | { |
417 | 417 | $columnsList = ''; |
418 | 418 | // means we have insert-select |
419 | - if($this->subquery) |
|
419 | + if ($this->subquery) |
|
420 | 420 | { |
421 | - foreach($this->columns as $column) |
|
421 | + foreach ($this->columns as $column) |
|
422 | 422 | { |
423 | - $columnsList .= $column->getColumnName() . ', '; |
|
423 | + $columnsList .= $column->getColumnName().', '; |
|
424 | 424 | } |
425 | 425 | $columnsList = substr($columnsList, 0, -2); |
426 | 426 | $selectStatement = $this->subquery->toString($with_values); |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | $valuesList = ''; |
432 | - foreach($this->columns as $column) |
|
432 | + foreach ($this->columns as $column) |
|
433 | 433 | { |
434 | - if($column->show()) |
|
434 | + if ($column->show()) |
|
435 | 435 | { |
436 | - $columnsList .= $column->getColumnName() . ', '; |
|
437 | - $valuesList .= $column->getValue($with_values) . ', '; |
|
436 | + $columnsList .= $column->getColumnName().', '; |
|
437 | + $valuesList .= $column->getValue($with_values).', '; |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | $columnsList = substr($columnsList, 0, -2); |
@@ -460,25 +460,25 @@ discard block |
||
460 | 460 | { |
461 | 461 | $from = ''; |
462 | 462 | $simple_table_count = 0; |
463 | - foreach($this->tables as $table) |
|
463 | + foreach ($this->tables as $table) |
|
464 | 464 | { |
465 | - if($table->isJoinTable() || !$simple_table_count) |
|
465 | + if ($table->isJoinTable() || !$simple_table_count) |
|
466 | 466 | { |
467 | - $from .= $table->toString($with_values) . ' '; |
|
467 | + $from .= $table->toString($with_values).' '; |
|
468 | 468 | } |
469 | 469 | else |
470 | 470 | { |
471 | - $from .= ', ' . $table->toString($with_values) . ' '; |
|
471 | + $from .= ', '.$table->toString($with_values).' '; |
|
472 | 472 | } |
473 | 473 | |
474 | - if(is_a($table, 'Subquery')) |
|
474 | + if (is_a($table, 'Subquery')) |
|
475 | 475 | { |
476 | - $from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' '; |
|
476 | + $from .= $table->getAlias() ? ' as '.$table->getAlias().' ' : ' '; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $simple_table_count++; |
480 | 480 | } |
481 | - if(trim($from) == '') |
|
481 | + if (trim($from) == '') |
|
482 | 482 | { |
483 | 483 | return ''; |
484 | 484 | } |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | $where = ''; |
497 | 497 | $condition_count = 0; |
498 | 498 | |
499 | - foreach($this->conditions as $conditionGroup) |
|
499 | + foreach ($this->conditions as $conditionGroup) |
|
500 | 500 | { |
501 | - if($condition_count === 0) |
|
501 | + if ($condition_count === 0) |
|
502 | 502 | { |
503 | 503 | $conditionGroup->setPipe(""); |
504 | 504 | } |
@@ -507,26 +507,26 @@ discard block |
||
507 | 507 | $condition_count++; |
508 | 508 | } |
509 | 509 | |
510 | - if($with_optimization && |
|
510 | + if ($with_optimization && |
|
511 | 511 | (strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order'))) |
512 | 512 | { |
513 | 513 | |
514 | - if($condition_count !== 0) |
|
514 | + if ($condition_count !== 0) |
|
515 | 515 | { |
516 | - $where = '(' . $where . ') '; |
|
516 | + $where = '('.$where.') '; |
|
517 | 517 | } |
518 | 518 | |
519 | - foreach($this->orderby as $order) |
|
519 | + foreach ($this->orderby as $order) |
|
520 | 520 | { |
521 | 521 | $colName = $order->getColumnName(); |
522 | - if(strstr($colName, 'list_order') || strstr($colName, 'update_order')) |
|
522 | + if (strstr($colName, 'list_order') || strstr($colName, 'update_order')) |
|
523 | 523 | { |
524 | 524 | $opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and'); |
525 | - if($condition_count === 0) |
|
525 | + if ($condition_count === 0) |
|
526 | 526 | { |
527 | 527 | $opt_condition->setPipe(""); |
528 | 528 | } |
529 | - $where .= $opt_condition->toString($with_values) . ' '; |
|
529 | + $where .= $opt_condition->toString($with_values).' '; |
|
530 | 530 | $condition_count++; |
531 | 531 | } |
532 | 532 | } |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | function getGroupByString() |
543 | 543 | { |
544 | 544 | $groupBy = ''; |
545 | - if($this->groups) |
|
545 | + if ($this->groups) |
|
546 | 546 | { |
547 | - if($this->groups[0] !== "") |
|
547 | + if ($this->groups[0] !== "") |
|
548 | 548 | { |
549 | 549 | $groupBy = implode(', ', $this->groups); |
550 | 550 | } |
@@ -558,16 +558,16 @@ discard block |
||
558 | 558 | */ |
559 | 559 | function getOrderByString() |
560 | 560 | { |
561 | - if(!$this->_orderByString) |
|
561 | + if (!$this->_orderByString) |
|
562 | 562 | { |
563 | - if(count($this->orderby) === 0) |
|
563 | + if (count($this->orderby) === 0) |
|
564 | 564 | { |
565 | 565 | return ''; |
566 | 566 | } |
567 | 567 | $orderBy = ''; |
568 | - foreach($this->orderby as $order) |
|
568 | + foreach ($this->orderby as $order) |
|
569 | 569 | { |
570 | - $orderBy .= $order->toString() . ', '; |
|
570 | + $orderBy .= $order->toString().', '; |
|
571 | 571 | } |
572 | 572 | $orderBy = substr($orderBy, 0, -2); |
573 | 573 | $this->_orderByString = $orderBy; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | function getLimitString() |
588 | 588 | { |
589 | 589 | $limit = ''; |
590 | - if(count($this->limit) > 0) |
|
590 | + if (count($this->limit) > 0) |
|
591 | 591 | { |
592 | 592 | $limit = ''; |
593 | 593 | $limit .= $this->limit->toString(); |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | */ |
607 | 607 | function getArguments() |
608 | 608 | { |
609 | - if(!isset($this->arguments)) |
|
609 | + if (!isset($this->arguments)) |
|
610 | 610 | { |
611 | 611 | $this->arguments = array(); |
612 | 612 | |
613 | 613 | // Join table arguments |
614 | - if(count($this->tables) > 0) |
|
614 | + if (count($this->tables) > 0) |
|
615 | 615 | { |
616 | - foreach($this->tables as $table) |
|
616 | + foreach ($this->tables as $table) |
|
617 | 617 | { |
618 | - if($table->isJoinTable() || is_a($table, 'Subquery')) |
|
618 | + if ($table->isJoinTable() || is_a($table, 'Subquery')) |
|
619 | 619 | { |
620 | 620 | $args = $table->getArguments(); |
621 | - if($args) |
|
621 | + if ($args) |
|
622 | 622 | { |
623 | 623 | $this->arguments = array_merge($this->arguments, $args); |
624 | 624 | } |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | |
629 | 629 | // Column arguments |
630 | 630 | // The if is for delete statements, all others must have columns |
631 | - if(count($this->columns) > 0) |
|
631 | + if (count($this->columns) > 0) |
|
632 | 632 | { |
633 | - foreach($this->columns as $column) |
|
633 | + foreach ($this->columns as $column) |
|
634 | 634 | { |
635 | - if($column->show()) |
|
635 | + if ($column->show()) |
|
636 | 636 | { |
637 | 637 | $args = $column->getArguments(); |
638 | - if($args) |
|
638 | + if ($args) |
|
639 | 639 | { |
640 | 640 | $this->arguments = array_merge($this->arguments, $args); |
641 | 641 | } |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | } |
645 | 645 | |
646 | 646 | // Condition arguments |
647 | - if(count($this->conditions) > 0) |
|
647 | + if (count($this->conditions) > 0) |
|
648 | 648 | { |
649 | - foreach($this->conditions as $conditionGroup) |
|
649 | + foreach ($this->conditions as $conditionGroup) |
|
650 | 650 | { |
651 | 651 | $args = $conditionGroup->getArguments(); |
652 | - if(count($args) > 0) |
|
652 | + if (count($args) > 0) |
|
653 | 653 | { |
654 | 654 | $this->arguments = array_merge($this->arguments, $args); |
655 | 655 | } |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | } |
658 | 658 | |
659 | 659 | // Navigation arguments |
660 | - if(count($this->orderby) > 0) |
|
660 | + if (count($this->orderby) > 0) |
|
661 | 661 | { |
662 | - foreach($this->orderby as $order) |
|
662 | + foreach ($this->orderby as $order) |
|
663 | 663 | { |
664 | 664 | $args = $order->getArguments(); |
665 | - if(count($args) > 0) |
|
665 | + if (count($args) > 0) |
|
666 | 666 | { |
667 | 667 | $this->arguments = array_merge($this->arguments, $args); |
668 | 668 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n |
134 | 134 | * This method only functions when __DEBUG__ variable is set to 1. |
135 | 135 | * __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php |
136 | - * @return void |
|
136 | + * @return null|string |
|
137 | 137 | */ |
138 | 138 | function _debugOutput() |
139 | 139 | { |
@@ -358,6 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | /** |
360 | 360 | * print a HTTP HEADER for HTML, which is encoded in UTF-8 |
361 | + * @param integer $code |
|
361 | 362 | * @return void |
362 | 363 | */ |
363 | 364 | function _printHttpStatusCode($code) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | function printContent(&$oModule) |
26 | 26 | { |
27 | 27 | // Check if the gzip encoding supported |
28 | - if( |
|
28 | + if ( |
|
29 | 29 | (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) && |
30 | 30 | strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && |
31 | 31 | extension_loaded('zlib') && |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Extract contents to display by the request method |
39 | - if(Context::get('xeVirtualRequestMethod') == 'xml') |
|
39 | + if (Context::get('xeVirtualRequestMethod') == 'xml') |
|
40 | 40 | { |
41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
42 | 42 | } |
43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
43 | + else if (Context::getRequestMethod() == 'XMLRPC') |
|
44 | 44 | { |
45 | 45 | $handler = new XMLDisplayHandler(); |
46 | - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
46 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
47 | 47 | { |
48 | 48 | $this->gz_enabled = FALSE; |
49 | 49 | } |
50 | 50 | } |
51 | - else if(Context::getRequestMethod() == 'JSON') |
|
51 | + else if (Context::getRequestMethod() == 'JSON') |
|
52 | 52 | { |
53 | 53 | $handler = new JSONDisplayHandler(); |
54 | 54 | } |
55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
55 | + else if (Context::getRequestMethod() == 'JS_CALLBACK') |
|
56 | 56 | { |
57 | 57 | $handler = new JSCallbackDisplayHandler(); |
58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $called_position = 'before_display_content'; |
71 | 71 | $oAddonController = getController('addon'); |
72 | 72 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
73 | - if(file_exists($addon_file)) include($addon_file); |
|
73 | + if (file_exists($addon_file)) include($addon_file); |
|
74 | 74 | |
75 | - if(method_exists($handler, "prepareToPrint")) |
|
75 | + if (method_exists($handler, "prepareToPrint")) |
|
76 | 76 | { |
77 | 77 | $handler->prepareToPrint($output); |
78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | // header output |
81 | 81 | |
82 | 82 | $httpStatusCode = $oModule->getHttpStatusCode(); |
83 | - if($httpStatusCode && $httpStatusCode != 200) |
|
83 | + if ($httpStatusCode && $httpStatusCode != 200) |
|
84 | 84 | { |
85 | 85 | $this->_printHttpStatusCode($httpStatusCode); |
86 | 86 | } |
87 | 87 | else |
88 | 88 | { |
89 | - if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
89 | + if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
90 | 90 | { |
91 | 91 | $this->_printJSONHeader(); |
92 | 92 | } |
93 | - else if(Context::getResponseMethod() != 'HTML') |
|
93 | + else if (Context::getResponseMethod() != 'HTML') |
|
94 | 94 | { |
95 | 95 | $this->_printXMLHeader(); |
96 | 96 | } |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | |
107 | 107 | // disable gzip if output already exists |
108 | 108 | ob_flush(); |
109 | - if(headers_sent()) |
|
109 | + if (headers_sent()) |
|
110 | 110 | { |
111 | 111 | $this->gz_enabled = FALSE; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // enable gzip using zlib extension |
115 | - if($this->gz_enabled) |
|
115 | + if ($this->gz_enabled) |
|
116 | 116 | { |
117 | 117 | ini_set('zlib.output_compression', true); |
118 | 118 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function _debugOutput() |
135 | 135 | { |
136 | - if(!__DEBUG__) |
|
136 | + if (!__DEBUG__) |
|
137 | 137 | { |
138 | 138 | return; |
139 | 139 | } |
@@ -141,32 +141,32 @@ discard block |
||
141 | 141 | $end = getMicroTime(); |
142 | 142 | |
143 | 143 | // Firebug console output |
144 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
144 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
145 | 145 | { |
146 | 146 | static $firephp; |
147 | - if(!isset($firephp)) |
|
147 | + if (!isset($firephp)) |
|
148 | 148 | { |
149 | 149 | $firephp = FirePHP::getInstance(true); |
150 | 150 | } |
151 | 151 | |
152 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
152 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
153 | 153 | { |
154 | 154 | $firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.'); |
155 | 155 | return; |
156 | 156 | } |
157 | 157 | // display total execution time and Request/Response info |
158 | - if(__DEBUG__ & 2) |
|
158 | + if (__DEBUG__ & 2) |
|
159 | 159 | { |
160 | 160 | $firephp->fb( |
161 | 161 | array( |
162 | - 'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), |
|
162 | + 'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(), |
|
163 | 163 | array( |
164 | 164 | array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), |
165 | 165 | array( |
166 | 166 | sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), |
167 | 167 | $_SERVER['REQUEST_METHOD'], |
168 | 168 | Context::getResponseMethod(), |
169 | - $this->content_size . ' byte', |
|
169 | + $this->content_size.' byte', |
|
170 | 170 | FileHandler::filesize(memory_get_peak_usage()) |
171 | 171 | ) |
172 | 172 | ) |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ); |
176 | 176 | $firephp->fb( |
177 | 177 | array( |
178 | - 'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), |
|
178 | + 'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__), |
|
179 | 179 | array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), |
180 | 180 | array( |
181 | 181 | sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | // display DB query history |
196 | - if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
196 | + if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
197 | 197 | { |
198 | 198 | $queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query')); |
199 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
199 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
200 | 200 | { |
201 | - $queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']); |
|
201 | + $queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']); |
|
202 | 202 | } |
203 | 203 | $firephp->fb( |
204 | 204 | array( |
205 | - 'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
205 | + 'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
206 | 206 | $queries_output |
207 | 207 | ), |
208 | 208 | 'TABLE' |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | $buff = array(); |
217 | 217 | // display total execution time and Request/Response info |
218 | - if(__DEBUG__ & 2) |
|
218 | + if (__DEBUG__ & 2) |
|
219 | 219 | { |
220 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
220 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
221 | 221 | { |
222 | 222 | return; |
223 | 223 | } |
@@ -248,21 +248,21 @@ discard block |
||
248 | 248 | $buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']); |
249 | 249 | } |
250 | 250 | // DB Logging |
251 | - if(__DEBUG__ & 4) |
|
251 | + if (__DEBUG__ & 4) |
|
252 | 252 | { |
253 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
253 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
254 | 254 | { |
255 | 255 | return; |
256 | 256 | } |
257 | 257 | |
258 | - if($GLOBALS['__db_queries__']) |
|
258 | + if ($GLOBALS['__db_queries__']) |
|
259 | 259 | { |
260 | 260 | $buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']); |
261 | 261 | $num = 0; |
262 | 262 | |
263 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
263 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
264 | 264 | { |
265 | - if($query['result'] == 'Success') |
|
265 | + if ($query['result'] == 'Success') |
|
266 | 266 | { |
267 | 267 | $query_result = "Query Success"; |
268 | 268 | } |
@@ -279,30 +279,30 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | // Output in HTML comments |
282 | - if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
282 | + if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
283 | 283 | { |
284 | 284 | $buff = implode("\r\n", $buff); |
285 | 285 | $buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); |
286 | 286 | |
287 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
287 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
288 | 288 | { |
289 | 289 | $buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
290 | 290 | } |
291 | 291 | |
292 | - return "<!--\r\n" . $buff . "\r\n-->"; |
|
292 | + return "<!--\r\n".$buff."\r\n-->"; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Output to a file |
296 | - if($buff && __DEBUG_OUTPUT__ == 0) |
|
296 | + if ($buff && __DEBUG_OUTPUT__ == 0) |
|
297 | 297 | { |
298 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
298 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
299 | 299 | $buff = implode(PHP_EOL, $buff); |
300 | 300 | $buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true)); |
301 | 301 | |
302 | - $buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80); |
|
303 | - $buff = "\n<?php\n/*" . $buff . "*/\n?>\n"; |
|
302 | + $buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80); |
|
303 | + $buff = "\n<?php\n/*".$buff."*/\n?>\n"; |
|
304 | 304 | |
305 | - if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX)) |
|
305 | + if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX)) |
|
306 | 306 | { |
307 | 307 | return; |
308 | 308 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | { |
319 | 319 | header("Content-Type: text/xml; charset=UTF-8"); |
320 | 320 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
321 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
321 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
322 | 322 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
323 | 323 | header("Cache-Control: post-check=0, pre-check=0", false); |
324 | 324 | header("Pragma: no-cache"); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | { |
333 | 333 | header("Content-Type: text/html; charset=UTF-8"); |
334 | 334 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
335 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
335 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
336 | 336 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
337 | 337 | header("Cache-Control: post-check=0, pre-check=0", false); |
338 | 338 | header("Pragma: no-cache"); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | { |
347 | 347 | header("Content-Type: text/html; charset=UTF-8"); |
348 | 348 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
349 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
349 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
350 | 350 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
351 | 351 | header("Cache-Control: post-check=0, pre-check=0", false); |
352 | 352 | header("Pragma: no-cache"); |
@@ -39,24 +39,20 @@ discard block |
||
39 | 39 | if(Context::get('xeVirtualRequestMethod') == 'xml') |
40 | 40 | { |
41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
42 | - } |
|
43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
42 | + } else if(Context::getRequestMethod() == 'XMLRPC') |
|
44 | 43 | { |
45 | 44 | $handler = new XMLDisplayHandler(); |
46 | 45 | if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
47 | 46 | { |
48 | 47 | $this->gz_enabled = FALSE; |
49 | 48 | } |
50 | - } |
|
51 | - else if(Context::getRequestMethod() == 'JSON') |
|
49 | + } else if(Context::getRequestMethod() == 'JSON') |
|
52 | 50 | { |
53 | 51 | $handler = new JSONDisplayHandler(); |
54 | - } |
|
55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
52 | + } else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
56 | 53 | { |
57 | 54 | $handler = new JSCallbackDisplayHandler(); |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $handler = new HTMLDisplayHandler(); |
62 | 58 | } |
@@ -70,7 +66,9 @@ discard block |
||
70 | 66 | $called_position = 'before_display_content'; |
71 | 67 | $oAddonController = getController('addon'); |
72 | 68 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
73 | - if(file_exists($addon_file)) include($addon_file); |
|
69 | + if(file_exists($addon_file)) { |
|
70 | + include($addon_file); |
|
71 | + } |
|
74 | 72 | |
75 | 73 | if(method_exists($handler, "prepareToPrint")) |
76 | 74 | { |
@@ -83,18 +81,15 @@ discard block |
||
83 | 81 | if($httpStatusCode && $httpStatusCode != 200) |
84 | 82 | { |
85 | 83 | $this->_printHttpStatusCode($httpStatusCode); |
86 | - } |
|
87 | - else |
|
84 | + } else |
|
88 | 85 | { |
89 | 86 | if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
90 | 87 | { |
91 | 88 | $this->_printJSONHeader(); |
92 | - } |
|
93 | - else if(Context::getResponseMethod() != 'HTML') |
|
89 | + } else if(Context::getResponseMethod() != 'HTML') |
|
94 | 90 | { |
95 | 91 | $this->_printXMLHeader(); |
96 | - } |
|
97 | - else |
|
92 | + } else |
|
98 | 93 | { |
99 | 94 | $this->_printHTMLHeader(); |
100 | 95 | } |
@@ -209,8 +204,7 @@ discard block |
||
209 | 204 | ); |
210 | 205 | } |
211 | 206 | // dislpay the file and HTML comments |
212 | - } |
|
213 | - else |
|
207 | + } else |
|
214 | 208 | { |
215 | 209 | |
216 | 210 | $buff = array(); |
@@ -265,8 +259,7 @@ discard block |
||
265 | 259 | if($query['result'] == 'Success') |
266 | 260 | { |
267 | 261 | $query_result = "Query Success"; |
268 | - } |
|
269 | - else |
|
262 | + } else |
|
270 | 263 | { |
271 | 264 | $query_result = sprintf("Query $s : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']); |
272 | 265 | } |
@@ -370,7 +370,7 @@ |
||
370 | 370 | /** |
371 | 371 | * add given .css or .js file names in widget code to Context |
372 | 372 | * @param array $matches |
373 | - * @return void |
|
373 | + * @return string|null |
|
374 | 374 | */ |
375 | 375 | function _transMeta($matches) |
376 | 376 | { |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | $template_path = $oModule->getTemplatePath(); |
21 | 21 | |
22 | - if(!is_dir($template_path)) |
|
22 | + if (!is_dir($template_path)) |
|
23 | 23 | { |
24 | - if($oModule->module_info->module == $oModule->module) |
|
24 | + if ($oModule->module_info->module == $oModule->module) |
|
25 | 25 | { |
26 | 26 | $skin = $oModule->origin_module_info->skin; |
27 | 27 | } |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | $skin = $oModule->module_config->skin; |
31 | 31 | } |
32 | 32 | |
33 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
33 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
34 | 34 | { |
35 | - if($skin && is_string($skin)) |
|
35 | + if ($skin && is_string($skin)) |
|
36 | 36 | { |
37 | 37 | $theme_skin = explode('|@|', $skin); |
38 | 38 | $template_path = $oModule->getTemplatePath(); |
39 | - if(count($theme_skin) == 2) |
|
39 | + if (count($theme_skin) == 2) |
|
40 | 40 | { |
41 | 41 | $theme_path = sprintf('./themes/%s', $theme_skin[0]); |
42 | 42 | // FIXME $theme_path $theme_path $theme_path ?? |
43 | - if(substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
43 | + if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
44 | 44 | { |
45 | 45 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
46 | 46 | } |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | $output = $oTemplate->compile($template_path, $tpl_file); |
62 | 62 | |
63 | 63 | // add .x div for adminitration pages |
64 | - if(Context::getResponseMethod() == 'HTML') |
|
64 | + if (Context::getResponseMethod() == 'HTML') |
|
65 | 65 | { |
66 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
66 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
67 | 67 | { |
68 | - $output = '<div class="x">' . $output . '</div>'; |
|
68 | + $output = '<div class="x">'.$output.'</div>'; |
|
69 | 69 | } |
70 | 70 | |
71 | - if(Context::get('layout') != 'none') |
|
71 | + if (Context::get('layout') != 'none') |
|
72 | 72 | { |
73 | - if(__DEBUG__ == 3) |
|
73 | + if (__DEBUG__ == 3) |
|
74 | 74 | { |
75 | 75 | $start = getMicroTime(); |
76 | 76 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $layout_srl = $layout_info->layout_srl; |
89 | 89 | |
90 | 90 | // compile if connected to the layout |
91 | - if($layout_srl > 0) |
|
91 | + if ($layout_srl > 0) |
|
92 | 92 | { |
93 | 93 | |
94 | 94 | // handle separately if the layout is faceoff |
95 | - if($layout_info && $layout_info->type == 'faceoff') |
|
95 | + if ($layout_info && $layout_info->type == 'faceoff') |
|
96 | 96 | { |
97 | 97 | $oLayoutModel->doActivateFaceOff($layout_info); |
98 | 98 | Context::set('layout_info', $layout_info); |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | // search if the changes CSS exists in the admin layout edit window |
102 | 102 | $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); |
103 | 103 | |
104 | - if(FileHandler::exists($edited_layout_css)) |
|
104 | + if (FileHandler::exists($edited_layout_css)) |
|
105 | 105 | { |
106 | 106 | Context::loadFile(array($edited_layout_css, 'all', '', 100)); |
107 | 107 | } |
108 | 108 | } |
109 | - if(!$layout_path) |
|
109 | + if (!$layout_path) |
|
110 | 110 | { |
111 | 111 | $layout_path = './common/tpl'; |
112 | 112 | } |
113 | - if(!$layout_file) |
|
113 | + if (!$layout_file) |
|
114 | 114 | { |
115 | 115 | $layout_file = 'default_layout'; |
116 | 116 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // if popup_layout, remove admin bar. |
120 | 120 | $realLayoutPath = FileHandler::getRealPath($layout_path); |
121 | - if(substr_compare($realLayoutPath, '/', -1) !== 0) |
|
121 | + if (substr_compare($realLayoutPath, '/', -1) !== 0) |
|
122 | 122 | { |
123 | 123 | $realLayoutPath .= '/'; |
124 | 124 | } |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | $pathInfo = pathinfo($layout_file); |
127 | 127 | $onlyLayoutFile = $pathInfo['filename']; |
128 | 128 | |
129 | - if(__DEBUG__ == 3) |
|
129 | + if (__DEBUG__ == 3) |
|
130 | 130 | { |
131 | 131 | $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; |
132 | 132 | } |
133 | 133 | |
134 | - if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
134 | + if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
135 | 135 | { |
136 | 136 | Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); |
137 | 137 | } |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function prepareToPrint(&$output) |
149 | 149 | { |
150 | - if(Context::getResponseMethod() != 'HTML') |
|
150 | + if (Context::getResponseMethod() != 'HTML') |
|
151 | 151 | { |
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | - if(__DEBUG__ == 3) |
|
155 | + if (__DEBUG__ == 3) |
|
156 | 156 | { |
157 | 157 | $start = getMicroTime(); |
158 | 158 | } |
@@ -170,20 +170,20 @@ discard block |
||
170 | 170 | $output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output); |
171 | 171 | |
172 | 172 | // handles a relative path generated by using the rewrite module |
173 | - if(Context::isAllowRewrite()) |
|
173 | + if (Context::isAllowRewrite()) |
|
174 | 174 | { |
175 | 175 | $url = parse_url(Context::getRequestUri()); |
176 | 176 | $real_path = $url['path']; |
177 | 177 | |
178 | 178 | $pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s'; |
179 | - $output = preg_replace($pattern, 'src=$1' . $real_path . '$2$3', $output); |
|
179 | + $output = preg_replace($pattern, 'src=$1'.$real_path.'$2$3', $output); |
|
180 | 180 | |
181 | 181 | $pattern = '/href=("|\'){1}(\?[^"\']+)/s'; |
182 | - $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output); |
|
182 | + $output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output); |
|
183 | 183 | |
184 | - if(Context::get('vid')) |
|
184 | + if (Context::get('vid')) |
|
185 | 185 | { |
186 | - $pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is'; |
|
186 | + $pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is'; |
|
187 | 187 | $output = preg_replace($pattern, '/?$1=', $output); |
188 | 188 | } |
189 | 189 | } |
@@ -191,18 +191,18 @@ discard block |
||
191 | 191 | // prevent the 2nd request due to url(none) of the background-image |
192 | 192 | $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); |
193 | 193 | |
194 | - if(is_array(Context::get('INPUT_ERROR'))) |
|
194 | + if (is_array(Context::get('INPUT_ERROR'))) |
|
195 | 195 | { |
196 | 196 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
197 | 197 | $keys = array_keys($INPUT_ERROR); |
198 | - $keys = '(' . implode('|', $keys) . ')'; |
|
198 | + $keys = '('.implode('|', $keys).')'; |
|
199 | 199 | |
200 | - $output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
201 | - $output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
202 | - $output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
200 | + $output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
201 | + $output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
202 | + $output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
203 | 203 | } |
204 | 204 | |
205 | - if(__DEBUG__ == 3) |
|
205 | + if (__DEBUG__ == 3) |
|
206 | 206 | { |
207 | 207 | $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; |
208 | 208 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | // convert the final layout |
221 | 221 | Context::set('content', $output); |
222 | 222 | $oTemplate = TemplateHandler::getInstance(); |
223 | - if(Mobile::isFromMobilePhone()) |
|
223 | + if (Mobile::isFromMobilePhone()) |
|
224 | 224 | { |
225 | 225 | $this->_loadMobileJSCSS(); |
226 | 226 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | { |
246 | 246 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
247 | 247 | |
248 | - $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4]; |
|
248 | + $str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4]; |
|
249 | 249 | |
250 | 250 | // get type |
251 | 251 | $type = 'text'; |
252 | - if(preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
252 | + if (preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
253 | 253 | { |
254 | 254 | $type = strtolower($m[1]); |
255 | 255 | } |
256 | 256 | |
257 | - switch($type) |
|
257 | + switch ($type) |
|
258 | 258 | { |
259 | 259 | case 'text': |
260 | 260 | case 'hidden': |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | case 'number': |
273 | 273 | case 'range': |
274 | 274 | case 'color': |
275 | - $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"'; |
|
275 | + $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"'; |
|
276 | 276 | break; |
277 | 277 | case 'password': |
278 | 278 | $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str); |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | case 'radio': |
281 | 281 | case 'checkbox': |
282 | 282 | $str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); |
283 | - if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) |
|
283 | + if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str)) |
|
284 | 284 | { |
285 | 285 | $str .= ' checked="checked"'; |
286 | 286 | } |
287 | 287 | break; |
288 | 288 | } |
289 | 289 | |
290 | - return $str . ' />'; |
|
290 | + return $str.' />'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m); |
305 | 305 | |
306 | 306 | $key = array_search($INPUT_ERROR[$matches[1]], $m[1]); |
307 | - if($key === FALSE) |
|
307 | + if ($key === FALSE) |
|
308 | 308 | { |
309 | 309 | return $matches[0]; |
310 | 310 | } |
311 | 311 | |
312 | 312 | $m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); |
313 | 313 | |
314 | - return $mm[0] . implode('', $m[0]) . '</select>'; |
|
314 | + return $mm[0].implode('', $m[0]).'</select>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
325 | 325 | preg_match('@<textarea.*?>@is', $matches[0], $mm); |
326 | - return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>'; |
|
326 | + return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | function _moveStyleToHeader($matches) |
336 | 336 | { |
337 | - if(isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
337 | + if (isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
338 | 338 | { |
339 | 339 | return $matches[0]; |
340 | 340 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | function _transMeta($matches) |
372 | 372 | { |
373 | - if($matches[1]) |
|
373 | + if ($matches[1]) |
|
374 | 374 | { |
375 | 375 | return ''; |
376 | 376 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $lang_type = Context::getLangType(); |
388 | 388 | |
389 | 389 | // add common JS/CSS files |
390 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
390 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
391 | 391 | { |
392 | 392 | $oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true); |
393 | 393 | $oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true); |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
401 | 401 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
402 | 402 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
403 | - if(!__DISABLE_DEFAULT_CSS__) |
|
403 | + if (!__DISABLE_DEFAULT_CSS__) |
|
404 | 404 | { |
405 | 405 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
406 | 406 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
416 | 416 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
417 | 417 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
418 | - if(!__DISABLE_DEFAULT_CSS__) |
|
418 | + if (!__DISABLE_DEFAULT_CSS__) |
|
419 | 419 | { |
420 | 420 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
421 | 421 | } |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // for admin page, add admin css |
429 | - if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
429 | + if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
430 | 430 | { |
431 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
431 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
432 | 432 | { |
433 | 433 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true); |
434 | 434 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $lang_type = Context::getLangType(); |
461 | 461 | |
462 | 462 | // add common JS/CSS files |
463 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
463 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
464 | 464 | { |
465 | 465 | $oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true); |
466 | 466 | $oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
473 | 473 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
474 | 474 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
475 | - if(!__DISABLE_DEFAULT_CSS__) |
|
475 | + if (!__DISABLE_DEFAULT_CSS__) |
|
476 | 476 | { |
477 | 477 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
478 | 478 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
489 | 489 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
490 | 490 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
491 | - if(!__DISABLE_DEFAULT_CSS__) |
|
491 | + if (!__DISABLE_DEFAULT_CSS__) |
|
492 | 492 | { |
493 | 493 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
494 | 494 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | if($oModule->module_info->module == $oModule->module) |
25 | 25 | { |
26 | 26 | $skin = $oModule->origin_module_info->skin; |
27 | - } |
|
28 | - else |
|
27 | + } else |
|
29 | 28 | { |
30 | 29 | $skin = $oModule->module_config->skin; |
31 | 30 | } |
@@ -45,13 +44,11 @@ discard block |
||
45 | 44 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
46 | 45 | } |
47 | 46 | } |
48 | - } |
|
49 | - else |
|
47 | + } else |
|
50 | 48 | { |
51 | 49 | $template_path = $oModule->getTemplatePath(); |
52 | 50 | } |
53 | - } |
|
54 | - else |
|
51 | + } else |
|
55 | 52 | { |
56 | 53 | $template_path = $oModule->getTemplatePath(); |
57 | 54 | } |
@@ -224,8 +221,7 @@ discard block |
||
224 | 221 | { |
225 | 222 | $this->_loadMobileJSCSS(); |
226 | 223 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
227 | - } |
|
228 | - else |
|
224 | + } else |
|
229 | 225 | { |
230 | 226 | $this->_loadJSCSS(); |
231 | 227 | $output = $oTemplate->compile('./common/tpl', 'common_layout'); |
@@ -403,13 +399,11 @@ discard block |
||
403 | 399 | if(!__DISABLE_DEFAULT_CSS__) |
404 | 400 | { |
405 | 401 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
406 | - } |
|
407 | - else |
|
402 | + } else |
|
408 | 403 | { |
409 | 404 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
410 | 405 | } |
411 | - } |
|
412 | - else |
|
406 | + } else |
|
413 | 407 | { |
414 | 408 | $oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1110000), true); |
415 | 409 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
@@ -418,8 +412,7 @@ discard block |
||
418 | 412 | if(!__DISABLE_DEFAULT_CSS__) |
419 | 413 | { |
420 | 414 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
421 | - } |
|
422 | - else |
|
415 | + } else |
|
423 | 416 | { |
424 | 417 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
425 | 418 | } |
@@ -437,8 +430,7 @@ discard block |
||
437 | 430 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true); |
438 | 431 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true); |
439 | 432 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true); |
440 | - } |
|
441 | - else |
|
433 | + } else |
|
442 | 434 | { |
443 | 435 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true); |
444 | 436 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -476,14 +468,12 @@ discard block |
||
476 | 468 | { |
477 | 469 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
478 | 470 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
479 | - } |
|
480 | - else |
|
471 | + } else |
|
481 | 472 | { |
482 | 473 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
483 | 474 | $oContext->unloadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
484 | 475 | } |
485 | - } |
|
486 | - else |
|
476 | + } else |
|
487 | 477 | { |
488 | 478 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
489 | 479 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
@@ -492,8 +482,7 @@ discard block |
||
492 | 482 | { |
493 | 483 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
494 | 484 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
495 | - } |
|
496 | - else |
|
485 | + } else |
|
497 | 486 | { |
498 | 487 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
499 | 488 | $oContext->unloadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |