@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | exit(); |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @brief admin log |
| 11 | 11 | */ |
| 12 | 12 | $logged_info = Context::get('logged_info'); |
| 13 | -if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
| 13 | +if ($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
| 14 | 14 | { |
| 15 | 15 | $oAdminloggingController = getController('adminlogging'); |
| 16 | 16 | $oAdminloggingController->insertLog($this->module, $this->act); |
@@ -1,8 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if(!defined('__XE__')) { |
|
| 5 | 5 | exit(); |
| 6 | +} |
|
| 6 | 7 | |
| 7 | 8 | /** |
| 8 | 9 | * @file adminlogging.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | exit(); |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | * Display point level icon before user name when point system is enabled. |
| 13 | 13 | * */ |
| 14 | 14 | // return unless before_display_content |
| 15 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
| 15 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
| 16 | 16 | { |
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php'); |
|
| 20 | +require_once(_XE_PATH_.'addons/point_level_icon/point_level_icon.lib.php'); |
|
| 21 | 21 | |
| 22 | 22 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); |
| 23 | -if($temp_output) |
|
| 23 | +if ($temp_output) |
|
| 24 | 24 | { |
| 25 | 25 | $output = $temp_output; |
| 26 | 26 | } |
@@ -1,8 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if(!defined('__XE__')) { |
|
| 5 | 5 | exit(); |
| 6 | +} |
|
| 6 | 7 | |
| 7 | 8 | /** |
| 8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | exit(); |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @author XEHub ([email protected]) |
| 10 | 10 | * @brief Automatic link add-on |
| 11 | 11 | */ |
| 12 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
| 12 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
| 13 | 13 | { |
| 14 | 14 | Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true); |
| 15 | 15 | } |
@@ -1,8 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if(!defined('__XE__')) { |
|
| 5 | 5 | exit(); |
| 6 | +} |
|
| 6 | 7 | |
| 7 | 8 | /** |
| 8 | 9 | * @file autolink.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 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('AddonMemberCaptcha', false)) |
|
| 12 | +if (!class_exists('AddonMemberCaptcha', false)) |
|
| 13 | 13 | { |
| 14 | 14 | class AddonMemberCaptcha |
| 15 | 15 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | function before_module_init(&$ModuleHandler) |
| 33 | 33 | { |
| 34 | 34 | $logged_info = Context::get('logged_info'); |
| 35 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
| 35 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
| 36 | 36 | { |
| 37 | 37 | return false; |
| 38 | 38 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | // { |
| 41 | 41 | // return false; |
| 42 | 42 | // } |
| 43 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
| 43 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
| 44 | 44 | { |
| 45 | 45 | $_SESSION['member_captcha_authed'] = false; |
| 46 | 46 | } |
| 47 | - if($_SESSION['member_captcha_authed']) |
|
| 47 | + if ($_SESSION['member_captcha_authed']) |
|
| 48 | 48 | { |
| 49 | 49 | return false; |
| 50 | 50 | } |
@@ -52,26 +52,26 @@ discard block |
||
| 52 | 52 | $type = Context::get('captchaType'); |
| 53 | 53 | |
| 54 | 54 | $this->target_acts = array(); |
| 55 | - if($this->addon_info->apply_find_account == 'apply') |
|
| 55 | + if ($this->addon_info->apply_find_account == 'apply') |
|
| 56 | 56 | { |
| 57 | 57 | $this->target_acts[] = 'procMemberFindAccount'; |
| 58 | 58 | } |
| 59 | - if($this->addon_info->apply_resend_auth_mail == 'apply') |
|
| 59 | + if ($this->addon_info->apply_resend_auth_mail == 'apply') |
|
| 60 | 60 | { |
| 61 | 61 | $this->target_acts[] = 'procMemberResendAuthMail'; |
| 62 | 62 | } |
| 63 | - if($this->addon_info->apply_signup == 'apply') |
|
| 63 | + if ($this->addon_info->apply_signup == 'apply') |
|
| 64 | 64 | { |
| 65 | 65 | $this->target_acts[] = 'procMemberInsert'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
| 68 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
| 69 | 69 | { |
| 70 | - if($type == 'inline') |
|
| 70 | + if ($type == 'inline') |
|
| 71 | 71 | { |
| 72 | - if(!$this->compareCaptcha()) |
|
| 72 | + if (!$this->compareCaptcha()) |
|
| 73 | 73 | { |
| 74 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
| 74 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
| 75 | 75 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
| 76 | 76 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
| 77 | 77 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | Context::addHtmlHeader('<script> |
| 85 | 85 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
| 86 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
| 86 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
| 87 | 87 | </script>'); |
| 88 | 88 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
| 93 | - if(!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
| 93 | + if (!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
| 94 | 94 | { |
| 95 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
| 95 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
| 96 | 96 | $ModuleHandler->error = "captcha_denied"; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | function createKeyword() |
| 103 | 103 | { |
| 104 | 104 | $type = Context::get('captchaType'); |
| 105 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
| 105 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
| 106 | 106 | { |
| 107 | 107 | return; |
| 108 | 108 | } |
@@ -115,19 +115,19 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | function before_module_init_setCaptchaSession() |
| 117 | 117 | { |
| 118 | - if($_SESSION['member_captcha_authed']) |
|
| 118 | + if ($_SESSION['member_captcha_authed']) |
|
| 119 | 119 | { |
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | // Load language files |
| 123 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
| 123 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
| 124 | 124 | // Generate keywords |
| 125 | 125 | $this->createKeyword(); |
| 126 | 126 | |
| 127 | 127 | $target = Context::getLang('target_captcha'); |
| 128 | 128 | header("Content-Type: text/xml; charset=UTF-8"); |
| 129 | 129 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 130 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 130 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 131 | 131 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 132 | 132 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 133 | 133 | header("Pragma: no-cache"); |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | function before_module_init_captchaImage() |
| 146 | 146 | { |
| 147 | - if($_SESSION['member_captcha_authed']) |
|
| 147 | + if ($_SESSION['member_captcha_authed']) |
|
| 148 | 148 | { |
| 149 | 149 | return false; |
| 150 | 150 | } |
| 151 | - if(Context::get('renew')) |
|
| 151 | + if (Context::get('renew')) |
|
| 152 | 152 | { |
| 153 | 153 | $this->createKeyword(); |
| 154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | function createCaptchaImage($string) |
| 171 | 171 | { |
| 172 | 172 | $arr = array(); |
| 173 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
| 173 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
| 174 | 174 | { |
| 175 | 175 | $arr[] = $string{$i}; |
| 176 | 176 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | shuffle($deg); |
| 193 | 193 | |
| 194 | 194 | // Create an image for each letter |
| 195 | - foreach($arr as $i => $str) |
|
| 195 | + foreach ($arr as $i => $str) |
|
| 196 | 196 | { |
| 197 | 197 | $im[$i + 1] = @imagecreate($w, $h); |
| 198 | 198 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $ran = range(1, 20); |
| 203 | 203 | shuffle($ran); |
| 204 | 204 | |
| 205 | - if(function_exists('imagerotate')) |
|
| 205 | + if (function_exists('imagerotate')) |
|
| 206 | 206 | { |
| 207 | 207 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
| 208 | 208 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // Combine images of each character |
| 220 | - for($i = 1; $i < count($im); $i++) |
|
| 220 | + for ($i = 1; $i < count($im); $i++) |
|
| 221 | 221 | { |
| 222 | 222 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
| 223 | 223 | imagedestroy($im[$i]); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
| 230 | 230 | imagedestroy($im[0]); |
| 231 | 231 | |
| 232 | - if(function_exists('imageantialias')) |
|
| 232 | + if (function_exists('imageantialias')) |
|
| 233 | 233 | { |
| 234 | 234 | imageantialias($big, true); |
| 235 | 235 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $h = $h * $big_count; |
| 242 | 242 | $d = array_pop($deg); |
| 243 | 243 | |
| 244 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
| 244 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
| 245 | 245 | { |
| 246 | 246 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
| 247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $x = range(0, ($w - 10)); |
| 250 | 250 | shuffle($x); |
| 251 | 251 | |
| 252 | - for($i = 0; $i < 200; $i++) |
|
| 252 | + for ($i = 0; $i < 200; $i++) |
|
| 253 | 253 | { |
| 254 | 254 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
| 255 | 255 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | function before_module_init_captchaAudio() |
| 261 | 261 | { |
| 262 | - if($_SESSION['member_captcha_authed']) |
|
| 262 | + if ($_SESSION['member_captcha_authed']) |
|
| 263 | 263 | { |
| 264 | 264 | return false; |
| 265 | 265 | } |
@@ -271,8 +271,8 @@ discard block |
||
| 271 | 271 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
| 272 | 272 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
| 273 | 273 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
| 274 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
| 275 | - header('Content-Length: ' . strlen($data)); |
|
| 274 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
| 275 | + header('Content-Length: '.strlen($data)); |
|
| 276 | 276 | |
| 277 | 277 | echo $data; |
| 278 | 278 | Context::close(); |
@@ -283,17 +283,17 @@ discard block |
||
| 283 | 283 | { |
| 284 | 284 | $data = ''; |
| 285 | 285 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
| 286 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
| 286 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
| 287 | 287 | { |
| 288 | 288 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
| 289 | 289 | |
| 290 | 290 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
| 291 | 291 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
| 292 | 292 | |
| 293 | - for($j = $start; $j < $datalen; $j+=64) |
|
| 293 | + for ($j = $start; $j < $datalen; $j += 64) |
|
| 294 | 294 | { |
| 295 | 295 | $ch = ord($_data{$j}); |
| 296 | - if($ch < 9 || $ch > 119) |
|
| 296 | + if ($ch < 9 || $ch > 119) |
|
| 297 | 297 | { |
| 298 | 298 | continue; |
| 299 | 299 | } |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | function compareCaptcha() |
| 310 | 310 | { |
| 311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
| 311 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
| 312 | 312 | |
| 313 | - if($_SESSION['member_captcha_authed']) |
|
| 313 | + if ($_SESSION['member_captcha_authed']) |
|
| 314 | 314 | { |
| 315 | 315 | return true; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
| 318 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
| 319 | 319 | { |
| 320 | 320 | $_SESSION['member_captcha_authed'] = true; |
| 321 | 321 | return true; |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | function before_module_init_captchaCompare() |
| 330 | 330 | { |
| 331 | - if(!$this->compareCaptcha()) |
|
| 331 | + if (!$this->compareCaptcha()) |
|
| 332 | 332 | { |
| 333 | 333 | return false; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | header("Content-Type: text/xml; charset=UTF-8"); |
| 337 | 337 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 338 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 338 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 339 | 339 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 340 | 340 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 341 | 341 | header("Pragma: no-cache"); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | unset($_SESSION['member_captcha_authed']); |
| 351 | 351 | $this->createKeyword(); |
| 352 | 352 | |
| 353 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
| 353 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
| 354 | 354 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
| 355 | 355 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
| 356 | 356 | |
@@ -388,18 +388,18 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $oAddonMemberCaptcha = &$GLOBALS['__AddonMemberCaptcha__']; |
| 390 | 390 | |
| 391 | -if(method_exists($oAddonMemberCaptcha, $called_position)) |
|
| 391 | +if (method_exists($oAddonMemberCaptcha, $called_position)) |
|
| 392 | 392 | { |
| 393 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
| 393 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
| 394 | 394 | { |
| 395 | 395 | return false; |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $addon_act = Context::get('captcha_action'); |
| 400 | -if($addon_act && method_exists($oAddonMemberCaptcha, $called_position . '_' . $addon_act)) |
|
| 400 | +if ($addon_act && method_exists($oAddonMemberCaptcha, $called_position.'_'.$addon_act)) |
|
| 401 | 401 | { |
| 402 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
| 402 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
| 403 | 403 | { |
| 404 | 404 | return false; |
| 405 | 405 | } |
@@ -1,7 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined("__XE__")) exit(); |
|
| 4 | +if(!defined("__XE__")) { |
|
| 5 | + exit(); |
|
| 6 | +} |
|
| 5 | 7 | |
| 6 | 8 | /** |
| 7 | 9 | * @file captcha.addon.php |
@@ -78,8 +80,7 @@ discard block |
||
| 78 | 80 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
| 79 | 81 | $ModuleHandler->_setInputValueToSession(); |
| 80 | 82 | } |
| 81 | - } |
|
| 82 | - else |
|
| 83 | + } else |
|
| 83 | 84 | { |
| 84 | 85 | Context::addHtmlHeader('<script> |
| 85 | 86 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -209,8 +210,7 @@ discard block |
||
| 209 | 210 | |
| 210 | 211 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
| 211 | 212 | imagecolortransparent($im[$i + 1], $background_color); |
| 212 | - } |
|
| 213 | - else |
|
| 213 | + } else |
|
| 214 | 214 | { |
| 215 | 215 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
| 216 | 216 | } |
@@ -308,7 +308,9 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | function compareCaptcha() |
| 310 | 310 | { |
| 311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
| 311 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
| 312 | + return true; |
|
| 313 | + } |
|
| 312 | 314 | |
| 313 | 315 | if($_SESSION['member_captcha_authed']) |
| 314 | 316 | { |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | exit(); |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | // Stop if non-logged-in user is |
| 17 | 17 | $logged_info = Context::get('logged_info'); |
| 18 | -if(!$logged_info|| isCrawler()) |
|
| 18 | +if (!$logged_info || isCrawler()) |
|
| 19 | 19 | { |
| 20 | 20 | return; |
| 21 | 21 | } |
@@ -23,35 +23,35 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received |
| 25 | 25 | * */ |
| 26 | -if($this->module != 'member' && $called_position == 'before_module_init') |
|
| 26 | +if ($this->module != 'member' && $called_position == 'before_module_init') |
|
| 27 | 27 | { |
| 28 | 28 | // Load a language file from the communication module |
| 29 | - Context::loadLang(_XE_PATH_ . 'modules/communication/lang'); |
|
| 29 | + Context::loadLang(_XE_PATH_.'modules/communication/lang'); |
|
| 30 | 30 | // Add menus on the member login information |
| 31 | 31 | $oMemberController = getController('member'); |
| 32 | 32 | $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); |
| 33 | 33 | $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); |
| 34 | 34 | |
| 35 | - $flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl; |
|
| 36 | - if($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
| 35 | + $flag_file = _XE_PATH_.'files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl).$logged_info->member_srl; |
|
| 36 | + if ($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
| 37 | 37 | { |
| 38 | 38 | // Pop-up to display messages if a flag on new message is set |
| 39 | 39 | $new_message_count = (int) trim(FileHandler::readFile($flag_file)); |
| 40 | 40 | FileHandler::removeFile($flag_file); |
| 41 | - Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang'); |
|
| 41 | + Context::loadLang(_XE_PATH_.'addons/member_communication/lang'); |
|
| 42 | 42 | Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); |
| 43 | 43 | |
| 44 | 44 | $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); |
| 45 | 45 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
| 48 | +elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
| 49 | 49 | { |
| 50 | 50 | $member_srl = Context::get('target_srl'); |
| 51 | 51 | $oCommunicationModel = getModel('communication'); |
| 52 | 52 | |
| 53 | 53 | // Add a feature to display own message box. |
| 54 | - if($logged_info->member_srl == $member_srl) |
|
| 54 | + if ($logged_info->member_srl == $member_srl) |
|
| 55 | 55 | { |
| 56 | 56 | $mid = Context::get('cur_mid'); |
| 57 | 57 | $oMemberController = getController('member'); |
@@ -66,17 +66,17 @@ discard block |
||
| 66 | 66 | // Get member information |
| 67 | 67 | $oMemberModel = getModel('member'); |
| 68 | 68 | $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
| 69 | - if(!$target_member_info->member_srl) |
|
| 69 | + if (!$target_member_info->member_srl) |
|
| 70 | 70 | { |
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $oMemberController = getController('member'); |
| 75 | 75 | // Add a menu for sending message |
| 76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
| 76 | + if ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
| 77 | 77 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
| 78 | 78 | // Add a menu for listing friends (if a friend is new) |
| 79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
| 79 | + if (!$oCommunicationModel->isAddedFriend($member_srl)) |
|
| 80 | 80 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -1,8 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if(!defined('__XE__')) { |
|
| 5 | 5 | exit(); |
| 6 | +} |
|
| 6 | 7 | |
| 7 | 8 | /** |
| 8 | 9 | * @file member_communication.addon.php |
@@ -44,8 +45,7 @@ discard block |
||
| 44 | 45 | $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); |
| 45 | 46 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
| 46 | 47 | } |
| 47 | -} |
|
| 48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
| 48 | +} elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
| 49 | 49 | { |
| 50 | 50 | $member_srl = Context::get('target_srl'); |
| 51 | 51 | $oCommunicationModel = getModel('communication'); |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | // Display a list of friends |
| 61 | 61 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); |
| 62 | 62 | // If not, Add menus to send message and to add friends |
| 63 | - } |
|
| 64 | - else |
|
| 63 | + } else |
|
| 65 | 64 | { |
| 66 | 65 | // Get member information |
| 67 | 66 | $oMemberModel = getModel('member'); |
@@ -73,11 +72,13 @@ discard block |
||
| 73 | 72 | |
| 74 | 73 | $oMemberController = getController('member'); |
| 75 | 74 | // Add a menu for sending message |
| 76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
| 77 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
| 75 | + if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) { |
|
| 76 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
| 77 | + } |
|
| 78 | 78 | // Add a menu for listing friends (if a friend is new) |
| 79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
| 80 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
| 79 | + if(!$oCommunicationModel->isAddedFriend($member_srl)) { |
|
| 80 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
| 81 | + } |
|
| 81 | 82 | } |
| 82 | 83 | } |
| 83 | 84 | /* End of file member_communication.addon.php */ |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | { |
| 6 | 6 | exit(); |
| 7 | 7 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Just before displaying, change image name/ image mark |
| 19 | 19 | */ |
| 20 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
| 20 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
| 21 | 21 | { |
| 22 | 22 | return; |
| 23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | require_once('./addons/member_extra_info/member_extra_info.lib.php'); |
| 26 | 26 | // 1. Find a part <div class="member_MemberSerialNumber"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName() |
| 27 | 27 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output); |
| 28 | -if($temp_output) |
|
| 28 | +if ($temp_output) |
|
| 29 | 29 | { |
| 30 | 30 | $output = $temp_output; |
| 31 | 31 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
| 3 | 3 | |
| 4 | -if(!defined('__XE__')) |
|
| 4 | +if (!defined('__XE__')) |
|
| 5 | 5 | { |
| 6 | 6 | exit(); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == 'HTML') |
|
| 9 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == 'HTML') |
|
| 10 | 10 | { |
| 11 | 11 | Context::loadFile('./addons/oembed/jquery.oembed.css'); |
| 12 | 12 | Context::loadFile(array('./addons/oembed/jquery.oembed.js', 'body', '', null), true); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($mimetype) |
|
| 45 | + if ($mimetype) |
|
| 46 | 46 | { |
| 47 | 47 | if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif')) && $mimetype !== 'image') |
| 48 | 48 | { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | protected static function _getMimetype($file, $trim_subtype = false) |
| 168 | 168 | { |
| 169 | - if(!extension_loaded('fileinfo')) |
|
| 169 | + if (!extension_loaded('fileinfo')) |
|
| 170 | 170 | { |
| 171 | 171 | return false; |
| 172 | 172 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $mime_type = finfo_file($finfo, $file); |
| 176 | 176 | finfo_close($finfo); |
| 177 | 177 | |
| 178 | - if($trim_subtype) |
|
| 178 | + if ($trim_subtype) |
|
| 179 | 179 | { |
| 180 | 180 | $mime_type = strstr($mime_type, '/', true); |
| 181 | 181 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 346 | 346 | session_start(); |
| 347 | 347 | |
| 348 | 348 | // set authentication information in Context and session |
| 349 | - if(self::isInstalled()) |
|
| 349 | + if (self::isInstalled()) |
|
| 350 | 350 | { |
| 351 | 351 | $oModuleModel = getModel('module'); |
| 352 | 352 | $oModuleModel->loadModuleExtends(); |
@@ -354,15 +354,15 @@ discard block |
||
| 354 | 354 | $oMemberModel = getModel('member'); |
| 355 | 355 | $oMemberController = getController('member'); |
| 356 | 356 | |
| 357 | - if($oMemberController && $oMemberModel) |
|
| 357 | + if ($oMemberController && $oMemberModel) |
|
| 358 | 358 | { |
| 359 | 359 | // if signed in, validate it. |
| 360 | - if($oMemberModel->isLogged()) |
|
| 360 | + if ($oMemberModel->isLogged()) |
|
| 361 | 361 | { |
| 362 | 362 | $oMemberController->setSessionInfo(); |
| 363 | 363 | } |
| 364 | 364 | // check auto sign-in |
| 365 | - elseif($_COOKIE['xeak']) |
|
| 365 | + elseif ($_COOKIE['xeak']) |
|
| 366 | 366 | { |
| 367 | 367 | $oMemberController->doAutologin(); |
| 368 | 368 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | // load common language file |
| 376 | 376 | $this->lang = &$GLOBALS['lang']; |
| 377 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 377 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 378 | 378 | |
| 379 | 379 | // check if using rewrite module |
| 380 | 380 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -382,28 +382,28 @@ discard block |
||
| 382 | 382 | // set locations for javascript use |
| 383 | 383 | $url = array(); |
| 384 | 384 | $current_url = self::getRequestUri(); |
| 385 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 386 | 386 | { |
| 387 | - if($this->get_vars) |
|
| 387 | + if ($this->get_vars) |
|
| 388 | 388 | { |
| 389 | 389 | $url = array(); |
| 390 | - foreach($this->get_vars as $key => $val) |
|
| 390 | + foreach ($this->get_vars as $key => $val) |
|
| 391 | 391 | { |
| 392 | - if(is_array($val) && count($val) > 0) |
|
| 392 | + if (is_array($val) && count($val) > 0) |
|
| 393 | 393 | { |
| 394 | - foreach($val as $k => $v) |
|
| 394 | + foreach ($val as $k => $v) |
|
| 395 | 395 | { |
| 396 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 396 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | - elseif($val) |
|
| 399 | + elseif ($val) |
|
| 400 | 400 | { |
| 401 | - $url[] = $key . '=' . urlencode($val); |
|
| 401 | + $url[] = $key.'='.urlencode($val); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $current_url = self::getRequestUri(); |
| 406 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 407 | 407 | } |
| 408 | 408 | else |
| 409 | 409 | { |
@@ -418,12 +418,12 @@ discard block |
||
| 418 | 418 | $this->set('current_url', $current_url); |
| 419 | 419 | $this->set('request_uri', self::getRequestUri()); |
| 420 | 420 | |
| 421 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 422 | 422 | { |
| 423 | 423 | $this->set('current_url', self::decodeIdna($current_url)); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 427 | 427 | { |
| 428 | 428 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 429 | 429 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | { |
| 449 | 449 | $self = self::getInstance(); |
| 450 | 450 | |
| 451 | - if(!$self->isInstalled()) |
|
| 451 | + if (!$self->isInstalled()) |
|
| 452 | 452 | { |
| 453 | 453 | return; |
| 454 | 454 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | ob_end_clean(); |
| 459 | 459 | |
| 460 | 460 | // If master_db information does not exist, the config file needs to be updated |
| 461 | - if(!isset($db_info->master_db)) |
|
| 461 | + if (!isset($db_info->master_db)) |
|
| 462 | 462 | { |
| 463 | 463 | $db_info->master_db = array(); |
| 464 | 464 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 477 | 477 | unset($db_info->db_table_prefix); |
| 478 | 478 | |
| 479 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 479 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 480 | 480 | { |
| 481 | 481 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 482 | 482 | } |
@@ -488,42 +488,42 @@ discard block |
||
| 488 | 488 | $oInstallController->makeConfigFile(); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - if(version_compare(PHP_VERSION, '7.0', '>=')) |
|
| 491 | + if (version_compare(PHP_VERSION, '7.0', '>=')) |
|
| 492 | 492 | { |
| 493 | 493 | $db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]); |
| 494 | - foreach($db_info->slave_db as &$slave_db_info) |
|
| 494 | + foreach ($db_info->slave_db as &$slave_db_info) |
|
| 495 | 495 | { |
| 496 | 496 | $slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]); |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if(!$db_info->use_prepared_statements) |
|
| 500 | + if (!$db_info->use_prepared_statements) |
|
| 501 | 501 | { |
| 502 | 502 | $db_info->use_prepared_statements = 'Y'; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if(!$db_info->time_zone) |
|
| 505 | + if (!$db_info->time_zone) |
|
| 506 | 506 | $db_info->time_zone = date('O'); |
| 507 | 507 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 508 | 508 | |
| 509 | - if($db_info->qmail_compatibility != 'Y') |
|
| 509 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 510 | 510 | $db_info->qmail_compatibility = 'N'; |
| 511 | 511 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 512 | 512 | |
| 513 | - if(!$db_info->use_db_session) |
|
| 513 | + if (!$db_info->use_db_session) |
|
| 514 | 514 | $db_info->use_db_session = 'N'; |
| 515 | - if(!$db_info->use_ssl) |
|
| 515 | + if (!$db_info->use_ssl) |
|
| 516 | 516 | $db_info->use_ssl = 'none'; |
| 517 | 517 | $this->set('_use_ssl', $db_info->use_ssl); |
| 518 | 518 | |
| 519 | 519 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 520 | 520 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 521 | 521 | |
| 522 | - if(!$db_info->sitelock_whitelist) { |
|
| 522 | + if (!$db_info->sitelock_whitelist) { |
|
| 523 | 523 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 526 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 527 | 527 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -594,10 +594,10 @@ discard block |
||
| 594 | 594 | function loadLangSupported() |
| 595 | 595 | { |
| 596 | 596 | static $lang_supported = null; |
| 597 | - if(!$lang_supported) |
|
| 597 | + if (!$lang_supported) |
|
| 598 | 598 | { |
| 599 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 600 | - foreach($langs as $val) |
|
| 599 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 600 | + foreach ($langs as $val) |
|
| 601 | 601 | { |
| 602 | 602 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 603 | 603 | $lang_text = trim($lang_text); |
@@ -615,17 +615,17 @@ discard block |
||
| 615 | 615 | function loadLangSelected() |
| 616 | 616 | { |
| 617 | 617 | static $lang_selected = null; |
| 618 | - if(!$lang_selected) |
|
| 618 | + if (!$lang_selected) |
|
| 619 | 619 | { |
| 620 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 621 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 622 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 620 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 621 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 622 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 623 | 623 | { |
| 624 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 624 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 625 | 625 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 628 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 629 | 629 | { |
| 630 | 630 | $buff = FileHandler::readFile($orig_lang_file); |
| 631 | 631 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | else |
| 635 | 635 | { |
| 636 | 636 | $langs = file($selected_lang_file); |
| 637 | - foreach($langs as $val) |
|
| 637 | + foreach ($langs as $val) |
|
| 638 | 638 | { |
| 639 | 639 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 640 | 640 | $lang_text = trim($lang_text); |
@@ -653,56 +653,56 @@ discard block |
||
| 653 | 653 | function checkSSO() |
| 654 | 654 | { |
| 655 | 655 | // pass if it's not GET request or XE is not yet installed |
| 656 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 656 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 657 | 657 | { |
| 658 | 658 | return TRUE; |
| 659 | 659 | } |
| 660 | 660 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 661 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 661 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 662 | 662 | { |
| 663 | 663 | return TRUE; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | // pass if default URL is not set |
| 667 | 667 | $default_url = trim($this->db_info->default_url); |
| 668 | - if(!$default_url) |
|
| 668 | + if (!$default_url) |
|
| 669 | 669 | { |
| 670 | 670 | return TRUE; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 673 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 674 | 674 | { |
| 675 | 675 | $default_url .= '/'; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // for sites recieving SSO valdiation |
| 679 | - if($default_url == self::getRequestUri()) |
|
| 679 | + if ($default_url == self::getRequestUri()) |
|
| 680 | 680 | { |
| 681 | - if(self::get('url')) |
|
| 681 | + if (self::get('url')) |
|
| 682 | 682 | { |
| 683 | 683 | $url = base64_decode(self::get('url')); |
| 684 | 684 | $url_info = parse_url($url); |
| 685 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 685 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 686 | 686 | { |
| 687 | 687 | echo self::get('lang')->msg_invalid_request; |
| 688 | 688 | return false; |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $oModuleModel = getModel('module'); |
| 692 | - $domain = $url_info['host'] . $url_info['path']; |
|
| 693 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 692 | + $domain = $url_info['host'].$url_info['path']; |
|
| 693 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 694 | 694 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 695 | 695 | |
| 696 | - if($site_info->site_srl) |
|
| 696 | + if ($site_info->site_srl) |
|
| 697 | 697 | { |
| 698 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 699 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 698 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 699 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 700 | 700 | } |
| 701 | 701 | else |
| 702 | 702 | { |
| 703 | 703 | $redirect_url = $url; |
| 704 | 704 | } |
| 705 | - header('location:' . $redirect_url); |
|
| 705 | + header('location:'.$redirect_url); |
|
| 706 | 706 | |
| 707 | 707 | return FALSE; |
| 708 | 708 | } |
@@ -711,9 +711,9 @@ discard block |
||
| 711 | 711 | else |
| 712 | 712 | { |
| 713 | 713 | // result handling : set session_name() |
| 714 | - if($session_name = self::get('SSOID')) |
|
| 714 | + if ($session_name = self::get('SSOID')) |
|
| 715 | 715 | { |
| 716 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 716 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 717 | 717 | { |
| 718 | 718 | echo self::get('lang')->msg_invalid_request; |
| 719 | 719 | return false; |
@@ -722,17 +722,17 @@ discard block |
||
| 722 | 722 | setcookie(session_name(), $session_name); |
| 723 | 723 | |
| 724 | 724 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 725 | - header('location:' . $url); |
|
| 725 | + header('location:'.$url); |
|
| 726 | 726 | return FALSE; |
| 727 | 727 | // send SSO request |
| 728 | 728 | } |
| 729 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 729 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 730 | 730 | { |
| 731 | 731 | setcookie('sso', md5(self::getRequestUri())); |
| 732 | 732 | $origin_url = self::getRequestUrl(); |
| 733 | 733 | $origin_sig = Password::createSignature($origin_url); |
| 734 | 734 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 735 | - header('location:' . $url); |
|
| 735 | + header('location:'.$url); |
|
| 736 | 736 | return FALSE; |
| 737 | 737 | } |
| 738 | 738 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | { |
| 760 | 760 | $self = self::getInstance(); |
| 761 | 761 | |
| 762 | - if(!$self->isFTPRegisted()) |
|
| 762 | + if (!$self->isFTPRegisted()) |
|
| 763 | 763 | { |
| 764 | 764 | return null; |
| 765 | 765 | } |
@@ -777,15 +777,15 @@ discard block |
||
| 777 | 777 | */ |
| 778 | 778 | function addBrowserTitle($site_title) |
| 779 | 779 | { |
| 780 | - if(!$site_title) |
|
| 780 | + if (!$site_title) |
|
| 781 | 781 | { |
| 782 | 782 | return; |
| 783 | 783 | } |
| 784 | 784 | $self = self::getInstance(); |
| 785 | 785 | |
| 786 | - if($self->site_title) |
|
| 786 | + if ($self->site_title) |
|
| 787 | 787 | { |
| 788 | - $self->site_title .= ' - ' . $site_title; |
|
| 788 | + $self->site_title .= ' - '.$site_title; |
|
| 789 | 789 | } |
| 790 | 790 | else |
| 791 | 791 | { |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | */ |
| 802 | 802 | function setBrowserTitle($site_title) |
| 803 | 803 | { |
| 804 | - if(!$site_title) |
|
| 804 | + if (!$site_title) |
|
| 805 | 805 | { |
| 806 | 806 | return; |
| 807 | 807 | } |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $oModuleModel = getModel('module'); |
| 834 | 834 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 835 | 835 | |
| 836 | - if(isset($moduleConfig->siteTitle)) |
|
| 836 | + if (isset($moduleConfig->siteTitle)) |
|
| 837 | 837 | { |
| 838 | 838 | return $moduleConfig->siteTitle; |
| 839 | 839 | } |
@@ -860,30 +860,30 @@ discard block |
||
| 860 | 860 | global $lang; |
| 861 | 861 | |
| 862 | 862 | $self = self::getInstance(); |
| 863 | - if(!$self->lang_type) |
|
| 863 | + if (!$self->lang_type) |
|
| 864 | 864 | { |
| 865 | 865 | return; |
| 866 | 866 | } |
| 867 | - if(!is_object($lang)) |
|
| 867 | + if (!is_object($lang)) |
|
| 868 | 868 | { |
| 869 | 869 | $lang = new stdClass; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 872 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 873 | 873 | { |
| 874 | 874 | $filename = $self->_loadPhpLang($path); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if(!is_array($self->loaded_lang_files)) |
|
| 877 | + if (!is_array($self->loaded_lang_files)) |
|
| 878 | 878 | { |
| 879 | 879 | $self->loaded_lang_files = array(); |
| 880 | 880 | } |
| 881 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 881 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 882 | 882 | { |
| 883 | 883 | return; |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | - if($filename && is_readable($filename)) |
|
| 886 | + if ($filename && is_readable($filename)) |
|
| 887 | 887 | { |
| 888 | 888 | $self->loaded_lang_files[] = $filename; |
| 889 | 889 | include($filename); |
@@ -904,24 +904,24 @@ discard block |
||
| 904 | 904 | { |
| 905 | 905 | global $lang; |
| 906 | 906 | |
| 907 | - if(!$path) return; |
|
| 907 | + if (!$path) return; |
|
| 908 | 908 | |
| 909 | - $_path = 'eval://' . $path; |
|
| 909 | + $_path = 'eval://'.$path; |
|
| 910 | 910 | |
| 911 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 911 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 912 | 912 | { |
| 913 | 913 | return; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 916 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 917 | 917 | { |
| 918 | 918 | $path .= '/'; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 921 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 922 | 922 | $content = $oXmlLangParser->getCompileContent(); |
| 923 | 923 | |
| 924 | - if($content) |
|
| 924 | + if ($content) |
|
| 925 | 925 | { |
| 926 | 926 | $this->loaded_lang_files[] = $_path; |
| 927 | 927 | eval($content); |
@@ -936,9 +936,9 @@ discard block |
||
| 936 | 936 | */ |
| 937 | 937 | function _loadXmlLang($path) |
| 938 | 938 | { |
| 939 | - if(!$path) return; |
|
| 939 | + if (!$path) return; |
|
| 940 | 940 | |
| 941 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 941 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 942 | 942 | return $oXmlLangParser->compile(); |
| 943 | 943 | } |
| 944 | 944 | |
@@ -950,22 +950,22 @@ discard block |
||
| 950 | 950 | */ |
| 951 | 951 | function _loadPhpLang($path) |
| 952 | 952 | { |
| 953 | - if(!$path) return; |
|
| 953 | + if (!$path) return; |
|
| 954 | 954 | |
| 955 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 955 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 956 | 956 | { |
| 957 | 957 | $path .= '/'; |
| 958 | 958 | } |
| 959 | - $path_tpl = $path . '%s.lang.php'; |
|
| 959 | + $path_tpl = $path.'%s.lang.php'; |
|
| 960 | 960 | $file = sprintf($path_tpl, $this->lang_type); |
| 961 | 961 | |
| 962 | 962 | $langs = array('ko', 'en'); // this will be configurable. |
| 963 | - while(!is_readable($file) && $langs[0]) |
|
| 963 | + while (!is_readable($file) && $langs[0]) |
|
| 964 | 964 | { |
| 965 | 965 | $file = sprintf($path_tpl, array_shift($langs)); |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - if(!is_readable($file)) |
|
| 968 | + if (!is_readable($file)) |
|
| 969 | 969 | { |
| 970 | 970 | return FALSE; |
| 971 | 971 | } |
@@ -1007,11 +1007,11 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | function getLang($code) |
| 1009 | 1009 | { |
| 1010 | - if(!$code) |
|
| 1010 | + if (!$code) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | return; |
| 1013 | 1013 | } |
| 1014 | - if($GLOBALS['lang']->{$code}) |
|
| 1014 | + if ($GLOBALS['lang']->{$code}) |
|
| 1015 | 1015 | { |
| 1016 | 1016 | return $GLOBALS['lang']->{$code}; |
| 1017 | 1017 | } |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | */ |
| 1028 | 1028 | function setLang($code, $val) |
| 1029 | 1029 | { |
| 1030 | - if(!isset($GLOBALS['lang'])) |
|
| 1030 | + if (!isset($GLOBALS['lang'])) |
|
| 1031 | 1031 | { |
| 1032 | 1032 | $GLOBALS['lang'] = new stdClass(); |
| 1033 | 1033 | } |
@@ -1052,17 +1052,17 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | $obj = clone $source_obj; |
| 1054 | 1054 | |
| 1055 | - foreach($charset_list as $charset) |
|
| 1055 | + foreach ($charset_list as $charset) |
|
| 1056 | 1056 | { |
| 1057 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1057 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1058 | 1058 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1059 | - if($flag) |
|
| 1059 | + if ($flag) |
|
| 1060 | 1060 | { |
| 1061 | - if($charset == 'UTF-8') |
|
| 1061 | + if ($charset == 'UTF-8') |
|
| 1062 | 1062 | { |
| 1063 | 1063 | return $obj; |
| 1064 | 1064 | } |
| 1065 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1065 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1066 | 1066 | return $obj; |
| 1067 | 1067 | } |
| 1068 | 1068 | } |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1082 | 1082 | { |
| 1083 | 1083 | static $flag = TRUE; |
| 1084 | - if($charset) |
|
| 1084 | + if ($charset) |
|
| 1085 | 1085 | { |
| 1086 | - if(is_array($val)) |
|
| 1087 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1088 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1086 | + if (is_array($val)) |
|
| 1087 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1088 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1089 | 1089 | else $flag = FALSE; |
| 1090 | 1090 | } |
| 1091 | 1091 | else |
@@ -1109,9 +1109,9 @@ discard block |
||
| 1109 | 1109 | { |
| 1110 | 1110 | if (is_array($val)) |
| 1111 | 1111 | { |
| 1112 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1112 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1113 | 1113 | } |
| 1114 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1114 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | */ |
| 1123 | 1123 | function convertEncodingStr($str) |
| 1124 | 1124 | { |
| 1125 | - if(!$str) return null; |
|
| 1125 | + if (!$str) return null; |
|
| 1126 | 1126 | $obj = new stdClass(); |
| 1127 | 1127 | $obj->str = $str; |
| 1128 | 1128 | $obj = self::convertEncoding($obj); |
@@ -1131,9 +1131,9 @@ discard block |
||
| 1131 | 1131 | |
| 1132 | 1132 | function decodeIdna($domain) |
| 1133 | 1133 | { |
| 1134 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1134 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1135 | 1135 | { |
| 1136 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1136 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1137 | 1137 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1138 | 1138 | $domain = $IDN->decode($domain); |
| 1139 | 1139 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | { |
| 1165 | 1165 | $self = self::getInstance(); |
| 1166 | 1166 | |
| 1167 | - if($self->response_method) |
|
| 1167 | + if ($self->response_method) |
|
| 1168 | 1168 | { |
| 1169 | 1169 | return $self->response_method; |
| 1170 | 1170 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1205 | 1205 | |
| 1206 | 1206 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1207 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1207 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | $this->isSuccessInit = FALSE; |
| 1210 | 1210 | } |
@@ -1217,30 +1217,30 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | function _setRequestArgument() |
| 1219 | 1219 | { |
| 1220 | - if(!count($_REQUEST)) |
|
| 1220 | + if (!count($_REQUEST)) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | return; |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | $requestMethod = $this->getRequestMethod(); |
| 1226 | - foreach($_REQUEST as $key => $val) |
|
| 1226 | + foreach ($_REQUEST as $key => $val) |
|
| 1227 | 1227 | { |
| 1228 | - if($val === '' || self::get($key)) |
|
| 1228 | + if ($val === '' || self::get($key)) |
|
| 1229 | 1229 | { |
| 1230 | 1230 | continue; |
| 1231 | 1231 | } |
| 1232 | 1232 | $key = htmlentities($key); |
| 1233 | 1233 | $val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET')); |
| 1234 | 1234 | |
| 1235 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1235 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | $set_to_vars = TRUE; |
| 1238 | 1238 | } |
| 1239 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1239 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $set_to_vars = TRUE; |
| 1242 | 1242 | } |
| 1243 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1243 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1244 | 1244 | { |
| 1245 | 1245 | $set_to_vars = TRUE; |
| 1246 | 1246 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | $set_to_vars = FALSE; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - if($set_to_vars) |
|
| 1252 | + if ($set_to_vars) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $this->_recursiveCheckVar($val); |
| 1255 | 1255 | } |
@@ -1260,20 +1260,20 @@ discard block |
||
| 1260 | 1260 | |
| 1261 | 1261 | function _recursiveCheckVar($val) |
| 1262 | 1262 | { |
| 1263 | - if(is_string($val)) |
|
| 1263 | + if (is_string($val)) |
|
| 1264 | 1264 | { |
| 1265 | - foreach($this->patterns as $pattern) |
|
| 1265 | + foreach ($this->patterns as $pattern) |
|
| 1266 | 1266 | { |
| 1267 | - if(preg_match($pattern, $val)) |
|
| 1267 | + if (preg_match($pattern, $val)) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $this->isSuccessInit = FALSE; |
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
| 1274 | - else if(is_array($val)) |
|
| 1274 | + else if (is_array($val)) |
|
| 1275 | 1275 | { |
| 1276 | - foreach($val as $val2) |
|
| 1276 | + foreach ($val as $val2) |
|
| 1277 | 1277 | { |
| 1278 | 1278 | $this->_recursiveCheckVar($val2); |
| 1279 | 1279 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | */ |
| 1288 | 1288 | function _setJSONRequestArgument() |
| 1289 | 1289 | { |
| 1290 | - if($this->getRequestMethod() != 'JSON') |
|
| 1290 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1291 | 1291 | { |
| 1292 | 1292 | return; |
| 1293 | 1293 | } |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | $params = array(); |
| 1296 | 1296 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1297 | 1297 | |
| 1298 | - foreach($params as $key => $val) |
|
| 1298 | + foreach ($params as $key => $val) |
|
| 1299 | 1299 | { |
| 1300 | 1300 | $key = htmlentities($key); |
| 1301 | 1301 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
@@ -1309,13 +1309,13 @@ discard block |
||
| 1309 | 1309 | */ |
| 1310 | 1310 | function _setXmlRpcArgument() |
| 1311 | 1311 | { |
| 1312 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1312 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1313 | 1313 | { |
| 1314 | 1314 | return; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1318 | - if(Security::detectingXEE($xml)) |
|
| 1318 | + if (Security::detectingXEE($xml)) |
|
| 1319 | 1319 | { |
| 1320 | 1320 | header("HTTP/1.0 400 Bad Request"); |
| 1321 | 1321 | exit; |
@@ -1327,12 +1327,12 @@ discard block |
||
| 1327 | 1327 | $params = $xml_obj->methodcall->params; |
| 1328 | 1328 | unset($params->node_name, $params->attrs, $params->body); |
| 1329 | 1329 | |
| 1330 | - if(!count(get_object_vars($params))) |
|
| 1330 | + if (!count(get_object_vars($params))) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | return; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - foreach($params as $key => $val) |
|
| 1335 | + foreach ($params as $key => $val) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1338 | 1338 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
| 1347 | 1347 | */ |
| 1348 | 1348 | function _filterXmlVars($key, $val) |
| 1349 | 1349 | { |
| 1350 | - if(is_array($val)) |
|
| 1350 | + if (is_array($val)) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | $stack = array(); |
| 1353 | - foreach($val as $k => $v) |
|
| 1353 | + foreach ($val as $k => $v) |
|
| 1354 | 1354 | { |
| 1355 | 1355 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1356 | 1356 | } |
@@ -1360,20 +1360,20 @@ discard block |
||
| 1360 | 1360 | |
| 1361 | 1361 | $body = $val->body; |
| 1362 | 1362 | unset($val->node_name, $val->attrs, $val->body); |
| 1363 | - if(!count(get_object_vars($val))) |
|
| 1363 | + if (!count(get_object_vars($val))) |
|
| 1364 | 1364 | { |
| 1365 | 1365 | return $this->_filterRequestVar($key, $body, 0); |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | $stack = new stdClass(); |
| 1369 | - foreach($val as $k => $v) |
|
| 1369 | + foreach ($val as $k => $v) |
|
| 1370 | 1370 | { |
| 1371 | 1371 | $output = $this->_filterXmlVars($k, $v); |
| 1372 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1372 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1373 | 1373 | { |
| 1374 | 1374 | $output = array($output); |
| 1375 | 1375 | } |
| 1376 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1376 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1377 | 1377 | { |
| 1378 | 1378 | return $output; |
| 1379 | 1379 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | $stack->{$k} = $output; |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | - if(!count(get_object_vars($stack))) |
|
| 1384 | + if (!count(get_object_vars($stack))) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | return NULL; |
| 1387 | 1387 | } |
@@ -1400,42 +1400,42 @@ discard block |
||
| 1400 | 1400 | */ |
| 1401 | 1401 | function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false) |
| 1402 | 1402 | { |
| 1403 | - if(!($isArray = is_array($val))) |
|
| 1403 | + if (!($isArray = is_array($val))) |
|
| 1404 | 1404 | { |
| 1405 | 1405 | $val = array($val); |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | $result = array(); |
| 1409 | - foreach($val as $k => $v) |
|
| 1409 | + foreach ($val as $k => $v) |
|
| 1410 | 1410 | { |
| 1411 | 1411 | $k = escape($k); |
| 1412 | 1412 | $result[$k] = $v; |
| 1413 | 1413 | |
| 1414 | - if($remove_hack && !is_array($result[$k])) { |
|
| 1415 | - if(stripos($result[$k], '<script') || stripos($result[$k], 'lt;script') || stripos($result[$k], '%3Cscript')) |
|
| 1414 | + if ($remove_hack && !is_array($result[$k])) { |
|
| 1415 | + if (stripos($result[$k], '<script') || stripos($result[$k], 'lt;script') || stripos($result[$k], '%3Cscript')) |
|
| 1416 | 1416 | { |
| 1417 | 1417 | $result[$k] = escape($result[$k]); |
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1421 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1422 | 1422 | { |
| 1423 | 1423 | $result[$k] = !preg_match('/^[0-9,]+$/', $result[$k]) ? (int) $result[$k] : $result[$k]; |
| 1424 | 1424 | } |
| 1425 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1425 | + elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) { |
|
| 1426 | 1426 | $result[$k] = escape($result[$k], false); |
| 1427 | 1427 | } |
| 1428 | - elseif($key === 'vid') |
|
| 1428 | + elseif ($key === 'vid') |
|
| 1429 | 1429 | { |
| 1430 | 1430 | $result[$k] = urlencode($result[$k]); |
| 1431 | 1431 | } |
| 1432 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1432 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1433 | 1433 | { |
| 1434 | 1434 | unset($result[$k]); |
| 1435 | 1435 | } |
| 1436 | 1436 | else |
| 1437 | 1437 | { |
| 1438 | - if(in_array($k, array( |
|
| 1438 | + if (in_array($k, array( |
|
| 1439 | 1439 | 'act', |
| 1440 | 1440 | 'addon', |
| 1441 | 1441 | 'cur_mid', |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | $result[$k] = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', $result[$k])); |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1459 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1460 | 1460 | { |
| 1461 | 1461 | if (is_array($result[$k])) |
| 1462 | 1462 | { |
@@ -1468,7 +1468,7 @@ discard block |
||
| 1468 | 1468 | } |
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | - if(is_array($result[$k])) |
|
| 1471 | + if (is_array($result[$k])) |
|
| 1472 | 1472 | { |
| 1473 | 1473 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1474 | 1474 | } |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | $result[$k] = trim($result[$k]); |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | - if($remove_hack) |
|
| 1480 | + if ($remove_hack) |
|
| 1481 | 1481 | { |
| 1482 | 1482 | $result[$k] = escape($result[$k], false); |
| 1483 | 1483 | } |
@@ -1505,18 +1505,18 @@ discard block |
||
| 1505 | 1505 | */ |
| 1506 | 1506 | function _setUploadedArgument() |
| 1507 | 1507 | { |
| 1508 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1508 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1509 | 1509 | { |
| 1510 | 1510 | return; |
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | - foreach($_FILES as $key => $val) |
|
| 1513 | + foreach ($_FILES as $key => $val) |
|
| 1514 | 1514 | { |
| 1515 | 1515 | $tmp_name = $val['tmp_name']; |
| 1516 | 1516 | |
| 1517 | - if(!is_array($tmp_name)) |
|
| 1517 | + if (!is_array($tmp_name)) |
|
| 1518 | 1518 | { |
| 1519 | - if(!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1519 | + if (!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1520 | 1520 | { |
| 1521 | 1521 | unset($_FILES[$key]); |
| 1522 | 1522 | continue; |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | $files = array(); |
| 1531 | 1531 | foreach ($tmp_name as $i => $j) |
| 1532 | 1532 | { |
| 1533 | - if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1533 | + if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1534 | 1534 | { |
| 1535 | 1535 | $files = array(); |
| 1536 | 1536 | unset($_FILES[$key]); |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | $file['size'] = $val['size'][$i]; |
| 1545 | 1545 | $files[] = $file; |
| 1546 | 1546 | } |
| 1547 | - if(count($files)) |
|
| 1547 | + if (count($files)) |
|
| 1548 | 1548 | { |
| 1549 | 1549 | self::set($key, $files, true); |
| 1550 | 1550 | } |
@@ -1569,16 +1569,16 @@ discard block |
||
| 1569 | 1569 | function getRequestUrl() |
| 1570 | 1570 | { |
| 1571 | 1571 | static $url = null; |
| 1572 | - if(is_null($url)) |
|
| 1572 | + if (is_null($url)) |
|
| 1573 | 1573 | { |
| 1574 | 1574 | $url = self::getRequestUri(); |
| 1575 | - if(count($_GET) > 0) |
|
| 1575 | + if (count($_GET) > 0) |
|
| 1576 | 1576 | { |
| 1577 | - foreach($_GET as $key => $val) |
|
| 1577 | + foreach ($_GET as $key => $val) |
|
| 1578 | 1578 | { |
| 1579 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1579 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1580 | 1580 | } |
| 1581 | - $url .= '?' . join('&', $vars); |
|
| 1581 | + $url .= '?'.join('&', $vars); |
|
| 1582 | 1582 | } |
| 1583 | 1583 | } |
| 1584 | 1584 | return $url; |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | $self = self::getInstance(); |
| 1594 | 1594 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1595 | 1595 | |
| 1596 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1596 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1597 | 1597 | { |
| 1598 | 1598 | unset($js_callback_func); |
| 1599 | 1599 | unset($_GET['xe_js_callback']); |
@@ -1621,22 +1621,22 @@ discard block |
||
| 1621 | 1621 | $self = self::getInstance(); |
| 1622 | 1622 | |
| 1623 | 1623 | // retrieve virtual site information |
| 1624 | - if(is_null($site_module_info)) |
|
| 1624 | + if (is_null($site_module_info)) |
|
| 1625 | 1625 | { |
| 1626 | 1626 | $site_module_info = self::get('site_module_info'); |
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1630 | - if($domain && isSiteID($domain)) |
|
| 1630 | + if ($domain && isSiteID($domain)) |
|
| 1631 | 1631 | { |
| 1632 | 1632 | $vid = $domain; |
| 1633 | 1633 | $domain = ''; |
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | // If $domain, $vid are not set, use current site information |
| 1637 | - if(!$domain && !$vid) |
|
| 1637 | + if (!$domain && !$vid) |
|
| 1638 | 1638 | { |
| 1639 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1639 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1640 | 1640 | { |
| 1641 | 1641 | $vid = $site_module_info->domain; |
| 1642 | 1642 | } |
@@ -1647,21 +1647,21 @@ discard block |
||
| 1647 | 1647 | } |
| 1648 | 1648 | |
| 1649 | 1649 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1650 | - if($domain) |
|
| 1650 | + if ($domain) |
|
| 1651 | 1651 | { |
| 1652 | 1652 | $domain_info = parse_url($domain); |
| 1653 | - if(is_null($current_info)) |
|
| 1653 | + if (is_null($current_info)) |
|
| 1654 | 1654 | { |
| 1655 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1655 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1656 | 1656 | } |
| 1657 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1657 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1658 | 1658 | { |
| 1659 | 1659 | unset($domain); |
| 1660 | 1660 | } |
| 1661 | 1661 | else |
| 1662 | 1662 | { |
| 1663 | 1663 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1664 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1664 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1665 | 1665 | { |
| 1666 | 1666 | $domain .= '/'; |
| 1667 | 1667 | } |
@@ -1671,41 +1671,41 @@ discard block |
||
| 1671 | 1671 | $get_vars = array(); |
| 1672 | 1672 | |
| 1673 | 1673 | // If there is no GET variables or first argument is '' to reset variables |
| 1674 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1674 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1675 | 1675 | { |
| 1676 | 1676 | // rearrange args_list |
| 1677 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1677 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1678 | 1678 | { |
| 1679 | 1679 | array_shift($args_list); |
| 1680 | 1680 | } |
| 1681 | 1681 | } |
| 1682 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1682 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1683 | 1683 | { |
| 1684 | 1684 | // Otherwise, make GET variables into array |
| 1685 | 1685 | $get_vars = get_object_vars($self->get_vars); |
| 1686 | 1686 | } |
| 1687 | 1687 | else |
| 1688 | 1688 | { |
| 1689 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1690 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1691 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1692 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1693 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1694 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1695 | - if($get_vars['act'] == 'IS') |
|
| 1689 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1690 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1691 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1692 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1693 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1694 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1695 | + if ($get_vars['act'] == 'IS') |
|
| 1696 | 1696 | { |
| 1697 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1697 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1698 | 1698 | } |
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | // arrange args_list |
| 1702 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1702 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1703 | 1703 | { |
| 1704 | 1704 | $key = $args_list[$i]; |
| 1705 | 1705 | $val = trim($args_list[$i + 1]); |
| 1706 | 1706 | |
| 1707 | 1707 | // If value is not set, remove the key |
| 1708 | - if(!isset($val) || !strlen($val)) |
|
| 1708 | + if (!isset($val) || !strlen($val)) |
|
| 1709 | 1709 | { |
| 1710 | 1710 | unset($get_vars[$key]); |
| 1711 | 1711 | continue; |
@@ -1716,7 +1716,7 @@ discard block |
||
| 1716 | 1716 | |
| 1717 | 1717 | // remove vid, rnd |
| 1718 | 1718 | unset($get_vars['rnd']); |
| 1719 | - if($vid) |
|
| 1719 | + if ($vid) |
|
| 1720 | 1720 | { |
| 1721 | 1721 | $get_vars['vid'] = $vid; |
| 1722 | 1722 | } |
@@ -1733,17 +1733,17 @@ discard block |
||
| 1733 | 1733 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1734 | 1734 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1735 | 1735 | ); |
| 1736 | - if($act_alias[$act]) |
|
| 1736 | + if ($act_alias[$act]) |
|
| 1737 | 1737 | { |
| 1738 | 1738 | $get_vars['act'] = $act_alias[$act]; |
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | 1741 | // organize URL |
| 1742 | 1742 | $query = ''; |
| 1743 | - if(count($get_vars) > 0) |
|
| 1743 | + if (count($get_vars) > 0) |
|
| 1744 | 1744 | { |
| 1745 | 1745 | // if using rewrite mod |
| 1746 | - if($self->allow_rewrite) |
|
| 1746 | + if ($self->allow_rewrite) |
|
| 1747 | 1747 | { |
| 1748 | 1748 | $var_keys = array_keys($get_vars); |
| 1749 | 1749 | sort($var_keys); |
@@ -1763,8 +1763,8 @@ discard block |
||
| 1763 | 1763 | 'vid' => $vid, |
| 1764 | 1764 | 'mid' => $mid, |
| 1765 | 1765 | 'mid.vid' => "$vid/$mid", |
| 1766 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1767 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1766 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1767 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1768 | 1768 | 'document_srl' => $srl, |
| 1769 | 1769 | 'document_srl.mid' => "$mid/$srl", |
| 1770 | 1770 | 'document_srl.vid' => "$vid/$srl", |
@@ -1781,66 +1781,66 @@ discard block |
||
| 1781 | 1781 | $query = $target_map[$target]; |
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | - if(!$query) |
|
| 1784 | + if (!$query) |
|
| 1785 | 1785 | { |
| 1786 | 1786 | $queries = array(); |
| 1787 | - foreach($get_vars as $key => $val) |
|
| 1787 | + foreach ($get_vars as $key => $val) |
|
| 1788 | 1788 | { |
| 1789 | - if(is_array($val) && count($val) > 0) |
|
| 1789 | + if (is_array($val) && count($val) > 0) |
|
| 1790 | 1790 | { |
| 1791 | - foreach($val as $k => $v) |
|
| 1791 | + foreach ($val as $k => $v) |
|
| 1792 | 1792 | { |
| 1793 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1793 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1794 | 1794 | } |
| 1795 | 1795 | } |
| 1796 | - elseif(!is_array($val)) |
|
| 1796 | + elseif (!is_array($val)) |
|
| 1797 | 1797 | { |
| 1798 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1798 | + $queries[] = $key.'='.urlencode($val); |
|
| 1799 | 1799 | } |
| 1800 | 1800 | } |
| 1801 | - if(count($queries) > 0) |
|
| 1801 | + if (count($queries) > 0) |
|
| 1802 | 1802 | { |
| 1803 | - $query = 'index.php?' . join('&', $queries); |
|
| 1803 | + $query = 'index.php?'.join('&', $queries); |
|
| 1804 | 1804 | } |
| 1805 | 1805 | } |
| 1806 | 1806 | } |
| 1807 | 1807 | |
| 1808 | 1808 | // If using SSL always |
| 1809 | 1809 | $_use_ssl = $self->get('_use_ssl'); |
| 1810 | - if($_use_ssl == 'always') |
|
| 1810 | + if ($_use_ssl == 'always') |
|
| 1811 | 1811 | { |
| 1812 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1812 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1813 | 1813 | // optional SSL use |
| 1814 | 1814 | } |
| 1815 | - elseif($_use_ssl == 'optional') |
|
| 1815 | + elseif ($_use_ssl == 'optional') |
|
| 1816 | 1816 | { |
| 1817 | 1817 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1818 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1818 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1819 | 1819 | // no SSL |
| 1820 | 1820 | } |
| 1821 | 1821 | else |
| 1822 | 1822 | { |
| 1823 | 1823 | // currently on SSL but target is not based on SSL |
| 1824 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1824 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1825 | 1825 | { |
| 1826 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1826 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1827 | 1827 | } |
| 1828 | - else if($domain) // if $domain is set |
|
| 1828 | + else if ($domain) // if $domain is set |
|
| 1829 | 1829 | { |
| 1830 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1830 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | else |
| 1833 | 1833 | { |
| 1834 | - $query = getScriptPath() . $query; |
|
| 1834 | + $query = getScriptPath().$query; |
|
| 1835 | 1835 | } |
| 1836 | 1836 | } |
| 1837 | 1837 | |
| 1838 | - if(!$encode) |
|
| 1838 | + if (!$encode) |
|
| 1839 | 1839 | { |
| 1840 | 1840 | return $query; |
| 1841 | 1841 | } |
| 1842 | 1842 | |
| 1843 | - if(!$autoEncode) |
|
| 1843 | + if (!$autoEncode) |
|
| 1844 | 1844 | { |
| 1845 | 1845 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1846 | 1846 | } |
@@ -1849,16 +1849,16 @@ discard block |
||
| 1849 | 1849 | $encode_queries = array(); |
| 1850 | 1850 | $parsedUrl = parse_url($query); |
| 1851 | 1851 | parse_str($parsedUrl['query'], $output); |
| 1852 | - foreach($output as $key => $value) |
|
| 1852 | + foreach ($output as $key => $value) |
|
| 1853 | 1853 | { |
| 1854 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1854 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1855 | 1855 | { |
| 1856 | 1856 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1857 | 1857 | } |
| 1858 | - $encode_queries[] = $key . '=' . $value; |
|
| 1858 | + $encode_queries[] = $key.'='.$value; |
|
| 1859 | 1859 | } |
| 1860 | 1860 | |
| 1861 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1861 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | 1864 | /** |
@@ -1873,17 +1873,17 @@ discard block |
||
| 1873 | 1873 | static $url = array(); |
| 1874 | 1874 | |
| 1875 | 1875 | // Check HTTP Request |
| 1876 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1876 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1877 | 1877 | { |
| 1878 | 1878 | return; |
| 1879 | 1879 | } |
| 1880 | 1880 | |
| 1881 | - if(self::get('_use_ssl') == 'always') |
|
| 1881 | + if (self::get('_use_ssl') == 'always') |
|
| 1882 | 1882 | { |
| 1883 | 1883 | $ssl_mode = ENFORCE_SSL; |
| 1884 | 1884 | } |
| 1885 | 1885 | |
| 1886 | - if($domain) |
|
| 1886 | + if ($domain) |
|
| 1887 | 1887 | { |
| 1888 | 1888 | $domain_key = md5($domain); |
| 1889 | 1889 | } |
@@ -1892,14 +1892,14 @@ discard block |
||
| 1892 | 1892 | $domain_key = 'default'; |
| 1893 | 1893 | } |
| 1894 | 1894 | |
| 1895 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1895 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1896 | 1896 | { |
| 1897 | 1897 | return $url[$ssl_mode][$domain_key]; |
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | 1900 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1901 | 1901 | |
| 1902 | - switch($ssl_mode) |
|
| 1902 | + switch ($ssl_mode) |
|
| 1903 | 1903 | { |
| 1904 | 1904 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1905 | 1905 | break; |
@@ -1909,34 +1909,34 @@ discard block |
||
| 1909 | 1909 | break; |
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | - if($domain) |
|
| 1912 | + if ($domain) |
|
| 1913 | 1913 | { |
| 1914 | 1914 | $target_url = trim($domain); |
| 1915 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1915 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1916 | 1916 | { |
| 1917 | - $target_url.= '/'; |
|
| 1917 | + $target_url .= '/'; |
|
| 1918 | 1918 | } |
| 1919 | 1919 | } |
| 1920 | 1920 | else |
| 1921 | 1921 | { |
| 1922 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1922 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | - $url_info = parse_url('http://' . $target_url); |
|
| 1925 | + $url_info = parse_url('http://'.$target_url); |
|
| 1926 | 1926 | |
| 1927 | - if($current_use_ssl != $use_ssl) |
|
| 1927 | + if ($current_use_ssl != $use_ssl) |
|
| 1928 | 1928 | { |
| 1929 | 1929 | unset($url_info['port']); |
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | - if($use_ssl) |
|
| 1932 | + if ($use_ssl) |
|
| 1933 | 1933 | { |
| 1934 | 1934 | $port = self::get('_https_port'); |
| 1935 | - if($port && $port != 443) |
|
| 1935 | + if ($port && $port != 443) |
|
| 1936 | 1936 | { |
| 1937 | 1937 | $url_info['port'] = $port; |
| 1938 | 1938 | } |
| 1939 | - elseif($url_info['port'] == 443) |
|
| 1939 | + elseif ($url_info['port'] == 443) |
|
| 1940 | 1940 | { |
| 1941 | 1941 | unset($url_info['port']); |
| 1942 | 1942 | } |
@@ -1944,17 +1944,17 @@ discard block |
||
| 1944 | 1944 | else |
| 1945 | 1945 | { |
| 1946 | 1946 | $port = self::get('_http_port'); |
| 1947 | - if($port && $port != 80) |
|
| 1947 | + if ($port && $port != 80) |
|
| 1948 | 1948 | { |
| 1949 | 1949 | $url_info['port'] = $port; |
| 1950 | 1950 | } |
| 1951 | - elseif($url_info['port'] == 80) |
|
| 1951 | + elseif ($url_info['port'] == 80) |
|
| 1952 | 1952 | { |
| 1953 | 1953 | unset($url_info['port']); |
| 1954 | 1954 | } |
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1957 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1958 | 1958 | |
| 1959 | 1959 | return $url[$ssl_mode][$domain_key]; |
| 1960 | 1960 | } |
@@ -1971,16 +1971,16 @@ discard block |
||
| 1971 | 1971 | { |
| 1972 | 1972 | $self = self::getInstance(); |
| 1973 | 1973 | $self->context->{$key} = $val; |
| 1974 | - if($set_to_get_vars === FALSE) |
|
| 1974 | + if ($set_to_get_vars === FALSE) |
|
| 1975 | 1975 | { |
| 1976 | 1976 | return; |
| 1977 | 1977 | } |
| 1978 | - if($val === NULL || $val === '') |
|
| 1978 | + if ($val === NULL || $val === '') |
|
| 1979 | 1979 | { |
| 1980 | 1980 | unset($self->get_vars->{$key}); |
| 1981 | 1981 | return; |
| 1982 | 1982 | } |
| 1983 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1983 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1984 | 1984 | { |
| 1985 | 1985 | $self->get_vars->{$key} = $val; |
| 1986 | 1986 | } |
@@ -1996,7 +1996,7 @@ discard block |
||
| 1996 | 1996 | { |
| 1997 | 1997 | $self = self::getInstance(); |
| 1998 | 1998 | |
| 1999 | - if(!isset($self->context->{$key})) |
|
| 1999 | + if (!isset($self->context->{$key})) |
|
| 2000 | 2000 | { |
| 2001 | 2001 | return null; |
| 2002 | 2002 | } |
@@ -2011,7 +2011,7 @@ discard block |
||
| 2011 | 2011 | function gets() |
| 2012 | 2012 | { |
| 2013 | 2013 | $num_args = func_num_args(); |
| 2014 | - if($num_args < 1) |
|
| 2014 | + if ($num_args < 1) |
|
| 2015 | 2015 | { |
| 2016 | 2016 | return; |
| 2017 | 2017 | } |
@@ -2019,7 +2019,7 @@ discard block |
||
| 2019 | 2019 | |
| 2020 | 2020 | $args_list = func_get_args(); |
| 2021 | 2021 | $output = new stdClass(); |
| 2022 | - foreach($args_list as $v) |
|
| 2022 | + foreach ($args_list as $v) |
|
| 2023 | 2023 | { |
| 2024 | 2024 | $output->{$v} = $self->get($v); |
| 2025 | 2025 | } |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | function getRequestVars() |
| 2046 | 2046 | { |
| 2047 | 2047 | $self = self::getInstance(); |
| 2048 | - if($self->get_vars) |
|
| 2048 | + if ($self->get_vars) |
|
| 2049 | 2049 | { |
| 2050 | 2050 | return clone($self->get_vars); |
| 2051 | 2051 | } |
@@ -2062,13 +2062,13 @@ discard block |
||
| 2062 | 2062 | { |
| 2063 | 2063 | $self = self::getInstance(); |
| 2064 | 2064 | |
| 2065 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2065 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2066 | 2066 | { |
| 2067 | 2067 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2068 | 2068 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | - if(!isset($self->ssl_actions[$action])) |
|
| 2071 | + if (!isset($self->ssl_actions[$action])) |
|
| 2072 | 2072 | { |
| 2073 | 2073 | $self->ssl_actions[$action] = 1; |
| 2074 | 2074 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2086,16 +2086,16 @@ discard block |
||
| 2086 | 2086 | { |
| 2087 | 2087 | $self = self::getInstance(); |
| 2088 | 2088 | |
| 2089 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2089 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2090 | 2090 | { |
| 2091 | 2091 | unset($self->ssl_actions); |
| 2092 | 2092 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2093 | 2093 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2094 | 2094 | } |
| 2095 | 2095 | |
| 2096 | - foreach($action_array as $action) |
|
| 2096 | + foreach ($action_array as $action) |
|
| 2097 | 2097 | { |
| 2098 | - if(!isset($self->ssl_actions[$action])) |
|
| 2098 | + if (!isset($self->ssl_actions[$action])) |
|
| 2099 | 2099 | { |
| 2100 | 2100 | $self->ssl_actions[$action] = 1; |
| 2101 | 2101 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2114,7 +2114,7 @@ discard block |
||
| 2114 | 2114 | { |
| 2115 | 2115 | $self = self::getInstance(); |
| 2116 | 2116 | |
| 2117 | - if($self->isExistsSSLAction($action)) |
|
| 2117 | + if ($self->isExistsSSLAction($action)) |
|
| 2118 | 2118 | { |
| 2119 | 2119 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2120 | 2120 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | function getSSLActions() |
| 2132 | 2132 | { |
| 2133 | 2133 | $self = self::getInstance(); |
| 2134 | - if($self->getSslStatus() == 'optional') |
|
| 2134 | + if ($self->getSslStatus() == 'optional') |
|
| 2135 | 2135 | { |
| 2136 | 2136 | return $self->ssl_actions; |
| 2137 | 2137 | } |
@@ -2158,12 +2158,12 @@ discard block |
||
| 2158 | 2158 | */ |
| 2159 | 2159 | function normalizeFilePath($file) |
| 2160 | 2160 | { |
| 2161 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2161 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2162 | 2162 | { |
| 2163 | - $file = './' . $file; |
|
| 2163 | + $file = './'.$file; |
|
| 2164 | 2164 | } |
| 2165 | 2165 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2166 | - while(strpos($file, '/../') !== FALSE) |
|
| 2166 | + while (strpos($file, '/../') !== FALSE) |
|
| 2167 | 2167 | { |
| 2168 | 2168 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2169 | 2169 | } |
@@ -2182,13 +2182,13 @@ discard block |
||
| 2182 | 2182 | { |
| 2183 | 2183 | $file = self::normalizeFilePath($file); |
| 2184 | 2184 | $script_path = getScriptPath(); |
| 2185 | - if(strpos($file, './') === 0) |
|
| 2185 | + if (strpos($file, './') === 0) |
|
| 2186 | 2186 | { |
| 2187 | - $file = $script_path . substr($file, 2); |
|
| 2187 | + $file = $script_path.substr($file, 2); |
|
| 2188 | 2188 | } |
| 2189 | - elseif(strpos($file, '../') === 0) |
|
| 2189 | + elseif (strpos($file, '../') === 0) |
|
| 2190 | 2190 | { |
| 2191 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2191 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | return $file; |
@@ -2258,12 +2258,12 @@ discard block |
||
| 2258 | 2258 | */ |
| 2259 | 2259 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2260 | 2260 | { |
| 2261 | - if($isRuleset) |
|
| 2261 | + if ($isRuleset) |
|
| 2262 | 2262 | { |
| 2263 | - if(strpos($file, '#') !== FALSE) |
|
| 2263 | + if (strpos($file, '#') !== FALSE) |
|
| 2264 | 2264 | { |
| 2265 | 2265 | $file = str_replace('#', '', $file); |
| 2266 | - if(!is_readable($file)) |
|
| 2266 | + if (!is_readable($file)) |
|
| 2267 | 2267 | { |
| 2268 | 2268 | $file = $autoPath; |
| 2269 | 2269 | } |
@@ -2328,9 +2328,9 @@ discard block |
||
| 2328 | 2328 | ksort($files); |
| 2329 | 2329 | $files = array_values($files); |
| 2330 | 2330 | $filenames = array(); |
| 2331 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2331 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2332 | 2332 | { |
| 2333 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2333 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2334 | 2334 | { |
| 2335 | 2335 | unset($files[$i]); |
| 2336 | 2336 | } |
@@ -2415,14 +2415,14 @@ discard block |
||
| 2415 | 2415 | */ |
| 2416 | 2416 | function getJavascriptPluginInfo($pluginName) |
| 2417 | 2417 | { |
| 2418 | - if($plugin_name == 'ui.datepicker') |
|
| 2418 | + if ($plugin_name == 'ui.datepicker') |
|
| 2419 | 2419 | { |
| 2420 | 2420 | $plugin_name = 'ui'; |
| 2421 | 2421 | } |
| 2422 | 2422 | |
| 2423 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2424 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2425 | - if(!is_readable($info_file)) |
|
| 2423 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2424 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2425 | + if (!is_readable($info_file)) |
|
| 2426 | 2426 | { |
| 2427 | 2427 | return; |
| 2428 | 2428 | } |
@@ -2432,32 +2432,32 @@ discard block |
||
| 2432 | 2432 | $result->jsList = array(); |
| 2433 | 2433 | $result->cssList = array(); |
| 2434 | 2434 | |
| 2435 | - foreach($list as $filename) |
|
| 2435 | + foreach ($list as $filename) |
|
| 2436 | 2436 | { |
| 2437 | 2437 | $filename = trim($filename); |
| 2438 | - if(!$filename) |
|
| 2438 | + if (!$filename) |
|
| 2439 | 2439 | { |
| 2440 | 2440 | continue; |
| 2441 | 2441 | } |
| 2442 | 2442 | |
| 2443 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2443 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2444 | 2444 | { |
| 2445 | 2445 | $filename = substr($filename, 2); |
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2448 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2449 | 2449 | { |
| 2450 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2450 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2451 | 2451 | } |
| 2452 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2452 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2453 | 2453 | { |
| 2454 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2454 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2455 | 2455 | } |
| 2456 | 2456 | } |
| 2457 | 2457 | |
| 2458 | - if(is_dir($plugin_path . 'lang')) |
|
| 2458 | + if (is_dir($plugin_path.'lang')) |
|
| 2459 | 2459 | { |
| 2460 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2460 | + $result->langPath = $plugin_path.'lang'; |
|
| 2461 | 2461 | } |
| 2462 | 2462 | |
| 2463 | 2463 | return $result; |
@@ -2473,50 +2473,50 @@ discard block |
||
| 2473 | 2473 | static $loaded_plugins = array(); |
| 2474 | 2474 | |
| 2475 | 2475 | $self = self::getInstance(); |
| 2476 | - if($plugin_name == 'ui.datepicker') |
|
| 2476 | + if ($plugin_name == 'ui.datepicker') |
|
| 2477 | 2477 | { |
| 2478 | 2478 | $plugin_name = 'ui'; |
| 2479 | 2479 | } |
| 2480 | 2480 | |
| 2481 | - if($loaded_plugins[$plugin_name]) |
|
| 2481 | + if ($loaded_plugins[$plugin_name]) |
|
| 2482 | 2482 | { |
| 2483 | 2483 | return; |
| 2484 | 2484 | } |
| 2485 | 2485 | $loaded_plugins[$plugin_name] = TRUE; |
| 2486 | 2486 | |
| 2487 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2488 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2489 | - if(!is_readable($info_file)) |
|
| 2487 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2488 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2489 | + if (!is_readable($info_file)) |
|
| 2490 | 2490 | { |
| 2491 | 2491 | return; |
| 2492 | 2492 | } |
| 2493 | 2493 | |
| 2494 | 2494 | $list = file($info_file); |
| 2495 | - foreach($list as $filename) |
|
| 2495 | + foreach ($list as $filename) |
|
| 2496 | 2496 | { |
| 2497 | 2497 | $filename = trim($filename); |
| 2498 | - if(!$filename) |
|
| 2498 | + if (!$filename) |
|
| 2499 | 2499 | { |
| 2500 | 2500 | continue; |
| 2501 | 2501 | } |
| 2502 | 2502 | |
| 2503 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2503 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2504 | 2504 | { |
| 2505 | 2505 | $filename = substr($filename, 2); |
| 2506 | 2506 | } |
| 2507 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2507 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2508 | 2508 | { |
| 2509 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2509 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2510 | 2510 | } |
| 2511 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2511 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2512 | 2512 | { |
| 2513 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2513 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2514 | 2514 | } |
| 2515 | 2515 | } |
| 2516 | 2516 | |
| 2517 | - if(is_dir($plugin_path . 'lang')) |
|
| 2517 | + if (is_dir($plugin_path.'lang')) |
|
| 2518 | 2518 | { |
| 2519 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2519 | + $self->loadLang($plugin_path.'lang'); |
|
| 2520 | 2520 | } |
| 2521 | 2521 | } |
| 2522 | 2522 | |
@@ -2529,7 +2529,7 @@ discard block |
||
| 2529 | 2529 | function addHtmlHeader($header) |
| 2530 | 2530 | { |
| 2531 | 2531 | $self = self::getInstance(); |
| 2532 | - $self->html_header .= "\n" . $header; |
|
| 2532 | + $self->html_header .= "\n".$header; |
|
| 2533 | 2533 | } |
| 2534 | 2534 | |
| 2535 | 2535 | function clearHtmlHeader() |
@@ -2581,7 +2581,7 @@ discard block |
||
| 2581 | 2581 | function addBodyHeader($header) |
| 2582 | 2582 | { |
| 2583 | 2583 | $self = self::getInstance(); |
| 2584 | - $self->body_header .= "\n" . $header; |
|
| 2584 | + $self->body_header .= "\n".$header; |
|
| 2585 | 2585 | } |
| 2586 | 2586 | |
| 2587 | 2587 | /** |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | function addHtmlFooter($footer) |
| 2604 | 2604 | { |
| 2605 | 2605 | $self = self::getInstance(); |
| 2606 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2606 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | 2609 | /** |
@@ -2624,7 +2624,7 @@ discard block |
||
| 2624 | 2624 | */ |
| 2625 | 2625 | function getConfigFile() |
| 2626 | 2626 | { |
| 2627 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2627 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2628 | 2628 | } |
| 2629 | 2629 | |
| 2630 | 2630 | /** |
@@ -2634,7 +2634,7 @@ discard block |
||
| 2634 | 2634 | */ |
| 2635 | 2635 | function getFTPConfigFile() |
| 2636 | 2636 | { |
| 2637 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2637 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2638 | 2638 | } |
| 2639 | 2639 | |
| 2640 | 2640 | /** |
@@ -2686,14 +2686,14 @@ discard block |
||
| 2686 | 2686 | $_path = explode('/', $path); |
| 2687 | 2687 | $_base = explode('/', $base_url); |
| 2688 | 2688 | |
| 2689 | - if(!$_base[count($_base) - 1]) |
|
| 2689 | + if (!$_base[count($_base) - 1]) |
|
| 2690 | 2690 | { |
| 2691 | 2691 | array_pop($_base); |
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | - foreach($_xe as $idx => $dir) |
|
| 2694 | + foreach ($_xe as $idx => $dir) |
|
| 2695 | 2695 | { |
| 2696 | - if($_path[0] != $dir) |
|
| 2696 | + if ($_path[0] != $dir) |
|
| 2697 | 2697 | { |
| 2698 | 2698 | break; |
| 2699 | 2699 | } |
@@ -2701,9 +2701,9 @@ discard block |
||
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | 2703 | $idx = count($_xe) - $idx - 1; |
| 2704 | - while($idx--) |
|
| 2704 | + while ($idx--) |
|
| 2705 | 2705 | { |
| 2706 | - if(count($_base) > 0) |
|
| 2706 | + if (count($_base) > 0) |
|
| 2707 | 2707 | { |
| 2708 | 2708 | array_shift($_base); |
| 2709 | 2709 | } |
@@ -2713,13 +2713,13 @@ discard block |
||
| 2713 | 2713 | } |
| 2714 | 2714 | } |
| 2715 | 2715 | |
| 2716 | - if(count($_base) > 0) |
|
| 2716 | + if (count($_base) > 0) |
|
| 2717 | 2717 | { |
| 2718 | 2718 | array_unshift($_path, join('/', $_base)); |
| 2719 | 2719 | } |
| 2720 | 2720 | |
| 2721 | - $path = '/' . join('/', $_path); |
|
| 2722 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2721 | + $path = '/'.join('/', $_path); |
|
| 2722 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2723 | 2723 | { |
| 2724 | 2724 | $path .= '/'; |
| 2725 | 2725 | } |
@@ -2734,13 +2734,13 @@ discard block |
||
| 2734 | 2734 | { |
| 2735 | 2735 | $self = self::getInstance(); |
| 2736 | 2736 | |
| 2737 | - if(!is_array($self->meta_tags)) |
|
| 2737 | + if (!is_array($self->meta_tags)) |
|
| 2738 | 2738 | { |
| 2739 | 2739 | $self->meta_tags = array(); |
| 2740 | 2740 | } |
| 2741 | 2741 | |
| 2742 | 2742 | $ret = array(); |
| 2743 | - foreach($self->meta_tags as $key => $val) |
|
| 2743 | + foreach ($self->meta_tags as $key => $val) |
|
| 2744 | 2744 | { |
| 2745 | 2745 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2746 | 2746 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2760,7 +2760,7 @@ discard block |
||
| 2760 | 2760 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2761 | 2761 | { |
| 2762 | 2762 | $self = self::getInstance(); |
| 2763 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2763 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2764 | 2764 | } |
| 2765 | 2765 | |
| 2766 | 2766 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $this->loadDBInfo(); |
| 231 | 231 | if($this->db_info->use_sitelock == 'Y') |
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
| 234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 235 | + } |
|
| 234 | 236 | |
| 235 | 237 | if(!IpFilter::filter($whitelist)) |
| 236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
| 245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 246 | 248 | { |
| 247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 248 | - } |
|
| 249 | - else |
|
| 250 | + } else |
|
| 250 | 251 | { |
| 251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
| 303 | 304 | { |
| 304 | 305 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 305 | 306 | } |
| 306 | - } |
|
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + } elseif($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
@@ -342,7 +342,9 @@ discard block |
||
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | + if($sess = $_POST[session_name()]) { |
|
| 346 | + session_id($sess); |
|
| 347 | + } |
|
| 346 | 348 | session_start(); |
| 347 | 349 | |
| 348 | 350 | // set authentication information in Context and session |
@@ -395,22 +397,21 @@ discard block |
||
| 395 | 397 | { |
| 396 | 398 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 397 | 399 | } |
| 398 | - } |
|
| 399 | - elseif($val) |
|
| 400 | + } elseif($val) |
|
| 400 | 401 | { |
| 401 | 402 | $url[] = $key . '=' . urlencode($val); |
| 402 | 403 | } |
| 403 | 404 | } |
| 404 | 405 | |
| 405 | 406 | $current_url = self::getRequestUri(); |
| 406 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 407 | - } |
|
| 408 | - else |
|
| 407 | + if($url) { |
|
| 408 | + $current_url .= '?' . join('&', $url); |
|
| 409 | + } |
|
| 410 | + } else |
|
| 409 | 411 | { |
| 410 | 412 | $current_url = $this->getUrl(); |
| 411 | 413 | } |
| 412 | - } |
|
| 413 | - else |
|
| 414 | + } else |
|
| 414 | 415 | { |
| 415 | 416 | $current_url = self::getRequestUri(); |
| 416 | 417 | } |
@@ -502,18 +503,22 @@ discard block |
||
| 502 | 503 | $db_info->use_prepared_statements = 'Y'; |
| 503 | 504 | } |
| 504 | 505 | |
| 505 | - if(!$db_info->time_zone) |
|
| 506 | - $db_info->time_zone = date('O'); |
|
| 506 | + if(!$db_info->time_zone) { |
|
| 507 | + $db_info->time_zone = date('O'); |
|
| 508 | + } |
|
| 507 | 509 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 508 | 510 | |
| 509 | - if($db_info->qmail_compatibility != 'Y') |
|
| 510 | - $db_info->qmail_compatibility = 'N'; |
|
| 511 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 512 | + $db_info->qmail_compatibility = 'N'; |
|
| 513 | + } |
|
| 511 | 514 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 512 | 515 | |
| 513 | - if(!$db_info->use_db_session) |
|
| 514 | - $db_info->use_db_session = 'N'; |
|
| 515 | - if(!$db_info->use_ssl) |
|
| 516 | - $db_info->use_ssl = 'none'; |
|
| 516 | + if(!$db_info->use_db_session) { |
|
| 517 | + $db_info->use_db_session = 'N'; |
|
| 518 | + } |
|
| 519 | + if(!$db_info->use_ssl) { |
|
| 520 | + $db_info->use_ssl = 'none'; |
|
| 521 | + } |
|
| 517 | 522 | $this->set('_use_ssl', $db_info->use_ssl); |
| 518 | 523 | |
| 519 | 524 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -630,8 +635,7 @@ discard block |
||
| 630 | 635 | $buff = FileHandler::readFile($orig_lang_file); |
| 631 | 636 | FileHandler::writeFile($selected_lang_file, $buff); |
| 632 | 637 | $lang_selected = self::loadLangSupported(); |
| 633 | - } |
|
| 634 | - else |
|
| 638 | + } else |
|
| 635 | 639 | { |
| 636 | 640 | $langs = file($selected_lang_file); |
| 637 | 641 | foreach($langs as $val) |
@@ -690,15 +694,16 @@ discard block |
||
| 690 | 694 | |
| 691 | 695 | $oModuleModel = getModel('module'); |
| 692 | 696 | $domain = $url_info['host'] . $url_info['path']; |
| 693 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 697 | + if(substr_compare($domain, '/', -1) === 0) { |
|
| 698 | + $domain = substr($domain, 0, -1); |
|
| 699 | + } |
|
| 694 | 700 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 695 | 701 | |
| 696 | 702 | if($site_info->site_srl) |
| 697 | 703 | { |
| 698 | 704 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
| 699 | 705 | $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
| 700 | - } |
|
| 701 | - else |
|
| 706 | + } else |
|
| 702 | 707 | { |
| 703 | 708 | $redirect_url = $url; |
| 704 | 709 | } |
@@ -707,8 +712,7 @@ discard block |
||
| 707 | 712 | return FALSE; |
| 708 | 713 | } |
| 709 | 714 | // for sites requesting SSO validation |
| 710 | - } |
|
| 711 | - else |
|
| 715 | + } else |
|
| 712 | 716 | { |
| 713 | 717 | // result handling : set session_name() |
| 714 | 718 | if($session_name = self::get('SSOID')) |
@@ -725,8 +729,7 @@ discard block |
||
| 725 | 729 | header('location:' . $url); |
| 726 | 730 | return FALSE; |
| 727 | 731 | // send SSO request |
| 728 | - } |
|
| 729 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 732 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 730 | 733 | { |
| 731 | 734 | setcookie('sso', md5(self::getRequestUri())); |
| 732 | 735 | $origin_url = self::getRequestUrl(); |
@@ -786,8 +789,7 @@ discard block |
||
| 786 | 789 | if($self->site_title) |
| 787 | 790 | { |
| 788 | 791 | $self->site_title .= ' - ' . $site_title; |
| 789 | - } |
|
| 790 | - else |
|
| 792 | + } else |
|
| 791 | 793 | { |
| 792 | 794 | $self->site_title = $site_title; |
| 793 | 795 | } |
@@ -887,8 +889,7 @@ discard block |
||
| 887 | 889 | { |
| 888 | 890 | $self->loaded_lang_files[] = $filename; |
| 889 | 891 | include($filename); |
| 890 | - } |
|
| 891 | - else |
|
| 892 | + } else |
|
| 892 | 893 | { |
| 893 | 894 | $self->_evalxmlLang($path); |
| 894 | 895 | } |
@@ -904,7 +905,9 @@ discard block |
||
| 904 | 905 | { |
| 905 | 906 | global $lang; |
| 906 | 907 | |
| 907 | - if(!$path) return; |
|
| 908 | + if(!$path) { |
|
| 909 | + return; |
|
| 910 | + } |
|
| 908 | 911 | |
| 909 | 912 | $_path = 'eval://' . $path; |
| 910 | 913 | |
@@ -936,7 +939,9 @@ discard block |
||
| 936 | 939 | */ |
| 937 | 940 | function _loadXmlLang($path) |
| 938 | 941 | { |
| 939 | - if(!$path) return; |
|
| 942 | + if(!$path) { |
|
| 943 | + return; |
|
| 944 | + } |
|
| 940 | 945 | |
| 941 | 946 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 942 | 947 | return $oXmlLangParser->compile(); |
@@ -950,7 +955,9 @@ discard block |
||
| 950 | 955 | */ |
| 951 | 956 | function _loadPhpLang($path) |
| 952 | 957 | { |
| 953 | - if(!$path) return; |
|
| 958 | + if(!$path) { |
|
| 959 | + return; |
|
| 960 | + } |
|
| 954 | 961 | |
| 955 | 962 | if(substr_compare($path, '/', -1) !== 0) |
| 956 | 963 | { |
@@ -1083,12 +1090,14 @@ discard block |
||
| 1083 | 1090 | static $flag = TRUE; |
| 1084 | 1091 | if($charset) |
| 1085 | 1092 | { |
| 1086 | - if(is_array($val)) |
|
| 1087 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1088 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1089 | - else $flag = FALSE; |
|
| 1090 | - } |
|
| 1091 | - else |
|
| 1093 | + if(is_array($val)) { |
|
| 1094 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1095 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1096 | + $flag = FALSE; |
|
| 1097 | + } else { |
|
| 1098 | + $flag = FALSE; |
|
| 1099 | + } |
|
| 1100 | + } else |
|
| 1092 | 1101 | { |
| 1093 | 1102 | $return = $flag; |
| 1094 | 1103 | $flag = TRUE; |
@@ -1110,8 +1119,9 @@ discard block |
||
| 1110 | 1119 | if (is_array($val)) |
| 1111 | 1120 | { |
| 1112 | 1121 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1122 | + } else { |
|
| 1123 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1113 | 1124 | } |
| 1114 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1115 | 1125 | } |
| 1116 | 1126 | |
| 1117 | 1127 | /** |
@@ -1122,7 +1132,9 @@ discard block |
||
| 1122 | 1132 | */ |
| 1123 | 1133 | function convertEncodingStr($str) |
| 1124 | 1134 | { |
| 1125 | - if(!$str) return null; |
|
| 1135 | + if(!$str) { |
|
| 1136 | + return null; |
|
| 1137 | + } |
|
| 1126 | 1138 | $obj = new stdClass(); |
| 1127 | 1139 | $obj->str = $str; |
| 1128 | 1140 | $obj = self::convertEncoding($obj); |
@@ -1235,16 +1247,13 @@ discard block |
||
| 1235 | 1247 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1236 | 1248 | { |
| 1237 | 1249 | $set_to_vars = TRUE; |
| 1238 | - } |
|
| 1239 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1250 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1240 | 1251 | { |
| 1241 | 1252 | $set_to_vars = TRUE; |
| 1242 | - } |
|
| 1243 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1253 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1244 | 1254 | { |
| 1245 | 1255 | $set_to_vars = TRUE; |
| 1246 | - } |
|
| 1247 | - else |
|
| 1256 | + } else |
|
| 1248 | 1257 | { |
| 1249 | 1258 | $set_to_vars = FALSE; |
| 1250 | 1259 | } |
@@ -1270,8 +1279,7 @@ discard block |
||
| 1270 | 1279 | return; |
| 1271 | 1280 | } |
| 1272 | 1281 | } |
| 1273 | - } |
|
| 1274 | - else if(is_array($val)) |
|
| 1282 | + } else if(is_array($val)) |
|
| 1275 | 1283 | { |
| 1276 | 1284 | foreach($val as $val2) |
| 1277 | 1285 | { |
@@ -1421,19 +1429,15 @@ discard block |
||
| 1421 | 1429 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1422 | 1430 | { |
| 1423 | 1431 | $result[$k] = !preg_match('/^[0-9,]+$/', $result[$k]) ? (int) $result[$k] : $result[$k]; |
| 1424 | - } |
|
| 1425 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1432 | + } elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1426 | 1433 | $result[$k] = escape($result[$k], false); |
| 1427 | - } |
|
| 1428 | - elseif($key === 'vid') |
|
| 1434 | + } elseif($key === 'vid') |
|
| 1429 | 1435 | { |
| 1430 | 1436 | $result[$k] = urlencode($result[$k]); |
| 1431 | - } |
|
| 1432 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1437 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1433 | 1438 | { |
| 1434 | 1439 | unset($result[$k]); |
| 1435 | - } |
|
| 1436 | - else |
|
| 1440 | + } else |
|
| 1437 | 1441 | { |
| 1438 | 1442 | if(in_array($k, array( |
| 1439 | 1443 | 'act', |
@@ -1461,8 +1465,7 @@ discard block |
||
| 1461 | 1465 | if (is_array($result[$k])) |
| 1462 | 1466 | { |
| 1463 | 1467 | array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); |
| 1464 | - } |
|
| 1465 | - else |
|
| 1468 | + } else |
|
| 1466 | 1469 | { |
| 1467 | 1470 | $result[$k] = stripslashes($result[$k]); |
| 1468 | 1471 | } |
@@ -1471,8 +1474,7 @@ discard block |
||
| 1471 | 1474 | if(is_array($result[$k])) |
| 1472 | 1475 | { |
| 1473 | 1476 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1474 | - } |
|
| 1475 | - else |
|
| 1477 | + } else |
|
| 1476 | 1478 | { |
| 1477 | 1479 | $result[$k] = trim($result[$k]); |
| 1478 | 1480 | } |
@@ -1524,8 +1526,7 @@ discard block |
||
| 1524 | 1526 | $val['name'] = escape($val['name'], FALSE); |
| 1525 | 1527 | $this->set($key, $val, TRUE); |
| 1526 | 1528 | $this->is_uploaded = TRUE; |
| 1527 | - } |
|
| 1528 | - else |
|
| 1529 | + } else |
|
| 1529 | 1530 | { |
| 1530 | 1531 | $files = array(); |
| 1531 | 1532 | foreach ($tmp_name as $i => $j) |
@@ -1639,8 +1640,7 @@ discard block |
||
| 1639 | 1640 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1640 | 1641 | { |
| 1641 | 1642 | $vid = $site_module_info->domain; |
| 1642 | - } |
|
| 1643 | - else |
|
| 1643 | + } else |
|
| 1644 | 1644 | { |
| 1645 | 1645 | $domain = $site_module_info->domain; |
| 1646 | 1646 | } |
@@ -1657,8 +1657,7 @@ discard block |
||
| 1657 | 1657 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1658 | 1658 | { |
| 1659 | 1659 | unset($domain); |
| 1660 | - } |
|
| 1661 | - else |
|
| 1660 | + } else |
|
| 1662 | 1661 | { |
| 1663 | 1662 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1664 | 1663 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1678,23 +1677,35 @@ discard block |
||
| 1678 | 1677 | { |
| 1679 | 1678 | array_shift($args_list); |
| 1680 | 1679 | } |
| 1681 | - } |
|
| 1682 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1680 | + } elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1683 | 1681 | { |
| 1684 | 1682 | // Otherwise, make GET variables into array |
| 1685 | 1683 | $get_vars = get_object_vars($self->get_vars); |
| 1686 | - } |
|
| 1687 | - else |
|
| 1684 | + } else |
|
| 1688 | 1685 | { |
| 1689 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1690 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1691 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1692 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1693 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1694 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1686 | + if(!!$self->get_vars->module) { |
|
| 1687 | + $get_vars['module'] = $self->get_vars->module; |
|
| 1688 | + } |
|
| 1689 | + if(!!$self->get_vars->mid) { |
|
| 1690 | + $get_vars['mid'] = $self->get_vars->mid; |
|
| 1691 | + } |
|
| 1692 | + if(!!$self->get_vars->act) { |
|
| 1693 | + $get_vars['act'] = $self->get_vars->act; |
|
| 1694 | + } |
|
| 1695 | + if(!!$self->get_vars->page) { |
|
| 1696 | + $get_vars['page'] = $self->get_vars->page; |
|
| 1697 | + } |
|
| 1698 | + if(!!$self->get_vars->search_target) { |
|
| 1699 | + $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1700 | + } |
|
| 1701 | + if(!!$self->get_vars->search_keyword) { |
|
| 1702 | + $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1703 | + } |
|
| 1695 | 1704 | if($get_vars['act'] == 'IS') |
| 1696 | 1705 | { |
| 1697 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1706 | + if(!!$self->get_vars->is_keyword) { |
|
| 1707 | + $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1708 | + } |
|
| 1698 | 1709 | } |
| 1699 | 1710 | } |
| 1700 | 1711 | |
@@ -1719,8 +1730,7 @@ discard block |
||
| 1719 | 1730 | if($vid) |
| 1720 | 1731 | { |
| 1721 | 1732 | $get_vars['vid'] = $vid; |
| 1722 | - } |
|
| 1723 | - else |
|
| 1733 | + } else |
|
| 1724 | 1734 | { |
| 1725 | 1735 | unset($get_vars['vid']); |
| 1726 | 1736 | } |
@@ -1792,8 +1802,7 @@ discard block |
||
| 1792 | 1802 | { |
| 1793 | 1803 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1794 | 1804 | } |
| 1795 | - } |
|
| 1796 | - elseif(!is_array($val)) |
|
| 1805 | + } elseif(!is_array($val)) |
|
| 1797 | 1806 | { |
| 1798 | 1807 | $queries[] = $key . '=' . urlencode($val); |
| 1799 | 1808 | } |
@@ -1811,25 +1820,23 @@ discard block |
||
| 1811 | 1820 | { |
| 1812 | 1821 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1813 | 1822 | // optional SSL use |
| 1814 | - } |
|
| 1815 | - elseif($_use_ssl == 'optional') |
|
| 1823 | + } elseif($_use_ssl == 'optional') |
|
| 1816 | 1824 | { |
| 1817 | 1825 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1818 | 1826 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1819 | 1827 | // no SSL |
| 1820 | - } |
|
| 1821 | - else |
|
| 1828 | + } else |
|
| 1822 | 1829 | { |
| 1823 | 1830 | // currently on SSL but target is not based on SSL |
| 1824 | 1831 | if($_SERVER['HTTPS'] == 'on') |
| 1825 | 1832 | { |
| 1826 | 1833 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1827 | - } |
|
| 1828 | - else if($domain) // if $domain is set |
|
| 1834 | + } else if($domain) { |
|
| 1835 | + // if $domain is set |
|
| 1829 | 1836 | { |
| 1830 | 1837 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1831 | 1838 | } |
| 1832 | - else |
|
| 1839 | + } else |
|
| 1833 | 1840 | { |
| 1834 | 1841 | $query = getScriptPath() . $query; |
| 1835 | 1842 | } |
@@ -1886,8 +1893,7 @@ discard block |
||
| 1886 | 1893 | if($domain) |
| 1887 | 1894 | { |
| 1888 | 1895 | $domain_key = md5($domain); |
| 1889 | - } |
|
| 1890 | - else |
|
| 1896 | + } else |
|
| 1891 | 1897 | { |
| 1892 | 1898 | $domain_key = 'default'; |
| 1893 | 1899 | } |
@@ -1916,8 +1922,7 @@ discard block |
||
| 1916 | 1922 | { |
| 1917 | 1923 | $target_url.= '/'; |
| 1918 | 1924 | } |
| 1919 | - } |
|
| 1920 | - else |
|
| 1925 | + } else |
|
| 1921 | 1926 | { |
| 1922 | 1927 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1923 | 1928 | } |
@@ -1935,20 +1940,17 @@ discard block |
||
| 1935 | 1940 | if($port && $port != 443) |
| 1936 | 1941 | { |
| 1937 | 1942 | $url_info['port'] = $port; |
| 1938 | - } |
|
| 1939 | - elseif($url_info['port'] == 443) |
|
| 1943 | + } elseif($url_info['port'] == 443) |
|
| 1940 | 1944 | { |
| 1941 | 1945 | unset($url_info['port']); |
| 1942 | 1946 | } |
| 1943 | - } |
|
| 1944 | - else |
|
| 1947 | + } else |
|
| 1945 | 1948 | { |
| 1946 | 1949 | $port = self::get('_http_port'); |
| 1947 | 1950 | if($port && $port != 80) |
| 1948 | 1951 | { |
| 1949 | 1952 | $url_info['port'] = $port; |
| 1950 | - } |
|
| 1951 | - elseif($url_info['port'] == 80) |
|
| 1953 | + } elseif($url_info['port'] == 80) |
|
| 1952 | 1954 | { |
| 1953 | 1955 | unset($url_info['port']); |
| 1954 | 1956 | } |
@@ -2185,8 +2187,7 @@ discard block |
||
| 2185 | 2187 | if(strpos($file, './') === 0) |
| 2186 | 2188 | { |
| 2187 | 2189 | $file = $script_path . substr($file, 2); |
| 2188 | - } |
|
| 2189 | - elseif(strpos($file, '../') === 0) |
|
| 2190 | + } elseif(strpos($file, '../') === 0) |
|
| 2190 | 2191 | { |
| 2191 | 2192 | $file = self::normalizeFilePath($script_path . $file); |
| 2192 | 2193 | } |
@@ -2448,8 +2449,7 @@ discard block |
||
| 2448 | 2449 | if(substr_compare($filename, '.js', -3) === 0) |
| 2449 | 2450 | { |
| 2450 | 2451 | $result->jsList[] = $plugin_path . $filename; |
| 2451 | - } |
|
| 2452 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2452 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2453 | 2453 | { |
| 2454 | 2454 | $result->cssList[] = $plugin_path . $filename; |
| 2455 | 2455 | } |
@@ -2706,8 +2706,7 @@ discard block |
||
| 2706 | 2706 | if(count($_base) > 0) |
| 2707 | 2707 | { |
| 2708 | 2708 | array_shift($_base); |
| 2709 | - } |
|
| 2710 | - else |
|
| 2709 | + } else |
|
| 2711 | 2710 | { |
| 2712 | 2711 | array_unshift($_base, '..'); |
| 2713 | 2712 | } |