@@ -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 | } |
@@ -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 __construct($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 __construct($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 | } |
@@ -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(is_array($this->columnList) && count($this->columnList) > 0) |
|
| 147 | + if (is_array($this->columnList) && 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) || (is_array($columns) && count($columns) === 0)) |
|
| 164 | + if (!isset($columns) || (is_array($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) || (is_array($tables) && count($tables) === 0)) |
|
| 180 | + if (!isset($tables) || (is_array($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) || (is_array($conditions) && count($conditions) === 0)) |
|
| 203 | + if (!isset($conditions) || (is_array($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) || (is_array($groups) && count($groups) === 0)) |
|
| 223 | + if (!isset($groups) || (is_array($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) || (is_array($order) && count($order) === 0)) |
|
| 237 | + if (!isset($order) || (is_array($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(!is_array($this->orderby) || count($this->orderby) === 0) |
|
| 563 | + if (!is_array($this->orderby) || 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($this->limit) |
|
| 590 | + if ($this->limit) |
|
| 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(is_array($this->tables) && count($this->tables) > 0) |
|
| 614 | + if (is_array($this->tables) && 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(is_array($this->columns) && count($this->columns) > 0) |
|
| 631 | + if (is_array($this->columns) && 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(is_array($this->conditions) && count($this->conditions) > 0) |
|
| 647 | + if (is_array($this->conditions) && 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(is_array($this->orderby) && count($this->orderby) > 0) |
|
| 660 | + if (is_array($this->orderby) && count($this->orderby) > 0) |
|
| 661 | 661 | { |
| 662 | - foreach($this->orderby as $order) |
|
| 662 | + foreach ($this->orderby as $order) |
|
| 663 | 663 | { |
| 664 | 664 | $args = $order->getArguments(); |
| 665 | - if(count($args) > 0) |
|
| 665 | + if (count($args) > 0) |
|
| 666 | 666 | { |
| 667 | 667 | $this->arguments = array_merge($this->arguments, $args); |
| 668 | 668 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n |
| 134 | 134 | * This method only functions when __DEBUG__ variable is set to 1. |
| 135 | 135 | * __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php |
| 136 | - * @return void |
|
| 136 | + * @return null|string |
|
| 137 | 137 | */ |
| 138 | 138 | function _debugOutput() |
| 139 | 139 | { |
@@ -358,6 +358,7 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | /** |
| 360 | 360 | * print a HTTP HEADER for HTML, which is encoded in UTF-8 |
| 361 | + * @param integer $code |
|
| 361 | 362 | * @return void |
| 362 | 363 | */ |
| 363 | 364 | function _printHttpStatusCode($code) |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | function printContent(&$oModule) |
| 26 | 26 | { |
| 27 | 27 | // Check if the gzip encoding supported |
| 28 | - if( |
|
| 28 | + if ( |
|
| 29 | 29 | (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) && |
| 30 | 30 | strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && |
| 31 | 31 | extension_loaded('zlib') && |
@@ -36,23 +36,23 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Extract contents to display by the request method |
| 39 | - if(Context::get('xeVirtualRequestMethod') == 'xml') |
|
| 39 | + if (Context::get('xeVirtualRequestMethod') == 'xml') |
|
| 40 | 40 | { |
| 41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
| 42 | 42 | } |
| 43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 43 | + else if (Context::getRequestMethod() == 'XMLRPC') |
|
| 44 | 44 | { |
| 45 | 45 | $handler = new XMLDisplayHandler(); |
| 46 | - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 46 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | $this->gz_enabled = FALSE; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | - else if(Context::getRequestMethod() == 'JSON') |
|
| 51 | + else if (Context::getRequestMethod() == 'JSON') |
|
| 52 | 52 | { |
| 53 | 53 | $handler = new JSONDisplayHandler(); |
| 54 | 54 | } |
| 55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 55 | + else if (Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 56 | 56 | { |
| 57 | 57 | $handler = new JSCallbackDisplayHandler(); |
| 58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | $called_position = 'before_display_content'; |
| 71 | 71 | $oAddonController = getController('addon'); |
| 72 | 72 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 73 | - if(file_exists($addon_file)) include($addon_file); |
|
| 73 | + if (file_exists($addon_file)) include($addon_file); |
|
| 74 | 74 | |
| 75 | - if(method_exists($handler, "prepareToPrint")) |
|
| 75 | + if (method_exists($handler, "prepareToPrint")) |
|
| 76 | 76 | { |
| 77 | 77 | $handler->prepareToPrint($output); |
| 78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | // header output |
| 81 | 81 | |
| 82 | 82 | $httpStatusCode = $oModule->getHttpStatusCode(); |
| 83 | - if($httpStatusCode && $httpStatusCode != 200) |
|
| 83 | + if ($httpStatusCode && $httpStatusCode != 200) |
|
| 84 | 84 | { |
| 85 | 85 | $this->_printHttpStatusCode($httpStatusCode); |
| 86 | 86 | } |
| 87 | 87 | else |
| 88 | 88 | { |
| 89 | - if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
| 89 | + if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
| 90 | 90 | { |
| 91 | 91 | $this->_printJSONHeader(); |
| 92 | 92 | } |
| 93 | - else if(Context::getResponseMethod() != 'HTML') |
|
| 93 | + else if (Context::getResponseMethod() != 'HTML') |
|
| 94 | 94 | { |
| 95 | 95 | $this->_printXMLHeader(); |
| 96 | 96 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // disable gzip if output already exists |
| 108 | 108 | ob_flush(); |
| 109 | - if(headers_sent()) |
|
| 109 | + if (headers_sent()) |
|
| 110 | 110 | { |
| 111 | 111 | $this->gz_enabled = FALSE; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // enable gzip using zlib extension |
| 115 | - if($this->gz_enabled) |
|
| 115 | + if ($this->gz_enabled) |
|
| 116 | 116 | { |
| 117 | 117 | ini_set('zlib.output_compression', true); |
| 118 | 118 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function _debugOutput() |
| 135 | 135 | { |
| 136 | - if(!__DEBUG__) |
|
| 136 | + if (!__DEBUG__) |
|
| 137 | 137 | { |
| 138 | 138 | return; |
| 139 | 139 | } |
@@ -141,32 +141,32 @@ discard block |
||
| 141 | 141 | $end = getMicroTime(); |
| 142 | 142 | |
| 143 | 143 | // Firebug console output |
| 144 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 144 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 145 | 145 | { |
| 146 | 146 | static $firephp; |
| 147 | - if(!isset($firephp)) |
|
| 147 | + if (!isset($firephp)) |
|
| 148 | 148 | { |
| 149 | 149 | $firephp = FirePHP::getInstance(true); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 152 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 153 | 153 | { |
| 154 | 154 | $firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.'); |
| 155 | 155 | return; |
| 156 | 156 | } |
| 157 | 157 | // display total execution time and Request/Response info |
| 158 | - if(__DEBUG__ & 2) |
|
| 158 | + if (__DEBUG__ & 2) |
|
| 159 | 159 | { |
| 160 | 160 | $firephp->fb( |
| 161 | 161 | array( |
| 162 | - 'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), |
|
| 162 | + 'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(), |
|
| 163 | 163 | array( |
| 164 | 164 | array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), |
| 165 | 165 | array( |
| 166 | 166 | sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), |
| 167 | 167 | $_SERVER['REQUEST_METHOD'], |
| 168 | 168 | Context::getResponseMethod(), |
| 169 | - $this->content_size . ' byte', |
|
| 169 | + $this->content_size.' byte', |
|
| 170 | 170 | FileHandler::filesize(memory_get_peak_usage()) |
| 171 | 171 | ) |
| 172 | 172 | ) |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | ); |
| 176 | 176 | $firephp->fb( |
| 177 | 177 | array( |
| 178 | - 'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), |
|
| 178 | + 'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__), |
|
| 179 | 179 | array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), |
| 180 | 180 | array( |
| 181 | 181 | sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
@@ -193,16 +193,16 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // display DB query history |
| 196 | - if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
| 196 | + if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
| 197 | 197 | { |
| 198 | 198 | $queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query')); |
| 199 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
| 199 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
| 200 | 200 | { |
| 201 | - $queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']); |
|
| 201 | + $queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']); |
|
| 202 | 202 | } |
| 203 | 203 | $firephp->fb( |
| 204 | 204 | array( |
| 205 | - 'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
| 205 | + 'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
| 206 | 206 | $queries_output |
| 207 | 207 | ), |
| 208 | 208 | 'TABLE' |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $buff = array(); |
| 217 | 217 | // display total execution time and Request/Response info |
| 218 | - if(__DEBUG__ & 2) |
|
| 218 | + if (__DEBUG__ & 2) |
|
| 219 | 219 | { |
| 220 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 220 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 221 | 221 | { |
| 222 | 222 | return; |
| 223 | 223 | } |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | $buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']); |
| 249 | 249 | } |
| 250 | 250 | // DB Logging |
| 251 | - if(__DEBUG__ & 4) |
|
| 251 | + if (__DEBUG__ & 4) |
|
| 252 | 252 | { |
| 253 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 253 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 254 | 254 | { |
| 255 | 255 | return; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if($GLOBALS['__db_queries__']) |
|
| 258 | + if ($GLOBALS['__db_queries__']) |
|
| 259 | 259 | { |
| 260 | 260 | $buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']); |
| 261 | 261 | $num = 0; |
| 262 | 262 | |
| 263 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
| 263 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
| 264 | 264 | { |
| 265 | - if($query['result'] == 'Success') |
|
| 265 | + if ($query['result'] == 'Success') |
|
| 266 | 266 | { |
| 267 | 267 | $query_result = "Query Success"; |
| 268 | 268 | } |
@@ -279,30 +279,30 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Output in HTML comments |
| 282 | - if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
| 282 | + if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
| 283 | 283 | { |
| 284 | 284 | $buff = implode("\r\n", $buff); |
| 285 | 285 | $buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); |
| 286 | 286 | |
| 287 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 287 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 288 | 288 | { |
| 289 | 289 | $buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - return "<!--\r\n" . $buff . "\r\n-->"; |
|
| 292 | + return "<!--\r\n".$buff."\r\n-->"; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // Output to a file |
| 296 | - if($buff && __DEBUG_OUTPUT__ == 0) |
|
| 296 | + if ($buff && __DEBUG_OUTPUT__ == 0) |
|
| 297 | 297 | { |
| 298 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 298 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 299 | 299 | $buff = implode(PHP_EOL, $buff); |
| 300 | 300 | $buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true)); |
| 301 | 301 | |
| 302 | - $buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80); |
|
| 303 | - $buff = "\n<?php\n/*" . $buff . "*/\n?>\n"; |
|
| 302 | + $buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80); |
|
| 303 | + $buff = "\n<?php\n/*".$buff."*/\n?>\n"; |
|
| 304 | 304 | |
| 305 | - if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX)) |
|
| 305 | + if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX)) |
|
| 306 | 306 | { |
| 307 | 307 | return; |
| 308 | 308 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | { |
| 319 | 319 | header("Content-Type: text/xml; charset=UTF-8"); |
| 320 | 320 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 321 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 321 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 322 | 322 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 323 | 323 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 324 | 324 | header("Pragma: no-cache"); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | header("Content-Type: text/html; charset=UTF-8"); |
| 334 | 334 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 335 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 335 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 336 | 336 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 337 | 337 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 338 | 338 | header("Pragma: no-cache"); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | { |
| 347 | 347 | header("Content-Type: text/html; charset=UTF-8"); |
| 348 | 348 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 349 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 349 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 350 | 350 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 351 | 351 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 352 | 352 | header("Pragma: no-cache"); |
@@ -39,24 +39,20 @@ discard block |
||
| 39 | 39 | if(Context::get('xeVirtualRequestMethod') == 'xml') |
| 40 | 40 | { |
| 41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
| 42 | - } |
|
| 43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 42 | + } else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 44 | 43 | { |
| 45 | 44 | $handler = new XMLDisplayHandler(); |
| 46 | 45 | if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
| 47 | 46 | { |
| 48 | 47 | $this->gz_enabled = FALSE; |
| 49 | 48 | } |
| 50 | - } |
|
| 51 | - else if(Context::getRequestMethod() == 'JSON') |
|
| 49 | + } else if(Context::getRequestMethod() == 'JSON') |
|
| 52 | 50 | { |
| 53 | 51 | $handler = new JSONDisplayHandler(); |
| 54 | - } |
|
| 55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 52 | + } else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 56 | 53 | { |
| 57 | 54 | $handler = new JSCallbackDisplayHandler(); |
| 58 | - } |
|
| 59 | - else |
|
| 55 | + } else |
|
| 60 | 56 | { |
| 61 | 57 | $handler = new HTMLDisplayHandler(); |
| 62 | 58 | } |
@@ -70,7 +66,9 @@ discard block |
||
| 70 | 66 | $called_position = 'before_display_content'; |
| 71 | 67 | $oAddonController = getController('addon'); |
| 72 | 68 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 73 | - if(file_exists($addon_file)) include($addon_file); |
|
| 69 | + if(file_exists($addon_file)) { |
|
| 70 | + include($addon_file); |
|
| 71 | + } |
|
| 74 | 72 | |
| 75 | 73 | if(method_exists($handler, "prepareToPrint")) |
| 76 | 74 | { |
@@ -83,18 +81,15 @@ discard block |
||
| 83 | 81 | if($httpStatusCode && $httpStatusCode != 200) |
| 84 | 82 | { |
| 85 | 83 | $this->_printHttpStatusCode($httpStatusCode); |
| 86 | - } |
|
| 87 | - else |
|
| 84 | + } else |
|
| 88 | 85 | { |
| 89 | 86 | if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
| 90 | 87 | { |
| 91 | 88 | $this->_printJSONHeader(); |
| 92 | - } |
|
| 93 | - else if(Context::getResponseMethod() != 'HTML') |
|
| 89 | + } else if(Context::getResponseMethod() != 'HTML') |
|
| 94 | 90 | { |
| 95 | 91 | $this->_printXMLHeader(); |
| 96 | - } |
|
| 97 | - else |
|
| 92 | + } else |
|
| 98 | 93 | { |
| 99 | 94 | $this->_printHTMLHeader(); |
| 100 | 95 | } |
@@ -209,8 +204,7 @@ discard block |
||
| 209 | 204 | ); |
| 210 | 205 | } |
| 211 | 206 | // dislpay the file and HTML comments |
| 212 | - } |
|
| 213 | - else |
|
| 207 | + } else |
|
| 214 | 208 | { |
| 215 | 209 | |
| 216 | 210 | $buff = array(); |
@@ -265,8 +259,7 @@ discard block |
||
| 265 | 259 | if($query['result'] == 'Success') |
| 266 | 260 | { |
| 267 | 261 | $query_result = "Query Success"; |
| 268 | - } |
|
| 269 | - else |
|
| 262 | + } else |
|
| 270 | 263 | { |
| 271 | 264 | $query_result = sprintf("Query $s : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']); |
| 272 | 265 | } |
@@ -370,7 +370,7 @@ |
||
| 370 | 370 | /** |
| 371 | 371 | * add given .css or .js file names in widget code to Context |
| 372 | 372 | * @param array $matches |
| 373 | - * @return void |
|
| 373 | + * @return string|null |
|
| 374 | 374 | */ |
| 375 | 375 | function _transMeta($matches) |
| 376 | 376 | { |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $template_path = $oModule->getTemplatePath(); |
| 21 | 21 | |
| 22 | - if(!is_dir($template_path)) |
|
| 22 | + if (!is_dir($template_path)) |
|
| 23 | 23 | { |
| 24 | - if($oModule->module_info->module == $oModule->module) |
|
| 24 | + if ($oModule->module_info->module == $oModule->module) |
|
| 25 | 25 | { |
| 26 | 26 | $skin = $oModule->origin_module_info->skin; |
| 27 | 27 | } |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | $skin = $oModule->module_config->skin; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
| 33 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
| 34 | 34 | { |
| 35 | - if($skin && is_string($skin)) |
|
| 35 | + if ($skin && is_string($skin)) |
|
| 36 | 36 | { |
| 37 | 37 | $theme_skin = explode('|@|', $skin); |
| 38 | 38 | $template_path = $oModule->getTemplatePath(); |
| 39 | - if(count($theme_skin) == 2) |
|
| 39 | + if (count($theme_skin) == 2) |
|
| 40 | 40 | { |
| 41 | 41 | $theme_path = sprintf('./themes/%s', $theme_skin[0]); |
| 42 | 42 | // FIXME $theme_path $theme_path $theme_path ?? |
| 43 | - if(substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
| 43 | + if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
| 44 | 44 | { |
| 45 | 45 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
| 46 | 46 | } |
@@ -61,16 +61,16 @@ discard block |
||
| 61 | 61 | $output = $oTemplate->compile($template_path, $tpl_file); |
| 62 | 62 | |
| 63 | 63 | // add .x div for adminitration pages |
| 64 | - if(Context::getResponseMethod() == 'HTML') |
|
| 64 | + if (Context::getResponseMethod() == 'HTML') |
|
| 65 | 65 | { |
| 66 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
| 66 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
| 67 | 67 | { |
| 68 | - $output = '<div class="x">' . $output . '</div>'; |
|
| 68 | + $output = '<div class="x">'.$output.'</div>'; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if(Context::get('layout') != 'none') |
|
| 71 | + if (Context::get('layout') != 'none') |
|
| 72 | 72 | { |
| 73 | - if(__DEBUG__ == 3) |
|
| 73 | + if (__DEBUG__ == 3) |
|
| 74 | 74 | { |
| 75 | 75 | $start = getMicroTime(); |
| 76 | 76 | } |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | $layout_srl = $layout_info->layout_srl; |
| 89 | 89 | |
| 90 | 90 | // compile if connected to the layout |
| 91 | - if($layout_srl > 0) |
|
| 91 | + if ($layout_srl > 0) |
|
| 92 | 92 | { |
| 93 | 93 | |
| 94 | 94 | // handle separately if the layout is faceoff |
| 95 | - if($layout_info && $layout_info->type == 'faceoff') |
|
| 95 | + if ($layout_info && $layout_info->type == 'faceoff') |
|
| 96 | 96 | { |
| 97 | 97 | $oLayoutModel->doActivateFaceOff($layout_info); |
| 98 | 98 | Context::set('layout_info', $layout_info); |
@@ -101,16 +101,16 @@ discard block |
||
| 101 | 101 | // search if the changes CSS exists in the admin layout edit window |
| 102 | 102 | $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); |
| 103 | 103 | |
| 104 | - if(FileHandler::exists($edited_layout_css)) |
|
| 104 | + if (FileHandler::exists($edited_layout_css)) |
|
| 105 | 105 | { |
| 106 | 106 | Context::loadFile(array($edited_layout_css, 'all', '', 100)); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - if(!$layout_path) |
|
| 109 | + if (!$layout_path) |
|
| 110 | 110 | { |
| 111 | 111 | $layout_path = './common/tpl'; |
| 112 | 112 | } |
| 113 | - if(!$layout_file) |
|
| 113 | + if (!$layout_file) |
|
| 114 | 114 | { |
| 115 | 115 | $layout_file = 'default_layout'; |
| 116 | 116 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | // if popup_layout, remove admin bar. |
| 120 | 120 | $realLayoutPath = FileHandler::getRealPath($layout_path); |
| 121 | - if(substr_compare($realLayoutPath, '/', -1) !== 0) |
|
| 121 | + if (substr_compare($realLayoutPath, '/', -1) !== 0) |
|
| 122 | 122 | { |
| 123 | 123 | $realLayoutPath .= '/'; |
| 124 | 124 | } |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | $pathInfo = pathinfo($layout_file); |
| 127 | 127 | $onlyLayoutFile = $pathInfo['filename']; |
| 128 | 128 | |
| 129 | - if(__DEBUG__ == 3) |
|
| 129 | + if (__DEBUG__ == 3) |
|
| 130 | 130 | { |
| 131 | 131 | $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
| 134 | + if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
| 135 | 135 | { |
| 136 | 136 | Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); |
| 137 | 137 | } |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function prepareToPrint(&$output) |
| 149 | 149 | { |
| 150 | - if(Context::getResponseMethod() != 'HTML') |
|
| 150 | + if (Context::getResponseMethod() != 'HTML') |
|
| 151 | 151 | { |
| 152 | 152 | return; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if(__DEBUG__ == 3) |
|
| 155 | + if (__DEBUG__ == 3) |
|
| 156 | 156 | { |
| 157 | 157 | $start = getMicroTime(); |
| 158 | 158 | } |
@@ -170,20 +170,20 @@ discard block |
||
| 170 | 170 | $output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output); |
| 171 | 171 | |
| 172 | 172 | // handles a relative path generated by using the rewrite module |
| 173 | - if(Context::isAllowRewrite()) |
|
| 173 | + if (Context::isAllowRewrite()) |
|
| 174 | 174 | { |
| 175 | 175 | $url = parse_url(Context::getRequestUri()); |
| 176 | 176 | $real_path = $url['path']; |
| 177 | 177 | |
| 178 | 178 | $pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s'; |
| 179 | - $output = preg_replace($pattern, 'src=$1' . $real_path . '$2$3', $output); |
|
| 179 | + $output = preg_replace($pattern, 'src=$1'.$real_path.'$2$3', $output); |
|
| 180 | 180 | |
| 181 | 181 | $pattern = '/href=("|\'){1}(\?[^"\']+)/s'; |
| 182 | - $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output); |
|
| 182 | + $output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output); |
|
| 183 | 183 | |
| 184 | - if(Context::get('vid')) |
|
| 184 | + if (Context::get('vid')) |
|
| 185 | 185 | { |
| 186 | - $pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is'; |
|
| 186 | + $pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is'; |
|
| 187 | 187 | $output = preg_replace($pattern, '/?$1=', $output); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -191,18 +191,18 @@ discard block |
||
| 191 | 191 | // prevent the 2nd request due to url(none) of the background-image |
| 192 | 192 | $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); |
| 193 | 193 | |
| 194 | - if(is_array(Context::get('INPUT_ERROR'))) |
|
| 194 | + if (is_array(Context::get('INPUT_ERROR'))) |
|
| 195 | 195 | { |
| 196 | 196 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 197 | 197 | $keys = array_keys($INPUT_ERROR); |
| 198 | - $keys = '(' . implode('|', $keys) . ')'; |
|
| 198 | + $keys = '('.implode('|', $keys).')'; |
|
| 199 | 199 | |
| 200 | - $output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
| 201 | - $output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
| 202 | - $output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
| 200 | + $output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
| 201 | + $output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
| 202 | + $output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if(__DEBUG__ == 3) |
|
| 205 | + if (__DEBUG__ == 3) |
|
| 206 | 206 | { |
| 207 | 207 | $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; |
| 208 | 208 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // convert the final layout |
| 221 | 221 | Context::set('content', $output); |
| 222 | 222 | $oTemplate = TemplateHandler::getInstance(); |
| 223 | - if(Mobile::isFromMobilePhone()) |
|
| 223 | + if (Mobile::isFromMobilePhone()) |
|
| 224 | 224 | { |
| 225 | 225 | $this->_loadMobileJSCSS(); |
| 226 | 226 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
@@ -245,16 +245,16 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 247 | 247 | |
| 248 | - $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4]; |
|
| 248 | + $str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4]; |
|
| 249 | 249 | |
| 250 | 250 | // get type |
| 251 | 251 | $type = 'text'; |
| 252 | - if(preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
| 252 | + if (preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
| 253 | 253 | { |
| 254 | 254 | $type = strtolower($m[1]); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - switch($type) |
|
| 257 | + switch ($type) |
|
| 258 | 258 | { |
| 259 | 259 | case 'text': |
| 260 | 260 | case 'hidden': |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | case 'number': |
| 273 | 273 | case 'range': |
| 274 | 274 | case 'color': |
| 275 | - $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"'; |
|
| 275 | + $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"'; |
|
| 276 | 276 | break; |
| 277 | 277 | case 'password': |
| 278 | 278 | $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str); |
@@ -280,14 +280,14 @@ discard block |
||
| 280 | 280 | case 'radio': |
| 281 | 281 | case 'checkbox': |
| 282 | 282 | $str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); |
| 283 | - if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) |
|
| 283 | + if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str)) |
|
| 284 | 284 | { |
| 285 | 285 | $str .= ' checked="checked"'; |
| 286 | 286 | } |
| 287 | 287 | break; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - return $str . ' />'; |
|
| 290 | + return $str.' />'; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m); |
| 305 | 305 | |
| 306 | 306 | $key = array_search($INPUT_ERROR[$matches[1]], $m[1]); |
| 307 | - if($key === FALSE) |
|
| 307 | + if ($key === FALSE) |
|
| 308 | 308 | { |
| 309 | 309 | return $matches[0]; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); |
| 313 | 313 | |
| 314 | - return $mm[0] . implode('', $m[0]) . '</select>'; |
|
| 314 | + return $mm[0].implode('', $m[0]).'</select>'; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | { |
| 324 | 324 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 325 | 325 | preg_match('@<textarea.*?>@is', $matches[0], $mm); |
| 326 | - return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>'; |
|
| 326 | + return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>'; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | function _moveStyleToHeader($matches) |
| 336 | 336 | { |
| 337 | - if(isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
| 337 | + if (isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
| 338 | 338 | { |
| 339 | 339 | return $matches[0]; |
| 340 | 340 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | function _transMeta($matches) |
| 372 | 372 | { |
| 373 | - if($matches[1]) |
|
| 373 | + if ($matches[1]) |
|
| 374 | 374 | { |
| 375 | 375 | return ''; |
| 376 | 376 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $lang_type = Context::getLangType(); |
| 388 | 388 | |
| 389 | 389 | // add common JS/CSS files |
| 390 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 390 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 391 | 391 | { |
| 392 | 392 | $oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true); |
| 393 | 393 | $oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
| 401 | 401 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
| 402 | 402 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
| 403 | - if(!__DISABLE_DEFAULT_CSS__) |
|
| 403 | + if (!__DISABLE_DEFAULT_CSS__) |
|
| 404 | 404 | { |
| 405 | 405 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 406 | 406 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
| 416 | 416 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
| 417 | 417 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
| 418 | - if(!__DISABLE_DEFAULT_CSS__) |
|
| 418 | + if (!__DISABLE_DEFAULT_CSS__) |
|
| 419 | 419 | { |
| 420 | 420 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 421 | 421 | } |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | // for admin page, add admin css |
| 429 | - if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
| 429 | + if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
| 430 | 430 | { |
| 431 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 431 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 432 | 432 | { |
| 433 | 433 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true); |
| 434 | 434 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $lang_type = Context::getLangType(); |
| 461 | 461 | |
| 462 | 462 | // add common JS/CSS files |
| 463 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 463 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 464 | 464 | { |
| 465 | 465 | $oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true); |
| 466 | 466 | $oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true); |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
| 473 | 473 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
| 474 | 474 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
| 475 | - if(!__DISABLE_DEFAULT_CSS__) |
|
| 475 | + if (!__DISABLE_DEFAULT_CSS__) |
|
| 476 | 476 | { |
| 477 | 477 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 478 | 478 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
| 489 | 489 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
| 490 | 490 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
| 491 | - if(!__DISABLE_DEFAULT_CSS__) |
|
| 491 | + if (!__DISABLE_DEFAULT_CSS__) |
|
| 492 | 492 | { |
| 493 | 493 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 494 | 494 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | if($oModule->module_info->module == $oModule->module) |
| 25 | 25 | { |
| 26 | 26 | $skin = $oModule->origin_module_info->skin; |
| 27 | - } |
|
| 28 | - else |
|
| 27 | + } else |
|
| 29 | 28 | { |
| 30 | 29 | $skin = $oModule->module_config->skin; |
| 31 | 30 | } |
@@ -45,13 +44,11 @@ discard block |
||
| 45 | 44 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
| 46 | 45 | } |
| 47 | 46 | } |
| 48 | - } |
|
| 49 | - else |
|
| 47 | + } else |
|
| 50 | 48 | { |
| 51 | 49 | $template_path = $oModule->getTemplatePath(); |
| 52 | 50 | } |
| 53 | - } |
|
| 54 | - else |
|
| 51 | + } else |
|
| 55 | 52 | { |
| 56 | 53 | $template_path = $oModule->getTemplatePath(); |
| 57 | 54 | } |
@@ -224,8 +221,7 @@ discard block |
||
| 224 | 221 | { |
| 225 | 222 | $this->_loadMobileJSCSS(); |
| 226 | 223 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
| 227 | - } |
|
| 228 | - else |
|
| 224 | + } else |
|
| 229 | 225 | { |
| 230 | 226 | $this->_loadJSCSS(); |
| 231 | 227 | $output = $oTemplate->compile('./common/tpl', 'common_layout'); |
@@ -403,13 +399,11 @@ discard block |
||
| 403 | 399 | if(!__DISABLE_DEFAULT_CSS__) |
| 404 | 400 | { |
| 405 | 401 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 406 | - } |
|
| 407 | - else |
|
| 402 | + } else |
|
| 408 | 403 | { |
| 409 | 404 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 410 | 405 | } |
| 411 | - } |
|
| 412 | - else |
|
| 406 | + } else |
|
| 413 | 407 | { |
| 414 | 408 | $oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1110000), true); |
| 415 | 409 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
@@ -418,8 +412,7 @@ discard block |
||
| 418 | 412 | if(!__DISABLE_DEFAULT_CSS__) |
| 419 | 413 | { |
| 420 | 414 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 421 | - } |
|
| 422 | - else |
|
| 415 | + } else |
|
| 423 | 416 | { |
| 424 | 417 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 425 | 418 | } |
@@ -437,8 +430,7 @@ discard block |
||
| 437 | 430 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true); |
| 438 | 431 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true); |
| 439 | 432 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true); |
| 440 | - } |
|
| 441 | - else |
|
| 433 | + } else |
|
| 442 | 434 | { |
| 443 | 435 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true); |
| 444 | 436 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -476,14 +468,12 @@ discard block |
||
| 476 | 468 | { |
| 477 | 469 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 478 | 470 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
| 479 | - } |
|
| 480 | - else |
|
| 471 | + } else |
|
| 481 | 472 | { |
| 482 | 473 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
| 483 | 474 | $oContext->unloadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
| 484 | 475 | } |
| 485 | - } |
|
| 486 | - else |
|
| 476 | + } else |
|
| 487 | 477 | { |
| 488 | 478 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
| 489 | 479 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
@@ -492,8 +482,7 @@ discard block |
||
| 492 | 482 | { |
| 493 | 483 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 494 | 484 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
| 495 | - } |
|
| 496 | - else |
|
| 485 | + } else |
|
| 497 | 486 | { |
| 498 | 487 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
| 499 | 488 | $oContext->unloadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Mether to add key/value pair to the HTTP request header |
| 54 | - * @param int|string $key HTTP header element |
|
| 54 | + * @param string $key HTTP header element |
|
| 55 | 55 | * @param string $value value string for HTTP header element |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | if(FALSE && is_callable('curl_init')) |
| 98 | 98 | { |
| 99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
| 100 | - } |
|
| 101 | - else |
|
| 100 | + } else |
|
| 102 | 101 | { |
| 103 | 102 | return $this->sendWithSock($target, $method, $timeout, $post_vars); |
| 104 | 103 | } |
@@ -179,8 +178,7 @@ discard block |
||
| 179 | 178 | { |
| 180 | 179 | $body .= fgets($sock, $chunk_size+1); |
| 181 | 180 | } |
| 182 | - } |
|
| 183 | - else |
|
| 181 | + } else |
|
| 184 | 182 | { |
| 185 | 183 | $body .= fgets($sock, 512); |
| 186 | 184 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * constructor |
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | - function __construct($host, $port, $scheme='') |
|
| 44 | + function __construct($host, $port, $scheme = '') |
|
| 45 | 45 | { |
| 46 | 46 | $this->m_host = $host; |
| 47 | 47 | $this->m_port = $port; |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | $this->addToHeader('Connection', 'close'); |
| 77 | 77 | |
| 78 | 78 | $method = strtoupper($method); |
| 79 | - if(!$allow_methods) |
|
| 79 | + if (!$allow_methods) |
|
| 80 | 80 | { |
| 81 | 81 | $allow_methods = explode(' ', 'GET POST PUT'); |
| 82 | 82 | } |
| 83 | - if(!in_array($method, $allow_methods)) |
|
| 83 | + if (!in_array($method, $allow_methods)) |
|
| 84 | 84 | { |
| 85 | 85 | $method = $allow_methods[0]; |
| 86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | $timout = max((int) $timeout, 0); |
| 90 | 90 | |
| 91 | 91 | // list of post variables |
| 92 | - if(!is_array($post_vars)) |
|
| 92 | + if (!is_array($post_vars)) |
|
| 93 | 93 | { |
| 94 | 94 | $post_vars = array(); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(FALSE && is_callable('curl_init')) |
|
| 97 | + if (FALSE && is_callable('curl_init')) |
|
| 98 | 98 | { |
| 99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
| 100 | 100 | } |
@@ -117,30 +117,30 @@ discard block |
||
| 117 | 117 | static $crlf = "\r\n"; |
| 118 | 118 | |
| 119 | 119 | $scheme = ''; |
| 120 | - if($this->m_scheme=='https') |
|
| 120 | + if ($this->m_scheme == 'https') |
|
| 121 | 121 | { |
| 122 | 122 | $scheme = 'ssl://'; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
| 126 | - if(!$sock) |
|
| 125 | + $sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
| 126 | + if (!$sock) |
|
| 127 | 127 | { |
| 128 | 128 | return new BaseObject(-1, 'socket_connect_failed'); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $headers = $this->m_headers + array(); |
| 132 | - if(!isset($headers['Accept-Encoding'])) |
|
| 132 | + if (!isset($headers['Accept-Encoding'])) |
|
| 133 | 133 | { |
| 134 | 134 | $headers['Accept-Encoding'] = 'identity'; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // post body |
| 138 | 138 | $post_body = ''; |
| 139 | - if($method == 'POST' && count($post_vars)) |
|
| 139 | + if ($method == 'POST' && count($post_vars)) |
|
| 140 | 140 | { |
| 141 | - foreach($post_vars as $key => $value) |
|
| 141 | + foreach ($post_vars as $key => $value) |
|
| 142 | 142 | { |
| 143 | - $post_body .= urlencode($key) . '=' . urlencode($value) . '&'; |
|
| 143 | + $post_body .= urlencode($key).'='.urlencode($value).'&'; |
|
| 144 | 144 | } |
| 145 | 145 | $post_body = substr($post_body, 0, -1); |
| 146 | 146 | |
@@ -149,35 +149,35 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $request = "$method $target HTTP/1.1$crlf"; |
| 152 | - foreach($headers as $equiv => $content) |
|
| 152 | + foreach ($headers as $equiv => $content) |
|
| 153 | 153 | { |
| 154 | 154 | $request .= "$equiv: $content$crlf"; |
| 155 | 155 | } |
| 156 | - $request .= $crlf . $post_body; |
|
| 156 | + $request .= $crlf.$post_body; |
|
| 157 | 157 | fwrite($sock, $request); |
| 158 | 158 | |
| 159 | 159 | list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3); |
| 160 | 160 | |
| 161 | 161 | // read response headers |
| 162 | 162 | $is_chunked = FALSE; |
| 163 | - while(strlen(trim($line = fgets($sock)))) |
|
| 163 | + while (strlen(trim($line = fgets($sock)))) |
|
| 164 | 164 | { |
| 165 | 165 | list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2); |
| 166 | - if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
| 166 | + if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
| 167 | 167 | { |
| 168 | 168 | $is_chunked = TRUE; |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $body = ''; |
| 173 | - while(!feof($sock)) |
|
| 173 | + while (!feof($sock)) |
|
| 174 | 174 | { |
| 175 | - if($is_chunked) |
|
| 175 | + if ($is_chunked) |
|
| 176 | 176 | { |
| 177 | 177 | $chunk_size = hexdec(fgets($sock)); |
| 178 | - if($chunk_size) |
|
| 178 | + if ($chunk_size) |
|
| 179 | 179 | { |
| 180 | - $body .= fgets($sock, $chunk_size+1); |
|
| 180 | + $body .= fgets($sock, $chunk_size + 1); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | else |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
| 220 | 220 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 221 | 221 | |
| 222 | - switch($method) |
|
| 222 | + switch ($method) |
|
| 223 | 223 | { |
| 224 | 224 | case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true); |
| 225 | 225 | break; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $arr_headers = array(); |
| 235 | - foreach($headers as $key => $value) |
|
| 235 | + foreach ($headers as $key => $value) |
|
| 236 | 236 | { |
| 237 | 237 | $arr_headers[] = "$key: $value"; |
| 238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers); |
| 241 | 241 | |
| 242 | 242 | $body = curl_exec($ch); |
| 243 | - if(curl_errno($ch)) |
|
| 243 | + if (curl_errno($ch)) |
|
| 244 | 244 | { |
| 245 | 245 | return new BaseObject(-1, 'socket_connect_failed'); |
| 246 | 246 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action |
| 115 | - * @return boolean true: OK, false: redirected |
|
| 115 | + * @return string|boolean true: OK, false: redirected |
|
| 116 | 116 | * */ |
| 117 | 117 | function init() |
| 118 | 118 | { |
@@ -1128,6 +1128,10 @@ discard block |
||
| 1128 | 1128 | return $GLOBALS['_loaded_module'][$module][$type][$kind]; |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | + /** |
|
| 1132 | + * @param string $type |
|
| 1133 | + * @param string $kind |
|
| 1134 | + */ |
|
| 1131 | 1135 | function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName) |
| 1132 | 1136 | { |
| 1133 | 1137 | $classPath = ModuleHandler::getModulePath($module); |
@@ -59,10 +59,10 @@ |
||
| 59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 62 | - if($entry = Context::get('entry')) |
|
| 63 | - { |
|
| 64 | - $this->entry = Context::convertEncodingStr($entry); |
|
| 65 | - } |
|
| 62 | + if($entry = Context::get('entry')) |
|
| 63 | + { |
|
| 64 | + $this->entry = Context::convertEncodingStr($entry); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | // Validate variables to prevent XSS |
| 68 | 68 | $isInvalid = NULL; |
@@ -112,7 +112,9 @@ discard block |
||
| 112 | 112 | $called_position = 'before_module_init'; |
| 113 | 113 | $oAddonController = getController('addon'); |
| 114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 115 | - if(file_exists($addon_file)) include($addon_file); |
|
| 115 | + if(file_exists($addon_file)) { |
|
| 116 | + include($addon_file); |
|
| 117 | + } |
|
| 116 | 118 | } |
| 117 | 119 | |
| 118 | 120 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
@@ -234,8 +236,7 @@ discard block |
||
| 234 | 236 | if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) |
| 235 | 237 | { |
| 236 | 238 | throw new Exception('msg_default_url_is_null'); |
| 237 | - } |
|
| 238 | - else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
| 239 | + } else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
| 239 | 240 | { |
| 240 | 241 | throw new exception('msg_invalid_request'); |
| 241 | 242 | } |
@@ -260,8 +261,7 @@ discard block |
||
| 260 | 261 | if(!$module_info) |
| 261 | 262 | { |
| 262 | 263 | unset($this->document_srl); |
| 263 | - } |
|
| 264 | - else |
|
| 264 | + } else |
|
| 265 | 265 | { |
| 266 | 266 | // If it exists, compare mid based on the module information |
| 267 | 267 | // if mids are not matching, set it as the document's mid |
@@ -273,8 +273,7 @@ discard block |
||
| 273 | 273 | $this->mid = $module_info->mid; |
| 274 | 274 | header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
| 275 | 275 | return FALSE; |
| 276 | - } |
|
| 277 | - else |
|
| 276 | + } else |
|
| 278 | 277 | { |
| 279 | 278 | $this->mid = $module_info->mid; |
| 280 | 279 | Context::set('mid', $this->mid); |
@@ -325,15 +324,13 @@ discard block |
||
| 325 | 324 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 326 | 325 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 327 | 326 | // If it's called from a virtual site, though it's not a module of the virtual site |
| 328 | - } |
|
| 329 | - else |
|
| 327 | + } else |
|
| 330 | 328 | { |
| 331 | 329 | $db_info = Context::getDBInfo(); |
| 332 | 330 | if(!$db_info->default_url) |
| 333 | 331 | { |
| 334 | 332 | return Context::getLang('msg_default_url_is_not_defined'); |
| 335 | - } |
|
| 336 | - else |
|
| 333 | + } else |
|
| 337 | 334 | { |
| 338 | 335 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 339 | 336 | } |
@@ -358,8 +355,7 @@ discard block |
||
| 358 | 355 | { |
| 359 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
| 360 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
| 361 | - } |
|
| 362 | - else |
|
| 358 | + } else |
|
| 363 | 359 | { |
| 364 | 360 | $layoutSrl = $module_info->{$targetSrl}; |
| 365 | 361 | } |
@@ -493,8 +489,7 @@ discard block |
||
| 493 | 489 | if(!$allowedMethod) |
| 494 | 490 | { |
| 495 | 491 | $allowedMethodList[0] = 'POST'; |
| 496 | - } |
|
| 497 | - else |
|
| 492 | + } else |
|
| 498 | 493 | { |
| 499 | 494 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 500 | 495 | } |
@@ -554,8 +549,7 @@ discard block |
||
| 554 | 549 | Mobile::setMobile(FALSE); |
| 555 | 550 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 556 | 551 | } |
| 557 | - } |
|
| 558 | - else |
|
| 552 | + } else |
|
| 559 | 553 | { |
| 560 | 554 | // create a module instance |
| 561 | 555 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
@@ -609,8 +603,7 @@ discard block |
||
| 609 | 603 | $forward->ruleset = $xml_info->action->{$this->act}->ruleset; |
| 610 | 604 | $forward->meta_noindex = $xml_info->action->{$this->act}->meta_noindex; |
| 611 | 605 | $forward->act = $this->act; |
| 612 | - } |
|
| 613 | - else |
|
| 606 | + } else |
|
| 614 | 607 | { |
| 615 | 608 | $this->error = 'msg_invalid_request'; |
| 616 | 609 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -662,8 +655,7 @@ discard block |
||
| 662 | 655 | if(!$allowedMethod) |
| 663 | 656 | { |
| 664 | 657 | $allowedMethodList[0] = 'POST'; |
| 665 | - } |
|
| 666 | - else |
|
| 658 | + } else |
|
| 667 | 659 | { |
| 668 | 660 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 669 | 661 | } |
@@ -691,8 +683,7 @@ discard block |
||
| 691 | 683 | Mobile::setMobile(FALSE); |
| 692 | 684 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 693 | 685 | } |
| 694 | - } |
|
| 695 | - else |
|
| 686 | + } else |
|
| 696 | 687 | { |
| 697 | 688 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 698 | 689 | } |
@@ -722,8 +713,7 @@ discard block |
||
| 722 | 713 | $oModule->setLayoutPath("./modules/admin/tpl"); |
| 723 | 714 | $oModule->setLayoutFile("layout.html"); |
| 724 | 715 | } |
| 725 | - } |
|
| 726 | - else |
|
| 716 | + } else |
|
| 727 | 717 | { |
| 728 | 718 | $this->_setInputErrorToContext(); |
| 729 | 719 | |
@@ -747,8 +737,7 @@ discard block |
||
| 747 | 737 | $oMessageObject->setMessage($this->error); |
| 748 | 738 | $oMessageObject->dispMessage(); |
| 749 | 739 | return $oMessageObject; |
| 750 | - } |
|
| 751 | - else |
|
| 740 | + } else |
|
| 752 | 741 | { |
| 753 | 742 | if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
| 754 | 743 | { |
@@ -762,12 +751,10 @@ discard block |
||
| 762 | 751 | } |
| 763 | 752 | } |
| 764 | 753 | } |
| 765 | - } |
|
| 766 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 754 | + } else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 767 | 755 | { |
| 768 | 756 | $this->act = $xml_info->default_index_act; |
| 769 | - } |
|
| 770 | - else |
|
| 757 | + } else |
|
| 771 | 758 | { |
| 772 | 759 | $this->error = 'msg_invalid_request'; |
| 773 | 760 | $oModule->setError(-1); |
@@ -869,7 +856,9 @@ discard block |
||
| 869 | 856 | $message = $oModule->getMessage(); |
| 870 | 857 | $messageType = $oModule->getMessageType(); |
| 871 | 858 | $redirectUrl = $oModule->getRedirectUrl(); |
| 872 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 859 | + if($messageType == 'error') { |
|
| 860 | + debugPrint($message, 'ERROR'); |
|
| 861 | + } |
|
| 873 | 862 | |
| 874 | 863 | if(!$procResult) |
| 875 | 864 | { |
@@ -879,8 +868,7 @@ discard block |
||
| 879 | 868 | $redirectUrl = Context::get('error_return_url'); |
| 880 | 869 | } |
| 881 | 870 | $this->_setInputValueToSession(); |
| 882 | - } |
|
| 883 | - else |
|
| 871 | + } else |
|
| 884 | 872 | { |
| 885 | 873 | |
| 886 | 874 | } |
@@ -1028,8 +1016,7 @@ discard block |
||
| 1028 | 1016 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1029 | 1017 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
| 1030 | 1018 | // Otherwise, set message instance as the target module |
| 1031 | - } |
|
| 1032 | - else |
|
| 1019 | + } else |
|
| 1033 | 1020 | { |
| 1034 | 1021 | $oModule = $oMessageObject; |
| 1035 | 1022 | } |
@@ -1041,8 +1028,7 @@ discard block |
||
| 1041 | 1028 | if(Mobile::isFromMobilePhone()) |
| 1042 | 1029 | { |
| 1043 | 1030 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1044 | - } |
|
| 1045 | - else |
|
| 1031 | + } else |
|
| 1046 | 1032 | { |
| 1047 | 1033 | $layout_srl = $oModule->module_info->layout_srl; |
| 1048 | 1034 | } |
@@ -1101,8 +1087,7 @@ discard block |
||
| 1101 | 1087 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
| 1102 | 1088 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
| 1103 | 1089 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1104 | - } |
|
| 1105 | - else |
|
| 1090 | + } else |
|
| 1106 | 1091 | { |
| 1107 | 1092 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file); |
| 1108 | 1093 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file); |
@@ -1139,8 +1124,7 @@ discard block |
||
| 1139 | 1124 | if($kind == 'admin') |
| 1140 | 1125 | { |
| 1141 | 1126 | $oModule->setLayoutFile('popup_layout'); |
| 1142 | - } |
|
| 1143 | - else |
|
| 1127 | + } else |
|
| 1144 | 1128 | { |
| 1145 | 1129 | $oModule->setLayoutPath('common/tpl'); |
| 1146 | 1130 | $oModule->setLayoutFile('default_layout'); |
@@ -1274,13 +1258,11 @@ discard block |
||
| 1274 | 1258 | { |
| 1275 | 1259 | $instanceName = '%s'; |
| 1276 | 1260 | $classFile = '%s%s.%s.php'; |
| 1277 | - } |
|
| 1278 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1261 | + } elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1279 | 1262 | { |
| 1280 | 1263 | $instanceName = '%sAdmin%s'; |
| 1281 | 1264 | $classFile = '%s%s.admin.%s.php'; |
| 1282 | - } |
|
| 1283 | - else |
|
| 1265 | + } else |
|
| 1284 | 1266 | { |
| 1285 | 1267 | $instanceName = '%s%s'; |
| 1286 | 1268 | $classFile = '%s%s.%s.php'; |
@@ -1343,7 +1325,9 @@ discard block |
||
| 1343 | 1325 | $slowlog->caller = $trigger_name . '.' . $called_position; |
| 1344 | 1326 | $slowlog->called = $module . '.' . $called_method; |
| 1345 | 1327 | $slowlog->called_extension = $module; |
| 1346 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1328 | + if($trigger_name != 'XE.writeSlowlog') { |
|
| 1329 | + writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1330 | + } |
|
| 1347 | 1331 | |
| 1348 | 1332 | if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
| 1349 | 1333 | { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
| 36 | 36 | { |
| 37 | 37 | // If XE has not installed yet, set module as install |
| 38 | - if(!Context::isInstalled()) |
|
| 38 | + if (!Context::isInstalled()) |
|
| 39 | 39 | { |
| 40 | 40 | $this->module = 'install'; |
| 41 | 41 | $this->act = Context::get('act'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance(); |
| 46 | - if($oContext->isSuccessInit == FALSE) |
|
| 46 | + if ($oContext->isSuccessInit == FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | // @see https://github.com/xpressengine/xe-core/issues/2304 |
| 49 | 49 | $this->error = 'msg_invalid_request'; |
@@ -56,26 +56,26 @@ discard block |
||
| 56 | 56 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 57 | 57 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 58 | 58 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 59 | - if($entry = Context::get('entry')) |
|
| 59 | + if ($entry = Context::get('entry')) |
|
| 60 | 60 | { |
| 61 | 61 | $this->entry = Context::convertEncodingStr($entry); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Validate variables to prevent XSS |
| 65 | 65 | $isInvalid = NULL; |
| 66 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 66 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 67 | 67 | { |
| 68 | 68 | $isInvalid = TRUE; |
| 69 | 69 | } |
| 70 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 70 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 71 | 71 | { |
| 72 | 72 | $isInvalid = TRUE; |
| 73 | 73 | } |
| 74 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 74 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 75 | 75 | { |
| 76 | 76 | $isInvalid = TRUE; |
| 77 | 77 | } |
| 78 | - if($isInvalid) |
|
| 78 | + if ($isInvalid) |
|
| 79 | 79 | { |
| 80 | 80 | htmlHeader(); |
| 81 | 81 | echo Context::getLang("msg_invalid_request"); |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | exit; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 87 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 88 | 88 | { |
| 89 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 89 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 90 | 90 | { |
| 91 | - if(Context::get('_https_port')!=null) { |
|
| 92 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
| 91 | + if (Context::get('_https_port') != null) { |
|
| 92 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
| 93 | 93 | } else { |
| 94 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
| 94 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
| 95 | 95 | } |
| 96 | 96 | return; |
| 97 | 97 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // call a trigger before moduleHandler init |
| 101 | 101 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
| 102 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 102 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 103 | 103 | { |
| 104 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 104 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 105 | 105 | { |
| 106 | 106 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
| 107 | 107 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -112,40 +112,40 @@ discard block |
||
| 112 | 112 | $called_position = 'before_module_init'; |
| 113 | 113 | $oAddonController = getController('addon'); |
| 114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 115 | - if(file_exists($addon_file)) include($addon_file); |
|
| 115 | + if (file_exists($addon_file)) include($addon_file); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 119 | 119 | { |
| 120 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 120 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 121 | 121 | { |
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | set_error_handler(function() { }, ~0); |
| 126 | 126 | |
| 127 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 128 | - if(!file_exists($debug_file)) |
|
| 127 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 128 | + if (!file_exists($debug_file)) |
|
| 129 | 129 | { |
| 130 | 130 | $print[] = '<?php exit() ?>'; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $errorname = self::getErrorType($errnumber); |
| 134 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 134 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 135 | 135 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 136 | 136 | $backtrace = debug_backtrace($backtrace_args); |
| 137 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 137 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 138 | 138 | { |
| 139 | 139 | array_shift($backtrace); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - foreach($backtrace as $key => $value) |
|
| 142 | + foreach ($backtrace as $key => $value) |
|
| 143 | 143 | { |
| 144 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 144 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 145 | 145 | $print[] = $message; |
| 146 | 146 | } |
| 147 | 147 | $print[] = PHP_EOL; |
| 148 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 148 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 149 | 149 | restore_error_handler(); |
| 150 | 150 | |
| 151 | 151 | return true; |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | set_error_handler(function() { }, ~0); |
| 163 | 163 | |
| 164 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 165 | - if(!file_exists($debug_file)) |
|
| 164 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 165 | + if (!file_exists($debug_file)) |
|
| 166 | 166 | { |
| 167 | 167 | $print[] = '<?php exit() ?>'; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $errorname = self::getErrorType($errinfo['type']); |
| 171 | 171 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 172 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 172 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 173 | 173 | |
| 174 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 174 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 175 | 175 | $print[] = $message; |
| 176 | 176 | |
| 177 | 177 | $print[] = PHP_EOL; |
| 178 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 178 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 179 | 179 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 180 | 180 | |
| 181 | 181 | return true; |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | $siteDomain = parse_url($site_module_info->domain); |
| 222 | 222 | $siteDomain = $siteDomain['host']; |
| 223 | 223 | |
| 224 | - foreach($urls as $url) |
|
| 224 | + foreach ($urls as $url) |
|
| 225 | 225 | { |
| 226 | - if(empty($url)) |
|
| 226 | + if (empty($url)) |
|
| 227 | 227 | { |
| 228 | 228 | continue; |
| 229 | 229 | } |
@@ -231,33 +231,33 @@ discard block |
||
| 231 | 231 | $urlInfo = parse_url(urldecode($url)); |
| 232 | 232 | $host = $urlInfo['host']; |
| 233 | 233 | |
| 234 | - if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) |
|
| 234 | + if ($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) |
|
| 235 | 235 | { |
| 236 | 236 | throw new Exception('msg_default_url_is_null'); |
| 237 | 237 | } |
| 238 | - else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
| 238 | + else if ((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
| 239 | 239 | { |
| 240 | 240 | throw new exception('msg_invalid_request'); |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 244 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 245 | 245 | { |
| 246 | 246 | $oDocumentModel = getModel('document'); |
| 247 | 247 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 248 | - if($this->document_srl) |
|
| 248 | + if ($this->document_srl) |
|
| 249 | 249 | { |
| 250 | 250 | Context::set('document_srl', $this->document_srl); |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // Get module's information based on document_srl, if it's specified |
| 255 | - if($this->document_srl) |
|
| 255 | + if ($this->document_srl) |
|
| 256 | 256 | { |
| 257 | 257 | |
| 258 | 258 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 259 | 259 | // If the document does not exist, remove document_srl |
| 260 | - if(!$module_info) |
|
| 260 | + if (!$module_info) |
|
| 261 | 261 | { |
| 262 | 262 | unset($this->document_srl); |
| 263 | 263 | } |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | { |
| 266 | 266 | // If it exists, compare mid based on the module information |
| 267 | 267 | // if mids are not matching, set it as the document's mid |
| 268 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 268 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 269 | 269 | { |
| 270 | 270 | |
| 271 | - if(Context::getRequestMethod() == 'GET') |
|
| 271 | + if (Context::getRequestMethod() == 'GET') |
|
| 272 | 272 | { |
| 273 | 273 | $this->mid = $module_info->mid; |
| 274 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 274 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 275 | 275 | return FALSE; |
| 276 | 276 | } |
| 277 | 277 | else |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | } |
| 284 | 284 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 285 | - if($this->module && $module_info->module != $this->module) |
|
| 285 | + if ($this->module && $module_info->module != $this->module) |
|
| 286 | 286 | { |
| 287 | 287 | unset($module_info); |
| 288 | 288 | } |
@@ -291,36 +291,36 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 294 | - if(!$module_info && $this->mid) |
|
| 294 | + if (!$module_info && $this->mid) |
|
| 295 | 295 | { |
| 296 | 296 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 297 | 297 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // redirect, if module_site_srl and site_srl are different |
| 301 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 301 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 302 | 302 | { |
| 303 | 303 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 304 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 304 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 305 | 305 | return FALSE; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | // If module_info is not set still, and $module does not exist, find the default module |
| 309 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 309 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 310 | 310 | { |
| 311 | 311 | $module_info = $site_module_info; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 314 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 315 | 315 | { |
| 316 | 316 | $module_info = $site_module_info; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 320 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 320 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 321 | 321 | { |
| 322 | 322 | // If the module is of virtual site |
| 323 | - if($module_info->site_srl) |
|
| 323 | + if ($module_info->site_srl) |
|
| 324 | 324 | { |
| 325 | 325 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 326 | 326 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | else |
| 330 | 330 | { |
| 331 | 331 | $db_info = Context::getDBInfo(); |
| 332 | - if(!$db_info->default_url) |
|
| 332 | + if (!$db_info->default_url) |
|
| 333 | 333 | { |
| 334 | 334 | return Context::getLang('msg_default_url_is_not_defined'); |
| 335 | 335 | } |
@@ -338,12 +338,12 @@ discard block |
||
| 338 | 338 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | - header("location:" . $redirect_url); |
|
| 341 | + header("location:".$redirect_url); |
|
| 342 | 342 | return FALSE; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // If module info was set, retrieve variables from the module information |
| 346 | - if($module_info) |
|
| 346 | + if ($module_info) |
|
| 347 | 347 | { |
| 348 | 348 | $this->module = $module_info->module; |
| 349 | 349 | $this->mid = $module_info->mid; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 355 | 355 | |
| 356 | 356 | // use the site default layout. |
| 357 | - if($module_info->{$targetSrl} == -1) |
|
| 357 | + if ($module_info->{$targetSrl} == -1) |
|
| 358 | 358 | { |
| 359 | 359 | $oLayoutAdminModel = getAdminModel('layout'); |
| 360 | 360 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // Set module and mid into module_info |
| 375 | - if(!isset($this->module_info)) |
|
| 375 | + if (!isset($this->module_info)) |
|
| 376 | 376 | { |
| 377 | 377 | $this->module_info = new stdClass(); |
| 378 | 378 | } |
@@ -383,21 +383,21 @@ discard block |
||
| 383 | 383 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 384 | 384 | |
| 385 | 385 | // Still no module? it's an error |
| 386 | - if(!$this->module) |
|
| 386 | + if (!$this->module) |
|
| 387 | 387 | { |
| 388 | 388 | $this->error = 'msg_module_is_not_exists'; |
| 389 | 389 | $this->httpStatusCode = '404'; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | // If mid exists, set mid into context |
| 393 | - if($this->mid) |
|
| 393 | + if ($this->mid) |
|
| 394 | 394 | { |
| 395 | 395 | Context::set('mid', $this->mid, TRUE); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Call a trigger after moduleHandler init |
| 399 | 399 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 400 | - if(!$output->toBool()) |
|
| 400 | + if (!$output->toBool()) |
|
| 401 | 401 | { |
| 402 | 402 | $this->error = $output->getMessage(); |
| 403 | 403 | return TRUE; |
@@ -419,14 +419,14 @@ discard block |
||
| 419 | 419 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 420 | 420 | |
| 421 | 421 | // If error occurred while preparation, return a message instance |
| 422 | - if($this->error) |
|
| 422 | + if ($this->error) |
|
| 423 | 423 | { |
| 424 | 424 | $this->_setInputErrorToContext(); |
| 425 | 425 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 426 | 426 | $oMessageObject->setError(-1); |
| 427 | 427 | $oMessageObject->setMessage($this->error); |
| 428 | 428 | $oMessageObject->dispMessage(); |
| 429 | - if($this->httpStatusCode) |
|
| 429 | + if ($this->httpStatusCode) |
|
| 430 | 430 | { |
| 431 | 431 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 432 | 432 | } |
@@ -437,22 +437,22 @@ discard block |
||
| 437 | 437 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 438 | 438 | |
| 439 | 439 | // If not installed yet, modify act |
| 440 | - if($this->module == "install") |
|
| 440 | + if ($this->module == "install") |
|
| 441 | 441 | { |
| 442 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 442 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 443 | 443 | { |
| 444 | 444 | $this->act = $xml_info->default_index_act; |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | // if act exists, find type of the action, if not use default index act |
| 449 | - if(!$this->act) |
|
| 449 | + if (!$this->act) |
|
| 450 | 450 | { |
| 451 | 451 | $this->act = $xml_info->default_index_act; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // still no act means error |
| 455 | - if(!$this->act) |
|
| 455 | + if (!$this->act) |
|
| 456 | 456 | { |
| 457 | 457 | $this->error = 'msg_module_is_not_exists'; |
| 458 | 458 | $this->httpStatusCode = '404'; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $oMessageObject->setError(-1); |
| 463 | 463 | $oMessageObject->setMessage($this->error); |
| 464 | 464 | $oMessageObject->dispMessage(); |
| 465 | - if($this->httpStatusCode) |
|
| 465 | + if ($this->httpStatusCode) |
|
| 466 | 466 | { |
| 467 | 467 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 468 | 468 | } |
@@ -480,17 +480,17 @@ discard block |
||
| 480 | 480 | Context::addMetaTag('robots', 'noindex'); |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - if(!$kind && $this->module == 'admin') |
|
| 483 | + if (!$kind && $this->module == 'admin') |
|
| 484 | 484 | { |
| 485 | 485 | $kind = 'admin'; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | // check REQUEST_METHOD in controller |
| 489 | - if($type == 'controller') |
|
| 489 | + if ($type == 'controller') |
|
| 490 | 490 | { |
| 491 | 491 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 492 | 492 | |
| 493 | - if(!$allowedMethod) |
|
| 493 | + if (!$allowedMethod) |
|
| 494 | 494 | { |
| 495 | 495 | $allowedMethodList[0] = 'POST'; |
| 496 | 496 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 502 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 503 | 503 | { |
| 504 | 504 | $this->error = "msg_invalid_request"; |
| 505 | 505 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if($this->module_info->use_mobile != "Y") |
|
| 513 | + if ($this->module_info->use_mobile != "Y") |
|
| 514 | 514 | { |
| 515 | 515 | Mobile::setMobile(FALSE); |
| 516 | 516 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | // check CSRF for non-GET actions |
| 521 | 521 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 522 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 522 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 523 | 523 | { |
| 524 | 524 | $this->error = 'msg_invalid_request'; |
| 525 | 525 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | // Admin ip |
| 533 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 533 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 534 | 534 | { |
| 535 | 535 | $this->_setInputErrorToContext(); |
| 536 | 536 | $this->error = "msg_not_permitted_act"; |
@@ -542,13 +542,13 @@ discard block |
||
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | // if(type == view, and case for using mobilephone) |
| 545 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 545 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 546 | 546 | { |
| 547 | 547 | $orig_type = "view"; |
| 548 | 548 | $type = "mobile"; |
| 549 | 549 | // create a module instance |
| 550 | 550 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 551 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 551 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 552 | 552 | { |
| 553 | 553 | $type = $orig_type; |
| 554 | 554 | Mobile::setMobile(FALSE); |
@@ -561,14 +561,14 @@ discard block |
||
| 561 | 561 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if(!is_object($oModule)) |
|
| 564 | + if (!is_object($oModule)) |
|
| 565 | 565 | { |
| 566 | 566 | $this->_setInputErrorToContext(); |
| 567 | 567 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 568 | 568 | $oMessageObject->setError(-1); |
| 569 | 569 | $oMessageObject->setMessage($this->error); |
| 570 | 570 | $oMessageObject->dispMessage(); |
| 571 | - if($this->httpStatusCode) |
|
| 571 | + if ($this->httpStatusCode) |
|
| 572 | 572 | { |
| 573 | 573 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 574 | 574 | } |
@@ -576,10 +576,10 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | // If there is no such action in the module object |
| 579 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 579 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 580 | 580 | { |
| 581 | 581 | |
| 582 | - if(!Context::isInstalled()) |
|
| 582 | + if (!Context::isInstalled()) |
|
| 583 | 583 | { |
| 584 | 584 | $this->_setInputErrorToContext(); |
| 585 | 585 | $this->error = 'msg_invalid_request'; |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | $oMessageObject->setError(-1); |
| 588 | 588 | $oMessageObject->setMessage($this->error); |
| 589 | 589 | $oMessageObject->dispMessage(); |
| 590 | - if($this->httpStatusCode) |
|
| 590 | + if ($this->httpStatusCode) |
|
| 591 | 591 | { |
| 592 | 592 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 593 | 593 | } |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | $forward = NULL; |
| 598 | 598 | // 1. Look for the module with action name |
| 599 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 599 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 600 | 600 | { |
| 601 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 601 | + $module = strtolower($matches[2].$matches[3]); |
|
| 602 | 602 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 603 | 603 | |
| 604 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 604 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 605 | 605 | { |
| 606 | 606 | $forward = new stdClass(); |
| 607 | 607 | $forward->module = $module; |
@@ -622,12 +622,12 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | - if(!$forward) |
|
| 625 | + if (!$forward) |
|
| 626 | 626 | { |
| 627 | 627 | $forward = $oModuleModel->getActionForward($this->act); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 630 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 631 | 631 | { |
| 632 | 632 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 633 | 633 | $type = $forward->type; |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $tpl_path = $oModule->getTemplatePath(); |
| 636 | 636 | $orig_module = $oModule; |
| 637 | 637 | |
| 638 | - if($forward->meta_noindex === 'true') { |
|
| 638 | + if ($forward->meta_noindex === 'true') { |
|
| 639 | 639 | Context::addMetaTag('robots', 'noindex'); |
| 640 | 640 | } |
| 641 | 641 | |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | // check CSRF for non-GET actions |
| 645 | 645 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 646 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 646 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 647 | 647 | { |
| 648 | 648 | $this->error = 'msg_invalid_request'; |
| 649 | 649 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -655,11 +655,11 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | // SECISSUE also check foward act method |
| 657 | 657 | // check REQUEST_METHOD in controller |
| 658 | - if($type == 'controller') |
|
| 658 | + if ($type == 'controller') |
|
| 659 | 659 | { |
| 660 | 660 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 661 | 661 | |
| 662 | - if(!$allowedMethod) |
|
| 662 | + if (!$allowedMethod) |
|
| 663 | 663 | { |
| 664 | 664 | $allowedMethodList[0] = 'POST'; |
| 665 | 665 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 671 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 672 | 672 | { |
| 673 | 673 | $this->error = "msg_invalid_request"; |
| 674 | 674 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 682 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 683 | 683 | { |
| 684 | 684 | $orig_type = "view"; |
| 685 | 685 | $type = "mobile"; |
| 686 | 686 | // create a module instance |
| 687 | 687 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 688 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 688 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 689 | 689 | { |
| 690 | 690 | $type = $orig_type; |
| 691 | 691 | Mobile::setMobile(FALSE); |
@@ -697,25 +697,25 @@ discard block |
||
| 697 | 697 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - if(!is_object($oModule)) |
|
| 700 | + if (!is_object($oModule)) |
|
| 701 | 701 | { |
| 702 | 702 | $this->_setInputErrorToContext(); |
| 703 | 703 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 704 | 704 | $oMessageObject->setError(-1); |
| 705 | 705 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 706 | 706 | $oMessageObject->dispMessage(); |
| 707 | - if($this->httpStatusCode) |
|
| 707 | + if ($this->httpStatusCode) |
|
| 708 | 708 | { |
| 709 | 709 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 710 | 710 | } |
| 711 | 711 | return $oMessageObject; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if($this->module == "admin" && $type == "view") |
|
| 714 | + if ($this->module == "admin" && $type == "view") |
|
| 715 | 715 | { |
| 716 | - if($logged_info->is_admin == 'Y') |
|
| 716 | + if ($logged_info->is_admin == 'Y') |
|
| 717 | 717 | { |
| 718 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 718 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 719 | 719 | { |
| 720 | 720 | $oAdminView = getAdminView('admin'); |
| 721 | 721 | $oAdminView->makeGnbUrl($forward->module); |
@@ -735,10 +735,10 @@ discard block |
||
| 735 | 735 | return $oMessageObject; |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | - if($kind == 'admin') |
|
| 738 | + if ($kind == 'admin') |
|
| 739 | 739 | { |
| 740 | 740 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 741 | - if(!$grant->manager) |
|
| 741 | + if (!$grant->manager) |
|
| 742 | 742 | { |
| 743 | 743 | $this->_setInputErrorToContext(); |
| 744 | 744 | $this->error = 'msg_is_not_manager'; |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | else |
| 752 | 752 | { |
| 753 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 753 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 754 | 754 | { |
| 755 | 755 | $this->_setInputErrorToContext(); |
| 756 | 756 | $this->error = 'msg_is_not_administrator'; |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | } |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 766 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 767 | 767 | { |
| 768 | 768 | $this->act = $xml_info->default_index_act; |
| 769 | 769 | } |
@@ -777,16 +777,16 @@ discard block |
||
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | // ruleset check... |
| 780 | - if(!empty($ruleset)) |
|
| 780 | + if (!empty($ruleset)) |
|
| 781 | 781 | { |
| 782 | 782 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 783 | 783 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 784 | - if(!empty($rulesetFile)) |
|
| 784 | + if (!empty($rulesetFile)) |
|
| 785 | 785 | { |
| 786 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 786 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 787 | 787 | { |
| 788 | 788 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 789 | - foreach($errorLang as $key => $val) |
|
| 789 | + foreach ($errorLang as $key => $val) |
|
| 790 | 790 | { |
| 791 | 791 | Context::setLang($key, $val); |
| 792 | 792 | } |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | |
| 796 | 796 | $Validator = new Validator($rulesetFile); |
| 797 | 797 | $result = $Validator->validate(); |
| 798 | - if(!$result) |
|
| 798 | + if (!$result) |
|
| 799 | 799 | { |
| 800 | 800 | $lastError = $Validator->getLastError(); |
| 801 | 801 | $returnUrl = Context::get('error_return_url'); |
@@ -827,26 +827,26 @@ discard block |
||
| 827 | 827 | 'dispLayoutPreviewWithModule' => 1 |
| 828 | 828 | ); |
| 829 | 829 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 830 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 830 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 831 | 831 | { |
| 832 | 832 | global $lang; |
| 833 | 833 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
| 834 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
| 834 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
| 835 | 835 | Context::addHtmlHeader($header); |
| 836 | 836 | Context::addHtmlFooter($footer); |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
| 839 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
| 840 | 840 | { |
| 841 | 841 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 842 | - if($module_config->htmlFooter) |
|
| 842 | + if ($module_config->htmlFooter) |
|
| 843 | 843 | { |
| 844 | 844 | Context::addHtmlFooter($module_config->htmlFooter); |
| 845 | 845 | } |
| 846 | - if($module_config->siteTitle) |
|
| 846 | + if ($module_config->siteTitle) |
|
| 847 | 847 | { |
| 848 | 848 | $siteTitle = Context::getBrowserTitle(); |
| 849 | - if(!$siteTitle) |
|
| 849 | + if (!$siteTitle) |
|
| 850 | 850 | { |
| 851 | 851 | Context::setBrowserTitle($module_config->siteTitle); |
| 852 | 852 | } |
@@ -863,18 +863,18 @@ discard block |
||
| 863 | 863 | $procResult = $oModule->proc(); |
| 864 | 864 | |
| 865 | 865 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 866 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 866 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 867 | 867 | { |
| 868 | 868 | $error = $oModule->getError(); |
| 869 | 869 | $message = $oModule->getMessage(); |
| 870 | 870 | $messageType = $oModule->getMessageType(); |
| 871 | 871 | $redirectUrl = $oModule->getRedirectUrl(); |
| 872 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 872 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 873 | 873 | |
| 874 | - if(!$procResult) |
|
| 874 | + if (!$procResult) |
|
| 875 | 875 | { |
| 876 | 876 | $this->error = $message; |
| 877 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 877 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 878 | 878 | { |
| 879 | 879 | $redirectUrl = Context::get('error_return_url'); |
| 880 | 880 | } |
@@ -887,13 +887,13 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 889 | 889 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 890 | - if($message != 'success') |
|
| 890 | + if ($message != 'success') |
|
| 891 | 891 | { |
| 892 | 892 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 893 | 893 | } |
| 894 | 894 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 895 | 895 | |
| 896 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 896 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 897 | 897 | { |
| 898 | 898 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 899 | 899 | } |
@@ -909,27 +909,27 @@ discard block |
||
| 909 | 909 | * */ |
| 910 | 910 | function _setInputErrorToContext() |
| 911 | 911 | { |
| 912 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 912 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 913 | 913 | { |
| 914 | 914 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 915 | 915 | } |
| 916 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 916 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 917 | 917 | { |
| 918 | 918 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 919 | 919 | } |
| 920 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 920 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 921 | 921 | { |
| 922 | 922 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 923 | 923 | } |
| 924 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 924 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 925 | 925 | { |
| 926 | 926 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 927 | 927 | } |
| 928 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 928 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 929 | 929 | { |
| 930 | 930 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 931 | 931 | } |
| 932 | - if(is_array($_SESSION['INPUT_ERROR']) && count($_SESSION['INPUT_ERROR'])) |
|
| 932 | + if (is_array($_SESSION['INPUT_ERROR']) && count($_SESSION['INPUT_ERROR'])) |
|
| 933 | 933 | { |
| 934 | 934 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 935 | 935 | } |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | { |
| 960 | 960 | $requestVars = Context::getRequestVars(); |
| 961 | 961 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 962 | - foreach($requestVars AS $key => $value) |
|
| 962 | + foreach ($requestVars AS $key => $value) |
|
| 963 | 963 | { |
| 964 | 964 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 965 | 965 | } |
@@ -973,41 +973,41 @@ discard block |
||
| 973 | 973 | function displayContent($oModule = NULL) |
| 974 | 974 | { |
| 975 | 975 | // If the module is not set or not an object, set error |
| 976 | - if(!$oModule || !is_object($oModule)) |
|
| 976 | + if (!$oModule || !is_object($oModule)) |
|
| 977 | 977 | { |
| 978 | 978 | $this->error = 'msg_module_is_not_exists'; |
| 979 | 979 | $this->httpStatusCode = '404'; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | // If connection to DB has a problem even though it's not install module, set error |
| 983 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 983 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 984 | 984 | { |
| 985 | 985 | $this->error = 'msg_dbconnect_failed'; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | // Call trigger after moduleHandler proc |
| 989 | 989 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 990 | - if(!$output->toBool()) |
|
| 990 | + if (!$output->toBool()) |
|
| 991 | 991 | { |
| 992 | 992 | $this->error = $output->getMessage(); |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | // Use message view object, if HTML call |
| 996 | 996 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 997 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 997 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 998 | 998 | { |
| 999 | 999 | |
| 1000 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 1000 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | $display_handler = new DisplayHandler(); |
| 1003 | 1003 | $display_handler->_debugOutput(); |
| 1004 | 1004 | |
| 1005 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 1005 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 1006 | 1006 | return; |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | // If error occurred, handle it |
| 1010 | - if($this->error) |
|
| 1010 | + if ($this->error) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | // display content with message module instance |
| 1013 | 1013 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -1016,14 +1016,14 @@ discard block |
||
| 1016 | 1016 | $oMessageObject->setMessage($this->error); |
| 1017 | 1017 | $oMessageObject->dispMessage(); |
| 1018 | 1018 | |
| 1019 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1019 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1020 | 1020 | { |
| 1021 | 1021 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 1022 | 1022 | $oMessageObject->setTemplateFile('http_status_code'); |
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | // If module was called normally, change the templates of the module into ones of the message view module |
| 1026 | - if($oModule) |
|
| 1026 | + if ($oModule) |
|
| 1027 | 1027 | { |
| 1028 | 1028 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1029 | 1029 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | // Check if layout_srl exists for the module |
| 1041 | - if(Mobile::isFromMobilePhone()) |
|
| 1041 | + if (Mobile::isFromMobilePhone()) |
|
| 1042 | 1042 | { |
| 1043 | 1043 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1044 | 1044 | } |
@@ -1048,58 +1048,58 @@ discard block |
||
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | // if layout_srl is rollback by module, set default layout |
| 1051 | - if($layout_srl == -1) |
|
| 1051 | + if ($layout_srl == -1) |
|
| 1052 | 1052 | { |
| 1053 | 1053 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1054 | 1054 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1055 | 1055 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1058 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | |
| 1061 | 1061 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1062 | 1062 | $oLayoutModel = getModel('layout'); |
| 1063 | 1063 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1064 | - if($layout_info) |
|
| 1064 | + if ($layout_info) |
|
| 1065 | 1065 | { |
| 1066 | 1066 | |
| 1067 | 1067 | // Input extra_vars into $layout_info |
| 1068 | - if($layout_info->extra_var_count) |
|
| 1068 | + if ($layout_info->extra_var_count) |
|
| 1069 | 1069 | { |
| 1070 | 1070 | |
| 1071 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1071 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1072 | 1072 | { |
| 1073 | - if($val->type == 'image') |
|
| 1073 | + if ($val->type == 'image') |
|
| 1074 | 1074 | { |
| 1075 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1075 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1076 | 1076 | { |
| 1077 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1077 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | $layout_info->{$var_id} = $val->value; |
| 1081 | 1081 | } |
| 1082 | 1082 | } |
| 1083 | 1083 | // Set menus into context |
| 1084 | - if($layout_info->menu_count) |
|
| 1084 | + if ($layout_info->menu_count) |
|
| 1085 | 1085 | { |
| 1086 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1086 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1087 | 1087 | { |
| 1088 | 1088 | // set default menu set(included home menu) |
| 1089 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1089 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1090 | 1090 | { |
| 1091 | 1091 | $oMenuAdminController = getAdminController('menu'); |
| 1092 | 1092 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1093 | 1093 | |
| 1094 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1094 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | include($homeMenuCacheFile); |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | - if(!$menu->menu_srl) |
|
| 1099 | + if (!$menu->menu_srl) |
|
| 1100 | 1100 | { |
| 1101 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1102 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1101 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1102 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1103 | 1103 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1104 | 1104 | } |
| 1105 | 1105 | else |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | $php_file = FileHandler::exists($menu->php_file); |
| 1113 | - if($php_file) |
|
| 1113 | + if ($php_file) |
|
| 1114 | 1114 | { |
| 1115 | 1115 | include($php_file); |
| 1116 | 1116 | } |
@@ -1126,17 +1126,17 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | // If layout was modified, use the modified version |
| 1128 | 1128 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1129 | - if(file_exists($edited_layout)) |
|
| 1129 | + if (file_exists($edited_layout)) |
|
| 1130 | 1130 | { |
| 1131 | 1131 | $oModule->setEditedLayoutFile($edited_layout); |
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | 1134 | } |
| 1135 | 1135 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1136 | - if($isLayoutDrop) |
|
| 1136 | + if ($isLayoutDrop) |
|
| 1137 | 1137 | { |
| 1138 | 1138 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1139 | - if($kind == 'admin') |
|
| 1139 | + if ($kind == 'admin') |
|
| 1140 | 1140 | { |
| 1141 | 1141 | $oModule->setLayoutFile('popup_layout'); |
| 1142 | 1142 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1175 | 1175 | { |
| 1176 | 1176 | |
| 1177 | - if(__DEBUG__ == 3) |
|
| 1177 | + if (__DEBUG__ == 3) |
|
| 1178 | 1178 | { |
| 1179 | 1179 | $start_time = getMicroTime(); |
| 1180 | 1180 | } |
@@ -1184,51 +1184,51 @@ discard block |
||
| 1184 | 1184 | $type = strtolower($type); |
| 1185 | 1185 | |
| 1186 | 1186 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1187 | - if(!isset($kinds[$kind])) |
|
| 1187 | + if (!isset($kinds[$kind])) |
|
| 1188 | 1188 | { |
| 1189 | 1189 | $kind = 'svc'; |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1192 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1193 | 1193 | |
| 1194 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1194 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | // if there is no instance of the module in global variable, create a new one |
| 1200 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1200 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1203 | 1203 | |
| 1204 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1204 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1205 | 1205 | { |
| 1206 | 1206 | $module = $parent_module; |
| 1207 | 1207 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | // Check if the base class and instance class exist |
| 1211 | - if(!class_exists($module, true)) |
|
| 1211 | + if (!class_exists($module, true)) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | return NULL; |
| 1214 | 1214 | } |
| 1215 | - if(!class_exists($instance_name, true)) |
|
| 1215 | + if (!class_exists($instance_name, true)) |
|
| 1216 | 1216 | { |
| 1217 | 1217 | return NULL; |
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | // Create an instance |
| 1221 | 1221 | $oModule = new $instance_name(); |
| 1222 | - if(!is_object($oModule)) |
|
| 1222 | + if (!is_object($oModule)) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | return NULL; |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | // Load language files for the class |
| 1228 | - Context::loadLang($class_path . 'lang'); |
|
| 1229 | - if($extend_module) |
|
| 1228 | + Context::loadLang($class_path.'lang'); |
|
| 1229 | + if ($extend_module) |
|
| 1230 | 1230 | { |
| 1231 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1231 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // Set variables to the instance |
@@ -1236,10 +1236,10 @@ discard block |
||
| 1236 | 1236 | $oModule->setModulePath($class_path); |
| 1237 | 1237 | |
| 1238 | 1238 | // If the module has a constructor, run it. |
| 1239 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1239 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1242 | - if(@method_exists($oModule, $instance_name)) |
|
| 1242 | + if (@method_exists($oModule, $instance_name)) |
|
| 1243 | 1243 | { |
| 1244 | 1244 | $oModule->{$instance_name}(); |
| 1245 | 1245 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - if(__DEBUG__ == 3) |
|
| 1252 | + if (__DEBUG__ == 3) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1255 | 1255 | } |
@@ -1265,17 +1265,17 @@ discard block |
||
| 1265 | 1265 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1266 | 1266 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1267 | 1267 | |
| 1268 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1269 | - if(!in_array($type, $types)) |
|
| 1268 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1269 | + if (!in_array($type, $types)) |
|
| 1270 | 1270 | { |
| 1271 | 1271 | $type = $types[0]; |
| 1272 | 1272 | } |
| 1273 | - if($type == 'class') |
|
| 1273 | + if ($type == 'class') |
|
| 1274 | 1274 | { |
| 1275 | 1275 | $instanceName = '%s'; |
| 1276 | 1276 | $classFile = '%s%s.%s.php'; |
| 1277 | 1277 | } |
| 1278 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1278 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1279 | 1279 | { |
| 1280 | 1280 | $instanceName = '%sAdmin%s'; |
| 1281 | 1281 | $classFile = '%s%s.admin.%s.php'; |
@@ -1300,26 +1300,26 @@ discard block |
||
| 1300 | 1300 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1301 | 1301 | { |
| 1302 | 1302 | // skip if not installed |
| 1303 | - if(!Context::isInstalled()) |
|
| 1303 | + if (!Context::isInstalled()) |
|
| 1304 | 1304 | { |
| 1305 | 1305 | return new BaseObject(); |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | $oModuleModel = getModel('module'); |
| 1309 | 1309 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1310 | - if(!$triggers || count($triggers) < 1) |
|
| 1310 | + if (!$triggers || count($triggers) < 1) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | return new BaseObject(); |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | //store before trigger call time |
| 1316 | 1316 | $before_trigger_time = NULL; |
| 1317 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1317 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | $before_trigger_time = microtime(true); |
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | - foreach($triggers as $item) |
|
| 1322 | + foreach ($triggers as $item) |
|
| 1323 | 1323 | { |
| 1324 | 1324 | $module = $item->module; |
| 1325 | 1325 | $type = $item->type; |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | |
| 1328 | 1328 | // todo why don't we call a normal class object ? |
| 1329 | 1329 | $oModule = getModule($module, $type); |
| 1330 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1330 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | continue; |
| 1333 | 1333 | } |
@@ -1340,12 +1340,12 @@ discard block |
||
| 1340 | 1340 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1341 | 1341 | |
| 1342 | 1342 | $slowlog = new stdClass; |
| 1343 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1344 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1343 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1344 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1345 | 1345 | $slowlog->called_extension = $module; |
| 1346 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1346 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1347 | 1347 | |
| 1348 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1348 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | return $output; |
| 1351 | 1351 | } |
@@ -1430,9 +1430,9 @@ discard block |
||
| 1430 | 1430 | '511' => 'Network Authentication Required', |
| 1431 | 1431 | ); |
| 1432 | 1432 | $statusMessage = $statusMessageList[$code]; |
| 1433 | - if(!$statusMessage) |
|
| 1433 | + if (!$statusMessage) |
|
| 1434 | 1434 | { |
| 1435 | - $statusMessage = 'HTTP ' . $code; |
|
| 1435 | + $statusMessage = 'HTTP '.$code; |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | Context::set('http_status_code', $code); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | 143 | * sett to set module information |
| 144 | - * @param object $module_info object containing module information |
|
| 144 | + * @param stdClass $module_info object containing module information |
|
| 145 | 145 | * @param object $xml_info object containing module description |
| 146 | 146 | * @return void |
| 147 | 147 | * */ |
@@ -247,6 +247,7 @@ discard block |
||
| 247 | 247 | /** |
| 248 | 248 | * set the file name of the template file |
| 249 | 249 | * @param string name of file |
| 250 | + * @param string $filename |
|
| 250 | 251 | * @return void |
| 251 | 252 | * */ |
| 252 | 253 | function setTemplateFile($filename) |
@@ -270,6 +271,7 @@ discard block |
||
| 270 | 271 | /** |
| 271 | 272 | * set the directory path of the template directory |
| 272 | 273 | * @param string path of template directory. |
| 274 | + * @param string $path |
|
| 273 | 275 | * @return void |
| 274 | 276 | * */ |
| 275 | 277 | function setTemplatePath($path) |
@@ -325,6 +327,7 @@ discard block |
||
| 325 | 327 | /** |
| 326 | 328 | * set the file name of the layout file |
| 327 | 329 | * @param string name of file |
| 330 | + * @param string $filename |
|
| 328 | 331 | * @return void |
| 329 | 332 | * */ |
| 330 | 333 | function setLayoutFile($filename) |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * */ |
| 45 | 45 | function setModulePath($path) |
| 46 | 46 | { |
| 47 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 47 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 48 | 48 | { |
| 49 | - $path.='/'; |
|
| 49 | + $path .= '/'; |
|
| 50 | 50 | } |
| 51 | 51 | $this->module_path = $path; |
| 52 | 52 | } |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | function setRedirectUrl($url = './', $output = NULL) |
| 61 | 61 | { |
| 62 | 62 | $ajaxRequestMethod = array_flip($this->ajaxRequestMethod); |
| 63 | - if(!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
| 63 | + if (!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
| 64 | 64 | { |
| 65 | 65 | $this->add('redirect_url', $url); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if($output !== NULL && is_object($output)) |
|
| 68 | + if ($output !== NULL && is_object($output)) |
|
| 69 | 69 | { |
| 70 | 70 | return $output; |
| 71 | 71 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $type = $this->get('message_type'); |
| 112 | 112 | $typeList = array('error' => 1, 'info' => 1, 'update' => 1); |
| 113 | - if(!isset($typeList[$type])) |
|
| 113 | + if (!isset($typeList[$type])) |
|
| 114 | 114 | { |
| 115 | 115 | $type = $this->getError() ? 'error' : 'info'; |
| 116 | 116 | } |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | $oModuleModel = getModel('module'); |
| 162 | 162 | // permission settings. access, manager(== is_admin) are fixed and privilege name in XE |
| 163 | 163 | $module_srl = Context::get('module_srl'); |
| 164 | - if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
| 164 | + if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
| 165 | 165 | { |
| 166 | 166 | $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 167 | - if($request_module->module_srl == $module_srl) |
|
| 167 | + if ($request_module->module_srl == $module_srl) |
|
| 168 | 168 | { |
| 169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
| 170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
| 175 | 175 | // have at least access grant |
| 176 | - if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
| 176 | + if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
| 177 | 177 | { |
| 178 | 178 | $grant->access = 1; |
| 179 | 179 | } |
@@ -181,24 +181,24 @@ discard block |
||
| 181 | 181 | // display no permission if the current module doesn't have an access privilege |
| 182 | 182 | //if(!$grant->access) return $this->stop("msg_not_permitted"); |
| 183 | 183 | // checks permission and action if you don't have an admin privilege |
| 184 | - if(!$grant->manager) |
|
| 184 | + if (!$grant->manager) |
|
| 185 | 185 | { |
| 186 | 186 | // get permission types(guest, member, manager, root) of the currently requested action |
| 187 | 187 | $permission_target = $xml_info->permission->{$this->act}; |
| 188 | 188 | // check manager if a permission in module.xml otherwise action if no permission |
| 189 | - if(!$permission_target && substr_count($this->act, 'Admin')) |
|
| 189 | + if (!$permission_target && substr_count($this->act, 'Admin')) |
|
| 190 | 190 | { |
| 191 | 191 | $permission_target = 'manager'; |
| 192 | 192 | } |
| 193 | 193 | // Check permissions |
| 194 | - switch($permission_target) |
|
| 194 | + switch ($permission_target) |
|
| 195 | 195 | { |
| 196 | 196 | case 'root' : |
| 197 | 197 | case 'manager' : |
| 198 | 198 | $this->stop('msg_is_not_administrator'); |
| 199 | 199 | return; |
| 200 | 200 | case 'member' : |
| 201 | - if(!$is_logged) |
|
| 201 | + if (!$is_logged) |
|
| 202 | 202 | { |
| 203 | 203 | $this->stop('msg_not_permitted_act'); |
| 204 | 204 | return; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl); |
| 215 | 215 | |
| 216 | - if(method_exists($this, 'init')) |
|
| 216 | + if (method_exists($this, 'init')) |
|
| 217 | 217 | { |
| 218 | 218 | $this->init(); |
| 219 | 219 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * */ |
| 252 | 252 | function setTemplateFile($filename) |
| 253 | 253 | { |
| 254 | - if(isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
| 254 | + if (isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
| 255 | 255 | { |
| 256 | 256 | $filename .= '.html'; |
| 257 | 257 | } |
@@ -274,14 +274,14 @@ discard block |
||
| 274 | 274 | * */ |
| 275 | 275 | function setTemplatePath($path) |
| 276 | 276 | { |
| 277 | - if(!$path) return; |
|
| 277 | + if (!$path) return; |
|
| 278 | 278 | |
| 279 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 279 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 280 | 280 | { |
| 281 | - $path = './' . $path; |
|
| 281 | + $path = './'.$path; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 284 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 285 | 285 | { |
| 286 | 286 | $path .= '/'; |
| 287 | 287 | } |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | * */ |
| 305 | 305 | function setEditedLayoutFile($filename) |
| 306 | 306 | { |
| 307 | - if(!$filename) return; |
|
| 307 | + if (!$filename) return; |
|
| 308 | 308 | |
| 309 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
| 309 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
| 310 | 310 | { |
| 311 | 311 | $filename .= '.html'; |
| 312 | 312 | } |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | * */ |
| 330 | 330 | function setLayoutFile($filename) |
| 331 | 331 | { |
| 332 | - if(!$filename) return; |
|
| 332 | + if (!$filename) return; |
|
| 333 | 333 | |
| 334 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
| 334 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
| 335 | 335 | { |
| 336 | 336 | $filename .= '.html'; |
| 337 | 337 | } |
@@ -353,13 +353,13 @@ discard block |
||
| 353 | 353 | * */ |
| 354 | 354 | function setLayoutPath($path) |
| 355 | 355 | { |
| 356 | - if(!$path) return; |
|
| 356 | + if (!$path) return; |
|
| 357 | 357 | |
| 358 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 358 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 359 | 359 | { |
| 360 | - $path = './' . $path; |
|
| 360 | + $path = './'.$path; |
|
| 361 | 361 | } |
| 362 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 362 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 363 | 363 | { |
| 364 | 364 | $path .= '/'; |
| 365 | 365 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | function proc() |
| 383 | 383 | { |
| 384 | 384 | // pass if stop_proc is true |
| 385 | - if($this->stop_proc) |
|
| 385 | + if ($this->stop_proc) |
|
| 386 | 386 | { |
| 387 | 387 | debugPrint($this->message, 'ERROR'); |
| 388 | 388 | return FALSE; |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // trigger call |
| 392 | 392 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); |
| 393 | - if(!$triggerOutput->toBool()) |
|
| 393 | + if (!$triggerOutput->toBool()) |
|
| 394 | 394 | { |
| 395 | 395 | $this->setError($triggerOutput->getError()); |
| 396 | 396 | $this->setMessage($triggerOutput->getMessage()); |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | $called_position = 'before_module_proc'; |
| 402 | 402 | $oAddonController = getController('addon'); |
| 403 | 403 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 404 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
| 405 | 405 | |
| 406 | - if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
| 406 | + if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
| 407 | 407 | { |
| 408 | 408 | // Check permissions |
| 409 | - if($this->module_srl && !$this->grant->access) |
|
| 409 | + if ($this->module_srl && !$this->grant->access) |
|
| 410 | 410 | { |
| 411 | 411 | $this->stop("msg_not_permitted_act"); |
| 412 | 412 | return FALSE; |
@@ -415,21 +415,21 @@ discard block |
||
| 415 | 415 | // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) |
| 416 | 416 | $is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N')); |
| 417 | 417 | $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); |
| 418 | - if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
| 418 | + if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
| 419 | 419 | { |
| 420 | 420 | $dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins'; |
| 421 | 421 | $valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin'; |
| 422 | 422 | $oModuleModel = getModel('module'); |
| 423 | 423 | $skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 424 | 424 | $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); |
| 425 | - if($this->module == 'page') |
|
| 425 | + if ($this->module == 'page') |
|
| 426 | 426 | { |
| 427 | 427 | $this->module_info->{$valueName} = $skinName; |
| 428 | 428 | } |
| 429 | 429 | else |
| 430 | 430 | { |
| 431 | 431 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
| 432 | - if(!$isTemplatPath) |
|
| 432 | + if (!$isTemplatPath) |
|
| 433 | 433 | { |
| 434 | 434 | $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); |
| 435 | 435 | } |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // trigger call |
| 451 | 451 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); |
| 452 | - if(!$triggerOutput->toBool()) |
|
| 452 | + if (!$triggerOutput->toBool()) |
|
| 453 | 453 | { |
| 454 | 454 | $this->setError($triggerOutput->getError()); |
| 455 | 455 | $this->setMessage($triggerOutput->getMessage()); |
@@ -460,25 +460,25 @@ discard block |
||
| 460 | 460 | $called_position = 'after_module_proc'; |
| 461 | 461 | $oAddonController = getController('addon'); |
| 462 | 462 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 463 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
| 464 | 464 | |
| 465 | - if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
|
| 465 | + if (is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
|
| 466 | 466 | { |
| 467 | 467 | $this->setError($output->getError()); |
| 468 | 468 | $this->setMessage($output->getMessage()); |
| 469 | 469 | |
| 470 | - if(!$output->toBool()) |
|
| 470 | + if (!$output->toBool()) |
|
| 471 | 471 | { |
| 472 | 472 | return FALSE; |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | // execute api methods of the module if view action is and result is XMLRPC or JSON |
| 476 | - if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile') |
|
| 476 | + if ($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile') |
|
| 477 | 477 | { |
| 478 | - if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
| 478 | + if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
| 479 | 479 | { |
| 480 | 480 | $oAPI = getAPI($this->module_info->module, 'api'); |
| 481 | - if(method_exists($oAPI, $this->act)) |
|
| 481 | + if (method_exists($oAPI, $this->act)) |
|
| 482 | 482 | { |
| 483 | 483 | $oAPI->{$this->act}($this); |
| 484 | 484 | } |
@@ -168,8 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
| 170 | 170 | } |
| 171 | - } |
|
| 172 | - else |
|
| 171 | + } else |
|
| 173 | 172 | { |
| 174 | 173 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
| 175 | 174 | // have at least access grant |
@@ -274,7 +273,9 @@ discard block |
||
| 274 | 273 | * */ |
| 275 | 274 | function setTemplatePath($path) |
| 276 | 275 | { |
| 277 | - if(!$path) return; |
|
| 276 | + if(!$path) { |
|
| 277 | + return; |
|
| 278 | + } |
|
| 278 | 279 | |
| 279 | 280 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
| 280 | 281 | { |
@@ -304,7 +305,9 @@ discard block |
||
| 304 | 305 | * */ |
| 305 | 306 | function setEditedLayoutFile($filename) |
| 306 | 307 | { |
| 307 | - if(!$filename) return; |
|
| 308 | + if(!$filename) { |
|
| 309 | + return; |
|
| 310 | + } |
|
| 308 | 311 | |
| 309 | 312 | if(substr_compare($filename, '.html', -5) !== 0) |
| 310 | 313 | { |
@@ -329,7 +332,9 @@ discard block |
||
| 329 | 332 | * */ |
| 330 | 333 | function setLayoutFile($filename) |
| 331 | 334 | { |
| 332 | - if(!$filename) return; |
|
| 335 | + if(!$filename) { |
|
| 336 | + return; |
|
| 337 | + } |
|
| 333 | 338 | |
| 334 | 339 | if(substr_compare($filename, '.html', -5) !== 0) |
| 335 | 340 | { |
@@ -353,7 +358,9 @@ discard block |
||
| 353 | 358 | * */ |
| 354 | 359 | function setLayoutPath($path) |
| 355 | 360 | { |
| 356 | - if(!$path) return; |
|
| 361 | + if(!$path) { |
|
| 362 | + return; |
|
| 363 | + } |
|
| 357 | 364 | |
| 358 | 365 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
| 359 | 366 | { |
@@ -401,7 +408,9 @@ discard block |
||
| 401 | 408 | $called_position = 'before_module_proc'; |
| 402 | 409 | $oAddonController = getController('addon'); |
| 403 | 410 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 411 | + if(FileHandler::exists($addon_file)) { |
|
| 412 | + include($addon_file); |
|
| 413 | + } |
|
| 405 | 414 | |
| 406 | 415 | if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
| 407 | 416 | { |
@@ -425,8 +434,7 @@ discard block |
||
| 425 | 434 | if($this->module == 'page') |
| 426 | 435 | { |
| 427 | 436 | $this->module_info->{$valueName} = $skinName; |
| 428 | - } |
|
| 429 | - else |
|
| 437 | + } else |
|
| 430 | 438 | { |
| 431 | 439 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
| 432 | 440 | if(!$isTemplatPath) |
@@ -441,8 +449,7 @@ discard block |
||
| 441 | 449 | Context::set('module_info', $this->module_info); |
| 442 | 450 | // Run |
| 443 | 451 | $output = $this->{$this->act}(); |
| 444 | - } |
|
| 445 | - else |
|
| 452 | + } else |
|
| 446 | 453 | { |
| 447 | 454 | return FALSE; |
| 448 | 455 | } |
@@ -460,7 +467,9 @@ discard block |
||
| 460 | 467 | $called_position = 'after_module_proc'; |
| 461 | 468 | $oAddonController = getController('addon'); |
| 462 | 469 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 470 | + if(FileHandler::exists($addon_file)) { |
|
| 471 | + include($addon_file); |
|
| 472 | + } |
|
| 464 | 473 | |
| 465 | 474 | if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
| 466 | 475 | { |
@@ -295,6 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | 297 | * Check the content. |
| 298 | + * @param string $content |
|
| 298 | 299 | * @return void |
| 299 | 300 | */ |
| 300 | 301 | function check(&$content) |
@@ -487,7 +488,7 @@ discard block |
||
| 487 | 488 | |
| 488 | 489 | /** |
| 489 | 490 | * Check white domain in object data attribute or embed src attribute. |
| 490 | - * @return string |
|
| 491 | + * @return boolean |
|
| 491 | 492 | */ |
| 492 | 493 | function isWhiteDomain($urlAttribute) |
| 493 | 494 | { |
@@ -506,7 +507,7 @@ discard block |
||
| 506 | 507 | |
| 507 | 508 | /** |
| 508 | 509 | * Check white domain in iframe src attribute. |
| 509 | - * @return string |
|
| 510 | + * @return boolean |
|
| 510 | 511 | */ |
| 511 | 512 | function isWhiteIframeDomain($urlAttribute) |
| 512 | 513 | { |
@@ -525,7 +526,7 @@ discard block |
||
| 525 | 526 | |
| 526 | 527 | /** |
| 527 | 528 | * Check white mime type in object type attribute or embed type attribute. |
| 528 | - * @return string |
|
| 529 | + * @return boolean |
|
| 529 | 530 | */ |
| 530 | 531 | function isWhiteMimetype($mimeType) |
| 531 | 532 | { |
@@ -590,7 +591,7 @@ discard block |
||
| 590 | 591 | |
| 591 | 592 | /** |
| 592 | 593 | * Make white domain list cache file from xml config file. |
| 593 | - * @param $whitelist array |
|
| 594 | + * @param stdClass $whitelist array |
|
| 594 | 595 | * @return void |
| 595 | 596 | */ |
| 596 | 597 | function _makeWhiteDomainList($whitelist = NULL) |
@@ -563,14 +563,12 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
| 565 | 565 | } |
| 566 | - } |
|
| 567 | - else if($m[1] == 'embed') |
|
| 566 | + } else if($m[1] == 'embed') |
|
| 568 | 567 | { |
| 569 | 568 | if(stripos($m[0], 'allowscriptaccess')) |
| 570 | 569 | { |
| 571 | 570 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 572 | - } |
|
| 573 | - else |
|
| 571 | + } else |
|
| 574 | 572 | { |
| 575 | 573 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
| 576 | 574 | } |
@@ -627,8 +625,7 @@ discard block |
||
| 627 | 625 | { |
| 628 | 626 | $whiteUrlList = $whitelist->object; |
| 629 | 627 | $whiteIframeUrlList = $whitelist->iframe; |
| 630 | - } |
|
| 631 | - else |
|
| 628 | + } else |
|
| 632 | 629 | { |
| 633 | 630 | $xmlBuff = FileHandler::readFile($this->whiteUrlXmlFile); |
| 634 | 631 | |
@@ -636,8 +633,12 @@ discard block |
||
| 636 | 633 | $domainListObj = $xmlParser->parse($xmlBuff); |
| 637 | 634 | $embedDomainList = $domainListObj->whiteurl->embed->domain; |
| 638 | 635 | $iframeDomainList = $domainListObj->whiteurl->iframe->domain; |
| 639 | - if(!is_array($embedDomainList)) $embedDomainList = array(); |
|
| 640 | - if(!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
| 636 | + if(!is_array($embedDomainList)) { |
|
| 637 | + $embedDomainList = array(); |
|
| 638 | + } |
|
| 639 | + if(!is_array($iframeDomainList)) { |
|
| 640 | + $iframeDomainList = array(); |
|
| 641 | + } |
|
| 641 | 642 | |
| 642 | 643 | foreach($embedDomainList AS $key => $value) |
| 643 | 644 | { |
@@ -648,8 +649,7 @@ discard block |
||
| 648 | 649 | { |
| 649 | 650 | $whiteUrlList[] = $value->body; |
| 650 | 651 | } |
| 651 | - } |
|
| 652 | - else |
|
| 652 | + } else |
|
| 653 | 653 | { |
| 654 | 654 | $whiteUrlList[] = $patternList->body; |
| 655 | 655 | } |
@@ -664,8 +664,7 @@ discard block |
||
| 664 | 664 | { |
| 665 | 665 | $whiteIframeUrlList[] = $value->body; |
| 666 | 666 | } |
| 667 | - } |
|
| 668 | - else |
|
| 667 | + } else |
|
| 669 | 668 | { |
| 670 | 669 | $whiteIframeUrlList[] = $patternList->body; |
| 671 | 670 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
| 3 | 3 | |
| 4 | -include _XE_PATH_ . 'classes/security/phphtmlparser/src/htmlparser.inc'; |
|
| 4 | +include _XE_PATH_.'classes/security/phphtmlparser/src/htmlparser.inc'; |
|
| 5 | 5 | |
| 6 | 6 | class EmbedFilter |
| 7 | 7 | { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | function getInstance() |
| 278 | 278 | { |
| 279 | - if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
| 279 | + if (!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
| 280 | 280 | { |
| 281 | 281 | $GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter(); |
| 282 | 282 | } |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m); |
| 318 | 318 | $objectTagList = $m[0]; |
| 319 | - if($objectTagList) |
|
| 319 | + if ($objectTagList) |
|
| 320 | 320 | { |
| 321 | - foreach($objectTagList AS $key => $objectTag) |
|
| 321 | + foreach ($objectTagList AS $key => $objectTag) |
|
| 322 | 322 | { |
| 323 | 323 | $isWhiteDomain = true; |
| 324 | 324 | $isWhiteMimetype = true; |
@@ -326,21 +326,21 @@ discard block |
||
| 326 | 326 | $ext = ''; |
| 327 | 327 | |
| 328 | 328 | $parser = new HtmlParser($objectTag); |
| 329 | - while($parser->parse()) |
|
| 329 | + while ($parser->parse()) |
|
| 330 | 330 | { |
| 331 | - if(is_array($parser->iNodeAttributes)) |
|
| 331 | + if (is_array($parser->iNodeAttributes)) |
|
| 332 | 332 | { |
| 333 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 333 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 334 | 334 | { |
| 335 | 335 | // data url check |
| 336 | - if($attrValue && strtolower($attrName) == 'data') |
|
| 336 | + if ($attrValue && strtolower($attrName) == 'data') |
|
| 337 | 337 | { |
| 338 | 338 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
| 339 | 339 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // mime type check |
| 343 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
| 343 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
| 344 | 344 | { |
| 345 | 345 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
| 346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
| 351 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
| 352 | 352 | { |
| 353 | 353 | $content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
| 354 | 354 | } |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | { |
| 365 | 365 | preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m); |
| 366 | 366 | $embedTagList = $m[0]; |
| 367 | - if($embedTagList) |
|
| 367 | + if ($embedTagList) |
|
| 368 | 368 | { |
| 369 | - foreach($embedTagList AS $key => $embedTag) |
|
| 369 | + foreach ($embedTagList AS $key => $embedTag) |
|
| 370 | 370 | { |
| 371 | 371 | $isWhiteDomain = TRUE; |
| 372 | 372 | $isWhiteMimetype = TRUE; |
@@ -374,21 +374,21 @@ discard block |
||
| 374 | 374 | $ext = ''; |
| 375 | 375 | |
| 376 | 376 | $parser = new HtmlParser($embedTag); |
| 377 | - while($parser->parse()) |
|
| 377 | + while ($parser->parse()) |
|
| 378 | 378 | { |
| 379 | - if(is_array($parser->iNodeAttributes)) |
|
| 379 | + if (is_array($parser->iNodeAttributes)) |
|
| 380 | 380 | { |
| 381 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 381 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 382 | 382 | { |
| 383 | 383 | // src url check |
| 384 | - if($attrValue && strtolower($attrName) == 'src') |
|
| 384 | + if ($attrValue && strtolower($attrName) == 'src') |
|
| 385 | 385 | { |
| 386 | 386 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
| 387 | 387 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // mime type check |
| 391 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
| 391 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
| 392 | 392 | { |
| 393 | 393 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
| 394 | 394 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
| 399 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
| 400 | 400 | { |
| 401 | 401 | $content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
| 402 | 402 | } |
@@ -415,22 +415,22 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m); |
| 417 | 417 | $iframeTagList = $m[0]; |
| 418 | - if($iframeTagList) |
|
| 418 | + if ($iframeTagList) |
|
| 419 | 419 | { |
| 420 | - foreach($iframeTagList AS $key => $iframeTag) |
|
| 420 | + foreach ($iframeTagList AS $key => $iframeTag) |
|
| 421 | 421 | { |
| 422 | 422 | $isWhiteDomain = TRUE; |
| 423 | 423 | $ext = ''; |
| 424 | 424 | |
| 425 | 425 | $parser = new HtmlParser($iframeTag); |
| 426 | - while($parser->parse()) |
|
| 426 | + while ($parser->parse()) |
|
| 427 | 427 | { |
| 428 | - if(is_array($parser->iNodeAttributes)) |
|
| 428 | + if (is_array($parser->iNodeAttributes)) |
|
| 429 | 429 | { |
| 430 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 430 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
| 431 | 431 | { |
| 432 | 432 | // src url check |
| 433 | - if(strtolower($attrName) == 'src' && $attrValue) |
|
| 433 | + if (strtolower($attrName) == 'src' && $attrValue) |
|
| 434 | 434 | { |
| 435 | 435 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
| 436 | 436 | $isWhiteDomain = $this->isWhiteIframeDomain($attrValue); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - if(!$isWhiteDomain) |
|
| 442 | + if (!$isWhiteDomain) |
|
| 443 | 443 | { |
| 444 | 444 | $content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
| 445 | 445 | } |
@@ -455,26 +455,26 @@ discard block |
||
| 455 | 455 | { |
| 456 | 456 | preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m); |
| 457 | 457 | $paramTagList = $m[0]; |
| 458 | - if($paramTagList) |
|
| 458 | + if ($paramTagList) |
|
| 459 | 459 | { |
| 460 | - foreach($paramTagList AS $key => $paramTag) |
|
| 460 | + foreach ($paramTagList AS $key => $paramTag) |
|
| 461 | 461 | { |
| 462 | 462 | $isWhiteDomain = TRUE; |
| 463 | 463 | $isWhiteExt = TRUE; |
| 464 | 464 | $ext = ''; |
| 465 | 465 | |
| 466 | 466 | $parser = new HtmlParser($paramTag); |
| 467 | - while($parser->parse()) |
|
| 467 | + while ($parser->parse()) |
|
| 468 | 468 | { |
| 469 | - if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
| 469 | + if ($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
| 470 | 470 | { |
| 471 | 471 | $name = strtolower($parser->iNodeAttributes['name']); |
| 472 | - if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
| 472 | + if ($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
| 473 | 473 | { |
| 474 | 474 | $ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1)); |
| 475 | 475 | $isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']); |
| 476 | 476 | |
| 477 | - if(!$isWhiteDomain) |
|
| 477 | + if (!$isWhiteDomain) |
|
| 478 | 478 | { |
| 479 | 479 | $content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
| 480 | 480 | } |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | function isWhiteDomain($urlAttribute) |
| 493 | 493 | { |
| 494 | - if(is_array($this->whiteUrlList)) |
|
| 494 | + if (is_array($this->whiteUrlList)) |
|
| 495 | 495 | { |
| 496 | - foreach($this->whiteUrlList AS $key => $value) |
|
| 496 | + foreach ($this->whiteUrlList AS $key => $value) |
|
| 497 | 497 | { |
| 498 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
| 498 | + if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute)) |
|
| 499 | 499 | { |
| 500 | 500 | return TRUE; |
| 501 | 501 | } |
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | */ |
| 511 | 511 | function isWhiteIframeDomain($urlAttribute) |
| 512 | 512 | { |
| 513 | - if(is_array($this->whiteIframeUrlList)) |
|
| 513 | + if (is_array($this->whiteIframeUrlList)) |
|
| 514 | 514 | { |
| 515 | - foreach($this->whiteIframeUrlList AS $key => $value) |
|
| 515 | + foreach ($this->whiteIframeUrlList AS $key => $value) |
|
| 516 | 516 | { |
| 517 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
| 517 | + if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute)) |
|
| 518 | 518 | { |
| 519 | 519 | return TRUE; |
| 520 | 520 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | */ |
| 530 | 530 | function isWhiteMimetype($mimeType) |
| 531 | 531 | { |
| 532 | - if(isset($this->mimeTypeList[$mimeType])) |
|
| 532 | + if (isset($this->mimeTypeList[$mimeType])) |
|
| 533 | 533 | { |
| 534 | 534 | return TRUE; |
| 535 | 535 | } |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | function isWhiteExt($ext) |
| 540 | 540 | { |
| 541 | - if(isset($this->extList[$ext])) |
|
| 541 | + if (isset($this->extList[$ext])) |
|
| 542 | 542 | { |
| 543 | 543 | return TRUE; |
| 544 | 544 | } |
@@ -547,26 +547,26 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | function _checkAllowScriptAccess($m) |
| 549 | 549 | { |
| 550 | - if($m[1] == 'object') |
|
| 550 | + if ($m[1] == 'object') |
|
| 551 | 551 | { |
| 552 | 552 | $this->allowscriptaccessList[] = 1; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - if($m[1] == 'param') |
|
| 555 | + if ($m[1] == 'param') |
|
| 556 | 556 | { |
| 557 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 557 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 558 | 558 | { |
| 559 | 559 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
| 560 | - if(substr($m[0], -1) == '/') |
|
| 560 | + if (substr($m[0], -1) == '/') |
|
| 561 | 561 | { |
| 562 | 562 | $m[0] .= '/'; |
| 563 | 563 | } |
| 564 | 564 | $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | - else if($m[1] == 'embed') |
|
| 567 | + else if ($m[1] == 'embed') |
|
| 568 | 568 | { |
| 569 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 569 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 570 | 570 | { |
| 571 | 571 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 572 | 572 | } |
@@ -580,9 +580,9 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | function _addAllowScriptAccess($m) |
| 582 | 582 | { |
| 583 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 583 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 584 | 584 | { |
| 585 | - $m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>'; |
|
| 585 | + $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
|
| 586 | 586 | } |
| 587 | 587 | $this->allowscriptaccessKey++; |
| 588 | 588 | return $m[0]; |
@@ -599,31 +599,31 @@ discard block |
||
| 599 | 599 | $whiteUrlCacheFile = FileHandler::getRealPath($this->whiteUrlCacheFile); |
| 600 | 600 | |
| 601 | 601 | $isMake = FALSE; |
| 602 | - if(!file_exists($whiteUrlCacheFile)) |
|
| 602 | + if (!file_exists($whiteUrlCacheFile)) |
|
| 603 | 603 | { |
| 604 | 604 | $isMake = TRUE; |
| 605 | 605 | } |
| 606 | - if(file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
| 606 | + if (file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
| 607 | 607 | { |
| 608 | 608 | $isMake = TRUE; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if(gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
| 611 | + if (gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
| 612 | 612 | { |
| 613 | 613 | $isMake = FALSE; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - if(isset($whitelist) && gettype($whitelist) == 'object') |
|
| 616 | + if (isset($whitelist) && gettype($whitelist) == 'object') |
|
| 617 | 617 | { |
| 618 | 618 | $isMake = TRUE; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - if($isMake) |
|
| 621 | + if ($isMake) |
|
| 622 | 622 | { |
| 623 | 623 | $whiteUrlList = array(); |
| 624 | 624 | $whiteIframeUrlList = array(); |
| 625 | 625 | |
| 626 | - if(gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
| 626 | + if (gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
| 627 | 627 | { |
| 628 | 628 | $whiteUrlList = $whitelist->object; |
| 629 | 629 | $whiteIframeUrlList = $whitelist->iframe; |
@@ -636,15 +636,15 @@ discard block |
||
| 636 | 636 | $domainListObj = $xmlParser->parse($xmlBuff); |
| 637 | 637 | $embedDomainList = $domainListObj->whiteurl->embed->domain; |
| 638 | 638 | $iframeDomainList = $domainListObj->whiteurl->iframe->domain; |
| 639 | - if(!is_array($embedDomainList)) $embedDomainList = array(); |
|
| 640 | - if(!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
| 639 | + if (!is_array($embedDomainList)) $embedDomainList = array(); |
|
| 640 | + if (!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
| 641 | 641 | |
| 642 | - foreach($embedDomainList AS $key => $value) |
|
| 642 | + foreach ($embedDomainList AS $key => $value) |
|
| 643 | 643 | { |
| 644 | 644 | $patternList = $value->pattern; |
| 645 | - if(is_array($patternList)) |
|
| 645 | + if (is_array($patternList)) |
|
| 646 | 646 | { |
| 647 | - foreach($patternList AS $key => $value) |
|
| 647 | + foreach ($patternList AS $key => $value) |
|
| 648 | 648 | { |
| 649 | 649 | $whiteUrlList[] = $value->body; |
| 650 | 650 | } |
@@ -655,12 +655,12 @@ discard block |
||
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - foreach($iframeDomainList AS $key => $value) |
|
| 658 | + foreach ($iframeDomainList AS $key => $value) |
|
| 659 | 659 | { |
| 660 | 660 | $patternList = $value->pattern; |
| 661 | - if(is_array($patternList)) |
|
| 661 | + if (is_array($patternList)) |
|
| 662 | 662 | { |
| 663 | - foreach($patternList AS $key => $value) |
|
| 663 | + foreach ($patternList AS $key => $value) |
|
| 664 | 664 | { |
| 665 | 665 | $whiteIframeUrlList[] = $value->body; |
| 666 | 666 | } |
@@ -674,12 +674,12 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | $db_info = Context::getDBInfo(); |
| 676 | 676 | |
| 677 | - if($db_info->embed_white_object) |
|
| 677 | + if ($db_info->embed_white_object) |
|
| 678 | 678 | { |
| 679 | 679 | $whiteUrlList = array_merge($whiteUrlList, $db_info->embed_white_object); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - if($db_info->embed_white_iframe) |
|
| 682 | + if ($db_info->embed_white_iframe) |
|
| 683 | 683 | { |
| 684 | 684 | $whiteIframeUrlList = array_merge($whiteIframeUrlList, $db_info->embed_white_iframe); |
| 685 | 685 | } |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | $buff = array(); |
| 693 | 693 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
| 694 | - $buff[] = '$whiteUrlList = ' . var_export($whiteUrlList, TRUE) . ';'; |
|
| 695 | - $buff[] = '$whiteIframeUrlList = ' . var_export($whiteIframeUrlList, TRUE) . ';'; |
|
| 694 | + $buff[] = '$whiteUrlList = '.var_export($whiteUrlList, TRUE).';'; |
|
| 695 | + $buff[] = '$whiteIframeUrlList = '.var_export($whiteIframeUrlList, TRUE).';'; |
|
| 696 | 696 | |
| 697 | 697 | FileHandler::writeFile($this->whiteUrlCacheFile, implode(PHP_EOL, $buff)); |
| 698 | 698 | } |