@@ -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 | } |
@@ -279,6 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | 281 | * @brief Specify title |
| 282 | + * @param string $title |
|
| 282 | 283 | */ |
| 283 | 284 | function setTitle($title) |
| 284 | 285 | { |
@@ -298,6 +299,7 @@ discard block |
||
| 298 | 299 | /** |
| 299 | 300 | * @brief Content Cleanup |
| 300 | 301 | * In HTML content, the ability to extract text and links |
| 302 | + * @param string $content |
|
| 301 | 303 | */ |
| 302 | 304 | function setContent($content) |
| 303 | 305 | { |
@@ -371,6 +373,9 @@ discard block |
||
| 371 | 373 | |
| 372 | 374 | /** |
| 373 | 375 | * @brief cutting the number of byte functions |
| 376 | + * @param string $string |
|
| 377 | + * @param integer $cut_size |
|
| 378 | + * @return string |
|
| 374 | 379 | */ |
| 375 | 380 | function cutStr($string, $cut_size) |
| 376 | 381 | { |
@@ -387,6 +392,8 @@ discard block |
||
| 387 | 392 | |
| 388 | 393 | /** |
| 389 | 394 | * @brief Specifies the home url |
| 395 | + * @param string $url |
|
| 396 | + * @param string $text |
|
| 390 | 397 | */ |
| 391 | 398 | function setHomeUrl($url, $text) |
| 392 | 399 | { |
@@ -397,6 +404,8 @@ discard block |
||
| 397 | 404 | |
| 398 | 405 | /** |
| 399 | 406 | * @brief Specify upper url |
| 407 | + * @param string $url |
|
| 408 | + * @param string $text |
|
| 400 | 409 | */ |
| 401 | 410 | function setUpperUrl($url, $text) |
| 402 | 411 | { |
@@ -407,6 +416,8 @@ discard block |
||
| 407 | 416 | |
| 408 | 417 | /** |
| 409 | 418 | * @brief Specify prev url |
| 419 | + * @param string $url |
|
| 420 | + * @param string $text |
|
| 410 | 421 | */ |
| 411 | 422 | function setPrevUrl($url, $text) |
| 412 | 423 | { |
@@ -417,6 +428,8 @@ discard block |
||
| 417 | 428 | |
| 418 | 429 | /** |
| 419 | 430 | * @brief Specify next url |
| 431 | + * @param string $url |
|
| 432 | + * @param string $text |
|
| 420 | 433 | */ |
| 421 | 434 | function setNextUrl($url, $text) |
| 422 | 435 | { |
@@ -49,7 +49,9 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | |
| 51 | 51 | $browserType = mobileXE::getBrowserType(); |
| 52 | - if(!$browserType) return; |
|
| 52 | + if(!$browserType) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | $class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); |
| 55 | 57 | require_once($class_file); |
@@ -59,14 +61,18 @@ discard block |
||
| 59 | 61 | { |
| 60 | 62 | $lang_supported = Context::get('lang_supported'); |
| 61 | 63 | $this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); |
| 62 | - if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang); |
|
| 64 | + if(isset($lang_supported[$this->lang])) { |
|
| 65 | + Context::setLangType($this->lang); |
|
| 66 | + } |
|
| 63 | 67 | } |
| 64 | 68 | Context::loadLang(_XE_PATH_.'addons/mobile/lang'); |
| 65 | 69 | |
| 66 | 70 | $instance = new wap(); |
| 67 | 71 | |
| 68 | 72 | $mobilePage = (int)Context::get('mpage'); |
| 69 | - if(!$mobilePage) $mobilePage = 1; |
|
| 73 | + if(!$mobilePage) { |
|
| 74 | + $mobilePage = 1; |
|
| 75 | + } |
|
| 70 | 76 | |
| 71 | 77 | $instance->setMobilePage($mobilePage); |
| 72 | 78 | } |
@@ -107,8 +113,11 @@ discard block |
||
| 107 | 113 | */ |
| 108 | 114 | function isLangChange() |
| 109 | 115 | { |
| 110 | - if($this->languageMode) return true; |
|
| 111 | - else return false; |
|
| 116 | + if($this->languageMode) { |
|
| 117 | + return true; |
|
| 118 | + } else { |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 112 | 121 | } |
| 113 | 122 | |
| 114 | 123 | /** |
@@ -122,7 +131,9 @@ discard block |
||
| 122 | 131 | if($this->lang && isset($lang_supported[$this->lang])) |
| 123 | 132 | { |
| 124 | 133 | $langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
| 125 | - if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
|
| 134 | + if($langbuff) { |
|
| 135 | + FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
|
| 136 | + } |
|
| 126 | 137 | $langbuff = '<?php /**'.$this->lang.'**/ ?>'; |
| 127 | 138 | FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff); |
| 128 | 139 | } |
@@ -133,7 +144,9 @@ discard block |
||
| 133 | 144 | */ |
| 134 | 145 | function setModuleInfo(&$module_info) |
| 135 | 146 | { |
| 136 | - if($this->module_info) return; |
|
| 147 | + if($this->module_info) { |
|
| 148 | + return; |
|
| 149 | + } |
|
| 137 | 150 | $this->module_info = $module_info; |
| 138 | 151 | } |
| 139 | 152 | |
@@ -142,12 +155,16 @@ discard block |
||
| 142 | 155 | */ |
| 143 | 156 | function setModuleInstance(&$oModule) |
| 144 | 157 | { |
| 145 | - if($this->oModule) return; |
|
| 158 | + if($this->oModule) { |
|
| 159 | + return; |
|
| 160 | + } |
|
| 146 | 161 | // Save instance |
| 147 | 162 | $this->oModule = $oModule; |
| 148 | 163 | // Of the current module if there is a menu by menu |
| 149 | 164 | $menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl); |
| 150 | - if(!file_exists($menu_cache_file)) return; |
|
| 165 | + if(!file_exists($menu_cache_file)) { |
|
| 166 | + return; |
|
| 167 | + } |
|
| 151 | 168 | |
| 152 | 169 | include $menu_cache_file; |
| 153 | 170 | // One-dimensional arrangement of menu changes |
@@ -168,10 +185,11 @@ discard block |
||
| 168 | 185 | if($parent_srl && $listed_items[$parent_srl]) |
| 169 | 186 | { |
| 170 | 187 | $parent_item = $listed_items[$parent_srl]; |
| 171 | - if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); |
|
| 188 | + if($parent_item) { |
|
| 189 | + $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); |
|
| 190 | + } |
|
| 172 | 191 | } |
| 173 | - } |
|
| 174 | - elseif (!$this->isNavigationMode()) |
|
| 192 | + } elseif (!$this->isNavigationMode()) |
|
| 175 | 193 | { |
| 176 | 194 | $this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap')); |
| 177 | 195 | } |
@@ -183,7 +201,9 @@ discard block |
||
| 183 | 201 | */ |
| 184 | 202 | function getBrowserType() |
| 185 | 203 | { |
| 186 | - if(Context::get('smartphone')) return null; |
|
| 204 | + if(Context::get('smartphone')) { |
|
| 205 | + return null; |
|
| 206 | + } |
|
| 187 | 207 | // Determine the type of browser |
| 188 | 208 | $browserAccept = $_SERVER['HTTP_ACCEPT']; |
| 189 | 209 | $userAgent = $_SERVER['HTTP_USER_AGENT']; |
@@ -193,9 +213,11 @@ discard block |
||
| 193 | 213 | { |
| 194 | 214 | Context::set('mobile_skt',1); |
| 195 | 215 | return "wml"; |
| 216 | + } elseif(stripos($browserAccept, "hdml") !== FALSE) { |
|
| 217 | + return "hdml"; |
|
| 218 | + } elseif(stripos($userAgent, "cellphone") !== FALSE) { |
|
| 219 | + return "mhtml"; |
|
| 196 | 220 | } |
| 197 | - elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml"; |
|
| 198 | - elseif(stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; |
|
| 199 | 221 | return null; |
| 200 | 222 | } |
| 201 | 223 | |
@@ -204,9 +226,13 @@ discard block |
||
| 204 | 226 | */ |
| 205 | 227 | function setCharSet($charset = 'UTF-8') |
| 206 | 228 | { |
| 207 | - if(!$charset) $charset = 'UTF-8'; |
|
| 229 | + if(!$charset) { |
|
| 230 | + $charset = 'UTF-8'; |
|
| 231 | + } |
|
| 208 | 232 | // SKT supports the euc-kr |
| 209 | - if(Context::get('mobile_skt')==1) $charset = 'euc-kr'; |
|
| 233 | + if(Context::get('mobile_skt')==1) { |
|
| 234 | + $charset = 'euc-kr'; |
|
| 235 | + } |
|
| 210 | 236 | |
| 211 | 237 | $this->charset = $charset; |
| 212 | 238 | } |
@@ -216,7 +242,9 @@ discard block |
||
| 216 | 242 | */ |
| 217 | 243 | function setMobilePage($page=1) |
| 218 | 244 | { |
| 219 | - if(!$page) $page = 1; |
|
| 245 | + if(!$page) { |
|
| 246 | + $page = 1; |
|
| 247 | + } |
|
| 220 | 248 | $this->mobilePage = $page; |
| 221 | 249 | } |
| 222 | 250 | |
@@ -329,7 +357,9 @@ discard block |
||
| 329 | 357 | |
| 330 | 358 | foreach($allow_tag_array as $tag) |
| 331 | 359 | { |
| 332 | - if($tag == '<br>') continue; |
|
| 360 | + if($tag == '<br>') { |
|
| 361 | + continue; |
|
| 362 | + } |
|
| 333 | 363 | $tag_open_pos = strpos($content, str_replace('>','',$tag)); |
| 334 | 364 | $tag_close_pos = strpos($content, str_replace('<','</',$tag)); |
| 335 | 365 | if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) |
@@ -390,7 +420,9 @@ discard block |
||
| 390 | 420 | */ |
| 391 | 421 | function setHomeUrl($url, $text) |
| 392 | 422 | { |
| 393 | - if(!$url) $url = '#'; |
|
| 423 | + if(!$url) { |
|
| 424 | + $url = '#'; |
|
| 425 | + } |
|
| 394 | 426 | $this->homeUrl->url = $url; |
| 395 | 427 | $this->homeUrl->text = $text; |
| 396 | 428 | } |
@@ -400,7 +432,9 @@ discard block |
||
| 400 | 432 | */ |
| 401 | 433 | function setUpperUrl($url, $text) |
| 402 | 434 | { |
| 403 | - if(!$url) $url = '#'; |
|
| 435 | + if(!$url) { |
|
| 436 | + $url = '#'; |
|
| 437 | + } |
|
| 404 | 438 | $this->upperUrl->url = $url; |
| 405 | 439 | $this->upperUrl->text = $text; |
| 406 | 440 | } |
@@ -410,7 +444,9 @@ discard block |
||
| 410 | 444 | */ |
| 411 | 445 | function setPrevUrl($url, $text) |
| 412 | 446 | { |
| 413 | - if(!$url) $url = '#'; |
|
| 447 | + if(!$url) { |
|
| 448 | + $url = '#'; |
|
| 449 | + } |
|
| 414 | 450 | $this->prevUrl->url = $url; |
| 415 | 451 | $this->prevUrl->text = $text; |
| 416 | 452 | } |
@@ -420,7 +456,9 @@ discard block |
||
| 420 | 456 | */ |
| 421 | 457 | function setNextUrl($url, $text) |
| 422 | 458 | { |
| 423 | - if(!$url) $url = '#'; |
|
| 459 | + if(!$url) { |
|
| 460 | + $url = '#'; |
|
| 461 | + } |
|
| 424 | 462 | $this->nextUrl->url = $url; |
| 425 | 463 | $this->nextUrl->text = $text; |
| 426 | 464 | } |
@@ -430,7 +468,9 @@ discard block |
||
| 430 | 468 | */ |
| 431 | 469 | function setEtcBtn($url, $text) |
| 432 | 470 | { |
| 433 | - if(!$url) $url = '#'; |
|
| 471 | + if(!$url) { |
|
| 472 | + $url = '#'; |
|
| 473 | + } |
|
| 434 | 474 | $etc['url'] = $url; |
| 435 | 475 | $etc['text'] = htmlspecialchars($text); |
| 436 | 476 | $this->etcBtn[] = $etc; |
@@ -444,7 +484,9 @@ discard block |
||
| 444 | 484 | // Home button assignments |
| 445 | 485 | $this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home')); |
| 446 | 486 | // Specify the title |
| 447 | - if(!$this->title) $this->setTitle(Context::getBrowserTitle()); |
|
| 487 | + if(!$this->title) { |
|
| 488 | + $this->setTitle(Context::getBrowserTitle()); |
|
| 489 | + } |
|
| 448 | 490 | |
| 449 | 491 | ob_start(); |
| 450 | 492 | // Output header |
@@ -460,8 +502,11 @@ discard block |
||
| 460 | 502 | |
| 461 | 503 | $content = ob_get_clean(); |
| 462 | 504 | // After conversion output |
| 463 | - if(strtolower($this->charset) == 'utf-8') print $content; |
|
| 464 | - else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); |
|
| 505 | + if(strtolower($this->charset) == 'utf-8') { |
|
| 506 | + print $content; |
|
| 507 | + } else { |
|
| 508 | + print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); |
|
| 509 | + } |
|
| 465 | 510 | |
| 466 | 511 | exit(); |
| 467 | 512 | } |
@@ -490,15 +535,16 @@ discard block |
||
| 490 | 535 | */ |
| 491 | 536 | function getListedItems($menu, &$listed_items, &$node_list) |
| 492 | 537 | { |
| 493 | - if(!count($menu)) return; |
|
| 538 | + if(!count($menu)) { |
|
| 539 | + return; |
|
| 540 | + } |
|
| 494 | 541 | foreach($menu as $node_srl => $item) |
| 495 | 542 | { |
| 496 | 543 | if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) |
| 497 | 544 | { |
| 498 | 545 | $mid = $item['mid'] = $item['url']; |
| 499 | 546 | $node_list[$mid] = $node_srl; |
| 500 | - } |
|
| 501 | - else |
|
| 547 | + } else |
|
| 502 | 548 | { |
| 503 | 549 | $mid = $item['mid'] = null; |
| 504 | 550 | } |
@@ -529,8 +575,7 @@ discard block |
||
| 529 | 575 | $childs[] = $obj; |
| 530 | 576 | } |
| 531 | 577 | |
| 532 | - } |
|
| 533 | - else |
|
| 578 | + } else |
|
| 534 | 579 | { |
| 535 | 580 | $list = $this->menu; |
| 536 | 581 | $upper_srl = 0; |
@@ -540,13 +585,14 @@ discard block |
||
| 540 | 585 | { |
| 541 | 586 | foreach($list as $key => $val) |
| 542 | 587 | { |
| 543 | - if(!$val['text']) continue; |
|
| 588 | + if(!$val['text']) { |
|
| 589 | + continue; |
|
| 590 | + } |
|
| 544 | 591 | $obj = array(); |
| 545 | 592 | if(!count($val['list'])) |
| 546 | 593 | { |
| 547 | 594 | $obj['href'] = getUrl('','mid',$val['url']); |
| 548 | - } |
|
| 549 | - else |
|
| 595 | + } else |
|
| 550 | 596 | { |
| 551 | 597 | $obj['href'] = getUrl('cmid',$val['node_srl']); |
| 552 | 598 | } |
@@ -602,10 +648,14 @@ discard block |
||
| 602 | 648 | { |
| 603 | 649 | // Create WAP class objects of the selected module |
| 604 | 650 | $oModule = &getWap($this->module_info->module); |
| 605 | - if(!$oModule || !method_exists($oModule, 'procWAP') ) return; |
|
| 651 | + if(!$oModule || !method_exists($oModule, 'procWAP') ) { |
|
| 652 | + return; |
|
| 653 | + } |
|
| 606 | 654 | |
| 607 | 655 | $vars = get_object_vars($this->oModule); |
| 608 | - if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val; |
|
| 656 | + if(count($vars)) { |
|
| 657 | + foreach($vars as $key => $val) $oModule->{$key} = $val; |
|
| 658 | + } |
|
| 609 | 659 | // Run |
| 610 | 660 | $oModule->procWAP($this); |
| 611 | 661 | // Output |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | static $instance = null; |
| 47 | 47 | |
| 48 | - if(!$instance) |
|
| 48 | + if (!$instance) |
|
| 49 | 49 | { |
| 50 | 50 | |
| 51 | 51 | $browserType = mobileXE::getBrowserType(); |
| 52 | - if(!$browserType) return; |
|
| 52 | + if (!$browserType) return; |
|
| 53 | 53 | |
| 54 | 54 | $class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); |
| 55 | 55 | require_once($class_file); |
| 56 | 56 | // Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..) |
| 57 | 57 | $this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
| 58 | - if($this->lang) |
|
| 58 | + if ($this->lang) |
|
| 59 | 59 | { |
| 60 | 60 | $lang_supported = Context::get('lang_supported'); |
| 61 | - $this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); |
|
| 62 | - if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang); |
|
| 61 | + $this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); |
|
| 62 | + if (isset($lang_supported[$this->lang])) Context::setLangType($this->lang); |
|
| 63 | 63 | } |
| 64 | 64 | Context::loadLang(_XE_PATH_.'addons/mobile/lang'); |
| 65 | 65 | |
| 66 | 66 | $instance = new wap(); |
| 67 | 67 | |
| 68 | - $mobilePage = (int)Context::get('mpage'); |
|
| 69 | - if(!$mobilePage) $mobilePage = 1; |
|
| 68 | + $mobilePage = (int) Context::get('mpage'); |
|
| 69 | + if (!$mobilePage) $mobilePage = 1; |
|
| 70 | 70 | |
| 71 | 71 | $instance->setMobilePage($mobilePage); |
| 72 | 72 | } |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | function mobileXE() |
| 80 | 80 | { |
| 81 | 81 | // Check navigation mode |
| 82 | - if(Context::get('nm')) |
|
| 82 | + if (Context::get('nm')) |
|
| 83 | 83 | { |
| 84 | 84 | $this->navigationMode = 1; |
| 85 | - $this->cmid = (int)Context::get('cmid'); |
|
| 85 | + $this->cmid = (int) Context::get('cmid'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if(Context::get('lcm')) |
|
| 88 | + if (Context::get('lcm')) |
|
| 89 | 89 | { |
| 90 | 90 | $this->languageMode = 1; |
| 91 | 91 | $this->lang = Context::get('sel_lang'); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | function isNavigationMode() |
| 100 | 100 | { |
| 101 | - return ($this->navigationMode && $this->module_info->menu_srl)?true:false; |
|
| 101 | + return ($this->navigationMode && $this->module_info->menu_srl) ?true:false; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | function isLangChange() |
| 109 | 109 | { |
| 110 | - if($this->languageMode) return true; |
|
| 110 | + if ($this->languageMode) return true; |
|
| 111 | 111 | else return false; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $lang_supported = Context::get('lang_supported'); |
| 121 | 121 | // Make sure that the language variables and parameters are valid |
| 122 | - if($this->lang && isset($lang_supported[$this->lang])) |
|
| 122 | + if ($this->lang && isset($lang_supported[$this->lang])) |
|
| 123 | 123 | { |
| 124 | 124 | $langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
| 125 | - if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
|
| 125 | + if ($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
|
| 126 | 126 | $langbuff = '<?php /**'.$this->lang.'**/ ?>'; |
| 127 | - FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff); |
|
| 127 | + FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php', $langbuff); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function setModuleInfo(&$module_info) |
| 135 | 135 | { |
| 136 | - if($this->module_info) return; |
|
| 136 | + if ($this->module_info) return; |
|
| 137 | 137 | $this->module_info = $module_info; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function setModuleInstance(&$oModule) |
| 144 | 144 | { |
| 145 | - if($this->oModule) return; |
|
| 145 | + if ($this->oModule) return; |
|
| 146 | 146 | // Save instance |
| 147 | 147 | $this->oModule = $oModule; |
| 148 | 148 | // Of the current module if there is a menu by menu |
| 149 | 149 | $menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl); |
| 150 | - if(!file_exists($menu_cache_file)) return; |
|
| 150 | + if (!file_exists($menu_cache_file)) return; |
|
| 151 | 151 | |
| 152 | 152 | include $menu_cache_file; |
| 153 | 153 | // One-dimensional arrangement of menu changes |
@@ -162,18 +162,18 @@ discard block |
||
| 162 | 162 | $this->index_mid = $k[0]; |
| 163 | 163 | // The depth of the current menu, the top button to specify if one or more |
| 164 | 164 | $cur_menu_item = $listed_items[$node_list[$this->module_info->mid]]; |
| 165 | - if($cur_menu_item['parent_srl']) |
|
| 165 | + if ($cur_menu_item['parent_srl']) |
|
| 166 | 166 | { |
| 167 | 167 | $parent_srl = $cur_menu_item['parent_srl']; |
| 168 | - if($parent_srl && $listed_items[$parent_srl]) |
|
| 168 | + if ($parent_srl && $listed_items[$parent_srl]) |
|
| 169 | 169 | { |
| 170 | 170 | $parent_item = $listed_items[$parent_srl]; |
| 171 | - if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); |
|
| 171 | + if ($parent_item) $this->setUpperUrl(getUrl('', 'mid', $parent_item['mid']), Context::getLang('cmd_go_upper')); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | elseif (!$this->isNavigationMode()) |
| 175 | 175 | { |
| 176 | - $this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap')); |
|
| 176 | + $this->setUpperUrl(getUrl('', 'mid', $this->index_mid, 'nm', '1', 'cmid', 0), Context::getLang('cmd_view_sitemap')); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | function getBrowserType() |
| 185 | 185 | { |
| 186 | - if(Context::get('smartphone')) return null; |
|
| 186 | + if (Context::get('smartphone')) return null; |
|
| 187 | 187 | // Determine the type of browser |
| 188 | 188 | $browserAccept = $_SERVER['HTTP_ACCEPT']; |
| 189 | 189 | $userAgent = $_SERVER['HTTP_USER_AGENT']; |
| 190 | 190 | $wap_sid = $_SERVER['HTTP_X_UP_SUBNO']; |
| 191 | 191 | |
| 192 | - if(stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE) |
|
| 192 | + if (stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE) |
|
| 193 | 193 | { |
| 194 | - Context::set('mobile_skt',1); |
|
| 194 | + Context::set('mobile_skt', 1); |
|
| 195 | 195 | return "wml"; |
| 196 | 196 | } |
| 197 | - elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml"; |
|
| 198 | - elseif(stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; |
|
| 197 | + elseif (stripos($browserAccept, "hdml") !== FALSE) return "hdml"; |
|
| 198 | + elseif (stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; |
|
| 199 | 199 | return null; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | function setCharSet($charset = 'UTF-8') |
| 206 | 206 | { |
| 207 | - if(!$charset) $charset = 'UTF-8'; |
|
| 207 | + if (!$charset) $charset = 'UTF-8'; |
|
| 208 | 208 | // SKT supports the euc-kr |
| 209 | - if(Context::get('mobile_skt')==1) $charset = 'euc-kr'; |
|
| 209 | + if (Context::get('mobile_skt') == 1) $charset = 'euc-kr'; |
|
| 210 | 210 | |
| 211 | 211 | $this->charset = $charset; |
| 212 | 212 | } |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | /** |
| 215 | 215 | * @brief Limited capacity of mobile devices, specifying a different virtual page |
| 216 | 216 | */ |
| 217 | - function setMobilePage($page=1) |
|
| 217 | + function setMobilePage($page = 1) |
|
| 218 | 218 | { |
| 219 | - if(!$page) $page = 1; |
|
| 219 | + if (!$page) $page = 1; |
|
| 220 | 220 | $this->mobilePage = $page; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -227,34 +227,34 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | // If more than nine the number of menu paging processing itself |
| 229 | 229 | $menu_count = count($childs); |
| 230 | - if($menu_count>9) |
|
| 230 | + if ($menu_count > 9) |
|
| 231 | 231 | { |
| 232 | - $startNum = ($this->mobilePage-1)*9; |
|
| 232 | + $startNum = ($this->mobilePage - 1) * 9; |
|
| 233 | 233 | $idx = 0; |
| 234 | 234 | $new_childs = array(); |
| 235 | - foreach($childs as $k => $v) |
|
| 235 | + foreach ($childs as $k => $v) |
|
| 236 | 236 | { |
| 237 | - if($idx >= $startNum && $idx < $startNum+9) |
|
| 237 | + if ($idx >= $startNum && $idx < $startNum + 9) |
|
| 238 | 238 | { |
| 239 | 239 | $new_childs[$k] = $v; |
| 240 | 240 | } |
| 241 | - $idx ++; |
|
| 241 | + $idx++; |
|
| 242 | 242 | } |
| 243 | 243 | $childs = $new_childs; |
| 244 | 244 | |
| 245 | - $this->totalPage = (int)(($menu_count-1)/9)+1; |
|
| 245 | + $this->totalPage = (int) (($menu_count - 1) / 9) + 1; |
|
| 246 | 246 | // next/prevUrl specify |
| 247 | - if($this->mobilePage>1) |
|
| 247 | + if ($this->mobilePage > 1) |
|
| 248 | 248 | { |
| 249 | - $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); |
|
| 250 | - $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); |
|
| 249 | + $url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1); |
|
| 250 | + $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage); |
|
| 251 | 251 | $this->setPrevUrl($url, $text); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if($this->mobilePage<$this->totalPage) |
|
| 254 | + if ($this->mobilePage < $this->totalPage) |
|
| 255 | 255 | { |
| 256 | - $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1); |
|
| 257 | - $text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage); |
|
| 256 | + $url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1); |
|
| 257 | + $text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage); |
|
| 258 | 258 | $this->setNextUrl($url, $text); |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function hasChilds() |
| 268 | 268 | { |
| 269 | - return count($this->childs)?true:0; |
|
| 269 | + return count($this->childs) ?true:0; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | function setContent($content) |
| 303 | 303 | { |
| 304 | 304 | $oModuleController = getController('module'); |
| 305 | - $allow_tag_array = array('<a>','<br>','<p>','<b>','<i>','<u>','<em>','<small>','<strong>','<big>','<table>','<tr>','<td>'); |
|
| 305 | + $allow_tag_array = array('<a>', '<br>', '<p>', '<b>', '<i>', '<u>', '<em>', '<small>', '<strong>', '<big>', '<table>', '<tr>', '<td>'); |
|
| 306 | 306 | // Links/wrap, remove all tags except gangjoman |
| 307 | 307 | $content = strip_tags($content, implode($allow_tag_array)); |
| 308 | 308 | // Margins tab removed |
@@ -310,16 +310,16 @@ discard block |
||
| 310 | 310 | // Repeat two more times the space and remove julnanumeul |
| 311 | 311 | $content = preg_replace('/( ){2,}/s', '', $content); |
| 312 | 312 | $content = preg_replace("/([\r\n]+)/s", "\r\n", $content); |
| 313 | - $content = preg_replace(array("/<a/i","/<\/a/i","/<b/i","/<\/b/i","/<br/i"),array('<a','</a','<b','</b','<br'),$content); |
|
| 314 | - $content = str_replace(array("<br>","<br />"), array("<br/>","<br/>"), $content); |
|
| 313 | + $content = preg_replace(array("/<a/i", "/<\/a/i", "/<b/i", "/<\/b/i", "/<br/i"), array('<a', '</a', '<b', '</b', '<br'), $content); |
|
| 314 | + $content = str_replace(array("<br>", "<br />"), array("<br/>", "<br/>"), $content); |
|
| 315 | 315 | |
| 316 | - while(strpos($content, '<br/><br/>')) |
|
| 316 | + while (strpos($content, '<br/><br/>')) |
|
| 317 | 317 | { |
| 318 | - $content = str_replace('<br/><br/>','<br/>',$content); |
|
| 318 | + $content = str_replace('<br/><br/>', '<br/>', $content); |
|
| 319 | 319 | } |
| 320 | 320 | // If the required size of a deck of mobile content to write down all the dividing pages |
| 321 | 321 | $contents = array(); |
| 322 | - while($content) |
|
| 322 | + while ($content) |
|
| 323 | 323 | { |
| 324 | 324 | $tmp = $this->cutStr($content, $this->deckSize, ''); |
| 325 | 325 | $contents[] = $tmp; |
@@ -327,46 +327,46 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | //$content = str_replace(array('&','<','>','"','&nbsp;'), array('&','<','>','"',' '), $content); |
| 329 | 329 | |
| 330 | - foreach($allow_tag_array as $tag) |
|
| 330 | + foreach ($allow_tag_array as $tag) |
|
| 331 | 331 | { |
| 332 | - if($tag == '<br>') continue; |
|
| 333 | - $tag_open_pos = strpos($content, str_replace('>','',$tag)); |
|
| 334 | - $tag_close_pos = strpos($content, str_replace('<','</',$tag)); |
|
| 335 | - if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) |
|
| 332 | + if ($tag == '<br>') continue; |
|
| 333 | + $tag_open_pos = strpos($content, str_replace('>', '', $tag)); |
|
| 334 | + $tag_close_pos = strpos($content, str_replace('<', '</', $tag)); |
|
| 335 | + if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos) |
|
| 336 | 336 | { |
| 337 | - $contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1); |
|
| 337 | + $contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1); |
|
| 338 | 338 | $content = substr($content, $tag_close_pos + strlen($tag) + 1); |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $tag_open_pos = strpos($content, '&'); |
| 343 | 343 | $tag_close_pos = strpos($content, ';'); |
| 344 | - if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) |
|
| 344 | + if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos) |
|
| 345 | 345 | { |
| 346 | - $contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + 1); |
|
| 346 | + $contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + 1); |
|
| 347 | 347 | $content = substr($content, $tag_close_pos + 1); |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $this->totalPage = count($contents); |
| 352 | 352 | // next/prevUrl specify |
| 353 | - if($this->mobilePage>1) |
|
| 353 | + if ($this->mobilePage > 1) |
|
| 354 | 354 | { |
| 355 | - $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); |
|
| 356 | - $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); |
|
| 355 | + $url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1); |
|
| 356 | + $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage); |
|
| 357 | 357 | $this->setPrevUrl($url, $text); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if($this->mobilePage<$this->totalPage) |
|
| 360 | + if ($this->mobilePage < $this->totalPage) |
|
| 361 | 361 | { |
| 362 | - $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1); |
|
| 363 | - $text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage); |
|
| 362 | + $url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1); |
|
| 363 | + $text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage); |
|
| 364 | 364 | $this->setNextUrl($url, $text); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $this->content = $contents[$this->mobilePage-1]; |
|
| 367 | + $this->content = $contents[$this->mobilePage - 1]; |
|
| 368 | 368 | $oModuleController->replaceDefinedLangCode($this->content); |
| 369 | - $content = str_replace(array('$','\''), array('$$','''), $content); |
|
| 369 | + $content = str_replace(array('$', '\''), array('$$', '''), $content); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | function setHomeUrl($url, $text) |
| 392 | 392 | { |
| 393 | - if(!$url) $url = '#'; |
|
| 393 | + if (!$url) $url = '#'; |
|
| 394 | 394 | $this->homeUrl->url = $url; |
| 395 | 395 | $this->homeUrl->text = $text; |
| 396 | 396 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | function setUpperUrl($url, $text) |
| 402 | 402 | { |
| 403 | - if(!$url) $url = '#'; |
|
| 403 | + if (!$url) $url = '#'; |
|
| 404 | 404 | $this->upperUrl->url = $url; |
| 405 | 405 | $this->upperUrl->text = $text; |
| 406 | 406 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | function setPrevUrl($url, $text) |
| 412 | 412 | { |
| 413 | - if(!$url) $url = '#'; |
|
| 413 | + if (!$url) $url = '#'; |
|
| 414 | 414 | $this->prevUrl->url = $url; |
| 415 | 415 | $this->prevUrl->text = $text; |
| 416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | function setNextUrl($url, $text) |
| 422 | 422 | { |
| 423 | - if(!$url) $url = '#'; |
|
| 423 | + if (!$url) $url = '#'; |
|
| 424 | 424 | $this->nextUrl->url = $url; |
| 425 | 425 | $this->nextUrl->text = $text; |
| 426 | 426 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | function setEtcBtn($url, $text) |
| 432 | 432 | { |
| 433 | - if(!$url) $url = '#'; |
|
| 433 | + if (!$url) $url = '#'; |
|
| 434 | 434 | $etc['url'] = $url; |
| 435 | 435 | $etc['text'] = htmlspecialchars($text); |
| 436 | 436 | $this->etcBtn[] = $etc; |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | // Home button assignments |
| 445 | 445 | $this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home')); |
| 446 | 446 | // Specify the title |
| 447 | - if(!$this->title) $this->setTitle(Context::getBrowserTitle()); |
|
| 447 | + if (!$this->title) $this->setTitle(Context::getBrowserTitle()); |
|
| 448 | 448 | |
| 449 | 449 | ob_start(); |
| 450 | 450 | // Output header |
@@ -460,8 +460,8 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | $content = ob_get_clean(); |
| 462 | 462 | // After conversion output |
| 463 | - if(strtolower($this->charset) == 'utf-8') print $content; |
|
| 464 | - else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); |
|
| 463 | + if (strtolower($this->charset) == 'utf-8') print $content; |
|
| 464 | + else print iconv('UTF-8', $this->charset."//TRANSLIT//IGNORE", $content); |
|
| 465 | 465 | |
| 466 | 466 | exit(); |
| 467 | 467 | } |
@@ -490,10 +490,10 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | function getListedItems($menu, &$listed_items, &$node_list) |
| 492 | 492 | { |
| 493 | - if(!count($menu)) return; |
|
| 494 | - foreach($menu as $node_srl => $item) |
|
| 493 | + if (!count($menu)) return; |
|
| 494 | + foreach ($menu as $node_srl => $item) |
|
| 495 | 495 | { |
| 496 | - if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) |
|
| 496 | + if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) |
|
| 497 | 497 | { |
| 498 | 498 | $mid = $item['mid'] = $item['url']; |
| 499 | 499 | $node_list[$mid] = $node_srl; |
@@ -515,16 +515,16 @@ discard block |
||
| 515 | 515 | { |
| 516 | 516 | $childs = array(); |
| 517 | 517 | |
| 518 | - if($this->cmid) |
|
| 518 | + if ($this->cmid) |
|
| 519 | 519 | { |
| 520 | 520 | $cur_item = $this->listed_items[$this->cmid]; |
| 521 | - $upper_srl = $cur_item['parent_srl'];; |
|
| 522 | - $list = $cur_item['list'];; |
|
| 523 | - $this->setUpperUrl(getUrl('cmid',$upper_srl), Context::getLang('cmd_go_upper')); |
|
| 524 | - if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url'])) |
|
| 521 | + $upper_srl = $cur_item['parent_srl']; ; |
|
| 522 | + $list = $cur_item['list']; ; |
|
| 523 | + $this->setUpperUrl(getUrl('cmid', $upper_srl), Context::getLang('cmd_go_upper')); |
|
| 524 | + if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url'])) |
|
| 525 | 525 | { |
| 526 | 526 | $obj = array(); |
| 527 | - $obj['href'] = getUrl('','mid',$cur_item['url']); |
|
| 527 | + $obj['href'] = getUrl('', 'mid', $cur_item['url']); |
|
| 528 | 528 | $obj['link'] = $obj['text'] = '['.$cur_item['text'].']'; |
| 529 | 529 | $childs[] = $obj; |
| 530 | 530 | } |
@@ -536,19 +536,19 @@ discard block |
||
| 536 | 536 | $upper_srl = 0; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - if(count($list)) |
|
| 539 | + if (count($list)) |
|
| 540 | 540 | { |
| 541 | - foreach($list as $key => $val) |
|
| 541 | + foreach ($list as $key => $val) |
|
| 542 | 542 | { |
| 543 | - if(!$val['text']) continue; |
|
| 543 | + if (!$val['text']) continue; |
|
| 544 | 544 | $obj = array(); |
| 545 | - if(!count($val['list'])) |
|
| 545 | + if (!count($val['list'])) |
|
| 546 | 546 | { |
| 547 | - $obj['href'] = getUrl('','mid',$val['url']); |
|
| 547 | + $obj['href'] = getUrl('', 'mid', $val['url']); |
|
| 548 | 548 | } |
| 549 | 549 | else |
| 550 | 550 | { |
| 551 | - $obj['href'] = getUrl('cmid',$val['node_srl']); |
|
| 551 | + $obj['href'] = getUrl('cmid', $val['node_srl']); |
|
| 552 | 552 | } |
| 553 | 553 | $obj['link'] = $obj['text'] = $val['text']; |
| 554 | 554 | $childs[] = $obj; |
@@ -567,25 +567,25 @@ discard block |
||
| 567 | 567 | $childs = array(); |
| 568 | 568 | |
| 569 | 569 | $this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); |
| 570 | - if($this->lang) |
|
| 570 | + if ($this->lang) |
|
| 571 | 571 | { |
| 572 | - $this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); |
|
| 572 | + $this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); |
|
| 573 | 573 | Context::setLangType($this->lang); |
| 574 | 574 | } |
| 575 | 575 | $lang_supported = Context::get('lang_supported'); |
| 576 | 576 | $lang_type = Context::getLangType(); |
| 577 | 577 | $obj = array(); |
| 578 | 578 | $obj['link'] = $obj['text'] = Context::getLang('president_lang').' : '.$lang_supported[$lang_type]; |
| 579 | - $obj['href'] = getUrl('sel_lang',$lang_type); |
|
| 579 | + $obj['href'] = getUrl('sel_lang', $lang_type); |
|
| 580 | 580 | $childs[] = $obj; |
| 581 | 581 | |
| 582 | - if(is_array($lang_supported)) |
|
| 582 | + if (is_array($lang_supported)) |
|
| 583 | 583 | { |
| 584 | - foreach($lang_supported as $key => $val) |
|
| 584 | + foreach ($lang_supported as $key => $val) |
|
| 585 | 585 | { |
| 586 | 586 | $obj = array(); |
| 587 | 587 | $obj['link'] = $obj['text'] = $val; |
| 588 | - $obj['href'] = getUrl('sel_lang',$key); |
|
| 588 | + $obj['href'] = getUrl('sel_lang', $key); |
|
| 589 | 589 | $childs[] = $obj; |
| 590 | 590 | } |
| 591 | 591 | } |
@@ -602,10 +602,10 @@ discard block |
||
| 602 | 602 | { |
| 603 | 603 | // Create WAP class objects of the selected module |
| 604 | 604 | $oModule = &getWap($this->module_info->module); |
| 605 | - if(!$oModule || !method_exists($oModule, 'procWAP') ) return; |
|
| 605 | + if (!$oModule || !method_exists($oModule, 'procWAP')) return; |
|
| 606 | 606 | |
| 607 | 607 | $vars = get_object_vars($this->oModule); |
| 608 | - if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val; |
|
| 608 | + if (count($vars)) foreach ($vars as $key => $val) $oModule->{$key} = $val; |
|
| 609 | 609 | // Run |
| 610 | 610 | $oModule->procWAP($this); |
| 611 | 611 | // Output |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | function displayContent() |
| 619 | 619 | { |
| 620 | - Context::set('layout','none'); |
|
| 620 | + Context::set('layout', 'none'); |
|
| 621 | 621 | // Compile a template |
| 622 | 622 | $oTemplate = new TemplateHandler(); |
| 623 | 623 | $oContext = &Context::getInstance(); |
@@ -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 | } |