| @@ -275,6 +275,9 @@ | ||
| 275 | 275 | exit(); | 
| 276 | 276 | } | 
| 277 | 277 | |
| 278 | + /** | |
| 279 | + * @param string $string | |
| 280 | + */ | |
| 278 | 281 | function createCaptchaAudio($string) | 
| 279 | 282 |  		{ | 
| 280 | 283 | $data = ''; | 
| @@ -1,7 +1,9 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ | 
| 3 | 3 | |
| 4 | -if(!defined("__XE__")) exit(); | |
| 4 | +if(!defined("__XE__")) { | |
| 5 | + exit(); | |
| 6 | +} | |
| 5 | 7 | |
| 6 | 8 | /** | 
| 7 | 9 | * @file captcha.addon.php | 
| @@ -74,8 +76,7 @@ discard block | ||
| 74 | 76 |  						$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); | 
| 75 | 77 | $ModuleHandler->_setInputValueToSession(); | 
| 76 | 78 | } | 
| 77 | - } | |
| 78 | - else | |
| 79 | + } else | |
| 79 | 80 |  				{ | 
| 80 | 81 |  					Context::addHtmlHeader('<script> | 
| 81 | 82 |  						if(!captchaTargetAct) {var captchaTargetAct = [];} | 
| @@ -205,8 +206,7 @@ discard block | ||
| 205 | 206 | |
| 206 | 207 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); | 
| 207 | 208 | imagecolortransparent($im[$i + 1], $background_color); | 
| 208 | - } | |
| 209 | - else | |
| 209 | + } else | |
| 210 | 210 |  				{ | 
| 211 | 211 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); | 
| 212 | 212 | } | 
| @@ -304,7 +304,9 @@ discard block | ||
| 304 | 304 | |
| 305 | 305 | function compareCaptcha() | 
| 306 | 306 |  		{ | 
| 307 | -			if(!in_array(Context::get('act'), $this->target_acts)) return true; | |
| 307 | +			if(!in_array(Context::get('act'), $this->target_acts)) { | |
| 308 | + return true; | |
| 309 | + } | |
| 308 | 310 | |
| 309 | 311 | if($_SESSION['captcha_authed']) | 
| 310 | 312 |  			{ | 
| @@ -1,7 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ | 
| 3 | 3 | |
| 4 | -if(!defined("__XE__")) exit(); | |
| 4 | +if (!defined("__XE__")) exit(); | |
| 5 | 5 | |
| 6 | 6 | /** | 
| 7 | 7 | * @file captcha.addon.php | 
| @@ -9,10 +9,10 @@ discard block | ||
| 9 | 9 | * @brief Captcha for a particular action | 
| 10 | 10 | * English alphabets and voice verification added | 
| 11 | 11 | * */ | 
| 12 | -if(!class_exists('AddonCaptcha', false)) | |
| 12 | +if (!class_exists('AddonCaptcha', false)) | |
| 13 | 13 |  { | 
| 14 | 14 | // On the mobile mode, XE Core does not load jquery and xe.js as normal. | 
| 15 | - if(Mobile::isFromMobilePhone()) | |
| 15 | + if (Mobile::isFromMobilePhone()) | |
| 16 | 16 |  	{ | 
| 17 | 17 |  		Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true); | 
| 18 | 18 |  		Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true); | 
| @@ -31,7 +31,7 @@ discard block | ||
| 31 | 31 | |
| 32 | 32 | function before_module_proc() | 
| 33 | 33 |  		{ | 
| 34 | - if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) | |
| 34 | + if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) | |
| 35 | 35 |  			{ | 
| 36 | 36 | unset($_SESSION['captcha_authed']); | 
| 37 | 37 | } | 
| @@ -40,19 +40,19 @@ discard block | ||
| 40 | 40 | function before_module_init(&$ModuleHandler) | 
| 41 | 41 |  		{ | 
| 42 | 42 |  			$logged_info = Context::get('logged_info'); | 
| 43 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) | |
| 43 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) | |
| 44 | 44 |  			{ | 
| 45 | 45 | return false; | 
| 46 | 46 | } | 
| 47 | -			if($this->addon_info->target != 'all' && Context::get('is_logged')) | |
| 47 | +			if ($this->addon_info->target != 'all' && Context::get('is_logged')) | |
| 48 | 48 |  			{ | 
| 49 | 49 | return false; | 
| 50 | 50 | } | 
| 51 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) | |
| 51 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) | |
| 52 | 52 |  			{ | 
| 53 | 53 | $_SESSION['captcha_authed'] = false; | 
| 54 | 54 | } | 
| 55 | - if($_SESSION['captcha_authed']) | |
| 55 | + if ($_SESSION['captcha_authed']) | |
| 56 | 56 |  			{ | 
| 57 | 57 | return false; | 
| 58 | 58 | } | 
| @@ -61,13 +61,13 @@ discard block | ||
| 61 | 61 | |
| 62 | 62 |  			$this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); | 
| 63 | 63 | |
| 64 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') | |
| 64 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') | |
| 65 | 65 |  			{ | 
| 66 | - if($type == 'inline') | |
| 66 | + if ($type == 'inline') | |
| 67 | 67 |  				{ | 
| 68 | - if(!$this->compareCaptcha()) | |
| 68 | + if (!$this->compareCaptcha()) | |
| 69 | 69 |  					{ | 
| 70 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); | |
| 70 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); | |
| 71 | 71 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; | 
| 72 | 72 |  						$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); | 
| 73 | 73 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; | 
| @@ -79,16 +79,16 @@ discard block | ||
| 79 | 79 |  				{ | 
| 80 | 80 |  					Context::addHtmlHeader('<script> | 
| 81 | 81 |  						if(!captchaTargetAct) {var captchaTargetAct = [];} | 
| 82 | -						captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); | |
| 82 | +						captchaTargetAct.push("' . implode('","', $this->target_acts).'"); | |
| 83 | 83 | </script>'); | 
| 84 | 84 |  					Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); | 
| 85 | 85 | } | 
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module | 
| 89 | -			if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) | |
| 89 | +			if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) | |
| 90 | 90 |  			{ | 
| 91 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); | |
| 91 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); | |
| 92 | 92 | $ModuleHandler->error = "captcha_denied"; | 
| 93 | 93 | } | 
| 94 | 94 | |
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | function createKeyword() | 
| 99 | 99 |  		{ | 
| 100 | 100 |  			$type = Context::get('captchaType'); | 
| 101 | - if($type == 'inline' && $_SESSION['captcha_keyword']) | |
| 101 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) | |
| 102 | 102 |  			{ | 
| 103 | 103 | return; | 
| 104 | 104 | } | 
| @@ -111,19 +111,19 @@ discard block | ||
| 111 | 111 | |
| 112 | 112 | function before_module_init_setCaptchaSession() | 
| 113 | 113 |  		{ | 
| 114 | - if($_SESSION['captcha_authed']) | |
| 114 | + if ($_SESSION['captcha_authed']) | |
| 115 | 115 |  			{ | 
| 116 | 116 | return false; | 
| 117 | 117 | } | 
| 118 | 118 | // Load language files | 
| 119 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); | |
| 119 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); | |
| 120 | 120 | // Generate keywords | 
| 121 | 121 | $this->createKeyword(); | 
| 122 | 122 | |
| 123 | 123 |  			$target = Context::getLang('target_captcha'); | 
| 124 | 124 |  			header("Content-Type: text/xml; charset=UTF-8"); | 
| 125 | 125 |  			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | 
| 126 | -			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
| 126 | +			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | |
| 127 | 127 |  			header("Cache-Control: no-store, no-cache, must-revalidate"); | 
| 128 | 128 |  			header("Cache-Control: post-check=0, pre-check=0", false); | 
| 129 | 129 |  			header("Pragma: no-cache"); | 
| @@ -140,11 +140,11 @@ discard block | ||
| 140 | 140 | |
| 141 | 141 | function before_module_init_captchaImage() | 
| 142 | 142 |  		{ | 
| 143 | - if($_SESSION['captcha_authed']) | |
| 143 | + if ($_SESSION['captcha_authed']) | |
| 144 | 144 |  			{ | 
| 145 | 145 | return false; | 
| 146 | 146 | } | 
| 147 | -			if(Context::get('renew')) | |
| 147 | +			if (Context::get('renew')) | |
| 148 | 148 |  			{ | 
| 149 | 149 | $this->createKeyword(); | 
| 150 | 150 | } | 
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | function createCaptchaImage($string) | 
| 167 | 167 |  		{ | 
| 168 | 168 | $arr = array(); | 
| 169 | - for($i = 0, $c = strlen($string); $i < $c; $i++) | |
| 169 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) | |
| 170 | 170 |  			{ | 
| 171 | 171 |  				$arr[] = $string{$i}; | 
| 172 | 172 | } | 
| @@ -188,7 +188,7 @@ discard block | ||
| 188 | 188 | shuffle($deg); | 
| 189 | 189 | |
| 190 | 190 | // Create an image for each letter | 
| 191 | - foreach($arr as $i => $str) | |
| 191 | + foreach ($arr as $i => $str) | |
| 192 | 192 |  			{ | 
| 193 | 193 | $im[$i + 1] = @imagecreate($w, $h); | 
| 194 | 194 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | $ran = range(1, 20); | 
| 199 | 199 | shuffle($ran); | 
| 200 | 200 | |
| 201 | -				if(function_exists('imagerotate')) | |
| 201 | +				if (function_exists('imagerotate')) | |
| 202 | 202 |  				{ | 
| 203 | 203 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); | 
| 204 | 204 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); | 
| @@ -213,7 +213,7 @@ discard block | ||
| 213 | 213 | } | 
| 214 | 214 | |
| 215 | 215 | // Combine images of each character | 
| 216 | - for($i = 1, $c = count($im); $i<$c; $i++) | |
| 216 | + for ($i = 1, $c = count($im); $i < $c; $i++) | |
| 217 | 217 |  			{ | 
| 218 | 218 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); | 
| 219 | 219 | imagedestroy($im[$i]); | 
| @@ -225,7 +225,7 @@ discard block | ||
| 225 | 225 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); | 
| 226 | 226 | imagedestroy($im[0]); | 
| 227 | 227 | |
| 228 | -			if(function_exists('imageantialias')) | |
| 228 | +			if (function_exists('imageantialias')) | |
| 229 | 229 |  			{ | 
| 230 | 230 | imageantialias($big, true); | 
| 231 | 231 | } | 
| @@ -237,7 +237,7 @@ discard block | ||
| 237 | 237 | $h = $h * $big_count; | 
| 238 | 238 | $d = array_pop($deg); | 
| 239 | 239 | |
| 240 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) | |
| 240 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) | |
| 241 | 241 |  			{ | 
| 242 | 242 | imageline($big, 0, $i + $d, $w, $i, $line_color); | 
| 243 | 243 | } | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 | $x = range(0, ($w - 10)); | 
| 246 | 246 | shuffle($x); | 
| 247 | 247 | |
| 248 | - for($i = 0; $i < 200; $i++) | |
| 248 | + for ($i = 0; $i < 200; $i++) | |
| 249 | 249 |  			{ | 
| 250 | 250 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); | 
| 251 | 251 | } | 
| @@ -255,7 +255,7 @@ discard block | ||
| 255 | 255 | |
| 256 | 256 | function before_module_init_captchaAudio() | 
| 257 | 257 |  		{ | 
| 258 | - if($_SESSION['captcha_authed']) | |
| 258 | + if ($_SESSION['captcha_authed']) | |
| 259 | 259 |  			{ | 
| 260 | 260 | return false; | 
| 261 | 261 | } | 
| @@ -267,8 +267,8 @@ discard block | ||
| 267 | 267 |  			header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); | 
| 268 | 268 |  			header('Cache-Control: no-store, no-cache, must-revalidate'); | 
| 269 | 269 |  			header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); | 
| 270 | -			header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); | |
| 271 | -			header('Content-Length: ' . strlen($data)); | |
| 270 | +			header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); | |
| 271 | +			header('Content-Length: '.strlen($data)); | |
| 272 | 272 | |
| 273 | 273 | echo $data; | 
| 274 | 274 | Context::close(); | 
| @@ -279,17 +279,17 @@ discard block | ||
| 279 | 279 |  		{ | 
| 280 | 280 | $data = ''; | 
| 281 | 281 | $_audio = './addons/captcha/audio/F_%s.mp3'; | 
| 282 | - for($i = 0, $c = strlen($string); $i < $c; $i++) | |
| 282 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) | |
| 283 | 283 |  			{ | 
| 284 | 284 |  				$_data = FileHandler::readFile(sprintf($_audio, $string{$i})); | 
| 285 | 285 | |
| 286 | 286 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data | 
| 287 | 287 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes | 
| 288 | 288 | |
| 289 | - for($j = $start; $j < $datalen; $j+=64) | |
| 289 | + for ($j = $start; $j < $datalen; $j += 64) | |
| 290 | 290 |  				{ | 
| 291 | 291 |  					$ch = ord($_data{$j}); | 
| 292 | - if($ch < 9 || $ch > 119) | |
| 292 | + if ($ch < 9 || $ch > 119) | |
| 293 | 293 |  					{ | 
| 294 | 294 | continue; | 
| 295 | 295 | } | 
| @@ -304,14 +304,14 @@ discard block | ||
| 304 | 304 | |
| 305 | 305 | function compareCaptcha() | 
| 306 | 306 |  		{ | 
| 307 | -			if(!in_array(Context::get('act'), $this->target_acts)) return true; | |
| 307 | +			if (!in_array(Context::get('act'), $this->target_acts)) return true; | |
| 308 | 308 | |
| 309 | - if($_SESSION['captcha_authed']) | |
| 309 | + if ($_SESSION['captcha_authed']) | |
| 310 | 310 |  			{ | 
| 311 | 311 | return true; | 
| 312 | 312 | } | 
| 313 | 313 | |
| 314 | -			if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) | |
| 314 | +			if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) | |
| 315 | 315 |  			{ | 
| 316 | 316 | $_SESSION['captcha_authed'] = true; | 
| 317 | 317 | return true; | 
| @@ -324,14 +324,14 @@ discard block | ||
| 324 | 324 | |
| 325 | 325 | function before_module_init_captchaCompare() | 
| 326 | 326 |  		{ | 
| 327 | - if(!$this->compareCaptcha()) | |
| 327 | + if (!$this->compareCaptcha()) | |
| 328 | 328 |  			{ | 
| 329 | 329 | return false; | 
| 330 | 330 | } | 
| 331 | 331 | |
| 332 | 332 |  			header("Content-Type: text/xml; charset=UTF-8"); | 
| 333 | 333 |  			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | 
| 334 | -			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
| 334 | +			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | |
| 335 | 335 |  			header("Cache-Control: no-store, no-cache, must-revalidate"); | 
| 336 | 336 |  			header("Cache-Control: post-check=0, pre-check=0", false); | 
| 337 | 337 |  			header("Pragma: no-cache"); | 
| @@ -346,7 +346,7 @@ discard block | ||
| 346 | 346 | unset($_SESSION['captcha_authed']); | 
| 347 | 347 | $this->createKeyword(); | 
| 348 | 348 | |
| 349 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; | |
| 349 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; | |
| 350 | 350 |  			Context::unloadFile('./addons/captcha/captcha.min.js'); | 
| 351 | 351 |  			Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); | 
| 352 | 352 | |
| @@ -384,18 +384,18 @@ discard block | ||
| 384 | 384 | |
| 385 | 385 | $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__']; | 
| 386 | 386 | |
| 387 | -if(method_exists($oAddonCaptcha, $called_position)) | |
| 387 | +if (method_exists($oAddonCaptcha, $called_position)) | |
| 388 | 388 |  { | 
| 389 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) | |
| 389 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) | |
| 390 | 390 |  	{ | 
| 391 | 391 | return false; | 
| 392 | 392 | } | 
| 393 | 393 | } | 
| 394 | 394 | |
| 395 | 395 |  $addon_act = Context::get('captcha_action'); | 
| 396 | -if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) | |
| 396 | +if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act)) | |
| 397 | 397 |  { | 
| 398 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) | |
| 398 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) | |
| 399 | 399 |  	{ | 
| 400 | 400 | return false; | 
| 401 | 401 | } | 
| @@ -279,6 +279,7 @@ discard block | ||
| 279 | 279 | |
| 280 | 280 | /** | 
| 281 | 281 | * @brief Specify title | 
| 282 | + * @param string $title | |
| 282 | 283 | */ | 
| 283 | 284 | function setTitle($title) | 
| 284 | 285 |  	{ | 
| @@ -298,6 +299,7 @@ discard block | ||
| 298 | 299 | /** | 
| 299 | 300 | * @brief Content Cleanup | 
| 300 | 301 | * In HTML content, the ability to extract text and links | 
| 302 | + * @param string $content | |
| 301 | 303 | */ | 
| 302 | 304 | function setContent($content) | 
| 303 | 305 |  	{ | 
| @@ -371,6 +373,9 @@ discard block | ||
| 371 | 373 | |
| 372 | 374 | /** | 
| 373 | 375 | * @brief cutting the number of byte functions | 
| 376 | + * @param string $string | |
| 377 | + * @param integer $cut_size | |
| 378 | + * @return string | |
| 374 | 379 | */ | 
| 375 | 380 | function cutStr($string, $cut_size) | 
| 376 | 381 |  	{ | 
| @@ -387,6 +392,8 @@ discard block | ||
| 387 | 392 | |
| 388 | 393 | /** | 
| 389 | 394 | * @brief Specifies the home url | 
| 395 | + * @param string $url | |
| 396 | + * @param string $text | |
| 390 | 397 | */ | 
| 391 | 398 | function setHomeUrl($url, $text) | 
| 392 | 399 |  	{ | 
| @@ -397,6 +404,8 @@ discard block | ||
| 397 | 404 | |
| 398 | 405 | /** | 
| 399 | 406 | * @brief Specify upper url | 
| 407 | + * @param string $url | |
| 408 | + * @param string $text | |
| 400 | 409 | */ | 
| 401 | 410 | function setUpperUrl($url, $text) | 
| 402 | 411 |  	{ | 
| @@ -407,6 +416,8 @@ discard block | ||
| 407 | 416 | |
| 408 | 417 | /** | 
| 409 | 418 | * @brief Specify prev url | 
| 419 | + * @param string $url | |
| 420 | + * @param string $text | |
| 410 | 421 | */ | 
| 411 | 422 | function setPrevUrl($url, $text) | 
| 412 | 423 |  	{ | 
| @@ -417,6 +428,8 @@ discard block | ||
| 417 | 428 | |
| 418 | 429 | /** | 
| 419 | 430 | * @brief Specify next url | 
| 431 | + * @param string $url | |
| 432 | + * @param string $text | |
| 420 | 433 | */ | 
| 421 | 434 | function setNextUrl($url, $text) | 
| 422 | 435 |  	{ | 
| @@ -49,7 +49,9 @@ discard block | ||
| 49 | 49 |  		{ | 
| 50 | 50 | |
| 51 | 51 | $browserType = mobileXE::getBrowserType(); | 
| 52 | - if(!$browserType) return; | |
| 52 | +			if(!$browserType) { | |
| 53 | + return; | |
| 54 | + } | |
| 53 | 55 | |
| 54 | 56 |  			$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); | 
| 55 | 57 | require_once($class_file); | 
| @@ -59,14 +61,18 @@ discard block | ||
| 59 | 61 |  			{ | 
| 60 | 62 |  				$lang_supported = Context::get('lang_supported'); | 
| 61 | 63 |  				$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); | 
| 62 | - if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang); | |
| 64 | +				if(isset($lang_supported[$this->lang])) { | |
| 65 | + Context::setLangType($this->lang); | |
| 66 | + } | |
| 63 | 67 | } | 
| 64 | 68 | Context::loadLang(_XE_PATH_.'addons/mobile/lang'); | 
| 65 | 69 | |
| 66 | 70 | $instance = new wap(); | 
| 67 | 71 | |
| 68 | 72 |  			$mobilePage = (int)Context::get('mpage'); | 
| 69 | - if(!$mobilePage) $mobilePage = 1; | |
| 73 | +			if(!$mobilePage) { | |
| 74 | + $mobilePage = 1; | |
| 75 | + } | |
| 70 | 76 | |
| 71 | 77 | $instance->setMobilePage($mobilePage); | 
| 72 | 78 | } | 
| @@ -107,8 +113,11 @@ discard block | ||
| 107 | 113 | */ | 
| 108 | 114 | function isLangChange() | 
| 109 | 115 |  	{ | 
| 110 | - if($this->languageMode) return true; | |
| 111 | - else return false; | |
| 116 | +		if($this->languageMode) { | |
| 117 | + return true; | |
| 118 | +		} else { | |
| 119 | + return false; | |
| 120 | + } | |
| 112 | 121 | } | 
| 113 | 122 | |
| 114 | 123 | /** | 
| @@ -122,7 +131,9 @@ discard block | ||
| 122 | 131 | if($this->lang && isset($lang_supported[$this->lang])) | 
| 123 | 132 |  		{ | 
| 124 | 133 |  			$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | 
| 125 | -			if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | |
| 134 | +			if($langbuff) { | |
| 135 | +				FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | |
| 136 | + } | |
| 126 | 137 | $langbuff = '<?php /**'.$this->lang.'**/ ?>'; | 
| 127 | 138 |  			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff); | 
| 128 | 139 | } | 
| @@ -133,7 +144,9 @@ discard block | ||
| 133 | 144 | */ | 
| 134 | 145 | function setModuleInfo(&$module_info) | 
| 135 | 146 |  	{ | 
| 136 | - if($this->module_info) return; | |
| 147 | +		if($this->module_info) { | |
| 148 | + return; | |
| 149 | + } | |
| 137 | 150 | $this->module_info = $module_info; | 
| 138 | 151 | } | 
| 139 | 152 | |
| @@ -142,12 +155,16 @@ discard block | ||
| 142 | 155 | */ | 
| 143 | 156 | function setModuleInstance(&$oModule) | 
| 144 | 157 |  	{ | 
| 145 | - if($this->oModule) return; | |
| 158 | +		if($this->oModule) { | |
| 159 | + return; | |
| 160 | + } | |
| 146 | 161 | // Save instance | 
| 147 | 162 | $this->oModule = $oModule; | 
| 148 | 163 | // Of the current module if there is a menu by menu | 
| 149 | 164 | $menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl); | 
| 150 | - if(!file_exists($menu_cache_file)) return; | |
| 165 | +		if(!file_exists($menu_cache_file)) { | |
| 166 | + return; | |
| 167 | + } | |
| 151 | 168 | |
| 152 | 169 | include $menu_cache_file; | 
| 153 | 170 | // One-dimensional arrangement of menu changes | 
| @@ -168,10 +185,11 @@ discard block | ||
| 168 | 185 | if($parent_srl && $listed_items[$parent_srl]) | 
| 169 | 186 |  			{ | 
| 170 | 187 | $parent_item = $listed_items[$parent_srl]; | 
| 171 | -				if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); | |
| 188 | +				if($parent_item) { | |
| 189 | +					$this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); | |
| 190 | + } | |
| 172 | 191 | } | 
| 173 | - } | |
| 174 | - elseif (!$this->isNavigationMode()) | |
| 192 | + } elseif (!$this->isNavigationMode()) | |
| 175 | 193 |  		{ | 
| 176 | 194 |  			$this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap')); | 
| 177 | 195 | } | 
| @@ -183,7 +201,9 @@ discard block | ||
| 183 | 201 | */ | 
| 184 | 202 | function getBrowserType() | 
| 185 | 203 |  	{ | 
| 186 | -		if(Context::get('smartphone')) return null; | |
| 204 | +		if(Context::get('smartphone')) { | |
| 205 | + return null; | |
| 206 | + } | |
| 187 | 207 | // Determine the type of browser | 
| 188 | 208 | $browserAccept = $_SERVER['HTTP_ACCEPT']; | 
| 189 | 209 | $userAgent = $_SERVER['HTTP_USER_AGENT']; | 
| @@ -193,9 +213,11 @@ discard block | ||
| 193 | 213 |  		{ | 
| 194 | 214 |  			Context::set('mobile_skt',1); | 
| 195 | 215 | return "wml"; | 
| 216 | +		} elseif(stripos($browserAccept, "hdml") !== FALSE) { | |
| 217 | + return "hdml"; | |
| 218 | +		} elseif(stripos($userAgent, "cellphone") !== FALSE) { | |
| 219 | + return "mhtml"; | |
| 196 | 220 | } | 
| 197 | - elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml"; | |
| 198 | - elseif(stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; | |
| 199 | 221 | return null; | 
| 200 | 222 | } | 
| 201 | 223 | |
| @@ -204,9 +226,13 @@ discard block | ||
| 204 | 226 | */ | 
| 205 | 227 | function setCharSet($charset = 'UTF-8') | 
| 206 | 228 |  	{ | 
| 207 | - if(!$charset) $charset = 'UTF-8'; | |
| 229 | +		if(!$charset) { | |
| 230 | + $charset = 'UTF-8'; | |
| 231 | + } | |
| 208 | 232 | // SKT supports the euc-kr | 
| 209 | -		if(Context::get('mobile_skt')==1) $charset = 'euc-kr'; | |
| 233 | +		if(Context::get('mobile_skt')==1) { | |
| 234 | + $charset = 'euc-kr'; | |
| 235 | + } | |
| 210 | 236 | |
| 211 | 237 | $this->charset = $charset; | 
| 212 | 238 | } | 
| @@ -216,7 +242,9 @@ discard block | ||
| 216 | 242 | */ | 
| 217 | 243 | function setMobilePage($page=1) | 
| 218 | 244 |  	{ | 
| 219 | - if(!$page) $page = 1; | |
| 245 | +		if(!$page) { | |
| 246 | + $page = 1; | |
| 247 | + } | |
| 220 | 248 | $this->mobilePage = $page; | 
| 221 | 249 | } | 
| 222 | 250 | |
| @@ -329,7 +357,9 @@ discard block | ||
| 329 | 357 | |
| 330 | 358 | foreach($allow_tag_array as $tag) | 
| 331 | 359 |  			{ | 
| 332 | - if($tag == '<br>') continue; | |
| 360 | +				if($tag == '<br>') { | |
| 361 | + continue; | |
| 362 | + } | |
| 333 | 363 |  				$tag_open_pos = strpos($content, str_replace('>','',$tag)); | 
| 334 | 364 |  				$tag_close_pos = strpos($content, str_replace('<','</',$tag)); | 
| 335 | 365 | if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) | 
| @@ -390,7 +420,9 @@ discard block | ||
| 390 | 420 | */ | 
| 391 | 421 | function setHomeUrl($url, $text) | 
| 392 | 422 |  	{ | 
| 393 | - if(!$url) $url = '#'; | |
| 423 | +		if(!$url) { | |
| 424 | + $url = '#'; | |
| 425 | + } | |
| 394 | 426 | $this->homeUrl->url = $url; | 
| 395 | 427 | $this->homeUrl->text = $text; | 
| 396 | 428 | } | 
| @@ -400,7 +432,9 @@ discard block | ||
| 400 | 432 | */ | 
| 401 | 433 | function setUpperUrl($url, $text) | 
| 402 | 434 |  	{ | 
| 403 | - if(!$url) $url = '#'; | |
| 435 | +		if(!$url) { | |
| 436 | + $url = '#'; | |
| 437 | + } | |
| 404 | 438 | $this->upperUrl->url = $url; | 
| 405 | 439 | $this->upperUrl->text = $text; | 
| 406 | 440 | } | 
| @@ -410,7 +444,9 @@ discard block | ||
| 410 | 444 | */ | 
| 411 | 445 | function setPrevUrl($url, $text) | 
| 412 | 446 |  	{ | 
| 413 | - if(!$url) $url = '#'; | |
| 447 | +		if(!$url) { | |
| 448 | + $url = '#'; | |
| 449 | + } | |
| 414 | 450 | $this->prevUrl->url = $url; | 
| 415 | 451 | $this->prevUrl->text = $text; | 
| 416 | 452 | } | 
| @@ -420,7 +456,9 @@ discard block | ||
| 420 | 456 | */ | 
| 421 | 457 | function setNextUrl($url, $text) | 
| 422 | 458 |  	{ | 
| 423 | - if(!$url) $url = '#'; | |
| 459 | +		if(!$url) { | |
| 460 | + $url = '#'; | |
| 461 | + } | |
| 424 | 462 | $this->nextUrl->url = $url; | 
| 425 | 463 | $this->nextUrl->text = $text; | 
| 426 | 464 | } | 
| @@ -430,7 +468,9 @@ discard block | ||
| 430 | 468 | */ | 
| 431 | 469 | function setEtcBtn($url, $text) | 
| 432 | 470 |  	{ | 
| 433 | - if(!$url) $url = '#'; | |
| 471 | +		if(!$url) { | |
| 472 | + $url = '#'; | |
| 473 | + } | |
| 434 | 474 | $etc['url'] = $url; | 
| 435 | 475 | $etc['text'] = htmlspecialchars($text); | 
| 436 | 476 | $this->etcBtn[] = $etc; | 
| @@ -444,7 +484,9 @@ discard block | ||
| 444 | 484 | // Home button assignments | 
| 445 | 485 |  		$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home')); | 
| 446 | 486 | // Specify the title | 
| 447 | - if(!$this->title) $this->setTitle(Context::getBrowserTitle()); | |
| 487 | +		if(!$this->title) { | |
| 488 | + $this->setTitle(Context::getBrowserTitle()); | |
| 489 | + } | |
| 448 | 490 | |
| 449 | 491 | ob_start(); | 
| 450 | 492 | // Output header | 
| @@ -460,8 +502,11 @@ discard block | ||
| 460 | 502 | |
| 461 | 503 | $content = ob_get_clean(); | 
| 462 | 504 | // After conversion output | 
| 463 | - if(strtolower($this->charset) == 'utf-8') print $content; | |
| 464 | -		else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); | |
| 505 | +		if(strtolower($this->charset) == 'utf-8') { | |
| 506 | + print $content; | |
| 507 | +		} else { | |
| 508 | +			print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); | |
| 509 | + } | |
| 465 | 510 | |
| 466 | 511 | exit(); | 
| 467 | 512 | } | 
| @@ -490,15 +535,16 @@ discard block | ||
| 490 | 535 | */ | 
| 491 | 536 | function getListedItems($menu, &$listed_items, &$node_list) | 
| 492 | 537 |  	{ | 
| 493 | - if(!count($menu)) return; | |
| 538 | +		if(!count($menu)) { | |
| 539 | + return; | |
| 540 | + } | |
| 494 | 541 | foreach($menu as $node_srl => $item) | 
| 495 | 542 |  		{ | 
| 496 | 543 |  			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) | 
| 497 | 544 |  			{ | 
| 498 | 545 | $mid = $item['mid'] = $item['url']; | 
| 499 | 546 | $node_list[$mid] = $node_srl; | 
| 500 | - } | |
| 501 | - else | |
| 547 | + } else | |
| 502 | 548 |  			{ | 
| 503 | 549 | $mid = $item['mid'] = null; | 
| 504 | 550 | } | 
| @@ -529,8 +575,7 @@ discard block | ||
| 529 | 575 | $childs[] = $obj; | 
| 530 | 576 | } | 
| 531 | 577 | |
| 532 | - } | |
| 533 | - else | |
| 578 | + } else | |
| 534 | 579 |  		{ | 
| 535 | 580 | $list = $this->menu; | 
| 536 | 581 | $upper_srl = 0; | 
| @@ -540,13 +585,14 @@ discard block | ||
| 540 | 585 |  		{ | 
| 541 | 586 | foreach($list as $key => $val) | 
| 542 | 587 |  			{ | 
| 543 | - if(!$val['text']) continue; | |
| 588 | +				if(!$val['text']) { | |
| 589 | + continue; | |
| 590 | + } | |
| 544 | 591 | $obj = array(); | 
| 545 | 592 | if(!count($val['list'])) | 
| 546 | 593 |  				{ | 
| 547 | 594 |  					$obj['href'] = getUrl('','mid',$val['url']); | 
| 548 | - } | |
| 549 | - else | |
| 595 | + } else | |
| 550 | 596 |  				{ | 
| 551 | 597 |  					$obj['href'] = getUrl('cmid',$val['node_srl']); | 
| 552 | 598 | } | 
| @@ -602,10 +648,14 @@ discard block | ||
| 602 | 648 |  	{ | 
| 603 | 649 | // Create WAP class objects of the selected module | 
| 604 | 650 | $oModule = &getWap($this->module_info->module); | 
| 605 | - if(!$oModule || !method_exists($oModule, 'procWAP') ) return; | |
| 651 | +		if(!$oModule || !method_exists($oModule, 'procWAP') ) { | |
| 652 | + return; | |
| 653 | + } | |
| 606 | 654 | |
| 607 | 655 | $vars = get_object_vars($this->oModule); | 
| 608 | -		if(count($vars)) foreach($vars as $key => $val) $oModule->{$key}  = $val; | |
| 656 | +		if(count($vars)) { | |
| 657 | +			foreach($vars as $key => $val) $oModule->{$key}  = $val; | |
| 658 | + } | |
| 609 | 659 | // Run | 
| 610 | 660 | $oModule->procWAP($this); | 
| 611 | 661 | // Output | 
| @@ -45,28 +45,28 @@ discard block | ||
| 45 | 45 |  	{ | 
| 46 | 46 | static $instance = null; | 
| 47 | 47 | |
| 48 | - if(!$instance) | |
| 48 | + if (!$instance) | |
| 49 | 49 |  		{ | 
| 50 | 50 | |
| 51 | 51 | $browserType = mobileXE::getBrowserType(); | 
| 52 | - if(!$browserType) return; | |
| 52 | + if (!$browserType) return; | |
| 53 | 53 | |
| 54 | 54 |  			$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); | 
| 55 | 55 | require_once($class_file); | 
| 56 | 56 | // Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..) | 
| 57 | 57 |  			$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | 
| 58 | - if($this->lang) | |
| 58 | + if ($this->lang) | |
| 59 | 59 |  			{ | 
| 60 | 60 |  				$lang_supported = Context::get('lang_supported'); | 
| 61 | -				$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); | |
| 62 | - if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang); | |
| 61 | +				$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); | |
| 62 | + if (isset($lang_supported[$this->lang])) Context::setLangType($this->lang); | |
| 63 | 63 | } | 
| 64 | 64 | Context::loadLang(_XE_PATH_.'addons/mobile/lang'); | 
| 65 | 65 | |
| 66 | 66 | $instance = new wap(); | 
| 67 | 67 | |
| 68 | -			$mobilePage = (int)Context::get('mpage'); | |
| 69 | - if(!$mobilePage) $mobilePage = 1; | |
| 68 | +			$mobilePage = (int) Context::get('mpage'); | |
| 69 | + if (!$mobilePage) $mobilePage = 1; | |
| 70 | 70 | |
| 71 | 71 | $instance->setMobilePage($mobilePage); | 
| 72 | 72 | } | 
| @@ -79,13 +79,13 @@ discard block | ||
| 79 | 79 | function mobileXE() | 
| 80 | 80 |  	{ | 
| 81 | 81 | // Check navigation mode | 
| 82 | -		if(Context::get('nm')) | |
| 82 | +		if (Context::get('nm')) | |
| 83 | 83 |  		{ | 
| 84 | 84 | $this->navigationMode = 1; | 
| 85 | -			$this->cmid = (int)Context::get('cmid'); | |
| 85 | +			$this->cmid = (int) Context::get('cmid'); | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | -		if(Context::get('lcm')) | |
| 88 | +		if (Context::get('lcm')) | |
| 89 | 89 |  		{ | 
| 90 | 90 | $this->languageMode = 1; | 
| 91 | 91 |  			$this->lang = Context::get('sel_lang'); | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | */ | 
| 99 | 99 | function isNavigationMode() | 
| 100 | 100 |  	{ | 
| 101 | - return ($this->navigationMode && $this->module_info->menu_srl)?true:false; | |
| 101 | + return ($this->navigationMode && $this->module_info->menu_srl) ? true : false; | |
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | /** | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | */ | 
| 108 | 108 | function isLangChange() | 
| 109 | 109 |  	{ | 
| 110 | - if($this->languageMode) return true; | |
| 110 | + if ($this->languageMode) return true; | |
| 111 | 111 | else return false; | 
| 112 | 112 | } | 
| 113 | 113 | |
| @@ -119,12 +119,12 @@ discard block | ||
| 119 | 119 |  	{ | 
| 120 | 120 |  		$lang_supported = Context::get('lang_supported'); | 
| 121 | 121 | // Make sure that the language variables and parameters are valid | 
| 122 | - if($this->lang && isset($lang_supported[$this->lang])) | |
| 122 | + if ($this->lang && isset($lang_supported[$this->lang])) | |
| 123 | 123 |  		{ | 
| 124 | 124 |  			$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | 
| 125 | -			if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | |
| 125 | +			if ($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | |
| 126 | 126 | $langbuff = '<?php /**'.$this->lang.'**/ ?>'; | 
| 127 | -			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff); | |
| 127 | +			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php', $langbuff); | |
| 128 | 128 | } | 
| 129 | 129 | } | 
| 130 | 130 | |
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | */ | 
| 134 | 134 | function setModuleInfo(&$module_info) | 
| 135 | 135 |  	{ | 
| 136 | - if($this->module_info) return; | |
| 136 | + if ($this->module_info) return; | |
| 137 | 137 | $this->module_info = $module_info; | 
| 138 | 138 | } | 
| 139 | 139 | |
| @@ -142,12 +142,12 @@ discard block | ||
| 142 | 142 | */ | 
| 143 | 143 | function setModuleInstance(&$oModule) | 
| 144 | 144 |  	{ | 
| 145 | - if($this->oModule) return; | |
| 145 | + if ($this->oModule) return; | |
| 146 | 146 | // Save instance | 
| 147 | 147 | $this->oModule = $oModule; | 
| 148 | 148 | // Of the current module if there is a menu by menu | 
| 149 | 149 | $menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl); | 
| 150 | - if(!file_exists($menu_cache_file)) return; | |
| 150 | + if (!file_exists($menu_cache_file)) return; | |
| 151 | 151 | |
| 152 | 152 | include $menu_cache_file; | 
| 153 | 153 | // One-dimensional arrangement of menu changes | 
| @@ -162,18 +162,18 @@ discard block | ||
| 162 | 162 | $this->index_mid = $k[0]; | 
| 163 | 163 | // The depth of the current menu, the top button to specify if one or more | 
| 164 | 164 | $cur_menu_item = $listed_items[$node_list[$this->module_info->mid]]; | 
| 165 | - if($cur_menu_item['parent_srl']) | |
| 165 | + if ($cur_menu_item['parent_srl']) | |
| 166 | 166 |  		{ | 
| 167 | 167 | $parent_srl = $cur_menu_item['parent_srl']; | 
| 168 | - if($parent_srl && $listed_items[$parent_srl]) | |
| 168 | + if ($parent_srl && $listed_items[$parent_srl]) | |
| 169 | 169 |  			{ | 
| 170 | 170 | $parent_item = $listed_items[$parent_srl]; | 
| 171 | -				if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper')); | |
| 171 | +				if ($parent_item) $this->setUpperUrl(getUrl('', 'mid', $parent_item['mid']), Context::getLang('cmd_go_upper')); | |
| 172 | 172 | } | 
| 173 | 173 | } | 
| 174 | 174 | elseif (!$this->isNavigationMode()) | 
| 175 | 175 |  		{ | 
| 176 | -			$this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap')); | |
| 176 | +			$this->setUpperUrl(getUrl('', 'mid', $this->index_mid, 'nm', '1', 'cmid', 0), Context::getLang('cmd_view_sitemap')); | |
| 177 | 177 | } | 
| 178 | 178 | } | 
| 179 | 179 | |
| @@ -183,19 +183,19 @@ discard block | ||
| 183 | 183 | */ | 
| 184 | 184 | function getBrowserType() | 
| 185 | 185 |  	{ | 
| 186 | -		if(Context::get('smartphone')) return null; | |
| 186 | +		if (Context::get('smartphone')) return null; | |
| 187 | 187 | // Determine the type of browser | 
| 188 | 188 | $browserAccept = $_SERVER['HTTP_ACCEPT']; | 
| 189 | 189 | $userAgent = $_SERVER['HTTP_USER_AGENT']; | 
| 190 | 190 | $wap_sid = $_SERVER['HTTP_X_UP_SUBNO']; | 
| 191 | 191 | |
| 192 | - if(stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE) | |
| 192 | + if (stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE) | |
| 193 | 193 |  		{ | 
| 194 | -			Context::set('mobile_skt',1); | |
| 194 | +			Context::set('mobile_skt', 1); | |
| 195 | 195 | return "wml"; | 
| 196 | 196 | } | 
| 197 | - elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml"; | |
| 198 | - elseif(stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; | |
| 197 | + elseif (stripos($browserAccept, "hdml") !== FALSE) return "hdml"; | |
| 198 | + elseif (stripos($userAgent, "cellphone") !== FALSE) return "mhtml"; | |
| 199 | 199 | return null; | 
| 200 | 200 | } | 
| 201 | 201 | |
| @@ -204,9 +204,9 @@ discard block | ||
| 204 | 204 | */ | 
| 205 | 205 | function setCharSet($charset = 'UTF-8') | 
| 206 | 206 |  	{ | 
| 207 | - if(!$charset) $charset = 'UTF-8'; | |
| 207 | + if (!$charset) $charset = 'UTF-8'; | |
| 208 | 208 | // SKT supports the euc-kr | 
| 209 | -		if(Context::get('mobile_skt')==1) $charset = 'euc-kr'; | |
| 209 | +		if (Context::get('mobile_skt') == 1) $charset = 'euc-kr'; | |
| 210 | 210 | |
| 211 | 211 | $this->charset = $charset; | 
| 212 | 212 | } | 
| @@ -214,9 +214,9 @@ discard block | ||
| 214 | 214 | /** | 
| 215 | 215 | * @brief Limited capacity of mobile devices, specifying a different virtual page | 
| 216 | 216 | */ | 
| 217 | - function setMobilePage($page=1) | |
| 217 | + function setMobilePage($page = 1) | |
| 218 | 218 |  	{ | 
| 219 | - if(!$page) $page = 1; | |
| 219 | + if (!$page) $page = 1; | |
| 220 | 220 | $this->mobilePage = $page; | 
| 221 | 221 | } | 
| 222 | 222 | |
| @@ -227,34 +227,34 @@ discard block | ||
| 227 | 227 |  	{ | 
| 228 | 228 | // If more than nine the number of menu paging processing itself | 
| 229 | 229 | $menu_count = count($childs); | 
| 230 | - if($menu_count>9) | |
| 230 | + if ($menu_count > 9) | |
| 231 | 231 |  		{ | 
| 232 | - $startNum = ($this->mobilePage-1)*9; | |
| 232 | + $startNum = ($this->mobilePage - 1) * 9; | |
| 233 | 233 | $idx = 0; | 
| 234 | 234 | $new_childs = array(); | 
| 235 | - foreach($childs as $k => $v) | |
| 235 | + foreach ($childs as $k => $v) | |
| 236 | 236 |  			{ | 
| 237 | - if($idx >= $startNum && $idx < $startNum+9) | |
| 237 | + if ($idx >= $startNum && $idx < $startNum + 9) | |
| 238 | 238 |  				{ | 
| 239 | 239 | $new_childs[$k] = $v; | 
| 240 | 240 | } | 
| 241 | - $idx ++; | |
| 241 | + $idx++; | |
| 242 | 242 | } | 
| 243 | 243 | $childs = $new_childs; | 
| 244 | 244 | |
| 245 | - $this->totalPage = (int)(($menu_count-1)/9)+1; | |
| 245 | + $this->totalPage = (int) (($menu_count - 1) / 9) + 1; | |
| 246 | 246 | // next/prevUrl specify | 
| 247 | - if($this->mobilePage>1) | |
| 247 | + if ($this->mobilePage > 1) | |
| 248 | 248 |  			{ | 
| 249 | -				$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); | |
| 250 | -				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); | |
| 249 | +				$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1); | |
| 250 | +				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage); | |
| 251 | 251 | $this->setPrevUrl($url, $text); | 
| 252 | 252 | } | 
| 253 | 253 | |
| 254 | - if($this->mobilePage<$this->totalPage) | |
| 254 | + if ($this->mobilePage < $this->totalPage) | |
| 255 | 255 |  			{ | 
| 256 | -				$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1); | |
| 257 | -				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage); | |
| 256 | +				$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1); | |
| 257 | +				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage); | |
| 258 | 258 | $this->setNextUrl($url, $text); | 
| 259 | 259 | } | 
| 260 | 260 | } | 
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | */ | 
| 267 | 267 | function hasChilds() | 
| 268 | 268 |  	{ | 
| 269 | - return count($this->childs)?true:0; | |
| 269 | + return count($this->childs) ? true : 0; | |
| 270 | 270 | } | 
| 271 | 271 | |
| 272 | 272 | /** | 
| @@ -302,7 +302,7 @@ discard block | ||
| 302 | 302 | function setContent($content) | 
| 303 | 303 |  	{ | 
| 304 | 304 |  		$oModuleController = getController('module'); | 
| 305 | -		$allow_tag_array = array('<a>','<br>','<p>','<b>','<i>','<u>','<em>','<small>','<strong>','<big>','<table>','<tr>','<td>'); | |
| 305 | +		$allow_tag_array = array('<a>', '<br>', '<p>', '<b>', '<i>', '<u>', '<em>', '<small>', '<strong>', '<big>', '<table>', '<tr>', '<td>'); | |
| 306 | 306 | // Links/wrap, remove all tags except gangjoman | 
| 307 | 307 | $content = strip_tags($content, implode($allow_tag_array)); | 
| 308 | 308 | // Margins tab removed | 
| @@ -310,16 +310,16 @@ discard block | ||
| 310 | 310 | // Repeat two more times the space and remove julnanumeul | 
| 311 | 311 |  		$content = preg_replace('/( ){2,}/s', '', $content); | 
| 312 | 312 |  		$content = preg_replace("/([\r\n]+)/s", "\r\n", $content); | 
| 313 | -		$content = preg_replace(array("/<a/i","/<\/a/i","/<b/i","/<\/b/i","/<br/i"),array('<a','</a','<b','</b','<br'),$content); | |
| 314 | -		$content = str_replace(array("<br>","<br />"), array("<br/>","<br/>"), $content); | |
| 313 | +		$content = preg_replace(array("/<a/i", "/<\/a/i", "/<b/i", "/<\/b/i", "/<br/i"), array('<a', '</a', '<b', '</b', '<br'), $content); | |
| 314 | +		$content = str_replace(array("<br>", "<br />"), array("<br/>", "<br/>"), $content); | |
| 315 | 315 | |
| 316 | - while(strpos($content, '<br/><br/>')) | |
| 316 | + while (strpos($content, '<br/><br/>')) | |
| 317 | 317 |  		{ | 
| 318 | -			$content = str_replace('<br/><br/>','<br/>',$content); | |
| 318 | +			$content = str_replace('<br/><br/>', '<br/>', $content); | |
| 319 | 319 | } | 
| 320 | 320 | // If the required size of a deck of mobile content to write down all the dividing pages | 
| 321 | 321 | $contents = array(); | 
| 322 | - while($content) | |
| 322 | + while ($content) | |
| 323 | 323 |  		{ | 
| 324 | 324 | $tmp = $this->cutStr($content, $this->deckSize, ''); | 
| 325 | 325 | $contents[] = $tmp; | 
| @@ -327,46 +327,46 @@ discard block | ||
| 327 | 327 | |
| 328 | 328 |  			//$content = str_replace(array('&','<','>','"','&nbsp;'), array('&','<','>','"',' '), $content); | 
| 329 | 329 | |
| 330 | - foreach($allow_tag_array as $tag) | |
| 330 | + foreach ($allow_tag_array as $tag) | |
| 331 | 331 |  			{ | 
| 332 | - if($tag == '<br>') continue; | |
| 333 | -				$tag_open_pos = strpos($content, str_replace('>','',$tag)); | |
| 334 | -				$tag_close_pos = strpos($content, str_replace('<','</',$tag)); | |
| 335 | - if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) | |
| 332 | + if ($tag == '<br>') continue; | |
| 333 | +				$tag_open_pos = strpos($content, str_replace('>', '', $tag)); | |
| 334 | +				$tag_close_pos = strpos($content, str_replace('<', '</', $tag)); | |
| 335 | + if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos) | |
| 336 | 336 |  				{ | 
| 337 | - $contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1); | |
| 337 | + $contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1); | |
| 338 | 338 | $content = substr($content, $tag_close_pos + strlen($tag) + 1); | 
| 339 | 339 | } | 
| 340 | 340 | } | 
| 341 | 341 | |
| 342 | 342 | $tag_open_pos = strpos($content, '&'); | 
| 343 | 343 | $tag_close_pos = strpos($content, ';'); | 
| 344 | - if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) | |
| 344 | + if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos) | |
| 345 | 345 |  			{ | 
| 346 | - $contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + 1); | |
| 346 | + $contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + 1); | |
| 347 | 347 | $content = substr($content, $tag_close_pos + 1); | 
| 348 | 348 | } | 
| 349 | 349 | } | 
| 350 | 350 | |
| 351 | 351 | $this->totalPage = count($contents); | 
| 352 | 352 | // next/prevUrl specify | 
| 353 | - if($this->mobilePage>1) | |
| 353 | + if ($this->mobilePage > 1) | |
| 354 | 354 |  		{ | 
| 355 | -			$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); | |
| 356 | -			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); | |
| 355 | +			$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1); | |
| 356 | +			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage); | |
| 357 | 357 | $this->setPrevUrl($url, $text); | 
| 358 | 358 | } | 
| 359 | 359 | |
| 360 | - if($this->mobilePage<$this->totalPage) | |
| 360 | + if ($this->mobilePage < $this->totalPage) | |
| 361 | 361 |  		{ | 
| 362 | -			$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1); | |
| 363 | -			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage); | |
| 362 | +			$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1); | |
| 363 | +			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage); | |
| 364 | 364 | $this->setNextUrl($url, $text); | 
| 365 | 365 | } | 
| 366 | 366 | |
| 367 | - $this->content = $contents[$this->mobilePage-1]; | |
| 367 | + $this->content = $contents[$this->mobilePage - 1]; | |
| 368 | 368 | $oModuleController->replaceDefinedLangCode($this->content); | 
| 369 | -		$content = str_replace(array('$','\''), array('$$','''), $content); | |
| 369 | +		$content = str_replace(array('$', '\''), array('$$', '''), $content); | |
| 370 | 370 | } | 
| 371 | 371 | |
| 372 | 372 | /** | 
| @@ -390,7 +390,7 @@ discard block | ||
| 390 | 390 | */ | 
| 391 | 391 | function setHomeUrl($url, $text) | 
| 392 | 392 |  	{ | 
| 393 | - if(!$url) $url = '#'; | |
| 393 | + if (!$url) $url = '#'; | |
| 394 | 394 | $this->homeUrl->url = $url; | 
| 395 | 395 | $this->homeUrl->text = $text; | 
| 396 | 396 | } | 
| @@ -400,7 +400,7 @@ discard block | ||
| 400 | 400 | */ | 
| 401 | 401 | function setUpperUrl($url, $text) | 
| 402 | 402 |  	{ | 
| 403 | - if(!$url) $url = '#'; | |
| 403 | + if (!$url) $url = '#'; | |
| 404 | 404 | $this->upperUrl->url = $url; | 
| 405 | 405 | $this->upperUrl->text = $text; | 
| 406 | 406 | } | 
| @@ -410,7 +410,7 @@ discard block | ||
| 410 | 410 | */ | 
| 411 | 411 | function setPrevUrl($url, $text) | 
| 412 | 412 |  	{ | 
| 413 | - if(!$url) $url = '#'; | |
| 413 | + if (!$url) $url = '#'; | |
| 414 | 414 | $this->prevUrl->url = $url; | 
| 415 | 415 | $this->prevUrl->text = $text; | 
| 416 | 416 | } | 
| @@ -420,7 +420,7 @@ discard block | ||
| 420 | 420 | */ | 
| 421 | 421 | function setNextUrl($url, $text) | 
| 422 | 422 |  	{ | 
| 423 | - if(!$url) $url = '#'; | |
| 423 | + if (!$url) $url = '#'; | |
| 424 | 424 | $this->nextUrl->url = $url; | 
| 425 | 425 | $this->nextUrl->text = $text; | 
| 426 | 426 | } | 
| @@ -430,7 +430,7 @@ discard block | ||
| 430 | 430 | */ | 
| 431 | 431 | function setEtcBtn($url, $text) | 
| 432 | 432 |  	{ | 
| 433 | - if(!$url) $url = '#'; | |
| 433 | + if (!$url) $url = '#'; | |
| 434 | 434 | $etc['url'] = $url; | 
| 435 | 435 | $etc['text'] = htmlspecialchars($text); | 
| 436 | 436 | $this->etcBtn[] = $etc; | 
| @@ -444,7 +444,7 @@ discard block | ||
| 444 | 444 | // Home button assignments | 
| 445 | 445 |  		$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home')); | 
| 446 | 446 | // Specify the title | 
| 447 | - if(!$this->title) $this->setTitle(Context::getBrowserTitle()); | |
| 447 | + if (!$this->title) $this->setTitle(Context::getBrowserTitle()); | |
| 448 | 448 | |
| 449 | 449 | ob_start(); | 
| 450 | 450 | // Output header | 
| @@ -460,8 +460,8 @@ discard block | ||
| 460 | 460 | |
| 461 | 461 | $content = ob_get_clean(); | 
| 462 | 462 | // After conversion output | 
| 463 | - if(strtolower($this->charset) == 'utf-8') print $content; | |
| 464 | -		else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); | |
| 463 | + if (strtolower($this->charset) == 'utf-8') print $content; | |
| 464 | +		else print iconv('UTF-8', $this->charset."//TRANSLIT//IGNORE", $content); | |
| 465 | 465 | |
| 466 | 466 | exit(); | 
| 467 | 467 | } | 
| @@ -490,10 +490,10 @@ discard block | ||
| 490 | 490 | */ | 
| 491 | 491 | function getListedItems($menu, &$listed_items, &$node_list) | 
| 492 | 492 |  	{ | 
| 493 | - if(!count($menu)) return; | |
| 494 | - foreach($menu as $node_srl => $item) | |
| 493 | + if (!count($menu)) return; | |
| 494 | + foreach ($menu as $node_srl => $item) | |
| 495 | 495 |  		{ | 
| 496 | -			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) | |
| 496 | +			if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) | |
| 497 | 497 |  			{ | 
| 498 | 498 | $mid = $item['mid'] = $item['url']; | 
| 499 | 499 | $node_list[$mid] = $node_srl; | 
| @@ -515,16 +515,16 @@ discard block | ||
| 515 | 515 |  	{ | 
| 516 | 516 | $childs = array(); | 
| 517 | 517 | |
| 518 | - if($this->cmid) | |
| 518 | + if ($this->cmid) | |
| 519 | 519 |  		{ | 
| 520 | 520 | $cur_item = $this->listed_items[$this->cmid]; | 
| 521 | - $upper_srl = $cur_item['parent_srl'];; | |
| 522 | - $list = $cur_item['list'];; | |
| 523 | -			$this->setUpperUrl(getUrl('cmid',$upper_srl), Context::getLang('cmd_go_upper')); | |
| 524 | -			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url'])) | |
| 521 | + $upper_srl = $cur_item['parent_srl']; ; | |
| 522 | + $list = $cur_item['list']; ; | |
| 523 | +			$this->setUpperUrl(getUrl('cmid', $upper_srl), Context::getLang('cmd_go_upper')); | |
| 524 | +			if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url'])) | |
| 525 | 525 |  			{ | 
| 526 | 526 | $obj = array(); | 
| 527 | -				$obj['href'] = getUrl('','mid',$cur_item['url']); | |
| 527 | +				$obj['href'] = getUrl('', 'mid', $cur_item['url']); | |
| 528 | 528 | $obj['link'] = $obj['text'] = '['.$cur_item['text'].']'; | 
| 529 | 529 | $childs[] = $obj; | 
| 530 | 530 | } | 
| @@ -536,19 +536,19 @@ discard block | ||
| 536 | 536 | $upper_srl = 0; | 
| 537 | 537 | } | 
| 538 | 538 | |
| 539 | - if(count($list)) | |
| 539 | + if (count($list)) | |
| 540 | 540 |  		{ | 
| 541 | - foreach($list as $key => $val) | |
| 541 | + foreach ($list as $key => $val) | |
| 542 | 542 |  			{ | 
| 543 | - if(!$val['text']) continue; | |
| 543 | + if (!$val['text']) continue; | |
| 544 | 544 | $obj = array(); | 
| 545 | - if(!count($val['list'])) | |
| 545 | + if (!count($val['list'])) | |
| 546 | 546 |  				{ | 
| 547 | -					$obj['href'] = getUrl('','mid',$val['url']); | |
| 547 | +					$obj['href'] = getUrl('', 'mid', $val['url']); | |
| 548 | 548 | } | 
| 549 | 549 | else | 
| 550 | 550 |  				{ | 
| 551 | -					$obj['href'] = getUrl('cmid',$val['node_srl']); | |
| 551 | +					$obj['href'] = getUrl('cmid', $val['node_srl']); | |
| 552 | 552 | } | 
| 553 | 553 | $obj['link'] = $obj['text'] = $val['text']; | 
| 554 | 554 | $childs[] = $obj; | 
| @@ -567,25 +567,25 @@ discard block | ||
| 567 | 567 | $childs = array(); | 
| 568 | 568 | |
| 569 | 569 |  		$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); | 
| 570 | - if($this->lang) | |
| 570 | + if ($this->lang) | |
| 571 | 571 |  		{ | 
| 572 | -			$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang); | |
| 572 | +			$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang); | |
| 573 | 573 | Context::setLangType($this->lang); | 
| 574 | 574 | } | 
| 575 | 575 |  		$lang_supported = Context::get('lang_supported'); | 
| 576 | 576 | $lang_type = Context::getLangType(); | 
| 577 | 577 | $obj = array(); | 
| 578 | 578 |  		$obj['link'] = $obj['text'] = Context::getLang('president_lang').' : '.$lang_supported[$lang_type]; | 
| 579 | -		$obj['href'] = getUrl('sel_lang',$lang_type); | |
| 579 | +		$obj['href'] = getUrl('sel_lang', $lang_type); | |
| 580 | 580 | $childs[] = $obj; | 
| 581 | 581 | |
| 582 | - if(is_array($lang_supported)) | |
| 582 | + if (is_array($lang_supported)) | |
| 583 | 583 |  		{ | 
| 584 | - foreach($lang_supported as $key => $val) | |
| 584 | + foreach ($lang_supported as $key => $val) | |
| 585 | 585 |  			{ | 
| 586 | 586 | $obj = array(); | 
| 587 | 587 | $obj['link'] = $obj['text'] = $val; | 
| 588 | -				$obj['href'] = getUrl('sel_lang',$key); | |
| 588 | +				$obj['href'] = getUrl('sel_lang', $key); | |
| 589 | 589 | $childs[] = $obj; | 
| 590 | 590 | } | 
| 591 | 591 | } | 
| @@ -602,10 +602,10 @@ discard block | ||
| 602 | 602 |  	{ | 
| 603 | 603 | // Create WAP class objects of the selected module | 
| 604 | 604 | $oModule = &getWap($this->module_info->module); | 
| 605 | - if(!$oModule || !method_exists($oModule, 'procWAP') ) return; | |
| 605 | + if (!$oModule || !method_exists($oModule, 'procWAP')) return; | |
| 606 | 606 | |
| 607 | 607 | $vars = get_object_vars($this->oModule); | 
| 608 | -		if(count($vars)) foreach($vars as $key => $val) $oModule->{$key}  = $val; | |
| 608 | +		if (count($vars)) foreach ($vars as $key => $val) $oModule->{$key} = $val; | |
| 609 | 609 | // Run | 
| 610 | 610 | $oModule->procWAP($this); | 
| 611 | 611 | // Output | 
| @@ -617,7 +617,7 @@ discard block | ||
| 617 | 617 | */ | 
| 618 | 618 | function displayContent() | 
| 619 | 619 |  	{ | 
| 620 | -		Context::set('layout','none'); | |
| 620 | +		Context::set('layout', 'none'); | |
| 621 | 621 | // Compile a template | 
| 622 | 622 | $oTemplate = new TemplateHandler(); | 
| 623 | 623 | $oContext = &Context::getInstance(); | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | /** | 
| 56 | 56 | * Return whether support or not support cache | 
| 57 | 57 | * | 
| 58 | - * @return true | |
| 58 | + * @return boolean | |
| 59 | 59 | */ | 
| 60 | 60 | function isSupport() | 
| 61 | 61 |  	{
 | 
| @@ -164,7 +164,7 @@ discard block | ||
| 164 | 164 | /** | 
| 165 | 165 | * Truncate all existing variables at the cache | 
| 166 | 166 | * | 
| 167 | - * @return bool Returns true on success or false on failure. | |
| 167 | + * @return boolean|null Returns true on success or false on failure. | |
| 168 | 168 | */ | 
| 169 | 169 | function truncate() | 
| 170 | 170 |  	{
 | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | */ | 
| 24 | 24 | function getInstance() | 
| 25 | 25 |  	{
 | 
| 26 | - if(!$GLOBALS['__CacheFile__']) | |
| 26 | + if (!$GLOBALS['__CacheFile__']) | |
| 27 | 27 |  		{
 | 
| 28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); | 
| 29 | 29 | } | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | */ | 
| 38 | 38 | function CacheFile() | 
| 39 | 39 |  	{
 | 
| 40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; | |
| 40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; | |
| 41 | 41 | FileHandler::makeDir($this->cache_dir); | 
| 42 | 42 | } | 
| 43 | 43 | |
| @@ -49,7 +49,7 @@ discard block | ||
| 49 | 49 | */ | 
| 50 | 50 | function getCacheFileName($key) | 
| 51 | 51 |  	{
 | 
| 52 | -		return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php';
 | |
| 52 | +		return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php';
 | |
| 53 | 53 | } | 
| 54 | 54 | |
| 55 | 55 | /** | 
| @@ -76,9 +76,9 @@ discard block | ||
| 76 | 76 | $content = array(); | 
| 77 | 77 | $content[] = '<?php'; | 
| 78 | 78 |  		$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
 | 
| 79 | - $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; | |
| 79 | + $content[] = 'return \''.addslashes(serialize($obj)).'\';'; | |
| 80 | 80 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); | 
| 81 | -		if(function_exists('opcache_invalidate'))
 | |
| 81 | +		if (function_exists('opcache_invalidate'))
 | |
| 82 | 82 |  		{
 | 
| 83 | 83 | @opcache_invalidate($cache_file, true); | 
| 84 | 84 | } | 
| @@ -95,9 +95,9 @@ discard block | ||
| 95 | 95 |  	{
 | 
| 96 | 96 | $cache_file = $this->getCacheFileName($key); | 
| 97 | 97 | |
| 98 | - if(file_exists($cache_file)) | |
| 98 | + if (file_exists($cache_file)) | |
| 99 | 99 |  		{
 | 
| 100 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) | |
| 100 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) | |
| 101 | 101 |  			{
 | 
| 102 | 102 | FileHandler::removeFile($cache_file); | 
| 103 | 103 | return false; | 
| @@ -118,12 +118,12 @@ discard block | ||
| 118 | 118 | */ | 
| 119 | 119 | function get($key, $modified_time = 0) | 
| 120 | 120 |  	{
 | 
| 121 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) | |
| 121 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) | |
| 122 | 122 |  		{
 | 
| 123 | 123 | return false; | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) | |
| 126 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) | |
| 127 | 127 |  		{
 | 
| 128 | 128 | FileHandler::removeFile($cache_file); | 
| 129 | 129 | return false; | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | function _delete($_key) | 
| 144 | 144 |  	{
 | 
| 145 | 145 | $cache_file = $this->getCacheFileName($_key); | 
| 146 | -		if(function_exists('opcache_invalidate'))
 | |
| 146 | +		if (function_exists('opcache_invalidate'))
 | |
| 147 | 147 |  		{
 | 
| 148 | 148 | @opcache_invalidate($cache_file, true); | 
| 149 | 149 | } | 
| @@ -157,7 +157,7 @@ discard block | ||
| 157 | 157 | /** | 
| 158 | 158 | * returns static context object (Singleton). It's to use Context without declaration of an object | 
| 159 | 159 | * | 
| 160 | - * @return object Instance | |
| 160 | + * @return Context Instance | |
| 161 | 161 | */ | 
| 162 | 162 | function &getInstance() | 
| 163 | 163 |  	{ | 
| @@ -722,7 +722,7 @@ discard block | ||
| 722 | 722 | /** | 
| 723 | 723 | * Get FTP information | 
| 724 | 724 | * | 
| 725 | - * @return object FTP information | |
| 725 | + * @return string FTP information | |
| 726 | 726 | */ | 
| 727 | 727 | function getFTPInfo() | 
| 728 | 728 |  	{ | 
| @@ -867,6 +867,7 @@ discard block | ||
| 867 | 867 | * Evaluation of xml language file | 
| 868 | 868 | * | 
| 869 | 869 | * @param string Path of the language file | 
| 870 | + * @param string $path | |
| 870 | 871 | * @return void | 
| 871 | 872 | */ | 
| 872 | 873 | function _evalxmlLang($path) | 
| @@ -1006,7 +1007,7 @@ discard block | ||
| 1006 | 1007 | /** | 
| 1007 | 1008 | * Convert strings of variables in $source_object into UTF-8 | 
| 1008 | 1009 | * | 
| 1009 | - * @param object $source_obj Conatins strings to convert | |
| 1010 | + * @param stdClass $source_obj Conatins strings to convert | |
| 1010 | 1011 | * @return object converted object | 
| 1011 | 1012 | */ | 
| 1012 | 1013 | function convertEncoding($source_obj) | 
| @@ -1044,11 +1045,11 @@ discard block | ||
| 1044 | 1045 | /** | 
| 1045 | 1046 | * Check flag | 
| 1046 | 1047 | * | 
| 1047 | - * @param mixed $val | |
| 1048 | + * @param boolean $val | |
| 1048 | 1049 | * @param string $key | 
| 1049 | 1050 | * @param mixed $charset charset | 
| 1050 | 1051 | * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 | 
| 1051 | - * @return void | |
| 1052 | + * @return null|boolean | |
| 1052 | 1053 | */ | 
| 1053 | 1054 | function checkConvertFlag(&$val, $key = null, $charset = null) | 
| 1054 | 1055 |  	{ | 
| @@ -1101,6 +1102,9 @@ discard block | ||
| 1101 | 1102 | return $obj->str; | 
| 1102 | 1103 | } | 
| 1103 | 1104 | |
| 1105 | + /** | |
| 1106 | + * @return string | |
| 1107 | + */ | |
| 1104 | 1108 | function decodeIdna($domain) | 
| 1105 | 1109 |  	{ | 
| 1106 | 1110 | if(strpos($domain, 'xn--') !== FALSE) | 
| @@ -1314,7 +1318,7 @@ discard block | ||
| 1314 | 1318 | * | 
| 1315 | 1319 | * @param string $key Variable key | 
| 1316 | 1320 | * @param object $val Variable value | 
| 1317 | - * @return mixed filtered value | |
| 1321 | + * @return string filtered value | |
| 1318 | 1322 | */ | 
| 1319 | 1323 | function _filterXmlVars($key, $val) | 
| 1320 | 1324 |  	{ | 
| @@ -1366,7 +1370,7 @@ discard block | ||
| 1366 | 1370 | * @see Cast variables, such as _srl, page, and cpage, into interger | 
| 1367 | 1371 | * @param string $key Variable key | 
| 1368 | 1372 | * @param string $val Variable value | 
| 1369 | - * @param string $do_stripslashes Whether to strip slashes | |
| 1373 | + * @param integer $do_stripslashes Whether to strip slashes | |
| 1370 | 1374 | * @return mixed filtered value. Type are string or array | 
| 1371 | 1375 | */ | 
| 1372 | 1376 | function _filterRequestVar($key, $val, $do_stripslashes = 1) | 
| @@ -1865,7 +1869,7 @@ discard block | ||
| 1865 | 1869 | * | 
| 1866 | 1870 | * @param string $key Key | 
| 1867 | 1871 | * @param string $val Value | 
| 1868 | - * @param mixed $set_to_get_vars If not FALSE, Set to get vars. | |
| 1872 | + * @param integer $set_to_get_vars If not FALSE, Set to get vars. | |
| 1869 | 1873 | * @return void | 
| 1870 | 1874 | */ | 
| 1871 | 1875 | function set($key, $val, $set_to_get_vars = 0) | 
| @@ -1907,7 +1911,7 @@ discard block | ||
| 1907 | 1911 | /** | 
| 1908 | 1912 | * Get one more vars in object vars with given arguments(key1, key2, key3,...) | 
| 1909 | 1913 | * | 
| 1910 | - * @return object | |
| 1914 | + * @return null|stdClass | |
| 1911 | 1915 | */ | 
| 1912 | 1916 | function gets() | 
| 1913 | 1917 |  	{ | 
| @@ -1980,7 +1984,7 @@ discard block | ||
| 1980 | 1984 | /** | 
| 1981 | 1985 | * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js | 
| 1982 | 1986 | * | 
| 1983 | - * @param string $action act name | |
| 1987 | + * @param string[] $action_array | |
| 1984 | 1988 | * @return void | 
| 1985 | 1989 | */ | 
| 1986 | 1990 | function addSSLActions($action_array) | 
| @@ -2150,7 +2154,7 @@ discard block | ||
| 2150 | 2154 | * @param string $file File name with path | 
| 2151 | 2155 | * @param string $optimized optimized (That seems to not use) | 
| 2152 | 2156 | * @param string $targetie target IE | 
| 2153 | - * @param string $index index | |
| 2157 | + * @param integer $index index | |
| 2154 | 2158 | * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>) | 
| 2155 | 2159 | * @param bool $isRuleset Use ruleset | 
| 2156 | 2160 | * @param string $autoPath If path not readed, set the path automatically. | 
| @@ -2260,7 +2264,7 @@ discard block | ||
| 2260 | 2264 | * @param string $optimized optimized (That seems to not use) | 
| 2261 | 2265 | * @param string $media Media query | 
| 2262 | 2266 | * @param string $targetie target IE | 
| 2263 | - * @param string $index index | |
| 2267 | + * @param integer $index index | |
| 2264 | 2268 | * @return void | 
| 2265 | 2269 | * | 
| 2266 | 2270 | */ | 
| @@ -1094,7 +1094,7 @@ | ||
| 1094 | 1094 | */ | 
| 1095 | 1095 | function convertEncodingStr($str) | 
| 1096 | 1096 |  	{ | 
| 1097 | - if(!$str) return null; | |
| 1097 | + if(!$str) return null; | |
| 1098 | 1098 | $obj = new stdClass(); | 
| 1099 | 1099 | $obj->str = $str; | 
| 1100 | 1100 | $obj = self::convertEncoding($obj); | 
| @@ -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'); | 
| @@ -341,11 +341,11 @@ discard block | ||
| 341 | 341 | ); | 
| 342 | 342 | } | 
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); | |
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess); | |
| 345 | 345 | session_start(); | 
| 346 | 346 | |
| 347 | 347 | // set authentication information in Context and session | 
| 348 | - if(self::isInstalled()) | |
| 348 | + if (self::isInstalled()) | |
| 349 | 349 |  		{ | 
| 350 | 350 |  			$oModuleModel = getModel('module'); | 
| 351 | 351 | $oModuleModel->loadModuleExtends(); | 
| @@ -353,15 +353,15 @@ discard block | ||
| 353 | 353 |  			$oMemberModel = getModel('member'); | 
| 354 | 354 |  			$oMemberController = getController('member'); | 
| 355 | 355 | |
| 356 | - if($oMemberController && $oMemberModel) | |
| 356 | + if ($oMemberController && $oMemberModel) | |
| 357 | 357 |  			{ | 
| 358 | 358 | // if signed in, validate it. | 
| 359 | - if($oMemberModel->isLogged()) | |
| 359 | + if ($oMemberModel->isLogged()) | |
| 360 | 360 |  				{ | 
| 361 | 361 | $oMemberController->setSessionInfo(); | 
| 362 | 362 | } | 
| 363 | 363 | // check auto sign-in | 
| 364 | - elseif($_COOKIE['xeak']) | |
| 364 | + elseif ($_COOKIE['xeak']) | |
| 365 | 365 |  				{ | 
| 366 | 366 | $oMemberController->doAutologin(); | 
| 367 | 367 | } | 
| @@ -373,7 +373,7 @@ discard block | ||
| 373 | 373 | |
| 374 | 374 | // load common language file | 
| 375 | 375 | $this->lang = &$GLOBALS['lang']; | 
| 376 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); | |
| 376 | + $this->loadLang(_XE_PATH_.'common/lang/'); | |
| 377 | 377 | |
| 378 | 378 | // check if using rewrite module | 
| 379 | 379 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); | 
| @@ -381,28 +381,28 @@ discard block | ||
| 381 | 381 | // set locations for javascript use | 
| 382 | 382 | $url = array(); | 
| 383 | 383 | $current_url = self::getRequestUri(); | 
| 384 | - if($_SERVER['REQUEST_METHOD'] == 'GET') | |
| 384 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') | |
| 385 | 385 |  		{ | 
| 386 | - if($this->get_vars) | |
| 386 | + if ($this->get_vars) | |
| 387 | 387 |  			{ | 
| 388 | 388 | $url = array(); | 
| 389 | - foreach($this->get_vars as $key => $val) | |
| 389 | + foreach ($this->get_vars as $key => $val) | |
| 390 | 390 |  				{ | 
| 391 | - if(is_array($val) && count($val) > 0) | |
| 391 | + if (is_array($val) && count($val) > 0) | |
| 392 | 392 |  					{ | 
| 393 | - foreach($val as $k => $v) | |
| 393 | + foreach ($val as $k => $v) | |
| 394 | 394 |  						{ | 
| 395 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); | |
| 395 | + $url[] = $key.'['.$k.']='.urlencode($v); | |
| 396 | 396 | } | 
| 397 | 397 | } | 
| 398 | - elseif($val) | |
| 398 | + elseif ($val) | |
| 399 | 399 |  					{ | 
| 400 | - $url[] = $key . '=' . urlencode($val); | |
| 400 | + $url[] = $key.'='.urlencode($val); | |
| 401 | 401 | } | 
| 402 | 402 | } | 
| 403 | 403 | |
| 404 | 404 | $current_url = self::getRequestUri(); | 
| 405 | -				if($url) $current_url .= '?' . join('&', $url); | |
| 405 | +				if ($url) $current_url .= '?'.join('&', $url); | |
| 406 | 406 | } | 
| 407 | 407 | else | 
| 408 | 408 |  			{ | 
| @@ -417,12 +417,12 @@ discard block | ||
| 417 | 417 |  		$this->set('current_url', $current_url); | 
| 418 | 418 |  		$this->set('request_uri', self::getRequestUri()); | 
| 419 | 419 | |
| 420 | - if(strpos($current_url, 'xn--') !== FALSE) | |
| 420 | + if (strpos($current_url, 'xn--') !== FALSE) | |
| 421 | 421 |  		{ | 
| 422 | 422 |  			$this->set('current_url', self::decodeIdna($current_url)); | 
| 423 | 423 | } | 
| 424 | 424 | |
| 425 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) | |
| 425 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) | |
| 426 | 426 |  		{ | 
| 427 | 427 |  			$this->set('request_uri', self::decodeIdna(self::getRequestUri())); | 
| 428 | 428 | } | 
| @@ -447,7 +447,7 @@ discard block | ||
| 447 | 447 |  	{ | 
| 448 | 448 | $self = self::getInstance(); | 
| 449 | 449 | |
| 450 | - if(!$self->isInstalled()) | |
| 450 | + if (!$self->isInstalled()) | |
| 451 | 451 |  		{ | 
| 452 | 452 | return; | 
| 453 | 453 | } | 
| @@ -455,7 +455,7 @@ discard block | ||
| 455 | 455 | include($self::getConfigFile()); | 
| 456 | 456 | |
| 457 | 457 | // If master_db information does not exist, the config file needs to be updated | 
| 458 | - if(!isset($db_info->master_db)) | |
| 458 | + if (!isset($db_info->master_db)) | |
| 459 | 459 |  		{ | 
| 460 | 460 | $db_info->master_db = array(); | 
| 461 | 461 | $db_info->master_db["db_type"] = $db_info->db_type; | 
| @@ -473,7 +473,7 @@ discard block | ||
| 473 | 473 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; | 
| 474 | 474 | unset($db_info->db_table_prefix); | 
| 475 | 475 | |
| 476 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) | |
| 476 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) | |
| 477 | 477 |  			{ | 
| 478 | 478 | $db_info->master_db["db_table_prefix"] .= '_'; | 
| 479 | 479 | } | 
| @@ -485,33 +485,33 @@ discard block | ||
| 485 | 485 | $oInstallController->makeConfigFile(); | 
| 486 | 486 | } | 
| 487 | 487 | |
| 488 | - if(!$db_info->use_prepared_statements) | |
| 488 | + if (!$db_info->use_prepared_statements) | |
| 489 | 489 |  		{ | 
| 490 | 490 | $db_info->use_prepared_statements = 'Y'; | 
| 491 | 491 | } | 
| 492 | 492 | |
| 493 | - if(!$db_info->time_zone) | |
| 493 | + if (!$db_info->time_zone) | |
| 494 | 494 |  			$db_info->time_zone = date('O'); | 
| 495 | 495 | $GLOBALS['_time_zone'] = $db_info->time_zone; | 
| 496 | 496 | |
| 497 | - if($db_info->qmail_compatibility != 'Y') | |
| 497 | + if ($db_info->qmail_compatibility != 'Y') | |
| 498 | 498 | $db_info->qmail_compatibility = 'N'; | 
| 499 | 499 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; | 
| 500 | 500 | |
| 501 | - if(!$db_info->use_db_session) | |
| 501 | + if (!$db_info->use_db_session) | |
| 502 | 502 | $db_info->use_db_session = 'N'; | 
| 503 | - if(!$db_info->use_ssl) | |
| 503 | + if (!$db_info->use_ssl) | |
| 504 | 504 | $db_info->use_ssl = 'none'; | 
| 505 | 505 |  		$this->set('_use_ssl', $db_info->use_ssl); | 
| 506 | 506 | |
| 507 | 507 |  		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); | 
| 508 | 508 |  		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); | 
| 509 | 509 | |
| 510 | -		if(!$db_info->sitelock_whitelist) { | |
| 510 | +		if (!$db_info->sitelock_whitelist) { | |
| 511 | 511 | $db_info->sitelock_whitelist = '127.0.0.1'; | 
| 512 | 512 | } | 
| 513 | 513 | |
| 514 | -		if(is_string($db_info->sitelock_whitelist)) { | |
| 514 | +		if (is_string($db_info->sitelock_whitelist)) { | |
| 515 | 515 |  			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); | 
| 516 | 516 | } | 
| 517 | 517 | |
| @@ -582,10 +582,10 @@ discard block | ||
| 582 | 582 | function loadLangSupported() | 
| 583 | 583 |  	{ | 
| 584 | 584 | static $lang_supported = null; | 
| 585 | - if(!$lang_supported) | |
| 585 | + if (!$lang_supported) | |
| 586 | 586 |  		{ | 
| 587 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); | |
| 588 | - foreach($langs as $val) | |
| 587 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); | |
| 588 | + foreach ($langs as $val) | |
| 589 | 589 |  			{ | 
| 590 | 590 |  				list($lang_prefix, $lang_text) = explode(',', $val); | 
| 591 | 591 | $lang_text = trim($lang_text); | 
| @@ -603,17 +603,17 @@ discard block | ||
| 603 | 603 | function loadLangSelected() | 
| 604 | 604 |  	{ | 
| 605 | 605 | static $lang_selected = null; | 
| 606 | - if(!$lang_selected) | |
| 606 | + if (!$lang_selected) | |
| 607 | 607 |  		{ | 
| 608 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; | |
| 609 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; | |
| 610 | - if(!FileHandler::hasContent($selected_lang_file)) | |
| 608 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; | |
| 609 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; | |
| 610 | + if (!FileHandler::hasContent($selected_lang_file)) | |
| 611 | 611 |  			{ | 
| 612 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; | |
| 612 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; | |
| 613 | 613 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); | 
| 614 | 614 | } | 
| 615 | 615 | |
| 616 | - if(!FileHandler::hasContent($selected_lang_file)) | |
| 616 | + if (!FileHandler::hasContent($selected_lang_file)) | |
| 617 | 617 |  			{ | 
| 618 | 618 | $buff = FileHandler::readFile($orig_lang_file); | 
| 619 | 619 | FileHandler::writeFile($selected_lang_file, $buff); | 
| @@ -622,7 +622,7 @@ discard block | ||
| 622 | 622 | else | 
| 623 | 623 |  			{ | 
| 624 | 624 | $langs = file($selected_lang_file); | 
| 625 | - foreach($langs as $val) | |
| 625 | + foreach ($langs as $val) | |
| 626 | 626 |  				{ | 
| 627 | 627 |  					list($lang_prefix, $lang_text) = explode(',', $val); | 
| 628 | 628 | $lang_text = trim($lang_text); | 
| @@ -641,56 +641,56 @@ discard block | ||
| 641 | 641 | function checkSSO() | 
| 642 | 642 |  	{ | 
| 643 | 643 | // pass if it's not GET request or XE is not yet installed | 
| 644 | - if($this->db_info->use_sso != 'Y' || isCrawler()) | |
| 644 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) | |
| 645 | 645 |  		{ | 
| 646 | 646 | return TRUE; | 
| 647 | 647 | } | 
| 648 | 648 |  		$checkActList = array('rss' => 1, 'atom' => 1); | 
| 649 | -		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) | |
| 649 | +		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) | |
| 650 | 650 |  		{ | 
| 651 | 651 | return TRUE; | 
| 652 | 652 | } | 
| 653 | 653 | |
| 654 | 654 | // pass if default URL is not set | 
| 655 | 655 | $default_url = trim($this->db_info->default_url); | 
| 656 | - if(!$default_url) | |
| 656 | + if (!$default_url) | |
| 657 | 657 |  		{ | 
| 658 | 658 | return TRUE; | 
| 659 | 659 | } | 
| 660 | 660 | |
| 661 | - if(substr_compare($default_url, '/', -1) !== 0) | |
| 661 | + if (substr_compare($default_url, '/', -1) !== 0) | |
| 662 | 662 |  		{ | 
| 663 | 663 | $default_url .= '/'; | 
| 664 | 664 | } | 
| 665 | 665 | |
| 666 | 666 | // for sites recieving SSO valdiation | 
| 667 | - if($default_url == self::getRequestUri()) | |
| 667 | + if ($default_url == self::getRequestUri()) | |
| 668 | 668 |  		{ | 
| 669 | -			if(self::get('url')) | |
| 669 | +			if (self::get('url')) | |
| 670 | 670 |  			{ | 
| 671 | 671 |  				$url = base64_decode(self::get('url')); | 
| 672 | 672 | $url_info = parse_url($url); | 
| 673 | -				if(!Password::checkSignature($url, self::get('sig'))) | |
| 673 | +				if (!Password::checkSignature($url, self::get('sig'))) | |
| 674 | 674 |  				{ | 
| 675 | 675 |  					echo self::get('lang')->msg_invalid_request; | 
| 676 | 676 | return false; | 
| 677 | 677 | } | 
| 678 | 678 | |
| 679 | 679 |  				$oModuleModel = getModel('module'); | 
| 680 | - $domain = $url_info['host'] . $url_info['path']; | |
| 681 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); | |
| 680 | + $domain = $url_info['host'].$url_info['path']; | |
| 681 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); | |
| 682 | 682 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); | 
| 683 | 683 | |
| 684 | - if($site_info->site_srl) | |
| 684 | + if ($site_info->site_srl) | |
| 685 | 685 |  				{ | 
| 686 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); | |
| 687 | -				$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']); | |
| 686 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); | |
| 687 | +				$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']); | |
| 688 | 688 | } | 
| 689 | 689 | else | 
| 690 | 690 |  				{ | 
| 691 | 691 | $redirect_url = $url; | 
| 692 | 692 | } | 
| 693 | -				header('location:' . $redirect_url); | |
| 693 | +				header('location:'.$redirect_url); | |
| 694 | 694 | |
| 695 | 695 | return FALSE; | 
| 696 | 696 | } | 
| @@ -699,9 +699,9 @@ discard block | ||
| 699 | 699 | else | 
| 700 | 700 |  		{ | 
| 701 | 701 | // result handling : set session_name() | 
| 702 | -			if($session_name = self::get('SSOID')) | |
| 702 | +			if ($session_name = self::get('SSOID')) | |
| 703 | 703 |  			{ | 
| 704 | -				if(!Password::checkSignature($session_name, self::get('sig'))) | |
| 704 | +				if (!Password::checkSignature($session_name, self::get('sig'))) | |
| 705 | 705 |  				{ | 
| 706 | 706 |  					echo self::get('lang')->msg_invalid_request; | 
| 707 | 707 | return false; | 
| @@ -710,17 +710,17 @@ discard block | ||
| 710 | 710 | setcookie(session_name(), $session_name); | 
| 711 | 711 | |
| 712 | 712 |  				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); | 
| 713 | -				header('location:' . $url); | |
| 713 | +				header('location:'.$url); | |
| 714 | 714 | return FALSE; | 
| 715 | 715 | // send SSO request | 
| 716 | 716 | } | 
| 717 | -			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | |
| 717 | +			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | |
| 718 | 718 |  			{ | 
| 719 | 719 |  				setcookie('sso', md5(self::getRequestUri())); | 
| 720 | 720 | $origin_url = self::getRequestUrl(); | 
| 721 | 721 | $origin_sig = Password::createSignature($origin_url); | 
| 722 | 722 |  				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); | 
| 723 | -				header('location:' . $url); | |
| 723 | +				header('location:'.$url); | |
| 724 | 724 | return FALSE; | 
| 725 | 725 | } | 
| 726 | 726 | } | 
| @@ -747,7 +747,7 @@ discard block | ||
| 747 | 747 |  	{ | 
| 748 | 748 | $self = self::getInstance(); | 
| 749 | 749 | |
| 750 | - if(!$self->isFTPRegisted()) | |
| 750 | + if (!$self->isFTPRegisted()) | |
| 751 | 751 |  		{ | 
| 752 | 752 | return null; | 
| 753 | 753 | } | 
| @@ -765,15 +765,15 @@ discard block | ||
| 765 | 765 | */ | 
| 766 | 766 | function addBrowserTitle($site_title) | 
| 767 | 767 |  	{ | 
| 768 | - if(!$site_title) | |
| 768 | + if (!$site_title) | |
| 769 | 769 |  		{ | 
| 770 | 770 | return; | 
| 771 | 771 | } | 
| 772 | 772 | $self = self::getInstance(); | 
| 773 | 773 | |
| 774 | - if($self->site_title) | |
| 774 | + if ($self->site_title) | |
| 775 | 775 |  		{ | 
| 776 | - $self->site_title .= ' - ' . $site_title; | |
| 776 | + $self->site_title .= ' - '.$site_title; | |
| 777 | 777 | } | 
| 778 | 778 | else | 
| 779 | 779 |  		{ | 
| @@ -789,7 +789,7 @@ discard block | ||
| 789 | 789 | */ | 
| 790 | 790 | function setBrowserTitle($site_title) | 
| 791 | 791 |  	{ | 
| 792 | - if(!$site_title) | |
| 792 | + if (!$site_title) | |
| 793 | 793 |  		{ | 
| 794 | 794 | return; | 
| 795 | 795 | } | 
| @@ -821,7 +821,7 @@ discard block | ||
| 821 | 821 |  		$oModuleModel = getModel('module'); | 
| 822 | 822 |  		$moduleConfig = $oModuleModel->getModuleConfig('module'); | 
| 823 | 823 | |
| 824 | - if(isset($moduleConfig->siteTitle)) | |
| 824 | + if (isset($moduleConfig->siteTitle)) | |
| 825 | 825 |  		{ | 
| 826 | 826 | return $moduleConfig->siteTitle; | 
| 827 | 827 | } | 
| @@ -848,30 +848,30 @@ discard block | ||
| 848 | 848 | global $lang; | 
| 849 | 849 | |
| 850 | 850 | $self = self::getInstance(); | 
| 851 | - if(!$self->lang_type) | |
| 851 | + if (!$self->lang_type) | |
| 852 | 852 |  		{ | 
| 853 | 853 | return; | 
| 854 | 854 | } | 
| 855 | - if(!is_object($lang)) | |
| 855 | + if (!is_object($lang)) | |
| 856 | 856 |  		{ | 
| 857 | 857 | $lang = new stdClass; | 
| 858 | 858 | } | 
| 859 | 859 | |
| 860 | - if(!($filename = $self->_loadXmlLang($path))) | |
| 860 | + if (!($filename = $self->_loadXmlLang($path))) | |
| 861 | 861 |  		{ | 
| 862 | 862 | $filename = $self->_loadPhpLang($path); | 
| 863 | 863 | } | 
| 864 | 864 | |
| 865 | - if(!is_array($self->loaded_lang_files)) | |
| 865 | + if (!is_array($self->loaded_lang_files)) | |
| 866 | 866 |  		{ | 
| 867 | 867 | $self->loaded_lang_files = array(); | 
| 868 | 868 | } | 
| 869 | - if(in_array($filename, $self->loaded_lang_files)) | |
| 869 | + if (in_array($filename, $self->loaded_lang_files)) | |
| 870 | 870 |  		{ | 
| 871 | 871 | return; | 
| 872 | 872 | } | 
| 873 | 873 | |
| 874 | - if($filename && is_readable($filename)) | |
| 874 | + if ($filename && is_readable($filename)) | |
| 875 | 875 |  		{ | 
| 876 | 876 | $self->loaded_lang_files[] = $filename; | 
| 877 | 877 | include($filename); | 
| @@ -892,24 +892,24 @@ discard block | ||
| 892 | 892 |  	{ | 
| 893 | 893 | global $lang; | 
| 894 | 894 | |
| 895 | - if(!$path) return; | |
| 895 | + if (!$path) return; | |
| 896 | 896 | |
| 897 | - $_path = 'eval://' . $path; | |
| 897 | + $_path = 'eval://'.$path; | |
| 898 | 898 | |
| 899 | - if(in_array($_path, $this->loaded_lang_files)) | |
| 899 | + if (in_array($_path, $this->loaded_lang_files)) | |
| 900 | 900 |  		{ | 
| 901 | 901 | return; | 
| 902 | 902 | } | 
| 903 | 903 | |
| 904 | - if(substr_compare($path, '/', -1) !== 0) | |
| 904 | + if (substr_compare($path, '/', -1) !== 0) | |
| 905 | 905 |  		{ | 
| 906 | 906 | $path .= '/'; | 
| 907 | 907 | } | 
| 908 | 908 | |
| 909 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); | |
| 909 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); | |
| 910 | 910 | $content = $oXmlLangParser->getCompileContent(); | 
| 911 | 911 | |
| 912 | - if($content) | |
| 912 | + if ($content) | |
| 913 | 913 |  		{ | 
| 914 | 914 | $this->loaded_lang_files[] = $_path; | 
| 915 | 915 | eval($content); | 
| @@ -924,9 +924,9 @@ discard block | ||
| 924 | 924 | */ | 
| 925 | 925 | function _loadXmlLang($path) | 
| 926 | 926 |  	{ | 
| 927 | - if(!$path) return; | |
| 927 | + if (!$path) return; | |
| 928 | 928 | |
| 929 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); | |
| 929 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); | |
| 930 | 930 | return $oXmlLangParser->compile(); | 
| 931 | 931 | } | 
| 932 | 932 | |
| @@ -938,22 +938,22 @@ discard block | ||
| 938 | 938 | */ | 
| 939 | 939 | function _loadPhpLang($path) | 
| 940 | 940 |  	{ | 
| 941 | - if(!$path) return; | |
| 941 | + if (!$path) return; | |
| 942 | 942 | |
| 943 | - if(substr_compare($path, '/', -1) !== 0) | |
| 943 | + if (substr_compare($path, '/', -1) !== 0) | |
| 944 | 944 |  		{ | 
| 945 | 945 | $path .= '/'; | 
| 946 | 946 | } | 
| 947 | - $path_tpl = $path . '%s.lang.php'; | |
| 947 | + $path_tpl = $path.'%s.lang.php'; | |
| 948 | 948 | $file = sprintf($path_tpl, $this->lang_type); | 
| 949 | 949 | |
| 950 | 950 |  		$langs = array('ko', 'en'); // this will be configurable. | 
| 951 | - while(!is_readable($file) && $langs[0]) | |
| 951 | + while (!is_readable($file) && $langs[0]) | |
| 952 | 952 |  		{ | 
| 953 | 953 | $file = sprintf($path_tpl, array_shift($langs)); | 
| 954 | 954 | } | 
| 955 | 955 | |
| 956 | - if(!is_readable($file)) | |
| 956 | + if (!is_readable($file)) | |
| 957 | 957 |  		{ | 
| 958 | 958 | return FALSE; | 
| 959 | 959 | } | 
| @@ -995,11 +995,11 @@ discard block | ||
| 995 | 995 | */ | 
| 996 | 996 | function getLang($code) | 
| 997 | 997 |  	{ | 
| 998 | - if(!$code) | |
| 998 | + if (!$code) | |
| 999 | 999 |  		{ | 
| 1000 | 1000 | return; | 
| 1001 | 1001 | } | 
| 1002 | -		if($GLOBALS['lang']->{$code}) | |
| 1002 | +		if ($GLOBALS['lang']->{$code}) | |
| 1003 | 1003 |  		{ | 
| 1004 | 1004 |  			return $GLOBALS['lang']->{$code}; | 
| 1005 | 1005 | } | 
| @@ -1015,7 +1015,7 @@ discard block | ||
| 1015 | 1015 | */ | 
| 1016 | 1016 | function setLang($code, $val) | 
| 1017 | 1017 |  	{ | 
| 1018 | - if(!isset($GLOBALS['lang'])) | |
| 1018 | + if (!isset($GLOBALS['lang'])) | |
| 1019 | 1019 |  		{ | 
| 1020 | 1020 | $GLOBALS['lang'] = new stdClass(); | 
| 1021 | 1021 | } | 
| @@ -1043,17 +1043,17 @@ discard block | ||
| 1043 | 1043 | |
| 1044 | 1044 | $obj = clone $source_obj; | 
| 1045 | 1045 | |
| 1046 | - foreach($charset_list as $charset) | |
| 1046 | + foreach ($charset_list as $charset) | |
| 1047 | 1047 |  		{ | 
| 1048 | - array_walk($obj,'Context::checkConvertFlag',$charset); | |
| 1048 | + array_walk($obj, 'Context::checkConvertFlag', $charset); | |
| 1049 | 1049 | $flag = self::checkConvertFlag($flag = TRUE); | 
| 1050 | - if($flag) | |
| 1050 | + if ($flag) | |
| 1051 | 1051 |  			{ | 
| 1052 | - if($charset == 'UTF-8') | |
| 1052 | + if ($charset == 'UTF-8') | |
| 1053 | 1053 |  				{ | 
| 1054 | 1054 | return $obj; | 
| 1055 | 1055 | } | 
| 1056 | - array_walk($obj,'Context::doConvertEncoding',$charset); | |
| 1056 | + array_walk($obj, 'Context::doConvertEncoding', $charset); | |
| 1057 | 1057 | return $obj; | 
| 1058 | 1058 | } | 
| 1059 | 1059 | } | 
| @@ -1072,11 +1072,11 @@ discard block | ||
| 1072 | 1072 | function checkConvertFlag(&$val, $key = null, $charset = null) | 
| 1073 | 1073 |  	{ | 
| 1074 | 1074 | static $flag = TRUE; | 
| 1075 | - if($charset) | |
| 1075 | + if ($charset) | |
| 1076 | 1076 |  		{ | 
| 1077 | - if(is_array($val)) | |
| 1078 | - array_walk($val,'Context::checkConvertFlag',$charset); | |
| 1079 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; | |
| 1077 | + if (is_array($val)) | |
| 1078 | + array_walk($val, 'Context::checkConvertFlag', $charset); | |
| 1079 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; | |
| 1080 | 1080 | else $flag = FALSE; | 
| 1081 | 1081 | } | 
| 1082 | 1082 | else | 
| @@ -1100,9 +1100,9 @@ discard block | ||
| 1100 | 1100 |  	{ | 
| 1101 | 1101 | if (is_array($val)) | 
| 1102 | 1102 |  		{ | 
| 1103 | - array_walk($val,'Context::doConvertEncoding',$charset); | |
| 1103 | + array_walk($val, 'Context::doConvertEncoding', $charset); | |
| 1104 | 1104 | } | 
| 1105 | - else $val = iconv($charset,'UTF-8',$val); | |
| 1105 | + else $val = iconv($charset, 'UTF-8', $val); | |
| 1106 | 1106 | } | 
| 1107 | 1107 | |
| 1108 | 1108 | /** | 
| @@ -1113,7 +1113,7 @@ discard block | ||
| 1113 | 1113 | */ | 
| 1114 | 1114 | function convertEncodingStr($str) | 
| 1115 | 1115 |  	{ | 
| 1116 | - if(!$str) return null; | |
| 1116 | + if (!$str) return null; | |
| 1117 | 1117 | $obj = new stdClass(); | 
| 1118 | 1118 | $obj->str = $str; | 
| 1119 | 1119 | $obj = self::convertEncoding($obj); | 
| @@ -1122,9 +1122,9 @@ discard block | ||
| 1122 | 1122 | |
| 1123 | 1123 | function decodeIdna($domain) | 
| 1124 | 1124 |  	{ | 
| 1125 | - if(strpos($domain, 'xn--') !== FALSE) | |
| 1125 | + if (strpos($domain, 'xn--') !== FALSE) | |
| 1126 | 1126 |  		{ | 
| 1127 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); | |
| 1127 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); | |
| 1128 | 1128 |  			$IDN = new idna_convert(array('idn_version' => 2008)); | 
| 1129 | 1129 | $domain = $IDN->decode($domain); | 
| 1130 | 1130 | } | 
| @@ -1155,7 +1155,7 @@ discard block | ||
| 1155 | 1155 |  	{ | 
| 1156 | 1156 | $self = self::getInstance(); | 
| 1157 | 1157 | |
| 1158 | - if($self->response_method) | |
| 1158 | + if ($self->response_method) | |
| 1159 | 1159 |  		{ | 
| 1160 | 1160 | return $self->response_method; | 
| 1161 | 1161 | } | 
| @@ -1195,7 +1195,7 @@ discard block | ||
| 1195 | 1195 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); | 
| 1196 | 1196 | |
| 1197 | 1197 |  		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; | 
| 1198 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) | |
| 1198 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) | |
| 1199 | 1199 |  		{ | 
| 1200 | 1200 | $this->isSuccessInit = FALSE; | 
| 1201 | 1201 | } | 
| @@ -1208,30 +1208,30 @@ discard block | ||
| 1208 | 1208 | */ | 
| 1209 | 1209 | function _setRequestArgument() | 
| 1210 | 1210 |  	{ | 
| 1211 | - if(!count($_REQUEST)) | |
| 1211 | + if (!count($_REQUEST)) | |
| 1212 | 1212 |  		{ | 
| 1213 | 1213 | return; | 
| 1214 | 1214 | } | 
| 1215 | 1215 | |
| 1216 | 1216 | $requestMethod = $this->getRequestMethod(); | 
| 1217 | - foreach($_REQUEST as $key => $val) | |
| 1217 | + foreach ($_REQUEST as $key => $val) | |
| 1218 | 1218 |  		{ | 
| 1219 | - if($val === '' || self::get($key)) | |
| 1219 | + if ($val === '' || self::get($key)) | |
| 1220 | 1220 |  			{ | 
| 1221 | 1221 | continue; | 
| 1222 | 1222 | } | 
| 1223 | 1223 | $key = htmlentities($key); | 
| 1224 | 1224 | $val = $this->_filterRequestVar($key, $val); | 
| 1225 | 1225 | |
| 1226 | - if($requestMethod == 'GET' && isset($_GET[$key])) | |
| 1226 | + if ($requestMethod == 'GET' && isset($_GET[$key])) | |
| 1227 | 1227 |  			{ | 
| 1228 | 1228 | $set_to_vars = TRUE; | 
| 1229 | 1229 | } | 
| 1230 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) | |
| 1230 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) | |
| 1231 | 1231 |  			{ | 
| 1232 | 1232 | $set_to_vars = TRUE; | 
| 1233 | 1233 | } | 
| 1234 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) | |
| 1234 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) | |
| 1235 | 1235 |  			{ | 
| 1236 | 1236 | $set_to_vars = TRUE; | 
| 1237 | 1237 | } | 
| @@ -1240,7 +1240,7 @@ discard block | ||
| 1240 | 1240 | $set_to_vars = FALSE; | 
| 1241 | 1241 | } | 
| 1242 | 1242 | |
| 1243 | - if($set_to_vars) | |
| 1243 | + if ($set_to_vars) | |
| 1244 | 1244 |  			{ | 
| 1245 | 1245 | $this->_recursiveCheckVar($val); | 
| 1246 | 1246 | } | 
| @@ -1251,20 +1251,20 @@ discard block | ||
| 1251 | 1251 | |
| 1252 | 1252 | function _recursiveCheckVar($val) | 
| 1253 | 1253 |  	{ | 
| 1254 | - if(is_string($val)) | |
| 1254 | + if (is_string($val)) | |
| 1255 | 1255 |  		{ | 
| 1256 | - foreach($this->patterns as $pattern) | |
| 1256 | + foreach ($this->patterns as $pattern) | |
| 1257 | 1257 |  			{ | 
| 1258 | - if(preg_match($pattern, $val)) | |
| 1258 | + if (preg_match($pattern, $val)) | |
| 1259 | 1259 |  				{ | 
| 1260 | 1260 | $this->isSuccessInit = FALSE; | 
| 1261 | 1261 | return; | 
| 1262 | 1262 | } | 
| 1263 | 1263 | } | 
| 1264 | 1264 | } | 
| 1265 | - else if(is_array($val)) | |
| 1265 | + else if (is_array($val)) | |
| 1266 | 1266 |  		{ | 
| 1267 | - foreach($val as $val2) | |
| 1267 | + foreach ($val as $val2) | |
| 1268 | 1268 |  			{ | 
| 1269 | 1269 | $this->_recursiveCheckVar($val2); | 
| 1270 | 1270 | } | 
| @@ -1278,7 +1278,7 @@ discard block | ||
| 1278 | 1278 | */ | 
| 1279 | 1279 | function _setJSONRequestArgument() | 
| 1280 | 1280 |  	{ | 
| 1281 | - if($this->getRequestMethod() != 'JSON') | |
| 1281 | + if ($this->getRequestMethod() != 'JSON') | |
| 1282 | 1282 |  		{ | 
| 1283 | 1283 | return; | 
| 1284 | 1284 | } | 
| @@ -1286,7 +1286,7 @@ discard block | ||
| 1286 | 1286 | $params = array(); | 
| 1287 | 1287 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); | 
| 1288 | 1288 | |
| 1289 | - foreach($params as $key => $val) | |
| 1289 | + foreach ($params as $key => $val) | |
| 1290 | 1290 |  		{ | 
| 1291 | 1291 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); | 
| 1292 | 1292 | } | 
| @@ -1299,13 +1299,13 @@ discard block | ||
| 1299 | 1299 | */ | 
| 1300 | 1300 | function _setXmlRpcArgument() | 
| 1301 | 1301 |  	{ | 
| 1302 | - if($this->getRequestMethod() != 'XMLRPC') | |
| 1302 | + if ($this->getRequestMethod() != 'XMLRPC') | |
| 1303 | 1303 |  		{ | 
| 1304 | 1304 | return; | 
| 1305 | 1305 | } | 
| 1306 | 1306 | |
| 1307 | 1307 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; | 
| 1308 | - if(Security::detectingXEE($xml)) | |
| 1308 | + if (Security::detectingXEE($xml)) | |
| 1309 | 1309 |  		{ | 
| 1310 | 1310 |  			header("HTTP/1.0 400 Bad Request"); | 
| 1311 | 1311 | exit; | 
| @@ -1317,12 +1317,12 @@ discard block | ||
| 1317 | 1317 | $params = $xml_obj->methodcall->params; | 
| 1318 | 1318 | unset($params->node_name, $params->attrs, $params->body); | 
| 1319 | 1319 | |
| 1320 | - if(!count(get_object_vars($params))) | |
| 1320 | + if (!count(get_object_vars($params))) | |
| 1321 | 1321 |  		{ | 
| 1322 | 1322 | return; | 
| 1323 | 1323 | } | 
| 1324 | 1324 | |
| 1325 | - foreach($params as $key => $val) | |
| 1325 | + foreach ($params as $key => $val) | |
| 1326 | 1326 |  		{ | 
| 1327 | 1327 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); | 
| 1328 | 1328 | } | 
| @@ -1337,10 +1337,10 @@ discard block | ||
| 1337 | 1337 | */ | 
| 1338 | 1338 | function _filterXmlVars($key, $val) | 
| 1339 | 1339 |  	{ | 
| 1340 | - if(is_array($val)) | |
| 1340 | + if (is_array($val)) | |
| 1341 | 1341 |  		{ | 
| 1342 | 1342 | $stack = array(); | 
| 1343 | - foreach($val as $k => $v) | |
| 1343 | + foreach ($val as $k => $v) | |
| 1344 | 1344 |  			{ | 
| 1345 | 1345 | $stack[$k] = $this->_filterXmlVars($k, $v); | 
| 1346 | 1346 | } | 
| @@ -1350,20 +1350,20 @@ discard block | ||
| 1350 | 1350 | |
| 1351 | 1351 | $body = $val->body; | 
| 1352 | 1352 | unset($val->node_name, $val->attrs, $val->body); | 
| 1353 | - if(!count(get_object_vars($val))) | |
| 1353 | + if (!count(get_object_vars($val))) | |
| 1354 | 1354 |  		{ | 
| 1355 | 1355 | return $this->_filterRequestVar($key, $body, 0); | 
| 1356 | 1356 | } | 
| 1357 | 1357 | |
| 1358 | 1358 | $stack = new stdClass(); | 
| 1359 | - foreach($val as $k => $v) | |
| 1359 | + foreach ($val as $k => $v) | |
| 1360 | 1360 |  		{ | 
| 1361 | 1361 | $output = $this->_filterXmlVars($k, $v); | 
| 1362 | - if(is_object($v) && $v->attrs->type == 'array') | |
| 1362 | + if (is_object($v) && $v->attrs->type == 'array') | |
| 1363 | 1363 |  			{ | 
| 1364 | 1364 | $output = array($output); | 
| 1365 | 1365 | } | 
| 1366 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) | |
| 1366 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) | |
| 1367 | 1367 |  			{ | 
| 1368 | 1368 | return $output; | 
| 1369 | 1369 | } | 
| @@ -1371,7 +1371,7 @@ discard block | ||
| 1371 | 1371 |  			$stack->{$k} = $output; | 
| 1372 | 1372 | } | 
| 1373 | 1373 | |
| 1374 | - if(!count(get_object_vars($stack))) | |
| 1374 | + if (!count(get_object_vars($stack))) | |
| 1375 | 1375 |  		{ | 
| 1376 | 1376 | return NULL; | 
| 1377 | 1377 | } | 
| @@ -1390,32 +1390,32 @@ discard block | ||
| 1390 | 1390 | */ | 
| 1391 | 1391 | function _filterRequestVar($key, $val, $do_stripslashes = 1) | 
| 1392 | 1392 |  	{ | 
| 1393 | - if(!($isArray = is_array($val))) | |
| 1393 | + if (!($isArray = is_array($val))) | |
| 1394 | 1394 |  		{ | 
| 1395 | 1395 | $val = array($val); | 
| 1396 | 1396 | } | 
| 1397 | 1397 | |
| 1398 | 1398 | $result = array(); | 
| 1399 | - foreach($val as $k => $v) | |
| 1399 | + foreach ($val as $k => $v) | |
| 1400 | 1400 |  		{ | 
| 1401 | 1401 | $k = htmlentities($k); | 
| 1402 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) | |
| 1402 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) | |
| 1403 | 1403 |  			{ | 
| 1404 | 1404 |  				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; | 
| 1405 | 1405 | } | 
| 1406 | - elseif($key === 'mid' || $key === 'search_keyword') | |
| 1406 | + elseif ($key === 'mid' || $key === 'search_keyword') | |
| 1407 | 1407 |  			{ | 
| 1408 | 1408 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1409 | 1409 | } | 
| 1410 | - elseif($key === 'vid') | |
| 1410 | + elseif ($key === 'vid') | |
| 1411 | 1411 |  			{ | 
| 1412 | 1412 | $result[$k] = urlencode($v); | 
| 1413 | 1413 | } | 
| 1414 | - elseif($key === 'xe_validator_id') | |
| 1414 | + elseif ($key === 'xe_validator_id') | |
| 1415 | 1415 |  			{ | 
| 1416 | 1416 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1417 | 1417 | } | 
| 1418 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) | |
| 1418 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) | |
| 1419 | 1419 |  			{ | 
| 1420 | 1420 | unset($result[$k]); | 
| 1421 | 1421 | } | 
| @@ -1423,7 +1423,7 @@ discard block | ||
| 1423 | 1423 |  			{ | 
| 1424 | 1424 | $result[$k] = $v; | 
| 1425 | 1425 | |
| 1426 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) | |
| 1426 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) | |
| 1427 | 1427 |  				{ | 
| 1428 | 1428 | if (is_array($result[$k])) | 
| 1429 | 1429 |  					{ | 
| @@ -1435,7 +1435,7 @@ discard block | ||
| 1435 | 1435 | } | 
| 1436 | 1436 | } | 
| 1437 | 1437 | |
| 1438 | - if(is_array($result[$k])) | |
| 1438 | + if (is_array($result[$k])) | |
| 1439 | 1439 |  				{ | 
| 1440 | 1440 |  					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); | 
| 1441 | 1441 | } | 
| @@ -1467,17 +1467,17 @@ discard block | ||
| 1467 | 1467 | */ | 
| 1468 | 1468 | function _setUploadedArgument() | 
| 1469 | 1469 |  	{ | 
| 1470 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) | |
| 1470 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) | |
| 1471 | 1471 |  		{ | 
| 1472 | 1472 | return; | 
| 1473 | 1473 | } | 
| 1474 | 1474 | |
| 1475 | - foreach($_FILES as $key => $val) | |
| 1475 | + foreach ($_FILES as $key => $val) | |
| 1476 | 1476 |  		{ | 
| 1477 | 1477 | $tmp_name = $val['tmp_name']; | 
| 1478 | - if(!is_array($tmp_name)) | |
| 1478 | + if (!is_array($tmp_name)) | |
| 1479 | 1479 |  			{ | 
| 1480 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) | |
| 1480 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) | |
| 1481 | 1481 |  				{ | 
| 1482 | 1482 | continue; | 
| 1483 | 1483 | } | 
| @@ -1487,9 +1487,9 @@ discard block | ||
| 1487 | 1487 | } | 
| 1488 | 1488 | else | 
| 1489 | 1489 |  			{ | 
| 1490 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) | |
| 1490 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) | |
| 1491 | 1491 |  				{ | 
| 1492 | - if($val['size'][$i] > 0) | |
| 1492 | + if ($val['size'][$i] > 0) | |
| 1493 | 1493 |  					{ | 
| 1494 | 1494 | $file['name'] = $val['name'][$i]; | 
| 1495 | 1495 | $file['type'] = $val['type'][$i]; | 
| @@ -1521,16 +1521,16 @@ discard block | ||
| 1521 | 1521 | function getRequestUrl() | 
| 1522 | 1522 |  	{ | 
| 1523 | 1523 | static $url = null; | 
| 1524 | - if(is_null($url)) | |
| 1524 | + if (is_null($url)) | |
| 1525 | 1525 |  		{ | 
| 1526 | 1526 | $url = self::getRequestUri(); | 
| 1527 | - if(count($_GET) > 0) | |
| 1527 | + if (count($_GET) > 0) | |
| 1528 | 1528 |  			{ | 
| 1529 | - foreach($_GET as $key => $val) | |
| 1529 | + foreach ($_GET as $key => $val) | |
| 1530 | 1530 |  				{ | 
| 1531 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); | |
| 1531 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); | |
| 1532 | 1532 | } | 
| 1533 | -				$url .= '?' . join('&', $vars); | |
| 1533 | +				$url .= '?'.join('&', $vars); | |
| 1534 | 1534 | } | 
| 1535 | 1535 | } | 
| 1536 | 1536 | return $url; | 
| @@ -1545,7 +1545,7 @@ discard block | ||
| 1545 | 1545 | $self = self::getInstance(); | 
| 1546 | 1546 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; | 
| 1547 | 1547 | |
| 1548 | -		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) | |
| 1548 | +		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) | |
| 1549 | 1549 |  		{ | 
| 1550 | 1550 | unset($js_callback_func); | 
| 1551 | 1551 | unset($_GET['xe_js_callback']); | 
| @@ -1573,22 +1573,22 @@ discard block | ||
| 1573 | 1573 | $self = self::getInstance(); | 
| 1574 | 1574 | |
| 1575 | 1575 | // retrieve virtual site information | 
| 1576 | - if(is_null($site_module_info)) | |
| 1576 | + if (is_null($site_module_info)) | |
| 1577 | 1577 |  		{ | 
| 1578 | 1578 |  			$site_module_info = self::get('site_module_info'); | 
| 1579 | 1579 | } | 
| 1580 | 1580 | |
| 1581 | 1581 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) | 
| 1582 | - if($domain && isSiteID($domain)) | |
| 1582 | + if ($domain && isSiteID($domain)) | |
| 1583 | 1583 |  		{ | 
| 1584 | 1584 | $vid = $domain; | 
| 1585 | 1585 | $domain = ''; | 
| 1586 | 1586 | } | 
| 1587 | 1587 | |
| 1588 | 1588 | // If $domain, $vid are not set, use current site information | 
| 1589 | - if(!$domain && !$vid) | |
| 1589 | + if (!$domain && !$vid) | |
| 1590 | 1590 |  		{ | 
| 1591 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) | |
| 1591 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) | |
| 1592 | 1592 |  			{ | 
| 1593 | 1593 | $vid = $site_module_info->domain; | 
| 1594 | 1594 | } | 
| @@ -1599,21 +1599,21 @@ discard block | ||
| 1599 | 1599 | } | 
| 1600 | 1600 | |
| 1601 | 1601 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. | 
| 1602 | - if($domain) | |
| 1602 | + if ($domain) | |
| 1603 | 1603 |  		{ | 
| 1604 | 1604 | $domain_info = parse_url($domain); | 
| 1605 | - if(is_null($current_info)) | |
| 1605 | + if (is_null($current_info)) | |
| 1606 | 1606 |  			{ | 
| 1607 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); | |
| 1607 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); | |
| 1608 | 1608 | } | 
| 1609 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) | |
| 1609 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) | |
| 1610 | 1610 |  			{ | 
| 1611 | 1611 | unset($domain); | 
| 1612 | 1612 | } | 
| 1613 | 1613 | else | 
| 1614 | 1614 |  			{ | 
| 1615 | 1615 |  				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); | 
| 1616 | - if(substr_compare($domain, '/', -1) !== 0) | |
| 1616 | + if (substr_compare($domain, '/', -1) !== 0) | |
| 1617 | 1617 |  				{ | 
| 1618 | 1618 | $domain .= '/'; | 
| 1619 | 1619 | } | 
| @@ -1623,10 +1623,10 @@ discard block | ||
| 1623 | 1623 | $get_vars = array(); | 
| 1624 | 1624 | |
| 1625 | 1625 | // If there is no GET variables or first argument is '' to reset variables | 
| 1626 | - if(!$self->get_vars || $args_list[0] == '') | |
| 1626 | + if (!$self->get_vars || $args_list[0] == '') | |
| 1627 | 1627 |  		{ | 
| 1628 | 1628 | // rearrange args_list | 
| 1629 | - if(is_array($args_list) && $args_list[0] == '') | |
| 1629 | + if (is_array($args_list) && $args_list[0] == '') | |
| 1630 | 1630 |  			{ | 
| 1631 | 1631 | array_shift($args_list); | 
| 1632 | 1632 | } | 
| @@ -1638,13 +1638,13 @@ discard block | ||
| 1638 | 1638 | } | 
| 1639 | 1639 | |
| 1640 | 1640 | // arrange args_list | 
| 1641 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) | |
| 1641 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) | |
| 1642 | 1642 |  		{ | 
| 1643 | 1643 | $key = $args_list[$i]; | 
| 1644 | 1644 | $val = trim($args_list[$i + 1]); | 
| 1645 | 1645 | |
| 1646 | 1646 | // If value is not set, remove the key | 
| 1647 | - if(!isset($val) || !strlen($val)) | |
| 1647 | + if (!isset($val) || !strlen($val)) | |
| 1648 | 1648 |  			{ | 
| 1649 | 1649 | unset($get_vars[$key]); | 
| 1650 | 1650 | continue; | 
| @@ -1655,7 +1655,7 @@ discard block | ||
| 1655 | 1655 | |
| 1656 | 1656 | // remove vid, rnd | 
| 1657 | 1657 | unset($get_vars['rnd']); | 
| 1658 | - if($vid) | |
| 1658 | + if ($vid) | |
| 1659 | 1659 |  		{ | 
| 1660 | 1660 | $get_vars['vid'] = $vid; | 
| 1661 | 1661 | } | 
| @@ -1672,17 +1672,17 @@ discard block | ||
| 1672 | 1672 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', | 
| 1673 | 1673 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' | 
| 1674 | 1674 | ); | 
| 1675 | - if($act_alias[$act]) | |
| 1675 | + if ($act_alias[$act]) | |
| 1676 | 1676 |  		{ | 
| 1677 | 1677 | $get_vars['act'] = $act_alias[$act]; | 
| 1678 | 1678 | } | 
| 1679 | 1679 | |
| 1680 | 1680 | // organize URL | 
| 1681 | 1681 | $query = ''; | 
| 1682 | - if(count($get_vars) > 0) | |
| 1682 | + if (count($get_vars) > 0) | |
| 1683 | 1683 |  		{ | 
| 1684 | 1684 | // if using rewrite mod | 
| 1685 | - if($self->allow_rewrite) | |
| 1685 | + if ($self->allow_rewrite) | |
| 1686 | 1686 |  			{ | 
| 1687 | 1687 | $var_keys = array_keys($get_vars); | 
| 1688 | 1688 | sort($var_keys); | 
| @@ -1702,8 +1702,8 @@ discard block | ||
| 1702 | 1702 | 'vid' => $vid, | 
| 1703 | 1703 | 'mid' => $mid, | 
| 1704 | 1704 | 'mid.vid' => "$vid/$mid", | 
| 1705 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], | |
| 1706 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], | |
| 1705 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], | |
| 1706 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], | |
| 1707 | 1707 | 'document_srl' => $srl, | 
| 1708 | 1708 | 'document_srl.mid' => "$mid/$srl", | 
| 1709 | 1709 | 'document_srl.vid' => "$vid/$srl", | 
| @@ -1720,66 +1720,66 @@ discard block | ||
| 1720 | 1720 | $query = $target_map[$target]; | 
| 1721 | 1721 | } | 
| 1722 | 1722 | |
| 1723 | - if(!$query) | |
| 1723 | + if (!$query) | |
| 1724 | 1724 |  			{ | 
| 1725 | 1725 | $queries = array(); | 
| 1726 | - foreach($get_vars as $key => $val) | |
| 1726 | + foreach ($get_vars as $key => $val) | |
| 1727 | 1727 |  				{ | 
| 1728 | - if(is_array($val) && count($val) > 0) | |
| 1728 | + if (is_array($val) && count($val) > 0) | |
| 1729 | 1729 |  					{ | 
| 1730 | - foreach($val as $k => $v) | |
| 1730 | + foreach ($val as $k => $v) | |
| 1731 | 1731 |  						{ | 
| 1732 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); | |
| 1732 | + $queries[] = $key.'['.$k.']='.urlencode($v); | |
| 1733 | 1733 | } | 
| 1734 | 1734 | } | 
| 1735 | - elseif(!is_array($val)) | |
| 1735 | + elseif (!is_array($val)) | |
| 1736 | 1736 |  					{ | 
| 1737 | - $queries[] = $key . '=' . urlencode($val); | |
| 1737 | + $queries[] = $key.'='.urlencode($val); | |
| 1738 | 1738 | } | 
| 1739 | 1739 | } | 
| 1740 | - if(count($queries) > 0) | |
| 1740 | + if (count($queries) > 0) | |
| 1741 | 1741 |  				{ | 
| 1742 | -					$query = 'index.php?' . join('&', $queries); | |
| 1742 | +					$query = 'index.php?'.join('&', $queries); | |
| 1743 | 1743 | } | 
| 1744 | 1744 | } | 
| 1745 | 1745 | } | 
| 1746 | 1746 | |
| 1747 | 1747 | // If using SSL always | 
| 1748 | 1748 |  		$_use_ssl = $self->get('_use_ssl'); | 
| 1749 | - if($_use_ssl == 'always') | |
| 1749 | + if ($_use_ssl == 'always') | |
| 1750 | 1750 |  		{ | 
| 1751 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | |
| 1751 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; | |
| 1752 | 1752 | // optional SSL use | 
| 1753 | 1753 | } | 
| 1754 | - elseif($_use_ssl == 'optional') | |
| 1754 | + elseif ($_use_ssl == 'optional') | |
| 1755 | 1755 |  		{ | 
| 1756 | 1756 |  			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; | 
| 1757 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; | |
| 1757 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; | |
| 1758 | 1758 | // no SSL | 
| 1759 | 1759 | } | 
| 1760 | 1760 | else | 
| 1761 | 1761 |  		{ | 
| 1762 | 1762 | // currently on SSL but target is not based on SSL | 
| 1763 | - if($_SERVER['HTTPS'] == 'on') | |
| 1763 | + if ($_SERVER['HTTPS'] == 'on') | |
| 1764 | 1764 |  			{ | 
| 1765 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | |
| 1765 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; | |
| 1766 | 1766 | } | 
| 1767 | - else if($domain) // if $domain is set | |
| 1767 | + else if ($domain) // if $domain is set | |
| 1768 | 1768 |  			{ | 
| 1769 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; | |
| 1769 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; | |
| 1770 | 1770 | } | 
| 1771 | 1771 | else | 
| 1772 | 1772 |  			{ | 
| 1773 | - $query = getScriptPath() . $query; | |
| 1773 | + $query = getScriptPath().$query; | |
| 1774 | 1774 | } | 
| 1775 | 1775 | } | 
| 1776 | 1776 | |
| 1777 | - if(!$encode) | |
| 1777 | + if (!$encode) | |
| 1778 | 1778 |  		{ | 
| 1779 | 1779 | return $query; | 
| 1780 | 1780 | } | 
| 1781 | 1781 | |
| 1782 | - if(!$autoEncode) | |
| 1782 | + if (!$autoEncode) | |
| 1783 | 1783 |  		{ | 
| 1784 | 1784 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1785 | 1785 | } | 
| @@ -1788,16 +1788,16 @@ discard block | ||
| 1788 | 1788 | $encode_queries = array(); | 
| 1789 | 1789 | $parsedUrl = parse_url($query); | 
| 1790 | 1790 | parse_str($parsedUrl['query'], $output); | 
| 1791 | - foreach($output as $key => $value) | |
| 1791 | + foreach ($output as $key => $value) | |
| 1792 | 1792 |  		{ | 
| 1793 | -			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) | |
| 1793 | +			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) | |
| 1794 | 1794 |  			{ | 
| 1795 | 1795 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); | 
| 1796 | 1796 | } | 
| 1797 | - $encode_queries[] = $key . '=' . $value; | |
| 1797 | + $encode_queries[] = $key.'='.$value; | |
| 1798 | 1798 | } | 
| 1799 | 1799 | |
| 1800 | -		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | |
| 1800 | +		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | |
| 1801 | 1801 | } | 
| 1802 | 1802 | |
| 1803 | 1803 | /** | 
| @@ -1812,17 +1812,17 @@ discard block | ||
| 1812 | 1812 | static $url = array(); | 
| 1813 | 1813 | |
| 1814 | 1814 | // Check HTTP Request | 
| 1815 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) | |
| 1815 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) | |
| 1816 | 1816 |  		{ | 
| 1817 | 1817 | return; | 
| 1818 | 1818 | } | 
| 1819 | 1819 | |
| 1820 | -		if(self::get('_use_ssl') == 'always') | |
| 1820 | +		if (self::get('_use_ssl') == 'always') | |
| 1821 | 1821 |  		{ | 
| 1822 | 1822 | $ssl_mode = ENFORCE_SSL; | 
| 1823 | 1823 | } | 
| 1824 | 1824 | |
| 1825 | - if($domain) | |
| 1825 | + if ($domain) | |
| 1826 | 1826 |  		{ | 
| 1827 | 1827 | $domain_key = md5($domain); | 
| 1828 | 1828 | } | 
| @@ -1831,14 +1831,14 @@ discard block | ||
| 1831 | 1831 | $domain_key = 'default'; | 
| 1832 | 1832 | } | 
| 1833 | 1833 | |
| 1834 | - if(isset($url[$ssl_mode][$domain_key])) | |
| 1834 | + if (isset($url[$ssl_mode][$domain_key])) | |
| 1835 | 1835 |  		{ | 
| 1836 | 1836 | return $url[$ssl_mode][$domain_key]; | 
| 1837 | 1837 | } | 
| 1838 | 1838 | |
| 1839 | 1839 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); | 
| 1840 | 1840 | |
| 1841 | - switch($ssl_mode) | |
| 1841 | + switch ($ssl_mode) | |
| 1842 | 1842 |  		{ | 
| 1843 | 1843 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; | 
| 1844 | 1844 | break; | 
| @@ -1848,34 +1848,34 @@ discard block | ||
| 1848 | 1848 | break; | 
| 1849 | 1849 | } | 
| 1850 | 1850 | |
| 1851 | - if($domain) | |
| 1851 | + if ($domain) | |
| 1852 | 1852 |  		{ | 
| 1853 | 1853 | $target_url = trim($domain); | 
| 1854 | - if(substr_compare($target_url, '/', -1) !== 0) | |
| 1854 | + if (substr_compare($target_url, '/', -1) !== 0) | |
| 1855 | 1855 |  			{ | 
| 1856 | - $target_url.= '/'; | |
| 1856 | + $target_url .= '/'; | |
| 1857 | 1857 | } | 
| 1858 | 1858 | } | 
| 1859 | 1859 | else | 
| 1860 | 1860 |  		{ | 
| 1861 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); | |
| 1861 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); | |
| 1862 | 1862 | } | 
| 1863 | 1863 | |
| 1864 | -		$url_info = parse_url('http://' . $target_url); | |
| 1864 | +		$url_info = parse_url('http://'.$target_url); | |
| 1865 | 1865 | |
| 1866 | - if($current_use_ssl != $use_ssl) | |
| 1866 | + if ($current_use_ssl != $use_ssl) | |
| 1867 | 1867 |  		{ | 
| 1868 | 1868 | unset($url_info['port']); | 
| 1869 | 1869 | } | 
| 1870 | 1870 | |
| 1871 | - if($use_ssl) | |
| 1871 | + if ($use_ssl) | |
| 1872 | 1872 |  		{ | 
| 1873 | 1873 |  			$port = self::get('_https_port'); | 
| 1874 | - if($port && $port != 443) | |
| 1874 | + if ($port && $port != 443) | |
| 1875 | 1875 |  			{ | 
| 1876 | 1876 | $url_info['port'] = $port; | 
| 1877 | 1877 | } | 
| 1878 | - elseif($url_info['port'] == 443) | |
| 1878 | + elseif ($url_info['port'] == 443) | |
| 1879 | 1879 |  			{ | 
| 1880 | 1880 | unset($url_info['port']); | 
| 1881 | 1881 | } | 
| @@ -1883,17 +1883,17 @@ discard block | ||
| 1883 | 1883 | else | 
| 1884 | 1884 |  		{ | 
| 1885 | 1885 |  			$port = self::get('_http_port'); | 
| 1886 | - if($port && $port != 80) | |
| 1886 | + if ($port && $port != 80) | |
| 1887 | 1887 |  			{ | 
| 1888 | 1888 | $url_info['port'] = $port; | 
| 1889 | 1889 | } | 
| 1890 | - elseif($url_info['port'] == 80) | |
| 1890 | + elseif ($url_info['port'] == 80) | |
| 1891 | 1891 |  			{ | 
| 1892 | 1892 | unset($url_info['port']); | 
| 1893 | 1893 | } | 
| 1894 | 1894 | } | 
| 1895 | 1895 | |
| 1896 | -		$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']); | |
| 1896 | +		$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']); | |
| 1897 | 1897 | |
| 1898 | 1898 | return $url[$ssl_mode][$domain_key]; | 
| 1899 | 1899 | } | 
| @@ -1910,16 +1910,16 @@ discard block | ||
| 1910 | 1910 |  	{ | 
| 1911 | 1911 | $self = self::getInstance(); | 
| 1912 | 1912 |  		$self->context->{$key} = $val; | 
| 1913 | - if($set_to_get_vars === FALSE) | |
| 1913 | + if ($set_to_get_vars === FALSE) | |
| 1914 | 1914 |  		{ | 
| 1915 | 1915 | return; | 
| 1916 | 1916 | } | 
| 1917 | - if($val === NULL || $val === '') | |
| 1917 | + if ($val === NULL || $val === '') | |
| 1918 | 1918 |  		{ | 
| 1919 | 1919 |  			unset($self->get_vars->{$key}); | 
| 1920 | 1920 | return; | 
| 1921 | 1921 | } | 
| 1922 | -		if($set_to_get_vars || $self->get_vars->{$key}) | |
| 1922 | +		if ($set_to_get_vars || $self->get_vars->{$key}) | |
| 1923 | 1923 |  		{ | 
| 1924 | 1924 |  			$self->get_vars->{$key} = $val; | 
| 1925 | 1925 | } | 
| @@ -1935,7 +1935,7 @@ discard block | ||
| 1935 | 1935 |  	{ | 
| 1936 | 1936 | $self = self::getInstance(); | 
| 1937 | 1937 | |
| 1938 | -		if(!isset($self->context->{$key})) | |
| 1938 | +		if (!isset($self->context->{$key})) | |
| 1939 | 1939 |  		{ | 
| 1940 | 1940 | return null; | 
| 1941 | 1941 | } | 
| @@ -1950,7 +1950,7 @@ discard block | ||
| 1950 | 1950 | function gets() | 
| 1951 | 1951 |  	{ | 
| 1952 | 1952 | $num_args = func_num_args(); | 
| 1953 | - if($num_args < 1) | |
| 1953 | + if ($num_args < 1) | |
| 1954 | 1954 |  		{ | 
| 1955 | 1955 | return; | 
| 1956 | 1956 | } | 
| @@ -1958,7 +1958,7 @@ discard block | ||
| 1958 | 1958 | |
| 1959 | 1959 | $args_list = func_get_args(); | 
| 1960 | 1960 | $output = new stdClass(); | 
| 1961 | - foreach($args_list as $v) | |
| 1961 | + foreach ($args_list as $v) | |
| 1962 | 1962 |  		{ | 
| 1963 | 1963 |  			$output->{$v} = $self->get($v); | 
| 1964 | 1964 | } | 
| @@ -1984,7 +1984,7 @@ discard block | ||
| 1984 | 1984 | function getRequestVars() | 
| 1985 | 1985 |  	{ | 
| 1986 | 1986 | $self = self::getInstance(); | 
| 1987 | - if($self->get_vars) | |
| 1987 | + if ($self->get_vars) | |
| 1988 | 1988 |  		{ | 
| 1989 | 1989 | return clone($self->get_vars); | 
| 1990 | 1990 | } | 
| @@ -2001,13 +2001,13 @@ discard block | ||
| 2001 | 2001 |  	{ | 
| 2002 | 2002 | $self = self::getInstance(); | 
| 2003 | 2003 | |
| 2004 | - if(!is_readable($self->sslActionCacheFile)) | |
| 2004 | + if (!is_readable($self->sslActionCacheFile)) | |
| 2005 | 2005 |  		{ | 
| 2006 | 2006 |  			$buff = '<?php if(!defined("__XE__"))exit;'; | 
| 2007 | 2007 | FileHandler::writeFile($self->sslActionCacheFile, $buff); | 
| 2008 | 2008 | } | 
| 2009 | 2009 | |
| 2010 | - if(!isset($self->ssl_actions[$action])) | |
| 2010 | + if (!isset($self->ssl_actions[$action])) | |
| 2011 | 2011 |  		{ | 
| 2012 | 2012 | $self->ssl_actions[$action] = 1; | 
| 2013 | 2013 |  			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
| @@ -2025,16 +2025,16 @@ discard block | ||
| 2025 | 2025 |  	{ | 
| 2026 | 2026 | $self = self::getInstance(); | 
| 2027 | 2027 | |
| 2028 | - if(!is_readable($self->sslActionCacheFile)) | |
| 2028 | + if (!is_readable($self->sslActionCacheFile)) | |
| 2029 | 2029 |  		{ | 
| 2030 | 2030 | unset($self->ssl_actions); | 
| 2031 | 2031 |  			$buff = '<?php if(!defined("__XE__"))exit;'; | 
| 2032 | 2032 | FileHandler::writeFile($self->sslActionCacheFile, $buff); | 
| 2033 | 2033 | } | 
| 2034 | 2034 | |
| 2035 | - foreach($action_array as $action) | |
| 2035 | + foreach ($action_array as $action) | |
| 2036 | 2036 |  		{ | 
| 2037 | - if(!isset($self->ssl_actions[$action])) | |
| 2037 | + if (!isset($self->ssl_actions[$action])) | |
| 2038 | 2038 |  			{ | 
| 2039 | 2039 | $self->ssl_actions[$action] = 1; | 
| 2040 | 2040 |  				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
| @@ -2053,7 +2053,7 @@ discard block | ||
| 2053 | 2053 |  	{ | 
| 2054 | 2054 | $self = self::getInstance(); | 
| 2055 | 2055 | |
| 2056 | - if($self->isExistsSSLAction($action)) | |
| 2056 | + if ($self->isExistsSSLAction($action)) | |
| 2057 | 2057 |  		{ | 
| 2058 | 2058 |  			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
| 2059 | 2059 | $buff = FileHandler::readFile($self->sslActionCacheFile); | 
| @@ -2070,7 +2070,7 @@ discard block | ||
| 2070 | 2070 | function getSSLActions() | 
| 2071 | 2071 |  	{ | 
| 2072 | 2072 | $self = self::getInstance(); | 
| 2073 | - if($self->getSslStatus() == 'optional') | |
| 2073 | + if ($self->getSslStatus() == 'optional') | |
| 2074 | 2074 |  		{ | 
| 2075 | 2075 | return $self->ssl_actions; | 
| 2076 | 2076 | } | 
| @@ -2097,12 +2097,12 @@ discard block | ||
| 2097 | 2097 | */ | 
| 2098 | 2098 | function normalizeFilePath($file) | 
| 2099 | 2099 |  	{ | 
| 2100 | -		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) | |
| 2100 | +		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) | |
| 2101 | 2101 |  		{ | 
| 2102 | - $file = './' . $file; | |
| 2102 | + $file = './'.$file; | |
| 2103 | 2103 | } | 
| 2104 | 2104 |  		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); | 
| 2105 | - while(strpos($file, '/../') !== FALSE) | |
| 2105 | + while (strpos($file, '/../') !== FALSE) | |
| 2106 | 2106 |  		{ | 
| 2107 | 2107 |  			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); | 
| 2108 | 2108 | } | 
| @@ -2121,13 +2121,13 @@ discard block | ||
| 2121 | 2121 |  	{ | 
| 2122 | 2122 | $file = self::normalizeFilePath($file); | 
| 2123 | 2123 | $script_path = getScriptPath(); | 
| 2124 | - if(strpos($file, './') === 0) | |
| 2124 | + if (strpos($file, './') === 0) | |
| 2125 | 2125 |  		{ | 
| 2126 | - $file = $script_path . substr($file, 2); | |
| 2126 | + $file = $script_path.substr($file, 2); | |
| 2127 | 2127 | } | 
| 2128 | - elseif(strpos($file, '../') === 0) | |
| 2128 | + elseif (strpos($file, '../') === 0) | |
| 2129 | 2129 |  		{ | 
| 2130 | - $file = self::normalizeFilePath($script_path . $file); | |
| 2130 | + $file = self::normalizeFilePath($script_path.$file); | |
| 2131 | 2131 | } | 
| 2132 | 2132 | |
| 2133 | 2133 | return $file; | 
| @@ -2197,12 +2197,12 @@ discard block | ||
| 2197 | 2197 | */ | 
| 2198 | 2198 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) | 
| 2199 | 2199 |  	{ | 
| 2200 | - if($isRuleset) | |
| 2200 | + if ($isRuleset) | |
| 2201 | 2201 |  		{ | 
| 2202 | - if(strpos($file, '#') !== FALSE) | |
| 2202 | + if (strpos($file, '#') !== FALSE) | |
| 2203 | 2203 |  			{ | 
| 2204 | 2204 |  				$file = str_replace('#', '', $file); | 
| 2205 | - if(!is_readable($file)) | |
| 2205 | + if (!is_readable($file)) | |
| 2206 | 2206 |  				{ | 
| 2207 | 2207 | $file = $autoPath; | 
| 2208 | 2208 | } | 
| @@ -2267,9 +2267,9 @@ discard block | ||
| 2267 | 2267 | ksort($files); | 
| 2268 | 2268 | $files = array_values($files); | 
| 2269 | 2269 | $filenames = array(); | 
| 2270 | - for($i = 0, $c = count($files); $i < $c; ++$i) | |
| 2270 | + for ($i = 0, $c = count($files); $i < $c; ++$i) | |
| 2271 | 2271 |  		{ | 
| 2272 | - if(in_array($files[$i]['file'], $filenames)) | |
| 2272 | + if (in_array($files[$i]['file'], $filenames)) | |
| 2273 | 2273 |  			{ | 
| 2274 | 2274 | unset($files[$i]); | 
| 2275 | 2275 | } | 
| @@ -2354,14 +2354,14 @@ discard block | ||
| 2354 | 2354 | */ | 
| 2355 | 2355 | function getJavascriptPluginInfo($pluginName) | 
| 2356 | 2356 |  	{ | 
| 2357 | - if($plugin_name == 'ui.datepicker') | |
| 2357 | + if ($plugin_name == 'ui.datepicker') | |
| 2358 | 2358 |  		{ | 
| 2359 | 2359 | $plugin_name = 'ui'; | 
| 2360 | 2360 | } | 
| 2361 | 2361 | |
| 2362 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; | |
| 2363 | - $info_file = $plugin_path . 'plugin.load'; | |
| 2364 | - if(!is_readable($info_file)) | |
| 2362 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; | |
| 2363 | + $info_file = $plugin_path.'plugin.load'; | |
| 2364 | + if (!is_readable($info_file)) | |
| 2365 | 2365 |  		{ | 
| 2366 | 2366 | return; | 
| 2367 | 2367 | } | 
| @@ -2371,32 +2371,32 @@ discard block | ||
| 2371 | 2371 | $result->jsList = array(); | 
| 2372 | 2372 | $result->cssList = array(); | 
| 2373 | 2373 | |
| 2374 | - foreach($list as $filename) | |
| 2374 | + foreach ($list as $filename) | |
| 2375 | 2375 |  		{ | 
| 2376 | 2376 | $filename = trim($filename); | 
| 2377 | - if(!$filename) | |
| 2377 | + if (!$filename) | |
| 2378 | 2378 |  			{ | 
| 2379 | 2379 | continue; | 
| 2380 | 2380 | } | 
| 2381 | 2381 | |
| 2382 | -			if(strncasecmp('./', $filename, 2) === 0) | |
| 2382 | +			if (strncasecmp('./', $filename, 2) === 0) | |
| 2383 | 2383 |  			{ | 
| 2384 | 2384 | $filename = substr($filename, 2); | 
| 2385 | 2385 | } | 
| 2386 | 2386 | |
| 2387 | - if(substr_compare($filename, '.js', -3) === 0) | |
| 2387 | + if (substr_compare($filename, '.js', -3) === 0) | |
| 2388 | 2388 |  			{ | 
| 2389 | - $result->jsList[] = $plugin_path . $filename; | |
| 2389 | + $result->jsList[] = $plugin_path.$filename; | |
| 2390 | 2390 | } | 
| 2391 | - elseif(substr_compare($filename, '.css', -4) === 0) | |
| 2391 | + elseif (substr_compare($filename, '.css', -4) === 0) | |
| 2392 | 2392 |  			{ | 
| 2393 | - $result->cssList[] = $plugin_path . $filename; | |
| 2393 | + $result->cssList[] = $plugin_path.$filename; | |
| 2394 | 2394 | } | 
| 2395 | 2395 | } | 
| 2396 | 2396 | |
| 2397 | - if(is_dir($plugin_path . 'lang')) | |
| 2397 | + if (is_dir($plugin_path.'lang')) | |
| 2398 | 2398 |  		{ | 
| 2399 | - $result->langPath = $plugin_path . 'lang'; | |
| 2399 | + $result->langPath = $plugin_path.'lang'; | |
| 2400 | 2400 | } | 
| 2401 | 2401 | |
| 2402 | 2402 | return $result; | 
| @@ -2412,50 +2412,50 @@ discard block | ||
| 2412 | 2412 | static $loaded_plugins = array(); | 
| 2413 | 2413 | |
| 2414 | 2414 | $self = self::getInstance(); | 
| 2415 | - if($plugin_name == 'ui.datepicker') | |
| 2415 | + if ($plugin_name == 'ui.datepicker') | |
| 2416 | 2416 |  		{ | 
| 2417 | 2417 | $plugin_name = 'ui'; | 
| 2418 | 2418 | } | 
| 2419 | 2419 | |
| 2420 | - if($loaded_plugins[$plugin_name]) | |
| 2420 | + if ($loaded_plugins[$plugin_name]) | |
| 2421 | 2421 |  		{ | 
| 2422 | 2422 | return; | 
| 2423 | 2423 | } | 
| 2424 | 2424 | $loaded_plugins[$plugin_name] = TRUE; | 
| 2425 | 2425 | |
| 2426 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; | |
| 2427 | - $info_file = $plugin_path . 'plugin.load'; | |
| 2428 | - if(!is_readable($info_file)) | |
| 2426 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; | |
| 2427 | + $info_file = $plugin_path.'plugin.load'; | |
| 2428 | + if (!is_readable($info_file)) | |
| 2429 | 2429 |  		{ | 
| 2430 | 2430 | return; | 
| 2431 | 2431 | } | 
| 2432 | 2432 | |
| 2433 | 2433 | $list = file($info_file); | 
| 2434 | - foreach($list as $filename) | |
| 2434 | + foreach ($list as $filename) | |
| 2435 | 2435 |  		{ | 
| 2436 | 2436 | $filename = trim($filename); | 
| 2437 | - if(!$filename) | |
| 2437 | + if (!$filename) | |
| 2438 | 2438 |  			{ | 
| 2439 | 2439 | continue; | 
| 2440 | 2440 | } | 
| 2441 | 2441 | |
| 2442 | -			if(strncasecmp('./', $filename, 2) === 0) | |
| 2442 | +			if (strncasecmp('./', $filename, 2) === 0) | |
| 2443 | 2443 |  			{ | 
| 2444 | 2444 | $filename = substr($filename, 2); | 
| 2445 | 2445 | } | 
| 2446 | - if(substr_compare($filename, '.js', -3) === 0) | |
| 2446 | + if (substr_compare($filename, '.js', -3) === 0) | |
| 2447 | 2447 |  			{ | 
| 2448 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); | |
| 2448 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); | |
| 2449 | 2449 | } | 
| 2450 | - if(substr_compare($filename, '.css', -4) === 0) | |
| 2450 | + if (substr_compare($filename, '.css', -4) === 0) | |
| 2451 | 2451 |  			{ | 
| 2452 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); | |
| 2452 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); | |
| 2453 | 2453 | } | 
| 2454 | 2454 | } | 
| 2455 | 2455 | |
| 2456 | - if(is_dir($plugin_path . 'lang')) | |
| 2456 | + if (is_dir($plugin_path.'lang')) | |
| 2457 | 2457 |  		{ | 
| 2458 | - $self->loadLang($plugin_path . 'lang'); | |
| 2458 | + $self->loadLang($plugin_path.'lang'); | |
| 2459 | 2459 | } | 
| 2460 | 2460 | } | 
| 2461 | 2461 | |
| @@ -2468,7 +2468,7 @@ discard block | ||
| 2468 | 2468 | function addHtmlHeader($header) | 
| 2469 | 2469 |  	{ | 
| 2470 | 2470 | $self = self::getInstance(); | 
| 2471 | - $self->html_header .= "\n" . $header; | |
| 2471 | + $self->html_header .= "\n".$header; | |
| 2472 | 2472 | } | 
| 2473 | 2473 | |
| 2474 | 2474 | function clearHtmlHeader() | 
| @@ -2520,7 +2520,7 @@ discard block | ||
| 2520 | 2520 | function addBodyHeader($header) | 
| 2521 | 2521 |  	{ | 
| 2522 | 2522 | $self = self::getInstance(); | 
| 2523 | - $self->body_header .= "\n" . $header; | |
| 2523 | + $self->body_header .= "\n".$header; | |
| 2524 | 2524 | } | 
| 2525 | 2525 | |
| 2526 | 2526 | /** | 
| @@ -2542,7 +2542,7 @@ discard block | ||
| 2542 | 2542 | function addHtmlFooter($footer) | 
| 2543 | 2543 |  	{ | 
| 2544 | 2544 | $self = self::getInstance(); | 
| 2545 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; | |
| 2545 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; | |
| 2546 | 2546 | } | 
| 2547 | 2547 | |
| 2548 | 2548 | /** | 
| @@ -2563,7 +2563,7 @@ discard block | ||
| 2563 | 2563 | */ | 
| 2564 | 2564 | function getConfigFile() | 
| 2565 | 2565 |  	{ | 
| 2566 | - return _XE_PATH_ . 'files/config/db.config.php'; | |
| 2566 | + return _XE_PATH_.'files/config/db.config.php'; | |
| 2567 | 2567 | } | 
| 2568 | 2568 | |
| 2569 | 2569 | /** | 
| @@ -2573,7 +2573,7 @@ discard block | ||
| 2573 | 2573 | */ | 
| 2574 | 2574 | function getFTPConfigFile() | 
| 2575 | 2575 |  	{ | 
| 2576 | - return _XE_PATH_ . 'files/config/ftp.config.php'; | |
| 2576 | + return _XE_PATH_.'files/config/ftp.config.php'; | |
| 2577 | 2577 | } | 
| 2578 | 2578 | |
| 2579 | 2579 | /** | 
| @@ -2625,14 +2625,14 @@ discard block | ||
| 2625 | 2625 |  		$_path = explode('/', $path); | 
| 2626 | 2626 |  		$_base = explode('/', $base_url); | 
| 2627 | 2627 | |
| 2628 | - if(!$_base[count($_base) - 1]) | |
| 2628 | + if (!$_base[count($_base) - 1]) | |
| 2629 | 2629 |  		{ | 
| 2630 | 2630 | array_pop($_base); | 
| 2631 | 2631 | } | 
| 2632 | 2632 | |
| 2633 | - foreach($_xe as $idx => $dir) | |
| 2633 | + foreach ($_xe as $idx => $dir) | |
| 2634 | 2634 |  		{ | 
| 2635 | - if($_path[0] != $dir) | |
| 2635 | + if ($_path[0] != $dir) | |
| 2636 | 2636 |  			{ | 
| 2637 | 2637 | break; | 
| 2638 | 2638 | } | 
| @@ -2640,9 +2640,9 @@ discard block | ||
| 2640 | 2640 | } | 
| 2641 | 2641 | |
| 2642 | 2642 | $idx = count($_xe) - $idx - 1; | 
| 2643 | - while($idx--) | |
| 2643 | + while ($idx--) | |
| 2644 | 2644 |  		{ | 
| 2645 | - if(count($_base) > 0) | |
| 2645 | + if (count($_base) > 0) | |
| 2646 | 2646 |  			{ | 
| 2647 | 2647 | array_shift($_base); | 
| 2648 | 2648 | } | 
| @@ -2652,13 +2652,13 @@ discard block | ||
| 2652 | 2652 | } | 
| 2653 | 2653 | } | 
| 2654 | 2654 | |
| 2655 | - if(count($_base) > 0) | |
| 2655 | + if (count($_base) > 0) | |
| 2656 | 2656 |  		{ | 
| 2657 | 2657 |  			array_unshift($_path, join('/', $_base)); | 
| 2658 | 2658 | } | 
| 2659 | 2659 | |
| 2660 | -		$path = '/' . join('/', $_path); | |
| 2661 | - if(substr_compare($path, '/', -1) !== 0) | |
| 2660 | +		$path = '/'.join('/', $_path); | |
| 2661 | + if (substr_compare($path, '/', -1) !== 0) | |
| 2662 | 2662 |  		{ | 
| 2663 | 2663 | $path .= '/'; | 
| 2664 | 2664 | } | 
| @@ -2673,13 +2673,13 @@ discard block | ||
| 2673 | 2673 |  	{ | 
| 2674 | 2674 | $self = self::getInstance(); | 
| 2675 | 2675 | |
| 2676 | - if(!is_array($self->meta_tags)) | |
| 2676 | + if (!is_array($self->meta_tags)) | |
| 2677 | 2677 |  		{ | 
| 2678 | 2678 | $self->meta_tags = array(); | 
| 2679 | 2679 | } | 
| 2680 | 2680 | |
| 2681 | 2681 | $ret = array(); | 
| 2682 | - foreach($self->meta_tags as $key => $val) | |
| 2682 | + foreach ($self->meta_tags as $key => $val) | |
| 2683 | 2683 |  		{ | 
| 2684 | 2684 |  			list($name, $is_http_equiv) = explode("\t", $key); | 
| 2685 | 2685 |  			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); | 
| @@ -2699,7 +2699,7 @@ discard block | ||
| 2699 | 2699 | function addMetaTag($name, $content, $is_http_equiv = FALSE) | 
| 2700 | 2700 |  	{ | 
| 2701 | 2701 | $self = self::getInstance(); | 
| 2702 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; | |
| 2702 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; | |
| 2703 | 2703 | } | 
| 2704 | 2704 | |
| 2705 | 2705 | } | 
| @@ -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 | } | 
| @@ -341,7 +341,9 @@ discard block | ||
| 341 | 341 | ); | 
| 342 | 342 | } | 
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); | |
| 344 | +		if($sess = $_POST[session_name()]) { | |
| 345 | + session_id($sess); | |
| 346 | + } | |
| 345 | 347 | session_start(); | 
| 346 | 348 | |
| 347 | 349 | // set authentication information in Context and session | 
| @@ -394,22 +396,21 @@ discard block | ||
| 394 | 396 |  						{ | 
| 395 | 397 | $url[] = $key . '[' . $k . ']=' . urlencode($v); | 
| 396 | 398 | } | 
| 397 | - } | |
| 398 | - elseif($val) | |
| 399 | + } elseif($val) | |
| 399 | 400 |  					{ | 
| 400 | 401 | $url[] = $key . '=' . urlencode($val); | 
| 401 | 402 | } | 
| 402 | 403 | } | 
| 403 | 404 | |
| 404 | 405 | $current_url = self::getRequestUri(); | 
| 405 | -				if($url) $current_url .= '?' . join('&', $url); | |
| 406 | - } | |
| 407 | - else | |
| 406 | +				if($url) { | |
| 407 | +					$current_url .= '?' . join('&', $url); | |
| 408 | + } | |
| 409 | + } else | |
| 408 | 410 |  			{ | 
| 409 | 411 | $current_url = $this->getUrl(); | 
| 410 | 412 | } | 
| 411 | - } | |
| 412 | - else | |
| 413 | + } else | |
| 413 | 414 |  		{ | 
| 414 | 415 | $current_url = self::getRequestUri(); | 
| 415 | 416 | } | 
| @@ -490,18 +491,22 @@ discard block | ||
| 490 | 491 | $db_info->use_prepared_statements = 'Y'; | 
| 491 | 492 | } | 
| 492 | 493 | |
| 493 | - if(!$db_info->time_zone) | |
| 494 | -			$db_info->time_zone = date('O'); | |
| 494 | +		if(!$db_info->time_zone) { | |
| 495 | +					$db_info->time_zone = date('O'); | |
| 496 | + } | |
| 495 | 497 | $GLOBALS['_time_zone'] = $db_info->time_zone; | 
| 496 | 498 | |
| 497 | - if($db_info->qmail_compatibility != 'Y') | |
| 498 | - $db_info->qmail_compatibility = 'N'; | |
| 499 | +		if($db_info->qmail_compatibility != 'Y') { | |
| 500 | + $db_info->qmail_compatibility = 'N'; | |
| 501 | + } | |
| 499 | 502 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; | 
| 500 | 503 | |
| 501 | - if(!$db_info->use_db_session) | |
| 502 | - $db_info->use_db_session = 'N'; | |
| 503 | - if(!$db_info->use_ssl) | |
| 504 | - $db_info->use_ssl = 'none'; | |
| 504 | +		if(!$db_info->use_db_session) { | |
| 505 | + $db_info->use_db_session = 'N'; | |
| 506 | + } | |
| 507 | +		if(!$db_info->use_ssl) { | |
| 508 | + $db_info->use_ssl = 'none'; | |
| 509 | + } | |
| 505 | 510 |  		$this->set('_use_ssl', $db_info->use_ssl); | 
| 506 | 511 | |
| 507 | 512 |  		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); | 
| @@ -618,8 +623,7 @@ discard block | ||
| 618 | 623 | $buff = FileHandler::readFile($orig_lang_file); | 
| 619 | 624 | FileHandler::writeFile($selected_lang_file, $buff); | 
| 620 | 625 | $lang_selected = self::loadLangSupported(); | 
| 621 | - } | |
| 622 | - else | |
| 626 | + } else | |
| 623 | 627 |  			{ | 
| 624 | 628 | $langs = file($selected_lang_file); | 
| 625 | 629 | foreach($langs as $val) | 
| @@ -678,15 +682,16 @@ discard block | ||
| 678 | 682 | |
| 679 | 683 |  				$oModuleModel = getModel('module'); | 
| 680 | 684 | $domain = $url_info['host'] . $url_info['path']; | 
| 681 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); | |
| 685 | +				if(substr_compare($domain, '/', -1) === 0) { | |
| 686 | + $domain = substr($domain, 0, -1); | |
| 687 | + } | |
| 682 | 688 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); | 
| 683 | 689 | |
| 684 | 690 | if($site_info->site_srl) | 
| 685 | 691 |  				{ | 
| 686 | 692 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); | 
| 687 | 693 |  				$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']); | 
| 688 | - } | |
| 689 | - else | |
| 694 | + } else | |
| 690 | 695 |  				{ | 
| 691 | 696 | $redirect_url = $url; | 
| 692 | 697 | } | 
| @@ -695,8 +700,7 @@ discard block | ||
| 695 | 700 | return FALSE; | 
| 696 | 701 | } | 
| 697 | 702 | // for sites requesting SSO validation | 
| 698 | - } | |
| 699 | - else | |
| 703 | + } else | |
| 700 | 704 |  		{ | 
| 701 | 705 | // result handling : set session_name() | 
| 702 | 706 |  			if($session_name = self::get('SSOID')) | 
| @@ -713,8 +717,7 @@ discard block | ||
| 713 | 717 |  				header('location:' . $url); | 
| 714 | 718 | return FALSE; | 
| 715 | 719 | // send SSO request | 
| 716 | - } | |
| 717 | -			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | |
| 720 | +			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | |
| 718 | 721 |  			{ | 
| 719 | 722 |  				setcookie('sso', md5(self::getRequestUri())); | 
| 720 | 723 | $origin_url = self::getRequestUrl(); | 
| @@ -774,8 +777,7 @@ discard block | ||
| 774 | 777 | if($self->site_title) | 
| 775 | 778 |  		{ | 
| 776 | 779 | $self->site_title .= ' - ' . $site_title; | 
| 777 | - } | |
| 778 | - else | |
| 780 | + } else | |
| 779 | 781 |  		{ | 
| 780 | 782 | $self->site_title = $site_title; | 
| 781 | 783 | } | 
| @@ -875,8 +877,7 @@ discard block | ||
| 875 | 877 |  		{ | 
| 876 | 878 | $self->loaded_lang_files[] = $filename; | 
| 877 | 879 | include($filename); | 
| 878 | - } | |
| 879 | - else | |
| 880 | + } else | |
| 880 | 881 |  		{ | 
| 881 | 882 | $self->_evalxmlLang($path); | 
| 882 | 883 | } | 
| @@ -892,7 +893,9 @@ discard block | ||
| 892 | 893 |  	{ | 
| 893 | 894 | global $lang; | 
| 894 | 895 | |
| 895 | - if(!$path) return; | |
| 896 | +		if(!$path) { | |
| 897 | + return; | |
| 898 | + } | |
| 896 | 899 | |
| 897 | 900 | $_path = 'eval://' . $path; | 
| 898 | 901 | |
| @@ -924,7 +927,9 @@ discard block | ||
| 924 | 927 | */ | 
| 925 | 928 | function _loadXmlLang($path) | 
| 926 | 929 |  	{ | 
| 927 | - if(!$path) return; | |
| 930 | +		if(!$path) { | |
| 931 | + return; | |
| 932 | + } | |
| 928 | 933 | |
| 929 | 934 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); | 
| 930 | 935 | return $oXmlLangParser->compile(); | 
| @@ -938,7 +943,9 @@ discard block | ||
| 938 | 943 | */ | 
| 939 | 944 | function _loadPhpLang($path) | 
| 940 | 945 |  	{ | 
| 941 | - if(!$path) return; | |
| 946 | +		if(!$path) { | |
| 947 | + return; | |
| 948 | + } | |
| 942 | 949 | |
| 943 | 950 | if(substr_compare($path, '/', -1) !== 0) | 
| 944 | 951 |  		{ | 
| @@ -1074,12 +1081,14 @@ discard block | ||
| 1074 | 1081 | static $flag = TRUE; | 
| 1075 | 1082 | if($charset) | 
| 1076 | 1083 |  		{ | 
| 1077 | - if(is_array($val)) | |
| 1078 | - array_walk($val,'Context::checkConvertFlag',$charset); | |
| 1079 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; | |
| 1080 | - else $flag = FALSE; | |
| 1081 | - } | |
| 1082 | - else | |
| 1084 | +			if(is_array($val)) { | |
| 1085 | + array_walk($val,'Context::checkConvertFlag',$charset); | |
| 1086 | +			} else if($val && iconv($charset,$charset,$val)!=$val) { | |
| 1087 | + $flag = FALSE; | |
| 1088 | +			} else { | |
| 1089 | + $flag = FALSE; | |
| 1090 | + } | |
| 1091 | + } else | |
| 1083 | 1092 |  		{ | 
| 1084 | 1093 | $return = $flag; | 
| 1085 | 1094 | $flag = TRUE; | 
| @@ -1101,8 +1110,9 @@ discard block | ||
| 1101 | 1110 | if (is_array($val)) | 
| 1102 | 1111 |  		{ | 
| 1103 | 1112 | array_walk($val,'Context::doConvertEncoding',$charset); | 
| 1113 | +		} else { | |
| 1114 | + $val = iconv($charset,'UTF-8',$val); | |
| 1104 | 1115 | } | 
| 1105 | - else $val = iconv($charset,'UTF-8',$val); | |
| 1106 | 1116 | } | 
| 1107 | 1117 | |
| 1108 | 1118 | /** | 
| @@ -1113,7 +1123,9 @@ discard block | ||
| 1113 | 1123 | */ | 
| 1114 | 1124 | function convertEncodingStr($str) | 
| 1115 | 1125 |  	{ | 
| 1116 | - if(!$str) return null; | |
| 1126 | +        if(!$str) { | |
| 1127 | + return null; | |
| 1128 | + } | |
| 1117 | 1129 | $obj = new stdClass(); | 
| 1118 | 1130 | $obj->str = $str; | 
| 1119 | 1131 | $obj = self::convertEncoding($obj); | 
| @@ -1226,16 +1238,13 @@ discard block | ||
| 1226 | 1238 | if($requestMethod == 'GET' && isset($_GET[$key])) | 
| 1227 | 1239 |  			{ | 
| 1228 | 1240 | $set_to_vars = TRUE; | 
| 1229 | - } | |
| 1230 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) | |
| 1241 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) | |
| 1231 | 1242 |  			{ | 
| 1232 | 1243 | $set_to_vars = TRUE; | 
| 1233 | - } | |
| 1234 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) | |
| 1244 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) | |
| 1235 | 1245 |  			{ | 
| 1236 | 1246 | $set_to_vars = TRUE; | 
| 1237 | - } | |
| 1238 | - else | |
| 1247 | + } else | |
| 1239 | 1248 |  			{ | 
| 1240 | 1249 | $set_to_vars = FALSE; | 
| 1241 | 1250 | } | 
| @@ -1261,8 +1270,7 @@ discard block | ||
| 1261 | 1270 | return; | 
| 1262 | 1271 | } | 
| 1263 | 1272 | } | 
| 1264 | - } | |
| 1265 | - else if(is_array($val)) | |
| 1273 | + } else if(is_array($val)) | |
| 1266 | 1274 |  		{ | 
| 1267 | 1275 | foreach($val as $val2) | 
| 1268 | 1276 |  			{ | 
| @@ -1402,24 +1410,19 @@ discard block | ||
| 1402 | 1410 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) | 
| 1403 | 1411 |  			{ | 
| 1404 | 1412 |  				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; | 
| 1405 | - } | |
| 1406 | - elseif($key === 'mid' || $key === 'search_keyword') | |
| 1413 | + } elseif($key === 'mid' || $key === 'search_keyword') | |
| 1407 | 1414 |  			{ | 
| 1408 | 1415 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1409 | - } | |
| 1410 | - elseif($key === 'vid') | |
| 1416 | + } elseif($key === 'vid') | |
| 1411 | 1417 |  			{ | 
| 1412 | 1418 | $result[$k] = urlencode($v); | 
| 1413 | - } | |
| 1414 | - elseif($key === 'xe_validator_id') | |
| 1419 | + } elseif($key === 'xe_validator_id') | |
| 1415 | 1420 |  			{ | 
| 1416 | 1421 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1417 | - } | |
| 1418 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) | |
| 1422 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) | |
| 1419 | 1423 |  			{ | 
| 1420 | 1424 | unset($result[$k]); | 
| 1421 | - } | |
| 1422 | - else | |
| 1425 | + } else | |
| 1423 | 1426 |  			{ | 
| 1424 | 1427 | $result[$k] = $v; | 
| 1425 | 1428 | |
| @@ -1428,8 +1431,7 @@ discard block | ||
| 1428 | 1431 | if (is_array($result[$k])) | 
| 1429 | 1432 |  					{ | 
| 1430 | 1433 |  						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); | 
| 1431 | - } | |
| 1432 | - else | |
| 1434 | + } else | |
| 1433 | 1435 |  					{ | 
| 1434 | 1436 | $result[$k] = stripslashes($result[$k]); | 
| 1435 | 1437 | } | 
| @@ -1438,8 +1440,7 @@ discard block | ||
| 1438 | 1440 | if(is_array($result[$k])) | 
| 1439 | 1441 |  				{ | 
| 1440 | 1442 |  					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); | 
| 1441 | - } | |
| 1442 | - else | |
| 1443 | + } else | |
| 1443 | 1444 |  				{ | 
| 1444 | 1445 | $result[$k] = trim($result[$k]); | 
| 1445 | 1446 | } | 
| @@ -1484,8 +1485,7 @@ discard block | ||
| 1484 | 1485 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
| 1485 | 1486 | $this->set($key, $val, TRUE); | 
| 1486 | 1487 | $this->is_uploaded = TRUE; | 
| 1487 | - } | |
| 1488 | - else | |
| 1488 | + } else | |
| 1489 | 1489 |  			{ | 
| 1490 | 1490 | for($i = 0, $c = count($tmp_name); $i < $c; $i++) | 
| 1491 | 1491 |  				{ | 
| @@ -1591,8 +1591,7 @@ discard block | ||
| 1591 | 1591 | if($site_module_info->domain && isSiteID($site_module_info->domain)) | 
| 1592 | 1592 |  			{ | 
| 1593 | 1593 | $vid = $site_module_info->domain; | 
| 1594 | - } | |
| 1595 | - else | |
| 1594 | + } else | |
| 1596 | 1595 |  			{ | 
| 1597 | 1596 | $domain = $site_module_info->domain; | 
| 1598 | 1597 | } | 
| @@ -1609,8 +1608,7 @@ discard block | ||
| 1609 | 1608 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) | 
| 1610 | 1609 |  			{ | 
| 1611 | 1610 | unset($domain); | 
| 1612 | - } | |
| 1613 | - else | |
| 1611 | + } else | |
| 1614 | 1612 |  			{ | 
| 1615 | 1613 |  				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); | 
| 1616 | 1614 | if(substr_compare($domain, '/', -1) !== 0) | 
| @@ -1630,8 +1628,7 @@ discard block | ||
| 1630 | 1628 |  			{ | 
| 1631 | 1629 | array_shift($args_list); | 
| 1632 | 1630 | } | 
| 1633 | - } | |
| 1634 | - else | |
| 1631 | + } else | |
| 1635 | 1632 |  		{ | 
| 1636 | 1633 | // Otherwise, make GET variables into array | 
| 1637 | 1634 | $get_vars = get_object_vars($self->get_vars); | 
| @@ -1658,8 +1655,7 @@ discard block | ||
| 1658 | 1655 | if($vid) | 
| 1659 | 1656 |  		{ | 
| 1660 | 1657 | $get_vars['vid'] = $vid; | 
| 1661 | - } | |
| 1662 | - else | |
| 1658 | + } else | |
| 1663 | 1659 |  		{ | 
| 1664 | 1660 | unset($get_vars['vid']); | 
| 1665 | 1661 | } | 
| @@ -1731,8 +1727,7 @@ discard block | ||
| 1731 | 1727 |  						{ | 
| 1732 | 1728 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); | 
| 1733 | 1729 | } | 
| 1734 | - } | |
| 1735 | - elseif(!is_array($val)) | |
| 1730 | + } elseif(!is_array($val)) | |
| 1736 | 1731 |  					{ | 
| 1737 | 1732 | $queries[] = $key . '=' . urlencode($val); | 
| 1738 | 1733 | } | 
| @@ -1750,25 +1745,23 @@ discard block | ||
| 1750 | 1745 |  		{ | 
| 1751 | 1746 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | 
| 1752 | 1747 | // optional SSL use | 
| 1753 | - } | |
| 1754 | - elseif($_use_ssl == 'optional') | |
| 1748 | + } elseif($_use_ssl == 'optional') | |
| 1755 | 1749 |  		{ | 
| 1756 | 1750 |  			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; | 
| 1757 | 1751 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; | 
| 1758 | 1752 | // no SSL | 
| 1759 | - } | |
| 1760 | - else | |
| 1753 | + } else | |
| 1761 | 1754 |  		{ | 
| 1762 | 1755 | // currently on SSL but target is not based on SSL | 
| 1763 | 1756 | if($_SERVER['HTTPS'] == 'on') | 
| 1764 | 1757 |  			{ | 
| 1765 | 1758 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | 
| 1766 | - } | |
| 1767 | - else if($domain) // if $domain is set | |
| 1759 | +			} else if($domain) { | |
| 1760 | + // if $domain is set | |
| 1768 | 1761 |  			{ | 
| 1769 | 1762 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; | 
| 1770 | 1763 | } | 
| 1771 | - else | |
| 1764 | + } else | |
| 1772 | 1765 |  			{ | 
| 1773 | 1766 | $query = getScriptPath() . $query; | 
| 1774 | 1767 | } | 
| @@ -1825,8 +1818,7 @@ discard block | ||
| 1825 | 1818 | if($domain) | 
| 1826 | 1819 |  		{ | 
| 1827 | 1820 | $domain_key = md5($domain); | 
| 1828 | - } | |
| 1829 | - else | |
| 1821 | + } else | |
| 1830 | 1822 |  		{ | 
| 1831 | 1823 | $domain_key = 'default'; | 
| 1832 | 1824 | } | 
| @@ -1855,8 +1847,7 @@ discard block | ||
| 1855 | 1847 |  			{ | 
| 1856 | 1848 | $target_url.= '/'; | 
| 1857 | 1849 | } | 
| 1858 | - } | |
| 1859 | - else | |
| 1850 | + } else | |
| 1860 | 1851 |  		{ | 
| 1861 | 1852 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); | 
| 1862 | 1853 | } | 
| @@ -1874,20 +1865,17 @@ discard block | ||
| 1874 | 1865 | if($port && $port != 443) | 
| 1875 | 1866 |  			{ | 
| 1876 | 1867 | $url_info['port'] = $port; | 
| 1877 | - } | |
| 1878 | - elseif($url_info['port'] == 443) | |
| 1868 | + } elseif($url_info['port'] == 443) | |
| 1879 | 1869 |  			{ | 
| 1880 | 1870 | unset($url_info['port']); | 
| 1881 | 1871 | } | 
| 1882 | - } | |
| 1883 | - else | |
| 1872 | + } else | |
| 1884 | 1873 |  		{ | 
| 1885 | 1874 |  			$port = self::get('_http_port'); | 
| 1886 | 1875 | if($port && $port != 80) | 
| 1887 | 1876 |  			{ | 
| 1888 | 1877 | $url_info['port'] = $port; | 
| 1889 | - } | |
| 1890 | - elseif($url_info['port'] == 80) | |
| 1878 | + } elseif($url_info['port'] == 80) | |
| 1891 | 1879 |  			{ | 
| 1892 | 1880 | unset($url_info['port']); | 
| 1893 | 1881 | } | 
| @@ -2124,8 +2112,7 @@ discard block | ||
| 2124 | 2112 | if(strpos($file, './') === 0) | 
| 2125 | 2113 |  		{ | 
| 2126 | 2114 | $file = $script_path . substr($file, 2); | 
| 2127 | - } | |
| 2128 | - elseif(strpos($file, '../') === 0) | |
| 2115 | + } elseif(strpos($file, '../') === 0) | |
| 2129 | 2116 |  		{ | 
| 2130 | 2117 | $file = self::normalizeFilePath($script_path . $file); | 
| 2131 | 2118 | } | 
| @@ -2387,8 +2374,7 @@ discard block | ||
| 2387 | 2374 | if(substr_compare($filename, '.js', -3) === 0) | 
| 2388 | 2375 |  			{ | 
| 2389 | 2376 | $result->jsList[] = $plugin_path . $filename; | 
| 2390 | - } | |
| 2391 | - elseif(substr_compare($filename, '.css', -4) === 0) | |
| 2377 | + } elseif(substr_compare($filename, '.css', -4) === 0) | |
| 2392 | 2378 |  			{ | 
| 2393 | 2379 | $result->cssList[] = $plugin_path . $filename; | 
| 2394 | 2380 | } | 
| @@ -2645,8 +2631,7 @@ discard block | ||
| 2645 | 2631 | if(count($_base) > 0) | 
| 2646 | 2632 |  			{ | 
| 2647 | 2633 | array_shift($_base); | 
| 2648 | - } | |
| 2649 | - else | |
| 2634 | + } else | |
| 2650 | 2635 |  			{ | 
| 2651 | 2636 | array_unshift($_base, '..'); | 
| 2652 | 2637 | } | 
| @@ -499,7 +499,7 @@ discard block | ||
| 499 | 499 | |
| 500 | 500 | /** | 
| 501 | 501 | * Returns object of error info | 
| 502 | - * @return object object of error | |
| 502 | + * @return Object object of error | |
| 503 | 503 | */ | 
| 504 | 504 | function getError() | 
| 505 | 505 |  	{ | 
| @@ -676,7 +676,7 @@ discard block | ||
| 676 | 676 | * Returns counter cache data | 
| 677 | 677 | * @param array|string $tables tables to get data | 
| 678 | 678 | * @param string $condition condition to get data | 
| 679 | - * @return int count of cache data | |
| 679 | + * @return boolean count of cache data | |
| 680 | 680 | */ | 
| 681 | 681 | function getCountCache($tables, $condition) | 
| 682 | 682 |  	{ | 
| @@ -736,7 +736,7 @@ discard block | ||
| 736 | 736 | * @param array|string $tables tables to save data | 
| 737 | 737 | * @param string $condition condition to save data | 
| 738 | 738 | * @param int $count count of cache data to save | 
| 739 | - * @return void | |
| 739 | + * @return boolean | |
| 740 | 740 | */ | 
| 741 | 741 | function putCountCache($tables, $condition, $count = 0) | 
| 742 | 742 |  	{ | 
| @@ -1247,7 +1247,7 @@ discard block | ||
| 1247 | 1247 | * DB Connect | 
| 1248 | 1248 | * this method is protected | 
| 1249 | 1249 | * @param array $connection | 
| 1250 | - * @return void | |
| 1250 | + * @return resource | |
| 1251 | 1251 | */ | 
| 1252 | 1252 | function __connect($connection) | 
| 1253 | 1253 |  	{ | 
| @@ -470,7 +470,7 @@ | ||
| 470 | 470 | * set query debug log | 
| 471 | 471 | * @param array $log values set query debug | 
| 472 | 472 | * @return void | 
| 473 | - */ | |
| 473 | + */ | |
| 474 | 474 | function setQueryLog($log) | 
| 475 | 475 |  	{ | 
| 476 | 476 | $GLOBALS['__db_queries__'][] = $log; | 
| @@ -327,8 +327,7 @@ discard block | ||
| 327 | 327 | if(!isset($this->priority_dbms[$a->db_type])) | 
| 328 | 328 |  		{ | 
| 329 | 329 | $priority_a = 0; | 
| 330 | - } | |
| 331 | - else | |
| 330 | + } else | |
| 332 | 331 |  		{ | 
| 333 | 332 | $priority_a = $this->priority_dbms[$a->db_type]; | 
| 334 | 333 | } | 
| @@ -336,8 +335,7 @@ discard block | ||
| 336 | 335 | if(!isset($this->priority_dbms[$b->db_type])) | 
| 337 | 336 |  		{ | 
| 338 | 337 | $priority_b = 0; | 
| 339 | - } | |
| 340 | - else | |
| 338 | + } else | |
| 341 | 339 |  		{ | 
| 342 | 340 | $priority_b = $this->priority_dbms[$b->db_type]; | 
| 343 | 341 | } | 
| @@ -371,8 +369,7 @@ discard block | ||
| 371 | 369 | if($type == 'master') | 
| 372 | 370 |  		{ | 
| 373 | 371 | return $this->master_db["is_connected"] ? TRUE : FALSE; | 
| 374 | - } | |
| 375 | - else | |
| 372 | + } else | |
| 376 | 373 |  		{ | 
| 377 | 374 | return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE; | 
| 378 | 375 | } | 
| @@ -450,8 +447,7 @@ discard block | ||
| 450 | 447 | $buff[] = print_r($log, TRUE); | 
| 451 | 448 |  				@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); | 
| 452 | 449 | } | 
| 453 | - } | |
| 454 | - else | |
| 450 | + } else | |
| 455 | 451 |  		{ | 
| 456 | 452 | $log['result'] = 'Success'; | 
| 457 | 453 | } | 
| @@ -540,8 +536,7 @@ discard block | ||
| 540 | 536 | $target = 'modules'; | 
| 541 | 537 | $module = $id_args[0]; | 
| 542 | 538 | $id = $id_args[1]; | 
| 543 | - } | |
| 544 | - elseif(count($id_args) == 3) | |
| 539 | + } elseif(count($id_args) == 3) | |
| 545 | 540 |  			{ | 
| 546 | 541 | $target = $id_args[0]; | 
| 547 | 542 |  				$typeList = array('addons' => 1, 'widgets' => 1); | 
| @@ -615,7 +610,9 @@ discard block | ||
| 615 | 610 |  	{ | 
| 616 | 611 | global $lang; | 
| 617 | 612 | |
| 618 | -		if(!in_array($type, array('master','slave'))) $type = 'slave'; | |
| 613 | +		if(!in_array($type, array('master','slave'))) { | |
| 614 | + $type = 'slave'; | |
| 615 | + } | |
| 619 | 616 | |
| 620 | 617 | if(!file_exists($cache_file)) | 
| 621 | 618 |  		{ | 
| @@ -661,8 +658,7 @@ discard block | ||
| 661 | 658 | if($this->isError()) | 
| 662 | 659 |  		{ | 
| 663 | 660 | $output = $this->getError(); | 
| 664 | - } | |
| 665 | - else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) | |
| 661 | + } else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) | |
| 666 | 662 |  		{ | 
| 667 | 663 | $output = new Object(); | 
| 668 | 664 | } | 
| @@ -1077,8 +1073,7 @@ discard block | ||
| 1077 | 1073 | if($type == 'master') | 
| 1078 | 1074 |  		{ | 
| 1079 | 1075 | $connection = &$this->master_db; | 
| 1080 | - } | |
| 1081 | - else | |
| 1076 | + } else | |
| 1082 | 1077 |  		{ | 
| 1083 | 1078 | $connection = &$this->slave_db[$indx]; | 
| 1084 | 1079 | } | 
| @@ -1173,8 +1168,7 @@ discard block | ||
| 1173 | 1168 |  		{ | 
| 1174 | 1169 | $this->transaction_started = FALSE; | 
| 1175 | 1170 | $this->transactionNestedLevel = 0; | 
| 1176 | - } | |
| 1177 | - else | |
| 1171 | + } else | |
| 1178 | 1172 |  		{ | 
| 1179 | 1173 | $this->transactionNestedLevel--; | 
| 1180 | 1174 | } | 
| @@ -1234,8 +1228,7 @@ discard block | ||
| 1234 | 1228 | ) | 
| 1235 | 1229 |  		{ | 
| 1236 | 1230 | $this->slave_db[0] = &$this->master_db; | 
| 1237 | - } | |
| 1238 | - else | |
| 1231 | + } else | |
| 1239 | 1232 |  		{ | 
| 1240 | 1233 | $this->slave_db = $db_info->slave_db; | 
| 1241 | 1234 | } | 
| @@ -1288,8 +1281,7 @@ discard block | ||
| 1288 | 1281 | if($type == 'master') | 
| 1289 | 1282 |  		{ | 
| 1290 | 1283 | $connection = &$this->master_db; | 
| 1291 | - } | |
| 1292 | - else | |
| 1284 | + } else | |
| 1293 | 1285 |  		{ | 
| 1294 | 1286 | $connection = &$this->slave_db[$indx]; | 
| 1295 | 1287 | } | 
| @@ -141,24 +141,24 @@ discard block | ||
| 141 | 141 | */ | 
| 142 | 142 | function getInstance($db_type = NULL) | 
| 143 | 143 |  	{ | 
| 144 | - if(!$db_type) | |
| 144 | + if (!$db_type) | |
| 145 | 145 |  		{ | 
| 146 | 146 | $db_type = Context::getDBType(); | 
| 147 | 147 | } | 
| 148 | - if(!$db_type && Context::isInstalled()) | |
| 148 | + if (!$db_type && Context::isInstalled()) | |
| 149 | 149 |  		{ | 
| 150 | 150 | return new Object(-1, 'msg_db_not_setted'); | 
| 151 | 151 | } | 
| 152 | 152 | |
| 153 | - if(!isset($GLOBALS['__DB__'])) | |
| 153 | + if (!isset($GLOBALS['__DB__'])) | |
| 154 | 154 |  		{ | 
| 155 | 155 | $GLOBALS['__DB__'] = array(); | 
| 156 | 156 | } | 
| 157 | - if(!isset($GLOBALS['__DB__'][$db_type])) | |
| 157 | + if (!isset($GLOBALS['__DB__'][$db_type])) | |
| 158 | 158 |  		{ | 
| 159 | - $class_name = 'DB' . ucfirst($db_type); | |
| 160 | - $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; | |
| 161 | - if(!file_exists($class_file)) | |
| 159 | + $class_name = 'DB'.ucfirst($db_type); | |
| 160 | + $class_file = _XE_PATH_."classes/db/$class_name.class.php"; | |
| 161 | + if (!file_exists($class_file)) | |
| 162 | 162 |  			{ | 
| 163 | 163 | return new Object(-1, 'msg_db_not_setted'); | 
| 164 | 164 | } | 
| @@ -187,8 +187,8 @@ discard block | ||
| 187 | 187 | */ | 
| 188 | 188 | function DB() | 
| 189 | 189 |  	{ | 
| 190 | - $this->count_cache_path = _XE_PATH_ . $this->count_cache_path; | |
| 191 | - $this->cache_file = _XE_PATH_ . $this->cache_file; | |
| 190 | + $this->count_cache_path = _XE_PATH_.$this->count_cache_path; | |
| 191 | + $this->cache_file = _XE_PATH_.$this->cache_file; | |
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | 194 | /** | 
| @@ -210,18 +210,18 @@ discard block | ||
| 210 | 210 | */ | 
| 211 | 211 | public static function getEnableList() | 
| 212 | 212 |  	{ | 
| 213 | - if(!self::$supported_list) | |
| 213 | + if (!self::$supported_list) | |
| 214 | 214 |  		{ | 
| 215 | 215 | $oDB = new DB(); | 
| 216 | 216 | self::$supported_list = $oDB->_getSupportedList(); | 
| 217 | 217 | } | 
| 218 | 218 | |
| 219 | 219 | $enableList = array(); | 
| 220 | - if(is_array(self::$supported_list)) | |
| 220 | + if (is_array(self::$supported_list)) | |
| 221 | 221 |  		{ | 
| 222 | - foreach(self::$supported_list AS $key => $value) | |
| 222 | + foreach (self::$supported_list AS $key => $value) | |
| 223 | 223 |  			{ | 
| 224 | - if($value->enable) | |
| 224 | + if ($value->enable) | |
| 225 | 225 |  				{ | 
| 226 | 226 | $enableList[] = $value; | 
| 227 | 227 | } | 
| @@ -237,18 +237,18 @@ discard block | ||
| 237 | 237 | */ | 
| 238 | 238 | public static function getDisableList() | 
| 239 | 239 |  	{ | 
| 240 | - if(!self::$supported_list) | |
| 240 | + if (!self::$supported_list) | |
| 241 | 241 |  		{ | 
| 242 | 242 | $oDB = new DB(); | 
| 243 | 243 | self::$supported_list = $oDB->_getSupportedList(); | 
| 244 | 244 | } | 
| 245 | 245 | |
| 246 | 246 | $disableList = array(); | 
| 247 | - if(is_array(self::$supported_list)) | |
| 247 | + if (is_array(self::$supported_list)) | |
| 248 | 248 |  		{ | 
| 249 | - foreach(self::$supported_list AS $key => $value) | |
| 249 | + foreach (self::$supported_list AS $key => $value) | |
| 250 | 250 |  			{ | 
| 251 | - if(!$value->enable) | |
| 251 | + if (!$value->enable) | |
| 252 | 252 |  				{ | 
| 253 | 253 | $disableList[] = $value; | 
| 254 | 254 | } | 
| @@ -265,24 +265,24 @@ discard block | ||
| 265 | 265 | function _getSupportedList() | 
| 266 | 266 |  	{ | 
| 267 | 267 | static $get_supported_list = ''; | 
| 268 | - if(is_array($get_supported_list)) | |
| 268 | + if (is_array($get_supported_list)) | |
| 269 | 269 |  		{ | 
| 270 | 270 | self::$supported_list = $get_supported_list; | 
| 271 | 271 | return self::$supported_list; | 
| 272 | 272 | } | 
| 273 | 273 | $get_supported_list = array(); | 
| 274 | - $db_classes_path = _XE_PATH_ . "classes/db/"; | |
| 274 | + $db_classes_path = _XE_PATH_."classes/db/"; | |
| 275 | 275 | $filter = "/^DB([^\.]+)\.class\.php/i"; | 
| 276 | 276 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); | 
| 277 | 277 | |
| 278 | 278 | // after creating instance of class, check is supported | 
| 279 | - for($i = 0; $i < count($supported_list); $i++) | |
| 279 | + for ($i = 0; $i < count($supported_list); $i++) | |
| 280 | 280 |  		{ | 
| 281 | 281 | $db_type = $supported_list[$i]; | 
| 282 | 282 | |
| 283 | 283 |  			$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); | 
| 284 | - $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); | |
| 285 | - if(!file_exists($class_file)) | |
| 284 | + $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name); | |
| 285 | + if (!file_exists($class_file)) | |
| 286 | 286 |  			{ | 
| 287 | 287 | continue; | 
| 288 | 288 | } | 
| @@ -291,7 +291,7 @@ discard block | ||
| 291 | 291 | require_once($class_file); | 
| 292 | 292 | $oDB = new $class_name(FALSE); | 
| 293 | 293 | |
| 294 | - if(!$oDB) | |
| 294 | + if (!$oDB) | |
| 295 | 295 |  			{ | 
| 296 | 296 | continue; | 
| 297 | 297 | } | 
| @@ -315,7 +315,7 @@ discard block | ||
| 315 | 315 | */ | 
| 316 | 316 | function _sortDBMS($a, $b) | 
| 317 | 317 |  	{ | 
| 318 | - if(!isset($this->priority_dbms[$a->db_type])) | |
| 318 | + if (!isset($this->priority_dbms[$a->db_type])) | |
| 319 | 319 |  		{ | 
| 320 | 320 | $priority_a = 0; | 
| 321 | 321 | } | 
| @@ -324,7 +324,7 @@ discard block | ||
| 324 | 324 | $priority_a = $this->priority_dbms[$a->db_type]; | 
| 325 | 325 | } | 
| 326 | 326 | |
| 327 | - if(!isset($this->priority_dbms[$b->db_type])) | |
| 327 | + if (!isset($this->priority_dbms[$b->db_type])) | |
| 328 | 328 |  		{ | 
| 329 | 329 | $priority_b = 0; | 
| 330 | 330 | } | 
| @@ -333,7 +333,7 @@ discard block | ||
| 333 | 333 | $priority_b = $this->priority_dbms[$b->db_type]; | 
| 334 | 334 | } | 
| 335 | 335 | |
| 336 | - if($priority_a == $priority_b) | |
| 336 | + if ($priority_a == $priority_b) | |
| 337 | 337 |  		{ | 
| 338 | 338 | return 0; | 
| 339 | 339 | } | 
| @@ -359,7 +359,7 @@ discard block | ||
| 359 | 359 | */ | 
| 360 | 360 | function isConnected($type = 'master', $indx = 0) | 
| 361 | 361 |  	{ | 
| 362 | - if($type == 'master') | |
| 362 | + if ($type == 'master') | |
| 363 | 363 |  		{ | 
| 364 | 364 | return $this->master_db["is_connected"] ? TRUE : FALSE; | 
| 365 | 365 | } | 
| @@ -388,7 +388,7 @@ discard block | ||
| 388 | 388 | */ | 
| 389 | 389 | function actFinish() | 
| 390 | 390 |  	{ | 
| 391 | - if(!$this->query) | |
| 391 | + if (!$this->query) | |
| 392 | 392 |  		{ | 
| 393 | 393 | return; | 
| 394 | 394 | } | 
| @@ -409,14 +409,14 @@ discard block | ||
| 409 | 409 | |
| 410 | 410 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); | 
| 411 | 411 | |
| 412 | - foreach($bt as $no => $call) | |
| 412 | + foreach ($bt as $no => $call) | |
| 413 | 413 |  		{ | 
| 414 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') | |
| 414 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') | |
| 415 | 415 |  			{ | 
| 416 | 416 | $call_no = $no; | 
| 417 | 417 | $call_no++; | 
| 418 | 418 | $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; | 
| 419 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); | |
| 419 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); | |
| 420 | 420 | $call_no++; | 
| 421 | 421 | $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; | 
| 422 | 422 | break; | 
| @@ -424,22 +424,22 @@ discard block | ||
| 424 | 424 | } | 
| 425 | 425 | |
| 426 | 426 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) | 
| 427 | - if($this->isError()) | |
| 427 | + if ($this->isError()) | |
| 428 | 428 |  		{ | 
| 429 | 429 | $log['result'] = 'Failed'; | 
| 430 | 430 | $log['errno'] = $this->errno; | 
| 431 | 431 | $log['errstr'] = $this->errstr; | 
| 432 | 432 | |
| 433 | - if(__DEBUG_DB_OUTPUT__ == 1) | |
| 433 | + if (__DEBUG_DB_OUTPUT__ == 1) | |
| 434 | 434 |  			{ | 
| 435 | - $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; | |
| 435 | + $debug_file = _XE_PATH_."files/_debug_db_query.php"; | |
| 436 | 436 | $buff = array(); | 
| 437 | - if(!file_exists($debug_file)) | |
| 437 | + if (!file_exists($debug_file)) | |
| 438 | 438 |  				{ | 
| 439 | - $buff[] = '<?php exit(); ?' . '>'; | |
| 439 | + $buff[] = '<?php exit(); ?'.'>'; | |
| 440 | 440 | } | 
| 441 | 441 | $buff[] = print_r($log, TRUE); | 
| 442 | -				@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); | |
| 442 | +				@file_put_contents($log_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX); | |
| 443 | 443 | } | 
| 444 | 444 | } | 
| 445 | 445 | else | 
| @@ -452,7 +452,7 @@ discard block | ||
| 452 | 452 | $log_args = new stdClass; | 
| 453 | 453 | $log_args->query = $this->query; | 
| 454 | 454 | $log_args->query_id = $this->query_id; | 
| 455 | - $log_args->caller = $log['called_method'] . '() in ' . $log['called_file']; | |
| 455 | + $log_args->caller = $log['called_method'].'() in '.$log['called_file']; | |
| 456 | 456 | $log_args->connection = $log['connection']; | 
| 457 | 457 |  		writeSlowlog('query', $elapsed_time, $log_args); | 
| 458 | 458 | } | 
| @@ -510,11 +510,11 @@ discard block | ||
| 510 | 510 |  	{ | 
| 511 | 511 | static $cache_file = array(); | 
| 512 | 512 | |
| 513 | - if(!$query_id) | |
| 513 | + if (!$query_id) | |
| 514 | 514 |  		{ | 
| 515 | 515 | return new Object(-1, 'msg_invalid_queryid'); | 
| 516 | 516 | } | 
| 517 | - if(!$this->db_type) | |
| 517 | + if (!$this->db_type) | |
| 518 | 518 |  		{ | 
| 519 | 519 | return; | 
| 520 | 520 | } | 
| @@ -523,20 +523,20 @@ discard block | ||
| 523 | 523 | |
| 524 | 524 | $this->query_id = $query_id; | 
| 525 | 525 | |
| 526 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) | |
| 526 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) | |
| 527 | 527 |  		{ | 
| 528 | 528 |  			$id_args = explode('.', $query_id); | 
| 529 | - if(count($id_args) == 2) | |
| 529 | + if (count($id_args) == 2) | |
| 530 | 530 |  			{ | 
| 531 | 531 | $target = 'modules'; | 
| 532 | 532 | $module = $id_args[0]; | 
| 533 | 533 | $id = $id_args[1]; | 
| 534 | 534 | } | 
| 535 | - elseif(count($id_args) == 3) | |
| 535 | + elseif (count($id_args) == 3) | |
| 536 | 536 |  			{ | 
| 537 | 537 | $target = $id_args[0]; | 
| 538 | 538 |  				$typeList = array('addons' => 1, 'widgets' => 1); | 
| 539 | - if(!isset($typeList[$target])) | |
| 539 | + if (!isset($typeList[$target])) | |
| 540 | 540 |  				{ | 
| 541 | 541 | $this->actDBClassFinish(); | 
| 542 | 542 | return; | 
| @@ -544,14 +544,14 @@ discard block | ||
| 544 | 544 | $module = $id_args[1]; | 
| 545 | 545 | $id = $id_args[2]; | 
| 546 | 546 | } | 
| 547 | - if(!$target || !$module || !$id) | |
| 547 | + if (!$target || !$module || !$id) | |
| 548 | 548 |  			{ | 
| 549 | 549 | $this->actDBClassFinish(); | 
| 550 | 550 | return new Object(-1, 'msg_invalid_queryid'); | 
| 551 | 551 | } | 
| 552 | 552 | |
| 553 | 553 |  			$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); | 
| 554 | - if(!file_exists($xml_file)) | |
| 554 | + if (!file_exists($xml_file)) | |
| 555 | 555 |  			{ | 
| 556 | 556 | $this->actDBClassFinish(); | 
| 557 | 557 | return new Object(-1, 'msg_invalid_queryid'); | 
| @@ -579,13 +579,13 @@ discard block | ||
| 579 | 579 |  		$cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); | 
| 580 | 580 | |
| 581 | 581 | $cache_time = -1; | 
| 582 | - if(file_exists($cache_file)) | |
| 582 | + if (file_exists($cache_file)) | |
| 583 | 583 |  		{ | 
| 584 | 584 | $cache_time = filemtime($cache_file); | 
| 585 | 585 | } | 
| 586 | 586 | |
| 587 | 587 | // if there is no cache file or is not new, find original xml query file and parse it | 
| 588 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) | |
| 588 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php')) | |
| 589 | 589 |  		{ | 
| 590 | 590 | $oParser = new XmlQueryParser(); | 
| 591 | 591 | $oParser->parse($query_id, $xml_file, $cache_file); | 
| @@ -606,27 +606,27 @@ discard block | ||
| 606 | 606 |  	{ | 
| 607 | 607 | global $lang; | 
| 608 | 608 | |
| 609 | -		if(!in_array($type, array('master','slave'))) $type = 'slave'; | |
| 609 | +		if (!in_array($type, array('master', 'slave'))) $type = 'slave'; | |
| 610 | 610 | |
| 611 | - if(!file_exists($cache_file)) | |
| 611 | + if (!file_exists($cache_file)) | |
| 612 | 612 |  		{ | 
| 613 | 613 | return new Object(-1, 'msg_invalid_queryid'); | 
| 614 | 614 | } | 
| 615 | 615 | |
| 616 | - if($source_args) | |
| 616 | + if ($source_args) | |
| 617 | 617 |  		{ | 
| 618 | 618 | $args = clone $source_args; | 
| 619 | 619 | } | 
| 620 | 620 | |
| 621 | 621 | $output = include($cache_file); | 
| 622 | 622 | |
| 623 | - if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) | |
| 623 | + if ((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) | |
| 624 | 624 |  		{ | 
| 625 | 625 | return $output; | 
| 626 | 626 | } | 
| 627 | 627 | |
| 628 | 628 | // execute appropriate query | 
| 629 | - switch($output->getAction()) | |
| 629 | + switch ($output->getAction()) | |
| 630 | 630 |  		{ | 
| 631 | 631 | case 'insert' : | 
| 632 | 632 | case 'insert-select' : | 
| @@ -649,11 +649,11 @@ discard block | ||
| 649 | 649 | break; | 
| 650 | 650 | } | 
| 651 | 651 | |
| 652 | - if($this->isError()) | |
| 652 | + if ($this->isError()) | |
| 653 | 653 |  		{ | 
| 654 | 654 | $output = $this->getError(); | 
| 655 | 655 | } | 
| 656 | - else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) | |
| 656 | + else if (!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) | |
| 657 | 657 |  		{ | 
| 658 | 658 | $output = new Object(); | 
| 659 | 659 | } | 
| @@ -799,7 +799,7 @@ discard block | ||
| 799 | 799 | */ | 
| 800 | 800 | function dropTable($table_name) | 
| 801 | 801 |  	{ | 
| 802 | - if(!$table_name) | |
| 802 | + if (!$table_name) | |
| 803 | 803 |  		{ | 
| 804 | 804 | return; | 
| 805 | 805 | } | 
| @@ -816,59 +816,59 @@ discard block | ||
| 816 | 816 | function getSelectSql($query, $with_values = TRUE) | 
| 817 | 817 |  	{ | 
| 818 | 818 | $select = $query->getSelectString($with_values); | 
| 819 | - if($select == '') | |
| 819 | + if ($select == '') | |
| 820 | 820 |  		{ | 
| 821 | 821 | return new Object(-1, "Invalid query"); | 
| 822 | 822 | } | 
| 823 | - $select = 'SELECT ' . $select; | |
| 823 | + $select = 'SELECT '.$select; | |
| 824 | 824 | |
| 825 | 825 | $from = $query->getFromString($with_values); | 
| 826 | - if($from == '') | |
| 826 | + if ($from == '') | |
| 827 | 827 |  		{ | 
| 828 | 828 | return new Object(-1, "Invalid query"); | 
| 829 | 829 | } | 
| 830 | - $from = ' FROM ' . $from; | |
| 830 | + $from = ' FROM '.$from; | |
| 831 | 831 | |
| 832 | 832 | $where = $query->getWhereString($with_values); | 
| 833 | - if($where != '') | |
| 833 | + if ($where != '') | |
| 834 | 834 |  		{ | 
| 835 | - $where = ' WHERE ' . $where; | |
| 835 | + $where = ' WHERE '.$where; | |
| 836 | 836 | } | 
| 837 | 837 | |
| 838 | 838 | $tableObjects = $query->getTables(); | 
| 839 | 839 | $index_hint_list = ''; | 
| 840 | - foreach($tableObjects as $tableObject) | |
| 840 | + foreach ($tableObjects as $tableObject) | |
| 841 | 841 |  		{ | 
| 842 | - if(is_a($tableObject, 'CubridTableWithHint')) | |
| 842 | + if (is_a($tableObject, 'CubridTableWithHint')) | |
| 843 | 843 |  			{ | 
| 844 | - $index_hint_list .= $tableObject->getIndexHintString() . ', '; | |
| 844 | + $index_hint_list .= $tableObject->getIndexHintString().', '; | |
| 845 | 845 | } | 
| 846 | 846 | } | 
| 847 | 847 | $index_hint_list = substr($index_hint_list, 0, -2); | 
| 848 | - if($index_hint_list != '') | |
| 848 | + if ($index_hint_list != '') | |
| 849 | 849 |  		{ | 
| 850 | - $index_hint_list = 'USING INDEX ' . $index_hint_list; | |
| 850 | + $index_hint_list = 'USING INDEX '.$index_hint_list; | |
| 851 | 851 | } | 
| 852 | 852 | |
| 853 | 853 | $groupBy = $query->getGroupByString(); | 
| 854 | - if($groupBy != '') | |
| 854 | + if ($groupBy != '') | |
| 855 | 855 |  		{ | 
| 856 | - $groupBy = ' GROUP BY ' . $groupBy; | |
| 856 | + $groupBy = ' GROUP BY '.$groupBy; | |
| 857 | 857 | } | 
| 858 | 858 | |
| 859 | 859 | $orderBy = $query->getOrderByString(); | 
| 860 | - if($orderBy != '') | |
| 860 | + if ($orderBy != '') | |
| 861 | 861 |  		{ | 
| 862 | - $orderBy = ' ORDER BY ' . $orderBy; | |
| 862 | + $orderBy = ' ORDER BY '.$orderBy; | |
| 863 | 863 | } | 
| 864 | 864 | |
| 865 | 865 | $limit = $query->getLimitString(); | 
| 866 | - if($limit != '') | |
| 866 | + if ($limit != '') | |
| 867 | 867 |  		{ | 
| 868 | - $limit = ' LIMIT ' . $limit; | |
| 868 | + $limit = ' LIMIT '.$limit; | |
| 869 | 869 | } | 
| 870 | 870 | |
| 871 | - return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; | |
| 871 | + return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit; | |
| 872 | 872 | } | 
| 873 | 873 | |
| 874 | 874 | /** | 
| @@ -886,7 +886,7 @@ discard block | ||
| 886 | 886 |  	{ | 
| 887 | 887 | $new_update_columns = array(); | 
| 888 | 888 | $click_count_columns = $queryObject->getClickCountColumns(); | 
| 889 | - foreach($click_count_columns as $click_count_column) | |
| 889 | + foreach ($click_count_columns as $click_count_column) | |
| 890 | 890 |  		{ | 
| 891 | 891 | $click_count_column_name = $click_count_column->column_name; | 
| 892 | 892 | |
| @@ -918,16 +918,16 @@ discard block | ||
| 918 | 918 | $sql .= $tables[0]->getAlias(); | 
| 919 | 919 | |
| 920 | 920 | $from = $query->getFromString($with_values); | 
| 921 | - if($from == '') | |
| 921 | + if ($from == '') | |
| 922 | 922 |  		{ | 
| 923 | 923 | return new Object(-1, "Invalid query"); | 
| 924 | 924 | } | 
| 925 | - $sql .= ' FROM ' . $from; | |
| 925 | + $sql .= ' FROM '.$from; | |
| 926 | 926 | |
| 927 | 927 | $where = $query->getWhereString($with_values); | 
| 928 | - if($where != '') | |
| 928 | + if ($where != '') | |
| 929 | 929 |  		{ | 
| 930 | - $sql .= ' WHERE ' . $where; | |
| 930 | + $sql .= ' WHERE '.$where; | |
| 931 | 931 | } | 
| 932 | 932 | |
| 933 | 933 | return $sql; | 
| @@ -943,26 +943,26 @@ discard block | ||
| 943 | 943 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) | 
| 944 | 944 |  	{ | 
| 945 | 945 | $columnsList = $query->getUpdateString($with_values); | 
| 946 | - if($columnsList == '') | |
| 946 | + if ($columnsList == '') | |
| 947 | 947 |  		{ | 
| 948 | 948 | return new Object(-1, "Invalid query"); | 
| 949 | 949 | } | 
| 950 | 950 | |
| 951 | 951 | $tables = $query->getFromString($with_values); | 
| 952 | - if($tables == '') | |
| 952 | + if ($tables == '') | |
| 953 | 953 |  		{ | 
| 954 | 954 | return new Object(-1, "Invalid query"); | 
| 955 | 955 | } | 
| 956 | 956 | |
| 957 | 957 | $where = $query->getWhereString($with_values); | 
| 958 | - if($where != '') | |
| 958 | + if ($where != '') | |
| 959 | 959 |  		{ | 
| 960 | - $where = ' WHERE ' . $where; | |
| 960 | + $where = ' WHERE '.$where; | |
| 961 | 961 | } | 
| 962 | 962 | |
| 963 | 963 | $priority = $with_priority ? $query->getPriority() : ''; | 
| 964 | 964 | |
| 965 | - return "UPDATE $priority $tables SET $columnsList " . $where; | |
| 965 | + return "UPDATE $priority $tables SET $columnsList ".$where; | |
| 966 | 966 | } | 
| 967 | 967 | |
| 968 | 968 | /** | 
| @@ -1000,27 +1000,27 @@ discard block | ||
| 1000 | 1000 | */ | 
| 1001 | 1001 | function _getConnection($type = 'master', $indx = NULL) | 
| 1002 | 1002 |  	{ | 
| 1003 | - if($type == 'master') | |
| 1003 | + if ($type == 'master') | |
| 1004 | 1004 |  		{ | 
| 1005 | - if(!$this->master_db['is_connected']) | |
| 1005 | + if (!$this->master_db['is_connected']) | |
| 1006 | 1006 |  			{ | 
| 1007 | 1007 | $this->_connect($type); | 
| 1008 | 1008 | } | 
| 1009 | - $this->connection = 'Master ' . $this->master_db['db_hostname']; | |
| 1009 | + $this->connection = 'Master '.$this->master_db['db_hostname']; | |
| 1010 | 1010 | return $this->master_db["resource"]; | 
| 1011 | 1011 | } | 
| 1012 | 1012 | |
| 1013 | - if($indx === NULL) | |
| 1013 | + if ($indx === NULL) | |
| 1014 | 1014 |  		{ | 
| 1015 | 1015 | $indx = $this->_getSlaveConnectionStringIndex($type); | 
| 1016 | 1016 | } | 
| 1017 | 1017 | |
| 1018 | - if(!$this->slave_db[$indx]['is_connected']) | |
| 1018 | + if (!$this->slave_db[$indx]['is_connected']) | |
| 1019 | 1019 |  		{ | 
| 1020 | 1020 | $this->_connect($type, $indx); | 
| 1021 | 1021 | } | 
| 1022 | 1022 | |
| 1023 | - $this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname']; | |
| 1023 | + $this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname']; | |
| 1024 | 1024 | return $this->slave_db[$indx]["resource"]; | 
| 1025 | 1025 | } | 
| 1026 | 1026 | |
| @@ -1030,11 +1030,11 @@ discard block | ||
| 1030 | 1030 | */ | 
| 1031 | 1031 | function _dbInfoExists() | 
| 1032 | 1032 |  	{ | 
| 1033 | - if(!$this->master_db) | |
| 1033 | + if (!$this->master_db) | |
| 1034 | 1034 |  		{ | 
| 1035 | 1035 | return FALSE; | 
| 1036 | 1036 | } | 
| 1037 | - if(count($this->slave_db) === 0) | |
| 1037 | + if (count($this->slave_db) === 0) | |
| 1038 | 1038 |  		{ | 
| 1039 | 1039 | return FALSE; | 
| 1040 | 1040 | } | 
| @@ -1060,12 +1060,12 @@ discard block | ||
| 1060 | 1060 | */ | 
| 1061 | 1061 | function close($type = 'master', $indx = 0) | 
| 1062 | 1062 |  	{ | 
| 1063 | - if(!$this->isConnected($type, $indx)) | |
| 1063 | + if (!$this->isConnected($type, $indx)) | |
| 1064 | 1064 |  		{ | 
| 1065 | 1065 | return; | 
| 1066 | 1066 | } | 
| 1067 | 1067 | |
| 1068 | - if($type == 'master') | |
| 1068 | + if ($type == 'master') | |
| 1069 | 1069 |  		{ | 
| 1070 | 1070 | $connection = &$this->master_db; | 
| 1071 | 1071 | } | 
| @@ -1096,12 +1096,12 @@ discard block | ||
| 1096 | 1096 | */ | 
| 1097 | 1097 | function begin() | 
| 1098 | 1098 |  	{ | 
| 1099 | - if(!$this->isConnected()) | |
| 1099 | + if (!$this->isConnected()) | |
| 1100 | 1100 |  		{ | 
| 1101 | 1101 | return; | 
| 1102 | 1102 | } | 
| 1103 | 1103 | |
| 1104 | - if($this->_begin($this->transactionNestedLevel)) | |
| 1104 | + if ($this->_begin($this->transactionNestedLevel)) | |
| 1105 | 1105 |  		{ | 
| 1106 | 1106 | $this->transaction_started = TRUE; | 
| 1107 | 1107 | $this->transactionNestedLevel++; | 
| @@ -1124,15 +1124,15 @@ discard block | ||
| 1124 | 1124 | */ | 
| 1125 | 1125 | function rollback() | 
| 1126 | 1126 |  	{ | 
| 1127 | - if(!$this->isConnected() || !$this->transaction_started) | |
| 1127 | + if (!$this->isConnected() || !$this->transaction_started) | |
| 1128 | 1128 |  		{ | 
| 1129 | 1129 | return; | 
| 1130 | 1130 | } | 
| 1131 | - if($this->_rollback($this->transactionNestedLevel)) | |
| 1131 | + if ($this->_rollback($this->transactionNestedLevel)) | |
| 1132 | 1132 |  		{ | 
| 1133 | 1133 | $this->transactionNestedLevel--; | 
| 1134 | 1134 | |
| 1135 | - if(!$this->transactionNestedLevel) | |
| 1135 | + if (!$this->transactionNestedLevel) | |
| 1136 | 1136 |  			{ | 
| 1137 | 1137 | $this->transaction_started = FALSE; | 
| 1138 | 1138 | } | 
| @@ -1156,11 +1156,11 @@ discard block | ||
| 1156 | 1156 | */ | 
| 1157 | 1157 | function commit($force = FALSE) | 
| 1158 | 1158 |  	{ | 
| 1159 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) | |
| 1159 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) | |
| 1160 | 1160 |  		{ | 
| 1161 | 1161 | return; | 
| 1162 | 1162 | } | 
| 1163 | - if($this->transactionNestedLevel == 1 && $this->_commit()) | |
| 1163 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) | |
| 1164 | 1164 |  		{ | 
| 1165 | 1165 | $this->transaction_started = FALSE; | 
| 1166 | 1166 | $this->transactionNestedLevel = 0; | 
| @@ -1192,7 +1192,7 @@ discard block | ||
| 1192 | 1192 | */ | 
| 1193 | 1193 | function _query($query, $connection = NULL) | 
| 1194 | 1194 |  	{ | 
| 1195 | - if($connection == NULL) | |
| 1195 | + if ($connection == NULL) | |
| 1196 | 1196 |  		{ | 
| 1197 | 1197 |  			$connection = $this->_getConnection('master'); | 
| 1198 | 1198 | } | 
| @@ -1217,7 +1217,7 @@ discard block | ||
| 1217 | 1217 |  	{ | 
| 1218 | 1218 | $db_info = Context::getDBInfo(); | 
| 1219 | 1219 | $this->master_db = $db_info->master_db; | 
| 1220 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] | |
| 1220 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] | |
| 1221 | 1221 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] | 
| 1222 | 1222 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] | 
| 1223 | 1223 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] | 
| @@ -1265,18 +1265,18 @@ discard block | ||
| 1265 | 1265 | */ | 
| 1266 | 1266 | function _connect($type = 'master', $indx = 0) | 
| 1267 | 1267 |  	{ | 
| 1268 | - if($this->isConnected($type, $indx)) | |
| 1268 | + if ($this->isConnected($type, $indx)) | |
| 1269 | 1269 |  		{ | 
| 1270 | 1270 | return; | 
| 1271 | 1271 | } | 
| 1272 | 1272 | |
| 1273 | 1273 | // Ignore if no DB information exists | 
| 1274 | - if(!$this->_dbInfoExists()) | |
| 1274 | + if (!$this->_dbInfoExists()) | |
| 1275 | 1275 |  		{ | 
| 1276 | 1276 | return; | 
| 1277 | 1277 | } | 
| 1278 | 1278 | |
| 1279 | - if($type == 'master') | |
| 1279 | + if ($type == 'master') | |
| 1280 | 1280 |  		{ | 
| 1281 | 1281 | $connection = &$this->master_db; | 
| 1282 | 1282 | } | 
| @@ -1286,7 +1286,7 @@ discard block | ||
| 1286 | 1286 | } | 
| 1287 | 1287 | |
| 1288 | 1288 | $result = $this->__connect($connection); | 
| 1289 | - if($result === NULL || $result === FALSE) | |
| 1289 | + if ($result === NULL || $result === FALSE) | |
| 1290 | 1290 |  		{ | 
| 1291 | 1291 | $connection["is_connected"] = FALSE; | 
| 1292 | 1292 | return; | 
| @@ -1297,7 +1297,7 @@ discard block | ||
| 1297 | 1297 | $connection["is_connected"] = TRUE; | 
| 1298 | 1298 | |
| 1299 | 1299 | // Save connection info for db logs | 
| 1300 | - $this->connection = ucfirst($type) . ' ' . $connection["db_hostname"]; | |
| 1300 | + $this->connection = ucfirst($type).' '.$connection["db_hostname"]; | |
| 1301 | 1301 | |
| 1302 | 1302 | // regist $this->close callback | 
| 1303 | 1303 | register_shutdown_function(array($this, "close")); | 
| @@ -1322,7 +1322,7 @@ discard block | ||
| 1322 | 1322 | */ | 
| 1323 | 1323 | function actDBClassFinish() | 
| 1324 | 1324 |  	{ | 
| 1325 | - if(!$this->query) | |
| 1325 | + if (!$this->query) | |
| 1326 | 1326 |  		{ | 
| 1327 | 1327 | return; | 
| 1328 | 1328 | } | 
| @@ -1345,7 +1345,7 @@ discard block | ||
| 1345 | 1345 | function getParser($force = FALSE) | 
| 1346 | 1346 |  	{ | 
| 1347 | 1347 | static $dbParser = NULL; | 
| 1348 | - if(!$dbParser || $force) | |
| 1348 | + if (!$dbParser || $force) | |
| 1349 | 1349 |  		{ | 
| 1350 | 1350 | $oDB = DB::getInstance(); | 
| 1351 | 1351 | $dbParser = $oDB->getParser(); | 
| @@ -477,7 +477,7 @@ discard block | ||
| 477 | 477 | * @param int $size column size | 
| 478 | 478 | * @param string|int $default default value | 
| 479 | 479 | * @param boolean $notnull not null status, default value is false | 
| 480 | - * @return void | |
| 480 | + * @return resource|null | |
| 481 | 481 | */ | 
| 482 | 482 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE) | 
| 483 | 483 |  	{ | 
| @@ -693,7 +693,7 @@ discard block | ||
| 693 | 693 | /** | 
| 694 | 694 | * Creates a table by using xml contents | 
| 695 | 695 | * @param string $xml_doc xml schema contents | 
| 696 | - * @return void|object | |
| 696 | + * @return null|resource | |
| 697 | 697 | */ | 
| 698 | 698 | function createTableByXml($xml_doc) | 
| 699 | 699 |  	{ | 
| @@ -703,7 +703,7 @@ discard block | ||
| 703 | 703 | /** | 
| 704 | 704 | * Creates a table by using xml file path | 
| 705 | 705 | * @param string $file_name xml schema file path | 
| 706 | - * @return void|object | |
| 706 | + * @return null|resource | |
| 707 | 707 | */ | 
| 708 | 708 | function createTableByXmlFile($file_name) | 
| 709 | 709 |  	{ | 
| @@ -723,7 +723,7 @@ discard block | ||
| 723 | 723 | * opt : notnull, default, size\n | 
| 724 | 724 | * index : primary key, index, unique\n | 
| 725 | 725 | * @param string $xml_doc xml schema contents | 
| 726 | - * @return void|object | |
| 726 | + * @return null|resource | |
| 727 | 727 | */ | 
| 728 | 728 | function _createTable($xml_doc) | 
| 729 | 729 |  	{ | 
| @@ -951,7 +951,7 @@ discard block | ||
| 951 | 951 | * @param Object $queryObject | 
| 952 | 952 | * @param resource $connection | 
| 953 | 953 | * @param boolean $with_values | 
| 954 | - * @return Object | |
| 954 | + * @return Object|null | |
| 955 | 955 | */ | 
| 956 | 956 | function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE) | 
| 957 | 957 |  	{ | 
| @@ -995,7 +995,7 @@ discard block | ||
| 995 | 995 | /** | 
| 996 | 996 | * If have a error, return error object | 
| 997 | 997 | * @param Object $queryObject | 
| 998 | - * @return Object | |
| 998 | + * @return Object|null | |
| 999 | 999 | */ | 
| 1000 | 1000 | function queryError($queryObject) | 
| 1001 | 1001 |  	{ | 
| @@ -1018,7 +1018,7 @@ discard block | ||
| 1018 | 1018 | * @param Object $queryObject | 
| 1019 | 1019 | * @param resource $connection | 
| 1020 | 1020 | * @param boolean $with_values | 
| 1021 | - * @return Object Object with page info containing | |
| 1021 | + * @return Object|null Object with page info containing | |
| 1022 | 1022 | */ | 
| 1023 | 1023 | function queryPageLimit($queryObject, $connection, $with_values) | 
| 1024 | 1024 |  	{ | 
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 | function DBCubrid($auto_connect = TRUE) | 
| 53 | 53 |  	{ | 
| 54 | 54 | $this->_setDBInfo(); | 
| 55 | - if($auto_connect) $this->_connect(); | |
| 55 | + if ($auto_connect) $this->_connect(); | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | /** | 
| @@ -76,21 +76,21 @@ discard block | ||
| 76 | 76 | $result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]); | 
| 77 | 77 | |
| 78 | 78 | // check connections | 
| 79 | - if(!$result) | |
| 79 | + if (!$result) | |
| 80 | 80 |  		{ | 
| 81 | 81 | $this->setError(-1, 'database connect fail'); | 
| 82 | 82 | return; | 
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | -		if(!defined('__CUBRID_VERSION__')) | |
| 85 | +		if (!defined('__CUBRID_VERSION__')) | |
| 86 | 86 |  		{ | 
| 87 | 87 | $cubrid_version = cubrid_get_server_info($result); | 
| 88 | 88 |  			$cubrid_version_elem = explode('.', $cubrid_version); | 
| 89 | - $cubrid_version = $cubrid_version_elem[0] . '.' . $cubrid_version_elem[1] . '.' . $cubrid_version_elem[2]; | |
| 89 | + $cubrid_version = $cubrid_version_elem[0].'.'.$cubrid_version_elem[1].'.'.$cubrid_version_elem[2]; | |
| 90 | 90 |  			define('__CUBRID_VERSION__', $cubrid_version); | 
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | - if(__CUBRID_VERSION__ >= '8.4.0') | |
| 93 | + if (__CUBRID_VERSION__ >= '8.4.0') | |
| 94 | 94 | cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); | 
| 95 | 95 | |
| 96 | 96 | return $result; | 
| @@ -116,13 +116,13 @@ discard block | ||
| 116 | 116 | */ | 
| 117 | 117 | function addQuotes($string) | 
| 118 | 118 |  	{ | 
| 119 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && | |
| 119 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && | |
| 120 | 120 | get_magic_quotes_gpc()) | 
| 121 | 121 |  		{ | 
| 122 | 122 |  			$string = stripslashes(str_replace("\\", "\\\\", $string)); | 
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | - if(!is_numeric($string)) | |
| 125 | + if (!is_numeric($string)) | |
| 126 | 126 |  		{ | 
| 127 | 127 | /* | 
| 128 | 128 |  			  if ($this->isConnected()) { | 
| @@ -146,17 +146,17 @@ discard block | ||
| 146 | 146 | */ | 
| 147 | 147 | function _begin($transactionLevel = 0) | 
| 148 | 148 |  	{ | 
| 149 | - if(__CUBRID_VERSION__ >= '8.4.0') | |
| 149 | + if (__CUBRID_VERSION__ >= '8.4.0') | |
| 150 | 150 |  		{ | 
| 151 | 151 |  			$connection = $this->_getConnection('master'); | 
| 152 | 152 | |
| 153 | - if(!$transactionLevel) | |
| 153 | + if (!$transactionLevel) | |
| 154 | 154 |  			{ | 
| 155 | 155 | cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE); | 
| 156 | 156 | } | 
| 157 | 157 | else | 
| 158 | 158 |  			{ | 
| 159 | -				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection); | |
| 159 | +				$this->_query("SAVEPOINT SP".$transactionLevel, $connection); | |
| 160 | 160 | } | 
| 161 | 161 | } | 
| 162 | 162 | return TRUE; | 
| @@ -173,9 +173,9 @@ discard block | ||
| 173 | 173 | |
| 174 | 174 | $point = $transactionLevel - 1; | 
| 175 | 175 | |
| 176 | - if($point) | |
| 176 | + if ($point) | |
| 177 | 177 |  		{ | 
| 178 | -			$this->_query("ROLLBACK TO SP" . $point, $connection); | |
| 178 | +			$this->_query("ROLLBACK TO SP".$point, $connection); | |
| 179 | 179 | } | 
| 180 | 180 | else | 
| 181 | 181 |  		{ | 
| @@ -206,29 +206,29 @@ discard block | ||
| 206 | 206 | */ | 
| 207 | 207 | function __query($query, $connection) | 
| 208 | 208 |  	{ | 
| 209 | - if($this->use_prepared_statements == 'Y') | |
| 209 | + if ($this->use_prepared_statements == 'Y') | |
| 210 | 210 |  		{ | 
| 211 | 211 | $req = @cubrid_prepare($connection, $query); | 
| 212 | - if(!$req) | |
| 212 | + if (!$req) | |
| 213 | 213 |  			{ | 
| 214 | 214 | $this->_setError(); | 
| 215 | 215 | return false; | 
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 | $position = 0; | 
| 219 | - if($this->param) | |
| 219 | + if ($this->param) | |
| 220 | 220 |  			{ | 
| 221 | - foreach($this->param as $param) | |
| 221 | + foreach ($this->param as $param) | |
| 222 | 222 |  				{ | 
| 223 | 223 | $value = $param->getUnescapedValue(); | 
| 224 | 224 | $type = $param->getType(); | 
| 225 | 225 | |
| 226 | - if($param->isColumnName()) | |
| 226 | + if ($param->isColumnName()) | |
| 227 | 227 |  					{ | 
| 228 | 228 | continue; | 
| 229 | 229 | } | 
| 230 | 230 | |
| 231 | - switch($type) | |
| 231 | + switch ($type) | |
| 232 | 232 |  					{ | 
| 233 | 233 | case 'number' : | 
| 234 | 234 | $bind_type = 'numeric'; | 
| @@ -240,12 +240,12 @@ discard block | ||
| 240 | 240 | $bind_type = 'string'; | 
| 241 | 241 | } | 
| 242 | 242 | |
| 243 | - if(is_array($value)) | |
| 243 | + if (is_array($value)) | |
| 244 | 244 |  					{ | 
| 245 | - foreach($value as $v) | |
| 245 | + foreach ($value as $v) | |
| 246 | 246 |  						{ | 
| 247 | 247 | $bound = @cubrid_bind($req, ++$position, $v, $bind_type); | 
| 248 | - if(!$bound) | |
| 248 | + if (!$bound) | |
| 249 | 249 |  							{ | 
| 250 | 250 | $this->_setError(); | 
| 251 | 251 | return false; | 
| @@ -255,7 +255,7 @@ discard block | ||
| 255 | 255 | else | 
| 256 | 256 |  					{ | 
| 257 | 257 | $bound = @cubrid_bind($req, ++$position, $value, $bind_type); | 
| 258 | - if(!$bound) | |
| 258 | + if (!$bound) | |
| 259 | 259 |  						{ | 
| 260 | 260 | $this->_setError(); | 
| 261 | 261 | return false; | 
| @@ -265,7 +265,7 @@ discard block | ||
| 265 | 265 | } | 
| 266 | 266 | |
| 267 | 267 | $result = @cubrid_execute($req); | 
| 268 | - if(!$result) | |
| 268 | + if (!$result) | |
| 269 | 269 |  			{ | 
| 270 | 270 | $this->_setError(); | 
| 271 | 271 | return false; | 
| @@ -275,7 +275,7 @@ discard block | ||
| 275 | 275 | // Execute the query | 
| 276 | 276 | $result = @cubrid_execute($connection, $query); | 
| 277 | 277 | // error check | 
| 278 | - if(!$result) | |
| 278 | + if (!$result) | |
| 279 | 279 |  		{ | 
| 280 | 280 | $this->_setError(); | 
| 281 | 281 | return false; | 
| @@ -306,12 +306,12 @@ discard block | ||
| 306 | 306 | function _fetch($result, $arrayIndexEndValue = NULL) | 
| 307 | 307 |  	{ | 
| 308 | 308 | $output = array(); | 
| 309 | - if(!$this->isConnected() || $this->isError() || !$result) | |
| 309 | + if (!$this->isConnected() || $this->isError() || !$result) | |
| 310 | 310 |  		{ | 
| 311 | 311 | return array(); | 
| 312 | 312 | } | 
| 313 | 313 | |
| 314 | - if($this->use_prepared_statements == 'Y') | |
| 314 | + if ($this->use_prepared_statements == 'Y') | |
| 315 | 315 |  		{ | 
| 316 | 316 | |
| 317 | 317 | } | 
| @@ -322,25 +322,25 @@ discard block | ||
| 322 | 322 | $col_names = cubrid_column_names($result); | 
| 323 | 323 | $max = count($col_types); | 
| 324 | 324 | |
| 325 | - for($count = 0; $count < $max; $count++) | |
| 325 | + for ($count = 0; $count < $max; $count++) | |
| 326 | 326 |  		{ | 
| 327 | -			if(preg_match("/^char/", $col_types[$count]) > 0) | |
| 327 | +			if (preg_match("/^char/", $col_types[$count]) > 0) | |
| 328 | 328 |  			{ | 
| 329 | 329 | $char_type_fields[] = $col_names[$count]; | 
| 330 | 330 | } | 
| 331 | 331 | } | 
| 332 | 332 | |
| 333 | - while($tmp = cubrid_fetch($result, CUBRID_OBJECT)) | |
| 333 | + while ($tmp = cubrid_fetch($result, CUBRID_OBJECT)) | |
| 334 | 334 |  		{ | 
| 335 | - if(is_array($char_type_fields)) | |
| 335 | + if (is_array($char_type_fields)) | |
| 336 | 336 |  			{ | 
| 337 | - foreach($char_type_fields as $val) | |
| 337 | + foreach ($char_type_fields as $val) | |
| 338 | 338 |  				{ | 
| 339 | 339 |  					$tmp->{$val} = rtrim($tmp->{$val}); | 
| 340 | 340 | } | 
| 341 | 341 | } | 
| 342 | 342 | |
| 343 | - if($arrayIndexEndValue) | |
| 343 | + if ($arrayIndexEndValue) | |
| 344 | 344 |  			{ | 
| 345 | 345 | $output[$arrayIndexEndValue--] = $tmp; | 
| 346 | 346 | } | 
| @@ -352,15 +352,15 @@ discard block | ||
| 352 | 352 | |
| 353 | 353 | unset($char_type_fields); | 
| 354 | 354 | |
| 355 | - if($result) | |
| 355 | + if ($result) | |
| 356 | 356 |  		{ | 
| 357 | 357 | cubrid_close_request($result); | 
| 358 | 358 | } | 
| 359 | 359 | |
| 360 | - if(count($output) == 1) | |
| 360 | + if (count($output) == 1) | |
| 361 | 361 |  		{ | 
| 362 | 362 | // If call is made for pagination, always return array | 
| 363 | - if(isset($arrayIndexEndValue)) | |
| 363 | + if (isset($arrayIndexEndValue)) | |
| 364 | 364 |  			{ | 
| 365 | 365 | return $output; | 
| 366 | 366 | } | 
| @@ -395,7 +395,7 @@ discard block | ||
| 395 | 395 | */ | 
| 396 | 396 | function _makeSequence() | 
| 397 | 397 |  	{ | 
| 398 | - if($_GLOBALS['XE_EXISTS_SEQUENCE']) | |
| 398 | + if ($_GLOBALS['XE_EXISTS_SEQUENCE']) | |
| 399 | 399 | return; | 
| 400 | 400 | |
| 401 | 401 | // check cubrid serial | 
| @@ -404,21 +404,21 @@ discard block | ||
| 404 | 404 | $output = $this->_fetch($result); | 
| 405 | 405 | |
| 406 | 406 | // if do not create serial | 
| 407 | - if($output->count == 0) | |
| 408 | -		{ | |
| 409 | -			$query = sprintf('select max("a"."srl") as "srl" from ' . | |
| 410 | -					'( select max("document_srl") as "srl" from ' . | |
| 411 | - '"%sdocuments" UNION ' . | |
| 412 | -					'select max("comment_srl") as "srl" from ' . | |
| 413 | - '"%scomments" UNION ' . | |
| 414 | -					'select max("member_srl") as "srl" from ' . | |
| 415 | - '"%smember"' . | |
| 407 | + if ($output->count == 0) | |
| 408 | +		{ | |
| 409 | +			$query = sprintf('select max("a"."srl") as "srl" from '. | |
| 410 | +					'( select max("document_srl") as "srl" from '. | |
| 411 | + '"%sdocuments" UNION '. | |
| 412 | +					'select max("comment_srl") as "srl" from '. | |
| 413 | + '"%scomments" UNION '. | |
| 414 | +					'select max("member_srl") as "srl" from '. | |
| 415 | + '"%smember"'. | |
| 416 | 416 | ') as "a"', $this->prefix, $this->prefix, $this->prefix); | 
| 417 | 417 | |
| 418 | 418 | $result = $this->_query($query); | 
| 419 | 419 | $output = $this->_fetch($result); | 
| 420 | 420 | $srl = $output->srl; | 
| 421 | - if($srl < 1) | |
| 421 | + if ($srl < 1) | |
| 422 | 422 |  			{ | 
| 423 | 423 | $start = 1; | 
| 424 | 424 | } | 
| @@ -442,7 +442,7 @@ discard block | ||
| 442 | 442 | */ | 
| 443 | 443 | function isTableExists($target_name) | 
| 444 | 444 |  	{ | 
| 445 | - if($target_name == 'sequence') | |
| 445 | + if ($target_name == 'sequence') | |
| 446 | 446 |  		{ | 
| 447 | 447 |  			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name); | 
| 448 | 448 | } | 
| @@ -452,7 +452,7 @@ discard block | ||
| 452 | 452 | } | 
| 453 | 453 | |
| 454 | 454 | $result = $this->_query($query); | 
| 455 | - if(cubrid_num_rows($result) > 0) | |
| 455 | + if (cubrid_num_rows($result) > 0) | |
| 456 | 456 |  		{ | 
| 457 | 457 | $output = TRUE; | 
| 458 | 458 | } | 
| @@ -461,7 +461,7 @@ discard block | ||
| 461 | 461 | $output = FALSE; | 
| 462 | 462 | } | 
| 463 | 463 | |
| 464 | - if($result) | |
| 464 | + if ($result) | |
| 465 | 465 |  		{ | 
| 466 | 466 | cubrid_close_request($result); | 
| 467 | 467 | } | 
| @@ -482,22 +482,22 @@ discard block | ||
| 482 | 482 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE) | 
| 483 | 483 |  	{ | 
| 484 | 484 | $type = strtoupper($this->column_type[$type]); | 
| 485 | - if($type == 'INTEGER') | |
| 485 | + if ($type == 'INTEGER') | |
| 486 | 486 |  		{ | 
| 487 | 487 | $size = ''; | 
| 488 | 488 | } | 
| 489 | 489 | |
| 490 | 490 |  		$query = sprintf("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name); | 
| 491 | 491 | |
| 492 | - if($type == 'char' || $type == 'varchar') | |
| 492 | + if ($type == 'char' || $type == 'varchar') | |
| 493 | 493 |  		{ | 
| 494 | - if($size) | |
| 494 | + if ($size) | |
| 495 | 495 |  			{ | 
| 496 | 496 | $size = $size * 3; | 
| 497 | 497 | } | 
| 498 | 498 | } | 
| 499 | 499 | |
| 500 | - if($size) | |
| 500 | + if ($size) | |
| 501 | 501 |  		{ | 
| 502 | 502 |  			$query .= sprintf("%s(%s) ", $type, $size); | 
| 503 | 503 | } | 
| @@ -506,9 +506,9 @@ discard block | ||
| 506 | 506 |  			$query .= sprintf("%s ", $type); | 
| 507 | 507 | } | 
| 508 | 508 | |
| 509 | - if(isset($default)) | |
| 509 | + if (isset($default)) | |
| 510 | 510 |  		{ | 
| 511 | - if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') | |
| 511 | + if ($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') | |
| 512 | 512 |  			{ | 
| 513 | 513 |  				$query .= sprintf("default %d ", $default); | 
| 514 | 514 | } | 
| @@ -518,7 +518,7 @@ discard block | ||
| 518 | 518 | } | 
| 519 | 519 | } | 
| 520 | 520 | |
| 521 | - if($notnull) | |
| 521 | + if ($notnull) | |
| 522 | 522 |  		{ | 
| 523 | 523 | $query .= "not null "; | 
| 524 | 524 | } | 
| @@ -547,10 +547,10 @@ discard block | ||
| 547 | 547 | */ | 
| 548 | 548 | function isColumnExists($table_name, $column_name) | 
| 549 | 549 |  	{ | 
| 550 | -		$query = sprintf("select \"attr_name\" from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name); | |
| 550 | +		$query = sprintf("select \"attr_name\" from \"db_attribute\" where "."\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name); | |
| 551 | 551 | $result = $this->_query($query); | 
| 552 | 552 | |
| 553 | - if(cubrid_num_rows($result) > 0) | |
| 553 | + if (cubrid_num_rows($result) > 0) | |
| 554 | 554 |  		{ | 
| 555 | 555 | $output = TRUE; | 
| 556 | 556 | } | 
| @@ -559,7 +559,7 @@ discard block | ||
| 559 | 559 | $output = FALSE; | 
| 560 | 560 | } | 
| 561 | 561 | |
| 562 | - if($result) | |
| 562 | + if ($result) | |
| 563 | 563 |  		{ | 
| 564 | 564 | cubrid_close_request($result); | 
| 565 | 565 | } | 
| @@ -579,12 +579,12 @@ discard block | ||
| 579 | 579 | */ | 
| 580 | 580 | function addIndex($table_name, $index_name, $target_columns, $is_unique = FALSE) | 
| 581 | 581 |  	{ | 
| 582 | - if(!is_array($target_columns)) | |
| 582 | + if (!is_array($target_columns)) | |
| 583 | 583 |  		{ | 
| 584 | 584 | $target_columns = array($target_columns); | 
| 585 | 585 | } | 
| 586 | 586 | |
| 587 | -		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"' . implode('","', $target_columns) . '"'); | |
| 587 | +		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"'.implode('","', $target_columns).'"'); | |
| 588 | 588 | |
| 589 | 589 | $this->_query($query); | 
| 590 | 590 | } | 
| @@ -611,17 +611,17 @@ discard block | ||
| 611 | 611 | */ | 
| 612 | 612 | function isIndexExists($table_name, $index_name) | 
| 613 | 613 |  	{ | 
| 614 | -		$query = sprintf("select \"index_name\" from \"db_index\" where " . "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix . $index_name, $index_name); | |
| 614 | +		$query = sprintf("select \"index_name\" from \"db_index\" where "."\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix.$index_name, $index_name); | |
| 615 | 615 | $result = $this->_query($query); | 
| 616 | 616 | |
| 617 | - if($this->isError()) | |
| 617 | + if ($this->isError()) | |
| 618 | 618 |  		{ | 
| 619 | 619 | return FALSE; | 
| 620 | 620 | } | 
| 621 | 621 | |
| 622 | 622 | $output = $this->_fetch($result); | 
| 623 | 623 | |
| 624 | - if(!$output) | |
| 624 | + if (!$output) | |
| 625 | 625 |  		{ | 
| 626 | 626 | return FALSE; | 
| 627 | 627 | } | 
| @@ -653,25 +653,25 @@ discard block | ||
| 653 | 653 | ", strlen($this->prefix) | 
| 654 | 654 | , $this->prefix | 
| 655 | 655 | , strlen($this->prefix) + 1 | 
| 656 | - , "'" . $this->prefix . '%' . "'" | |
| 656 | + , "'".$this->prefix.'%'."'" | |
| 657 | 657 | , strlen($this->prefix) | 
| 658 | 658 | , $this->prefix | 
| 659 | 659 | , strlen($this->prefix) + 1 | 
| 660 | 660 | ); | 
| 661 | 661 | $result = $this->_query($query); | 
| 662 | 662 | |
| 663 | - if($this->isError()) | |
| 663 | + if ($this->isError()) | |
| 664 | 664 |  		{ | 
| 665 | 665 | return FALSE; | 
| 666 | 666 | } | 
| 667 | 667 | |
| 668 | 668 | $output = $this->_fetch($result); | 
| 669 | - if(!$output) | |
| 669 | + if (!$output) | |
| 670 | 670 |  		{ | 
| 671 | 671 | return FALSE; | 
| 672 | 672 | } | 
| 673 | 673 | |
| 674 | - if(!is_array($output)) | |
| 674 | + if (!is_array($output)) | |
| 675 | 675 |  		{ | 
| 676 | 676 | $indexes_to_be_deleted = array($output); | 
| 677 | 677 | } | 
| @@ -680,10 +680,10 @@ discard block | ||
| 680 | 680 | $indexes_to_be_deleted = $output; | 
| 681 | 681 | } | 
| 682 | 682 | |
| 683 | - foreach($indexes_to_be_deleted as $index) | |
| 683 | + foreach ($indexes_to_be_deleted as $index) | |
| 684 | 684 |  		{ | 
| 685 | 685 | $this->dropIndex(substr($index->class_name, strlen($this->prefix)) | 
| 686 | - , $this->prefix . $index->unprefixed_index_name | |
| 686 | + , $this->prefix.$index->unprefixed_index_name | |
| 687 | 687 | , $index->is_unique == 'YES' ? TRUE : FALSE); | 
| 688 | 688 | } | 
| 689 | 689 | |
| @@ -707,7 +707,7 @@ discard block | ||
| 707 | 707 | */ | 
| 708 | 708 | function createTableByXmlFile($file_name) | 
| 709 | 709 |  	{ | 
| 710 | - if(!file_exists($file_name)) | |
| 710 | + if (!file_exists($file_name)) | |
| 711 | 711 |  		{ | 
| 712 | 712 | return; | 
| 713 | 713 | } | 
| @@ -734,28 +734,28 @@ discard block | ||
| 734 | 734 | $table_name = $xml_obj->table->attrs->name; | 
| 735 | 735 | |
| 736 | 736 | // if the table already exists exit function | 
| 737 | - if($this->isTableExists($table_name)) | |
| 737 | + if ($this->isTableExists($table_name)) | |
| 738 | 738 |  		{ | 
| 739 | 739 | return; | 
| 740 | 740 | } | 
| 741 | 741 | |
| 742 | 742 | // If the table name is sequence, it creates a serial | 
| 743 | - if($table_name == 'sequence') | |
| 743 | + if ($table_name == 'sequence') | |
| 744 | 744 |  		{ | 
| 745 | -			$query = sprintf('create serial "%s" start with 1 increment by 1' . | |
| 746 | - ' minvalue 1 ' . | |
| 747 | - 'maxvalue 10000000000000000000000000000000000000' . ' nocycle;', $this->prefix . $table_name); | |
| 745 | +			$query = sprintf('create serial "%s" start with 1 increment by 1'. | |
| 746 | + ' minvalue 1 '. | |
| 747 | + 'maxvalue 10000000000000000000000000000000000000'.' nocycle;', $this->prefix.$table_name); | |
| 748 | 748 | |
| 749 | 749 | return $this->_query($query); | 
| 750 | 750 | } | 
| 751 | 751 | |
| 752 | 752 | |
| 753 | - $table_name = $this->prefix . $table_name; | |
| 753 | + $table_name = $this->prefix.$table_name; | |
| 754 | 754 | |
| 755 | 755 |  		$query = sprintf('create class "%s";', $table_name); | 
| 756 | 756 | $this->_query($query); | 
| 757 | 757 | |
| 758 | - if(!is_array($xml_obj->table->column)) | |
| 758 | + if (!is_array($xml_obj->table->column)) | |
| 759 | 759 |  		{ | 
| 760 | 760 | $columns[] = $xml_obj->table->column; | 
| 761 | 761 | } | 
| @@ -770,7 +770,7 @@ discard block | ||
| 770 | 770 | $unique_list = array(); | 
| 771 | 771 | $index_list = array(); | 
| 772 | 772 | |
| 773 | - foreach($columns as $column) | |
| 773 | + foreach ($columns as $column) | |
| 774 | 774 |  		{ | 
| 775 | 775 | $name = $column->attrs->name; | 
| 776 | 776 | $type = $column->attrs->type; | 
| @@ -781,7 +781,7 @@ discard block | ||
| 781 | 781 | $unique = $column->attrs->unique; | 
| 782 | 782 | $default = $column->attrs->default; | 
| 783 | 783 | |
| 784 | - switch($this->column_type[$type]) | |
| 784 | + switch ($this->column_type[$type]) | |
| 785 | 785 |  			{ | 
| 786 | 786 | case 'integer' : | 
| 787 | 787 | $size = NULL; | 
| @@ -791,58 +791,58 @@ discard block | ||
| 791 | 791 | break; | 
| 792 | 792 | } | 
| 793 | 793 | |
| 794 | - if(isset($default) && ($type == 'varchar' || $type == 'char' || | |
| 794 | + if (isset($default) && ($type == 'varchar' || $type == 'char' || | |
| 795 | 795 | $type == 'text' || $type == 'tinytext' || $type == 'bigtext')) | 
| 796 | 796 |  			{ | 
| 797 | 797 |  				$default = sprintf("'%s'", $default); | 
| 798 | 798 | } | 
| 799 | 799 | |
| 800 | - if($type == 'varchar' || $type == 'char') | |
| 800 | + if ($type == 'varchar' || $type == 'char') | |
| 801 | 801 |  			{ | 
| 802 | - if($size) | |
| 802 | + if ($size) | |
| 803 | 803 | $size = $size * 3; | 
| 804 | 804 | } | 
| 805 | 805 | |
| 806 | 806 | |
| 807 | -			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default " . $default : '', $notnull ? 'not null' : ''); | |
| 807 | +			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default ".$default : '', $notnull ? 'not null' : ''); | |
| 808 | 808 | |
| 809 | - if($primary_key) | |
| 809 | + if ($primary_key) | |
| 810 | 810 |  			{ | 
| 811 | 811 | $primary_list[] = $name; | 
| 812 | 812 | } | 
| 813 | - else if($unique) | |
| 813 | + else if ($unique) | |
| 814 | 814 |  			{ | 
| 815 | 815 | $unique_list[$unique][] = $name; | 
| 816 | 816 | } | 
| 817 | - else if($index) | |
| 817 | + else if ($index) | |
| 818 | 818 |  			{ | 
| 819 | 819 | $index_list[$index][] = $name; | 
| 820 | 820 | } | 
| 821 | 821 | } | 
| 822 | 822 | |
| 823 | -		$query .= implode(',', $column_schema) . ';'; | |
| 823 | +		$query .= implode(',', $column_schema).';'; | |
| 824 | 824 | $this->_query($query); | 
| 825 | 825 | |
| 826 | - if(count($primary_list)) | |
| 826 | + if (count($primary_list)) | |
| 827 | 827 |  		{ | 
| 828 | -			$query = sprintf("alter class \"%s\" add attribute constraint " . "\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"' . implode('","', $primary_list) . '"'); | |
| 828 | +			$query = sprintf("alter class \"%s\" add attribute constraint "."\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"'.implode('","', $primary_list).'"'); | |
| 829 | 829 | $this->_query($query); | 
| 830 | 830 | } | 
| 831 | 831 | |
| 832 | - if(count($unique_list)) | |
| 832 | + if (count($unique_list)) | |
| 833 | 833 |  		{ | 
| 834 | - foreach($unique_list as $key => $val) | |
| 834 | + foreach ($unique_list as $key => $val) | |
| 835 | 835 |  			{ | 
| 836 | -				$query = sprintf("create unique index \"%s\" on \"%s\" " . "(%s);", $key, $table_name, '"' . implode('","', $val) . '"'); | |
| 836 | +				$query = sprintf("create unique index \"%s\" on \"%s\" "."(%s);", $key, $table_name, '"'.implode('","', $val).'"'); | |
| 837 | 837 | $this->_query($query); | 
| 838 | 838 | } | 
| 839 | 839 | } | 
| 840 | 840 | |
| 841 | - if(count($index_list)) | |
| 841 | + if (count($index_list)) | |
| 842 | 842 |  		{ | 
| 843 | - foreach($index_list as $key => $val) | |
| 843 | + foreach ($index_list as $key => $val) | |
| 844 | 844 |  			{ | 
| 845 | -				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"'); | |
| 845 | +				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"'.implode('","', $val).'"'); | |
| 846 | 846 | $this->_query($query); | 
| 847 | 847 | } | 
| 848 | 848 | } | 
| @@ -856,22 +856,22 @@ discard block | ||
| 856 | 856 | */ | 
| 857 | 857 | function _executeInsertAct($queryObject, $with_values = TRUE) | 
| 858 | 858 |  	{ | 
| 859 | - if($this->use_prepared_statements == 'Y') | |
| 859 | + if ($this->use_prepared_statements == 'Y') | |
| 860 | 860 |  		{ | 
| 861 | 861 | $this->param = $queryObject->getArguments(); | 
| 862 | 862 | $with_values = FALSE; | 
| 863 | 863 | } | 
| 864 | 864 | $query = $this->getInsertSql($queryObject, $with_values); | 
| 865 | - if(is_a($query, 'Object')) | |
| 865 | + if (is_a($query, 'Object')) | |
| 866 | 866 |  		{ | 
| 867 | 867 | unset($this->param); | 
| 868 | 868 | return; | 
| 869 | 869 | } | 
| 870 | 870 | |
| 871 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 871 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 872 | 872 | |
| 873 | 873 | $result = $this->_query($query); | 
| 874 | - if($result && !$this->transaction_started) | |
| 874 | + if ($result && !$this->transaction_started) | |
| 875 | 875 |  		{ | 
| 876 | 876 | $this->_commit(); | 
| 877 | 877 | } | 
| @@ -887,23 +887,23 @@ discard block | ||
| 887 | 887 | */ | 
| 888 | 888 | function _executeUpdateAct($queryObject, $with_values = TRUE) | 
| 889 | 889 |  	{ | 
| 890 | - if($this->use_prepared_statements == 'Y') | |
| 890 | + if ($this->use_prepared_statements == 'Y') | |
| 891 | 891 |  		{ | 
| 892 | 892 | $this->param = $queryObject->getArguments(); | 
| 893 | 893 | $with_values = FALSE; | 
| 894 | 894 | } | 
| 895 | 895 | $query = $this->getUpdateSql($queryObject, $with_values); | 
| 896 | - if(is_a($query, 'Object')) | |
| 896 | + if (is_a($query, 'Object')) | |
| 897 | 897 |  		{ | 
| 898 | 898 | unset($this->param); | 
| 899 | 899 | return; | 
| 900 | 900 | } | 
| 901 | 901 | |
| 902 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 902 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 903 | 903 | |
| 904 | 904 | $result = $this->_query($query); | 
| 905 | 905 | |
| 906 | - if($result && !$this->transaction_started) | |
| 906 | + if ($result && !$this->transaction_started) | |
| 907 | 907 |  		{ | 
| 908 | 908 | $this->_commit(); | 
| 909 | 909 | } | 
| @@ -919,23 +919,23 @@ discard block | ||
| 919 | 919 | */ | 
| 920 | 920 | function _executeDeleteAct($queryObject, $with_values = TRUE) | 
| 921 | 921 |  	{ | 
| 922 | - if($this->use_prepared_statements == 'Y') | |
| 922 | + if ($this->use_prepared_statements == 'Y') | |
| 923 | 923 |  		{ | 
| 924 | 924 | $this->param = $queryObject->getArguments(); | 
| 925 | 925 | $with_values = FALSE; | 
| 926 | 926 | } | 
| 927 | 927 | $query = $this->getDeleteSql($queryObject, $with_values); | 
| 928 | - if(is_a($query, 'Object')) | |
| 928 | + if (is_a($query, 'Object')) | |
| 929 | 929 |  		{ | 
| 930 | 930 | unset($this->param); | 
| 931 | 931 | return; | 
| 932 | 932 | } | 
| 933 | 933 | |
| 934 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 934 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 935 | 935 | |
| 936 | 936 | $result = $this->_query($query); | 
| 937 | 937 | |
| 938 | - if($result && !$this->transaction_started) | |
| 938 | + if ($result && !$this->transaction_started) | |
| 939 | 939 |  		{ | 
| 940 | 940 | $this->_commit(); | 
| 941 | 941 | } | 
| @@ -955,36 +955,36 @@ discard block | ||
| 955 | 955 | */ | 
| 956 | 956 | function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE) | 
| 957 | 957 |  	{ | 
| 958 | - if($this->use_prepared_statements == 'Y') | |
| 958 | + if ($this->use_prepared_statements == 'Y') | |
| 959 | 959 |  		{ | 
| 960 | 960 | $this->param = $queryObject->getArguments(); | 
| 961 | 961 | $with_values = FALSE; | 
| 962 | 962 | } | 
| 963 | 963 | $limit = $queryObject->getLimit(); | 
| 964 | - if($limit && $limit->isPageHandler()) | |
| 964 | + if ($limit && $limit->isPageHandler()) | |
| 965 | 965 |  		{ | 
| 966 | 966 | return $this->queryPageLimit($queryObject, $connection, $with_values); | 
| 967 | 967 | } | 
| 968 | 968 | else | 
| 969 | 969 |  		{ | 
| 970 | 970 | $query = $this->getSelectSql($queryObject, $with_values); | 
| 971 | - if(is_a($query, 'Object')) | |
| 971 | + if (is_a($query, 'Object')) | |
| 972 | 972 |  			{ | 
| 973 | 973 | unset($this->param); | 
| 974 | 974 | return; | 
| 975 | 975 | } | 
| 976 | 976 | |
| 977 | -			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 977 | +			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 978 | 978 | $result = $this->_query($query, $connection); | 
| 979 | 979 | |
| 980 | - if($this->isError()) | |
| 980 | + if ($this->isError()) | |
| 981 | 981 |  			{ | 
| 982 | 982 | unset($this->param); | 
| 983 | 983 | return $this->queryError($queryObject); | 
| 984 | 984 | } | 
| 985 | 985 | |
| 986 | 986 | $data = $this->_fetch($result); | 
| 987 | - $buff = new Object (); | |
| 987 | + $buff = new Object(); | |
| 988 | 988 | $buff->data = $data; | 
| 989 | 989 | |
| 990 | 990 | unset($this->param); | 
| @@ -1000,16 +1000,16 @@ discard block | ||
| 1000 | 1000 | function queryError($queryObject) | 
| 1001 | 1001 |  	{ | 
| 1002 | 1002 | $limit = $queryObject->getLimit(); | 
| 1003 | - if($limit && $limit->isPageHandler()) | |
| 1003 | + if ($limit && $limit->isPageHandler()) | |
| 1004 | 1004 |  		{ | 
| 1005 | - $buff = new Object (); | |
| 1005 | + $buff = new Object(); | |
| 1006 | 1006 | $buff->total_count = 0; | 
| 1007 | 1007 | $buff->total_page = 0; | 
| 1008 | 1008 | $buff->page = 1; | 
| 1009 | 1009 | $buff->data = array(); | 
| 1010 | 1010 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values | 
| 1011 | 1011 | return $buff; | 
| 1012 | - }else | |
| 1012 | + } else | |
| 1013 | 1013 | return; | 
| 1014 | 1014 | } | 
| 1015 | 1015 | |
| @@ -1025,48 +1025,48 @@ discard block | ||
| 1025 | 1025 | $limit = $queryObject->getLimit(); | 
| 1026 | 1026 | // Total count | 
| 1027 | 1027 | $temp_where = $queryObject->getWhereString($with_values, FALSE); | 
| 1028 | -		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where)); | |
| 1028 | +		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where)); | |
| 1029 | 1029 | |
| 1030 | 1030 | // Check for distinct query and if found update count query structure | 
| 1031 | 1031 | $temp_select = $queryObject->getSelectString($with_values); | 
| 1032 | 1032 | $uses_distinct = stripos($temp_select, "distinct") !== FALSE; | 
| 1033 | 1033 | $uses_groupby = $queryObject->getGroupByString() != ''; | 
| 1034 | - if($uses_distinct || $uses_groupby) | |
| 1034 | + if ($uses_distinct || $uses_groupby) | |
| 1035 | 1035 |  		{ | 
| 1036 | 1036 |  			$count_query = sprintf('select %s %s %s %s' | 
| 1037 | 1037 | , $temp_select | 
| 1038 | - , 'FROM ' . $queryObject->getFromString($with_values) | |
| 1039 | - , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) | |
| 1040 | - , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') | |
| 1038 | + , 'FROM '.$queryObject->getFromString($with_values) | |
| 1039 | + , ($temp_where === '' ? '' : ' WHERE '.$temp_where) | |
| 1040 | + , ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '') | |
| 1041 | 1041 | ); | 
| 1042 | 1042 | |
| 1043 | 1043 | // If query uses grouping or distinct, count from original select | 
| 1044 | 1044 |  			$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); | 
| 1045 | 1045 | } | 
| 1046 | 1046 | |
| 1047 | -		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; | |
| 1047 | +		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; | |
| 1048 | 1048 | $result = $this->_query($count_query, $connection); | 
| 1049 | 1049 | $count_output = $this->_fetch($result); | 
| 1050 | 1050 | $total_count = (int) (isset($count_output->count) ? $count_output->count : NULL); | 
| 1051 | 1051 | |
| 1052 | 1052 | $list_count = $limit->list_count->getValue(); | 
| 1053 | - if(!$list_count) | |
| 1053 | + if (!$list_count) | |
| 1054 | 1054 |  		{ | 
| 1055 | 1055 | $list_count = 20; | 
| 1056 | 1056 | } | 
| 1057 | 1057 | $page_count = $limit->page_count->getValue(); | 
| 1058 | - if(!$page_count) | |
| 1058 | + if (!$page_count) | |
| 1059 | 1059 |  		{ | 
| 1060 | 1060 | $page_count = 10; | 
| 1061 | 1061 | } | 
| 1062 | 1062 | $page = $limit->page->getValue(); | 
| 1063 | - if(!$page || $page < 1) | |
| 1063 | + if (!$page || $page < 1) | |
| 1064 | 1064 |  		{ | 
| 1065 | 1065 | $page = 1; | 
| 1066 | 1066 | } | 
| 1067 | 1067 | |
| 1068 | 1068 | // total pages | 
| 1069 | - if($total_count) | |
| 1069 | + if ($total_count) | |
| 1070 | 1070 |  		{ | 
| 1071 | 1071 | $total_page = (int) (($total_count - 1) / $list_count) + 1; | 
| 1072 | 1072 | } | 
| @@ -1076,11 +1076,11 @@ discard block | ||
| 1076 | 1076 | } | 
| 1077 | 1077 | |
| 1078 | 1078 | // check the page variables | 
| 1079 | - if($page > $total_page) | |
| 1079 | + if ($page > $total_page) | |
| 1080 | 1080 |  		{ | 
| 1081 | 1081 | // If requested page is bigger than total number of pages, return empty list | 
| 1082 | 1082 | |
| 1083 | - $buff = new Object (); | |
| 1083 | + $buff = new Object(); | |
| 1084 | 1084 | $buff->total_count = $total_count; | 
| 1085 | 1085 | $buff->total_page = $total_page; | 
| 1086 | 1086 | $buff->page = $page; | 
| @@ -1092,9 +1092,9 @@ discard block | ||
| 1092 | 1092 | $start_count = ($page - 1) * $list_count; | 
| 1093 | 1093 | |
| 1094 | 1094 | $query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count); | 
| 1095 | -		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 1095 | +		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 1096 | 1096 | $result = $this->_query($query, $connection); | 
| 1097 | - if($this->isError()) | |
| 1097 | + if ($this->isError()) | |
| 1098 | 1098 |  		{ | 
| 1099 | 1099 | unset($this->param); | 
| 1100 | 1100 | return $this->queryError($queryObject); | 
| @@ -1103,7 +1103,7 @@ discard block | ||
| 1103 | 1103 | $virtual_no = $total_count - ($page - 1) * $list_count; | 
| 1104 | 1104 | $data = $this->_fetch($result, $virtual_no); | 
| 1105 | 1105 | |
| 1106 | - $buff = new Object (); | |
| 1106 | + $buff = new Object(); | |
| 1107 | 1107 | $buff->total_count = $total_count; | 
| 1108 | 1108 | $buff->total_page = $total_page; | 
| 1109 | 1109 | $buff->page = $page; | 
| @@ -1135,44 +1135,44 @@ discard block | ||
| 1135 | 1135 |  	{ | 
| 1136 | 1136 | |
| 1137 | 1137 | $select = $query->getSelectString($with_values); | 
| 1138 | - if($select == '') | |
| 1138 | + if ($select == '') | |
| 1139 | 1139 |  		{ | 
| 1140 | 1140 | return new Object(-1, "Invalid query"); | 
| 1141 | 1141 | } | 
| 1142 | - $select = 'SELECT ' . $select; | |
| 1142 | + $select = 'SELECT '.$select; | |
| 1143 | 1143 | |
| 1144 | 1144 | $from = $query->getFromString($with_values); | 
| 1145 | - if($from == '') | |
| 1145 | + if ($from == '') | |
| 1146 | 1146 |  		{ | 
| 1147 | 1147 | return new Object(-1, "Invalid query"); | 
| 1148 | 1148 | } | 
| 1149 | - $from = ' FROM ' . $from; | |
| 1149 | + $from = ' FROM '.$from; | |
| 1150 | 1150 | |
| 1151 | 1151 | $where = $query->getWhereString($with_values); | 
| 1152 | - if($where != '') | |
| 1152 | + if ($where != '') | |
| 1153 | 1153 |  		{ | 
| 1154 | - $where = ' WHERE ' . $where; | |
| 1154 | + $where = ' WHERE '.$where; | |
| 1155 | 1155 | } | 
| 1156 | 1156 | |
| 1157 | 1157 | $groupBy = $query->getGroupByString(); | 
| 1158 | - if($groupBy != '') | |
| 1158 | + if ($groupBy != '') | |
| 1159 | 1159 |  		{ | 
| 1160 | - $groupBy = ' GROUP BY ' . $groupBy; | |
| 1160 | + $groupBy = ' GROUP BY '.$groupBy; | |
| 1161 | 1161 | } | 
| 1162 | 1162 | |
| 1163 | 1163 | $orderBy = $query->getOrderByString(); | 
| 1164 | - if($orderBy != '') | |
| 1164 | + if ($orderBy != '') | |
| 1165 | 1165 |  		{ | 
| 1166 | - $orderBy = ' ORDER BY ' . $orderBy; | |
| 1166 | + $orderBy = ' ORDER BY '.$orderBy; | |
| 1167 | 1167 | } | 
| 1168 | 1168 | |
| 1169 | 1169 | $limit = $query->getLimitString(); | 
| 1170 | - if($limit != '') | |
| 1170 | + if ($limit != '') | |
| 1171 | 1171 |  		{ | 
| 1172 | 1172 |  			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); | 
| 1173 | 1173 | } | 
| 1174 | 1174 | |
| 1175 | - return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; | |
| 1175 | + return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit; | |
| 1176 | 1176 | } | 
| 1177 | 1177 | |
| 1178 | 1178 | } | 
| @@ -52,7 +52,9 @@ discard block | ||
| 52 | 52 | function DBCubrid($auto_connect = TRUE) | 
| 53 | 53 |  	{ | 
| 54 | 54 | $this->_setDBInfo(); | 
| 55 | - if($auto_connect) $this->_connect(); | |
| 55 | +		if($auto_connect) { | |
| 56 | + $this->_connect(); | |
| 57 | + } | |
| 56 | 58 | } | 
| 57 | 59 | |
| 58 | 60 | /** | 
| @@ -90,8 +92,9 @@ discard block | ||
| 90 | 92 |  			define('__CUBRID_VERSION__', $cubrid_version); | 
| 91 | 93 | } | 
| 92 | 94 | |
| 93 | - if(__CUBRID_VERSION__ >= '8.4.0') | |
| 94 | - cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); | |
| 95 | +		if(__CUBRID_VERSION__ >= '8.4.0') { | |
| 96 | + cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); | |
| 97 | + } | |
| 95 | 98 | |
| 96 | 99 | return $result; | 
| 97 | 100 | } | 
| @@ -153,8 +156,7 @@ discard block | ||
| 153 | 156 | if(!$transactionLevel) | 
| 154 | 157 |  			{ | 
| 155 | 158 | cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE); | 
| 156 | - } | |
| 157 | - else | |
| 159 | + } else | |
| 158 | 160 |  			{ | 
| 159 | 161 |  				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection); | 
| 160 | 162 | } | 
| @@ -176,8 +178,7 @@ discard block | ||
| 176 | 178 | if($point) | 
| 177 | 179 |  		{ | 
| 178 | 180 |  			$this->_query("ROLLBACK TO SP" . $point, $connection); | 
| 179 | - } | |
| 180 | - else | |
| 181 | + } else | |
| 181 | 182 |  		{ | 
| 182 | 183 | @cubrid_rollback($connection); | 
| 183 | 184 | } | 
| @@ -251,8 +252,7 @@ discard block | ||
| 251 | 252 | return false; | 
| 252 | 253 | } | 
| 253 | 254 | } | 
| 254 | - } | |
| 255 | - else | |
| 255 | + } else | |
| 256 | 256 |  					{ | 
| 257 | 257 | $bound = @cubrid_bind($req, ++$position, $value, $bind_type); | 
| 258 | 258 | if(!$bound) | 
| @@ -343,8 +343,7 @@ discard block | ||
| 343 | 343 | if($arrayIndexEndValue) | 
| 344 | 344 |  			{ | 
| 345 | 345 | $output[$arrayIndexEndValue--] = $tmp; | 
| 346 | - } | |
| 347 | - else | |
| 346 | + } else | |
| 348 | 347 |  			{ | 
| 349 | 348 | $output[] = $tmp; | 
| 350 | 349 | } | 
| @@ -395,8 +394,9 @@ discard block | ||
| 395 | 394 | */ | 
| 396 | 395 | function _makeSequence() | 
| 397 | 396 |  	{ | 
| 398 | - if($_GLOBALS['XE_EXISTS_SEQUENCE']) | |
| 399 | - return; | |
| 397 | +		if($_GLOBALS['XE_EXISTS_SEQUENCE']) { | |
| 398 | + return; | |
| 399 | + } | |
| 400 | 400 | |
| 401 | 401 | // check cubrid serial | 
| 402 | 402 |  		$query = sprintf('select count(*) as "count" from "db_serial" where name=\'%ssequence\'', $this->prefix); | 
| @@ -421,8 +421,7 @@ discard block | ||
| 421 | 421 | if($srl < 1) | 
| 422 | 422 |  			{ | 
| 423 | 423 | $start = 1; | 
| 424 | - } | |
| 425 | - else | |
| 424 | + } else | |
| 426 | 425 |  			{ | 
| 427 | 426 | $start = $srl + 1000000; | 
| 428 | 427 | } | 
| @@ -445,8 +444,7 @@ discard block | ||
| 445 | 444 | if($target_name == 'sequence') | 
| 446 | 445 |  		{ | 
| 447 | 446 |  			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name); | 
| 448 | - } | |
| 449 | - else | |
| 447 | + } else | |
| 450 | 448 |  		{ | 
| 451 | 449 |  			$query = sprintf("select \"class_name\" from \"db_class\" where \"class_name\" = '%s%s'", $this->prefix, $target_name); | 
| 452 | 450 | } | 
| @@ -455,8 +453,7 @@ discard block | ||
| 455 | 453 | if(cubrid_num_rows($result) > 0) | 
| 456 | 454 |  		{ | 
| 457 | 455 | $output = TRUE; | 
| 458 | - } | |
| 459 | - else | |
| 456 | + } else | |
| 460 | 457 |  		{ | 
| 461 | 458 | $output = FALSE; | 
| 462 | 459 | } | 
| @@ -500,8 +497,7 @@ discard block | ||
| 500 | 497 | if($size) | 
| 501 | 498 |  		{ | 
| 502 | 499 |  			$query .= sprintf("%s(%s) ", $type, $size); | 
| 503 | - } | |
| 504 | - else | |
| 500 | + } else | |
| 505 | 501 |  		{ | 
| 506 | 502 |  			$query .= sprintf("%s ", $type); | 
| 507 | 503 | } | 
| @@ -511,8 +507,7 @@ discard block | ||
| 511 | 507 | if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') | 
| 512 | 508 |  			{ | 
| 513 | 509 |  				$query .= sprintf("default %d ", $default); | 
| 514 | - } | |
| 515 | - else | |
| 510 | + } else | |
| 516 | 511 |  			{ | 
| 517 | 512 |  				$query .= sprintf("default '%s' ", $default); | 
| 518 | 513 | } | 
| @@ -553,8 +548,7 @@ discard block | ||
| 553 | 548 | if(cubrid_num_rows($result) > 0) | 
| 554 | 549 |  		{ | 
| 555 | 550 | $output = TRUE; | 
| 556 | - } | |
| 557 | - else | |
| 551 | + } else | |
| 558 | 552 |  		{ | 
| 559 | 553 | $output = FALSE; | 
| 560 | 554 | } | 
| @@ -674,8 +668,7 @@ discard block | ||
| 674 | 668 | if(!is_array($output)) | 
| 675 | 669 |  		{ | 
| 676 | 670 | $indexes_to_be_deleted = array($output); | 
| 677 | - } | |
| 678 | - else | |
| 671 | + } else | |
| 679 | 672 |  		{ | 
| 680 | 673 | $indexes_to_be_deleted = $output; | 
| 681 | 674 | } | 
| @@ -758,8 +751,7 @@ discard block | ||
| 758 | 751 | if(!is_array($xml_obj->table->column)) | 
| 759 | 752 |  		{ | 
| 760 | 753 | $columns[] = $xml_obj->table->column; | 
| 761 | - } | |
| 762 | - else | |
| 754 | + } else | |
| 763 | 755 |  		{ | 
| 764 | 756 | $columns = $xml_obj->table->column; | 
| 765 | 757 | } | 
| @@ -799,8 +791,9 @@ discard block | ||
| 799 | 791 | |
| 800 | 792 | if($type == 'varchar' || $type == 'char') | 
| 801 | 793 |  			{ | 
| 802 | - if($size) | |
| 803 | - $size = $size * 3; | |
| 794 | +				if($size) { | |
| 795 | + $size = $size * 3; | |
| 796 | + } | |
| 804 | 797 | } | 
| 805 | 798 | |
| 806 | 799 | |
| @@ -809,12 +802,10 @@ discard block | ||
| 809 | 802 | if($primary_key) | 
| 810 | 803 |  			{ | 
| 811 | 804 | $primary_list[] = $name; | 
| 812 | - } | |
| 813 | - else if($unique) | |
| 805 | + } else if($unique) | |
| 814 | 806 |  			{ | 
| 815 | 807 | $unique_list[$unique][] = $name; | 
| 816 | - } | |
| 817 | - else if($index) | |
| 808 | + } else if($index) | |
| 818 | 809 |  			{ | 
| 819 | 810 | $index_list[$index][] = $name; | 
| 820 | 811 | } | 
| @@ -964,8 +955,7 @@ discard block | ||
| 964 | 955 | if($limit && $limit->isPageHandler()) | 
| 965 | 956 |  		{ | 
| 966 | 957 | return $this->queryPageLimit($queryObject, $connection, $with_values); | 
| 967 | - } | |
| 968 | - else | |
| 958 | + } else | |
| 969 | 959 |  		{ | 
| 970 | 960 | $query = $this->getSelectSql($queryObject, $with_values); | 
| 971 | 961 | if(is_a($query, 'Object')) | 
| @@ -1009,8 +999,9 @@ discard block | ||
| 1009 | 999 | $buff->data = array(); | 
| 1010 | 1000 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values | 
| 1011 | 1001 | return $buff; | 
| 1012 | - }else | |
| 1013 | - return; | |
| 1002 | +		} else { | |
| 1003 | + return; | |
| 1004 | + } | |
| 1014 | 1005 | } | 
| 1015 | 1006 | |
| 1016 | 1007 | /** | 
| @@ -1069,8 +1060,7 @@ discard block | ||
| 1069 | 1060 | if($total_count) | 
| 1070 | 1061 |  		{ | 
| 1071 | 1062 | $total_page = (int) (($total_count - 1) / $list_count) + 1; | 
| 1072 | - } | |
| 1073 | - else | |
| 1063 | + } else | |
| 1074 | 1064 |  		{ | 
| 1075 | 1065 | $total_page = 1; | 
| 1076 | 1066 | } | 
| @@ -297,7 +297,7 @@ discard block | ||
| 297 | 297 | * @param int $size column size | 
| 298 | 298 | * @param string|int $default default value | 
| 299 | 299 | * @param boolean $notnull not null status, default value is false | 
| 300 | - * @return void | |
| 300 | + * @return resource|null | |
| 301 | 301 | */ | 
| 302 | 302 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) | 
| 303 | 303 |  	{ | 
| @@ -344,7 +344,7 @@ discard block | ||
| 344 | 344 | * Check column exist status of the table | 
| 345 | 345 | * @param string $table_name table name | 
| 346 | 346 | * @param string $column_name column name | 
| 347 | - * @return boolean | |
| 347 | + * @return null|boolean | |
| 348 | 348 | */ | 
| 349 | 349 | function isColumnExists($table_name, $column_name) | 
| 350 | 350 |  	{ | 
| @@ -408,7 +408,7 @@ discard block | ||
| 408 | 408 | * Check index status of the table | 
| 409 | 409 | * @param string $table_name table name | 
| 410 | 410 | * @param string $index_name index name | 
| 411 | - * @return boolean | |
| 411 | + * @return null|boolean | |
| 412 | 412 | */ | 
| 413 | 413 | function isIndexExists($table_name, $index_name) | 
| 414 | 414 |  	{ | 
| @@ -442,7 +442,7 @@ discard block | ||
| 442 | 442 | /** | 
| 443 | 443 | * Creates a table by using xml contents | 
| 444 | 444 | * @param string $xml_doc xml schema contents | 
| 445 | - * @return void|object | |
| 445 | + * @return null|false | |
| 446 | 446 | */ | 
| 447 | 447 | function createTableByXml($xml_doc) | 
| 448 | 448 |  	{ | 
| @@ -452,7 +452,7 @@ discard block | ||
| 452 | 452 | /** | 
| 453 | 453 | * Creates a table by using xml file path | 
| 454 | 454 | * @param string $file_name xml schema file path | 
| 455 | - * @return void|object | |
| 455 | + * @return null|false | |
| 456 | 456 | */ | 
| 457 | 457 | function createTableByXmlFile($file_name) | 
| 458 | 458 |  	{ | 
| @@ -472,7 +472,7 @@ discard block | ||
| 472 | 472 | * opt : notnull, default, size\n | 
| 473 | 473 | * index : primary key, index, unique\n | 
| 474 | 474 | * @param string $xml_doc xml schema contents | 
| 475 | - * @return void|object | |
| 475 | + * @return null|false | |
| 476 | 476 | */ | 
| 477 | 477 | function _createTable($xml_doc) | 
| 478 | 478 |  	{ | 
| @@ -618,7 +618,7 @@ discard block | ||
| 618 | 618 | * @param Object $queryObject | 
| 619 | 619 | * @param resource $connection | 
| 620 | 620 | * @param boolean $with_values | 
| 621 | - * @return Object | |
| 621 | + * @return Object|null | |
| 622 | 622 | */ | 
| 623 | 623 | function _executeSelectAct($queryObject, $connection = null, $with_values = true) | 
| 624 | 624 |  	{ | 
| @@ -703,7 +703,7 @@ discard block | ||
| 703 | 703 | /** | 
| 704 | 704 | * If have a error, return error object | 
| 705 | 705 | * @param Object $queryObject | 
| 706 | - * @return Object | |
| 706 | + * @return Object|null | |
| 707 | 707 | */ | 
| 708 | 708 | function queryError($queryObject) | 
| 709 | 709 |  	{ | 
| @@ -730,7 +730,7 @@ discard block | ||
| 730 | 730 | * @param resource $result | 
| 731 | 731 | * @param resource $connection | 
| 732 | 732 | * @param boolean $with_values | 
| 733 | - * @return Object Object with page info containing | |
| 733 | + * @return Object|null Object with page info containing | |
| 734 | 734 | */ | 
| 735 | 735 | function queryPageLimit($queryObject, $result, $connection, $with_values = true) | 
| 736 | 736 |  	{ | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | function DBMysql($auto_connect = TRUE) | 
| 47 | 47 |  	{ | 
| 48 | 48 | $this->_setDBInfo(); | 
| 49 | - if($auto_connect) $this->_connect(); | |
| 49 | + if ($auto_connect) $this->_connect(); | |
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | 52 | /** | 
| @@ -67,32 +67,32 @@ discard block | ||
| 67 | 67 | function __connect($connection) | 
| 68 | 68 |  	{ | 
| 69 | 69 | // Ignore if no DB information exists | 
| 70 | - if(strpos($connection["db_hostname"], ':') === false && $connection["db_port"]) | |
| 70 | + if (strpos($connection["db_hostname"], ':') === false && $connection["db_port"]) | |
| 71 | 71 |  		{ | 
| 72 | - $connection["db_hostname"] .= ':' . $connection["db_port"]; | |
| 72 | + $connection["db_hostname"] .= ':'.$connection["db_port"]; | |
| 73 | 73 | } | 
| 74 | 74 | |
| 75 | 75 | // Attempt to connect | 
| 76 | 76 | $result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]); | 
| 77 | - if(!$result) | |
| 77 | + if (!$result) | |
| 78 | 78 |  		{ | 
| 79 | 79 |  			exit('XE cannot connect to DB.'); | 
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | - if(mysql_error()) | |
| 82 | + if (mysql_error()) | |
| 83 | 83 |  		{ | 
| 84 | 84 | $this->setError(mysql_errno(), mysql_error()); | 
| 85 | 85 | return; | 
| 86 | 86 | } | 
| 87 | 87 | // Error appears if the version is lower than 4.1 | 
| 88 | - if(version_compare(mysql_get_server_info($result), '4.1', '<')) | |
| 88 | + if (version_compare(mysql_get_server_info($result), '4.1', '<')) | |
| 89 | 89 |  		{ | 
| 90 | - $this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info()); | |
| 90 | + $this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is '.mysql_get_server_info()); | |
| 91 | 91 | return; | 
| 92 | 92 | } | 
| 93 | 93 | // select db | 
| 94 | 94 | @mysql_select_db($connection["db_database"], $result); | 
| 95 | - if(mysql_error()) | |
| 95 | + if (mysql_error()) | |
| 96 | 96 |  		{ | 
| 97 | 97 | $this->setError(mysql_errno(), mysql_error()); | 
| 98 | 98 | return; | 
| @@ -131,11 +131,11 @@ discard block | ||
| 131 | 131 | */ | 
| 132 | 132 | function addQuotes($string) | 
| 133 | 133 |  	{ | 
| 134 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) | |
| 134 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) | |
| 135 | 135 |  		{ | 
| 136 | 136 |  			$string = stripslashes(str_replace("\\", "\\\\", $string)); | 
| 137 | 137 | } | 
| 138 | - if(!is_numeric($string)) | |
| 138 | + if (!is_numeric($string)) | |
| 139 | 139 |  		{ | 
| 140 | 140 | $string = @mysql_real_escape_string($string); | 
| 141 | 141 | } | 
| @@ -181,14 +181,14 @@ discard block | ||
| 181 | 181 | */ | 
| 182 | 182 | function __query($query, $connection) | 
| 183 | 183 |  	{ | 
| 184 | - if(!$connection) | |
| 184 | + if (!$connection) | |
| 185 | 185 |  		{ | 
| 186 | 186 |  			exit('XE cannot handle DB connection.'); | 
| 187 | 187 | } | 
| 188 | 188 | // Run the query statement | 
| 189 | 189 | $result = mysql_query($query, $connection); | 
| 190 | 190 | // Error Check | 
| 191 | - if(mysql_error($connection)) | |
| 191 | + if (mysql_error($connection)) | |
| 192 | 192 |  		{ | 
| 193 | 193 | $this->setError(mysql_errno($connection), mysql_error($connection)); | 
| 194 | 194 | } | 
| @@ -205,13 +205,13 @@ discard block | ||
| 205 | 205 | function _fetch($result, $arrayIndexEndValue = NULL) | 
| 206 | 206 |  	{ | 
| 207 | 207 | $output = array(); | 
| 208 | - if(!$this->isConnected() || $this->isError() || !$result) | |
| 208 | + if (!$this->isConnected() || $this->isError() || !$result) | |
| 209 | 209 |  		{ | 
| 210 | 210 | return $output; | 
| 211 | 211 | } | 
| 212 | - while($tmp = $this->db_fetch_object($result)) | |
| 212 | + while ($tmp = $this->db_fetch_object($result)) | |
| 213 | 213 |  		{ | 
| 214 | - if($arrayIndexEndValue) | |
| 214 | + if ($arrayIndexEndValue) | |
| 215 | 215 |  			{ | 
| 216 | 216 | $output[$arrayIndexEndValue--] = $tmp; | 
| 217 | 217 | } | 
| @@ -220,9 +220,9 @@ discard block | ||
| 220 | 220 | $output[] = $tmp; | 
| 221 | 221 | } | 
| 222 | 222 | } | 
| 223 | - if(count($output) == 1) | |
| 223 | + if (count($output) == 1) | |
| 224 | 224 |  		{ | 
| 225 | - if(isset($arrayIndexEndValue)) | |
| 225 | + if (isset($arrayIndexEndValue)) | |
| 226 | 226 |  			{ | 
| 227 | 227 | return $output; | 
| 228 | 228 | } | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 |  		$query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix); | 
| 246 | 246 | $this->_query($query); | 
| 247 | 247 | $sequence = $this->db_insert_id(); | 
| 248 | - if($sequence % 10000 == 0) | |
| 248 | + if ($sequence % 10000 == 0) | |
| 249 | 249 |  		{ | 
| 250 | 250 |  			$query = sprintf("delete from  `%ssequence` where seq < %d", $this->prefix, $sequence); | 
| 251 | 251 | $this->_query($query); | 
| @@ -265,7 +265,7 @@ discard block | ||
| 265 | 265 |  		$query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password)); | 
| 266 | 266 | $result = $this->_query($query); | 
| 267 | 267 | $tmp = $this->_fetch($result); | 
| 268 | - if($tmp->password === $saved_password || $tmp->old_password === $saved_password) | |
| 268 | + if ($tmp->password === $saved_password || $tmp->old_password === $saved_password) | |
| 269 | 269 |  		{ | 
| 270 | 270 | return true; | 
| 271 | 271 | } | 
| @@ -282,7 +282,7 @@ discard block | ||
| 282 | 282 |  		$query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name)); | 
| 283 | 283 | $result = $this->_query($query); | 
| 284 | 284 | $tmp = $this->_fetch($result); | 
| 285 | - if(!$tmp) | |
| 285 | + if (!$tmp) | |
| 286 | 286 |  		{ | 
| 287 | 287 | return false; | 
| 288 | 288 | } | 
| @@ -302,13 +302,13 @@ discard block | ||
| 302 | 302 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) | 
| 303 | 303 |  	{ | 
| 304 | 304 | $type = $this->column_type[$type]; | 
| 305 | - if(strtoupper($type) == 'INTEGER') | |
| 305 | + if (strtoupper($type) == 'INTEGER') | |
| 306 | 306 |  		{ | 
| 307 | 307 | $size = ''; | 
| 308 | 308 | } | 
| 309 | 309 | |
| 310 | 310 |  		$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name); | 
| 311 | - if($size) | |
| 311 | + if ($size) | |
| 312 | 312 |  		{ | 
| 313 | 313 |  			$query .= sprintf(" %s(%s) ", $type, $size); | 
| 314 | 314 | } | 
| @@ -316,11 +316,11 @@ discard block | ||
| 316 | 316 |  		{ | 
| 317 | 317 |  			$query .= sprintf(" %s ", $type); | 
| 318 | 318 | } | 
| 319 | - if(isset($default)) | |
| 319 | + if (isset($default)) | |
| 320 | 320 |  		{ | 
| 321 | 321 |  			$query .= sprintf(" default '%s' ", $default); | 
| 322 | 322 | } | 
| 323 | - if($notnull) | |
| 323 | + if ($notnull) | |
| 324 | 324 |  		{ | 
| 325 | 325 | $query .= " not null "; | 
| 326 | 326 | } | 
| @@ -350,18 +350,18 @@ discard block | ||
| 350 | 350 |  	{ | 
| 351 | 351 |  		$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name); | 
| 352 | 352 | $result = $this->_query($query); | 
| 353 | - if($this->isError()) | |
| 353 | + if ($this->isError()) | |
| 354 | 354 |  		{ | 
| 355 | 355 | return; | 
| 356 | 356 | } | 
| 357 | 357 | $output = $this->_fetch($result); | 
| 358 | - if($output) | |
| 358 | + if ($output) | |
| 359 | 359 |  		{ | 
| 360 | 360 | $column_name = strtolower($column_name); | 
| 361 | - foreach($output as $key => $val) | |
| 361 | + foreach ($output as $key => $val) | |
| 362 | 362 |  			{ | 
| 363 | 363 | $name = strtolower($val->Field); | 
| 364 | - if($column_name == $name) | |
| 364 | + if ($column_name == $name) | |
| 365 | 365 |  				{ | 
| 366 | 366 | return true; | 
| 367 | 367 | } | 
| @@ -382,7 +382,7 @@ discard block | ||
| 382 | 382 | */ | 
| 383 | 383 | function addIndex($table_name, $index_name, $target_columns, $is_unique = false) | 
| 384 | 384 |  	{ | 
| 385 | - if(!is_array($target_columns)) | |
| 385 | + if (!is_array($target_columns)) | |
| 386 | 386 |  		{ | 
| 387 | 387 | $target_columns = array($target_columns); | 
| 388 | 388 | } | 
| @@ -415,23 +415,23 @@ discard block | ||
| 415 | 415 |  		//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name); | 
| 416 | 416 |  		$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name); | 
| 417 | 417 | $result = $this->_query($query); | 
| 418 | - if($this->isError()) | |
| 418 | + if ($this->isError()) | |
| 419 | 419 |  		{ | 
| 420 | 420 | return; | 
| 421 | 421 | } | 
| 422 | 422 | $output = $this->_fetch($result); | 
| 423 | - if(!$output) | |
| 423 | + if (!$output) | |
| 424 | 424 |  		{ | 
| 425 | 425 | return; | 
| 426 | 426 | } | 
| 427 | - if(!is_array($output)) | |
| 427 | + if (!is_array($output)) | |
| 428 | 428 |  		{ | 
| 429 | 429 | $output = array($output); | 
| 430 | 430 | } | 
| 431 | 431 | |
| 432 | - for($i = 0; $i < count($output); $i++) | |
| 432 | + for ($i = 0; $i < count($output); $i++) | |
| 433 | 433 |  		{ | 
| 434 | - if($output[$i]->Key_name == $index_name) | |
| 434 | + if ($output[$i]->Key_name == $index_name) | |
| 435 | 435 |  			{ | 
| 436 | 436 | return true; | 
| 437 | 437 | } | 
| @@ -456,7 +456,7 @@ discard block | ||
| 456 | 456 | */ | 
| 457 | 457 | function createTableByXmlFile($file_name) | 
| 458 | 458 |  	{ | 
| 459 | - if(!file_exists($file_name)) | |
| 459 | + if (!file_exists($file_name)) | |
| 460 | 460 |  		{ | 
| 461 | 461 | return; | 
| 462 | 462 | } | 
| @@ -481,13 +481,13 @@ discard block | ||
| 481 | 481 | $xml_obj = $oXml->parse($xml_doc); | 
| 482 | 482 | // Create a table schema | 
| 483 | 483 | $table_name = $xml_obj->table->attrs->name; | 
| 484 | - if($this->isTableExists($table_name)) | |
| 484 | + if ($this->isTableExists($table_name)) | |
| 485 | 485 |  		{ | 
| 486 | 486 | return; | 
| 487 | 487 | } | 
| 488 | - $table_name = $this->prefix . $table_name; | |
| 488 | + $table_name = $this->prefix.$table_name; | |
| 489 | 489 | |
| 490 | - if(!is_array($xml_obj->table->column)) | |
| 490 | + if (!is_array($xml_obj->table->column)) | |
| 491 | 491 |  		{ | 
| 492 | 492 | $columns[] = $xml_obj->table->column; | 
| 493 | 493 | } | 
| @@ -500,7 +500,7 @@ discard block | ||
| 500 | 500 | $unique_list = array(); | 
| 501 | 501 | $index_list = array(); | 
| 502 | 502 | |
| 503 | - foreach($columns as $column) | |
| 503 | + foreach ($columns as $column) | |
| 504 | 504 |  		{ | 
| 505 | 505 | $name = $column->attrs->name; | 
| 506 | 506 | $type = $column->attrs->type; | 
| @@ -512,47 +512,47 @@ discard block | ||
| 512 | 512 | $default = $column->attrs->default; | 
| 513 | 513 | $auto_increment = $column->attrs->auto_increment; | 
| 514 | 514 | |
| 515 | -			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); | |
| 515 | +			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); | |
| 516 | 516 | |
| 517 | - if($primary_key) | |
| 517 | + if ($primary_key) | |
| 518 | 518 |  			{ | 
| 519 | 519 | $primary_list[] = $name; | 
| 520 | 520 | } | 
| 521 | - else if($unique) | |
| 521 | + else if ($unique) | |
| 522 | 522 |  			{ | 
| 523 | 523 | $unique_list[$unique][] = $name; | 
| 524 | 524 | } | 
| 525 | - else if($index) | |
| 525 | + else if ($index) | |
| 526 | 526 |  			{ | 
| 527 | 527 | $index_list[$index][] = $name; | 
| 528 | 528 | } | 
| 529 | 529 | } | 
| 530 | 530 | |
| 531 | - if(count($primary_list)) | |
| 531 | + if (count($primary_list)) | |
| 532 | 532 |  		{ | 
| 533 | -			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); | |
| 533 | +			$column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); | |
| 534 | 534 | } | 
| 535 | 535 | |
| 536 | - if(count($unique_list)) | |
| 536 | + if (count($unique_list)) | |
| 537 | 537 |  		{ | 
| 538 | - foreach($unique_list as $key => $val) | |
| 538 | + foreach ($unique_list as $key => $val) | |
| 539 | 539 |  			{ | 
| 540 | -				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); | |
| 540 | +				$column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); | |
| 541 | 541 | } | 
| 542 | 542 | } | 
| 543 | 543 | |
| 544 | - if(count($index_list)) | |
| 544 | + if (count($index_list)) | |
| 545 | 545 |  		{ | 
| 546 | - foreach($index_list as $key => $val) | |
| 546 | + foreach ($index_list as $key => $val) | |
| 547 | 547 |  			{ | 
| 548 | -				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); | |
| 548 | +				$column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); | |
| 549 | 549 | } | 
| 550 | 550 | } | 
| 551 | 551 | |
| 552 | 552 |  		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci"); | 
| 553 | 553 | |
| 554 | 554 | $output = $this->_query($schema); | 
| 555 | - if(!$output) | |
| 555 | + if (!$output) | |
| 556 | 556 | return false; | 
| 557 | 557 | } | 
| 558 | 558 | |
| @@ -565,8 +565,8 @@ discard block | ||
| 565 | 565 | function _executeInsertAct($queryObject, $with_values = true) | 
| 566 | 566 |  	{ | 
| 567 | 567 | $query = $this->getInsertSql($queryObject, $with_values, true); | 
| 568 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 569 | - if(is_a($query, 'Object')) | |
| 568 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 569 | + if (is_a($query, 'Object')) | |
| 570 | 570 |  		{ | 
| 571 | 571 | return; | 
| 572 | 572 | } | 
| @@ -582,13 +582,13 @@ discard block | ||
| 582 | 582 | function _executeUpdateAct($queryObject, $with_values = true) | 
| 583 | 583 |  	{ | 
| 584 | 584 | $query = $this->getUpdateSql($queryObject, $with_values, true); | 
| 585 | - if(is_a($query, 'Object')) | |
| 585 | + if (is_a($query, 'Object')) | |
| 586 | 586 |  		{ | 
| 587 | - if(!$query->toBool()) return $query; | |
| 587 | + if (!$query->toBool()) return $query; | |
| 588 | 588 | else return; | 
| 589 | 589 | } | 
| 590 | 590 | |
| 591 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 591 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 592 | 592 | |
| 593 | 593 | |
| 594 | 594 | return $this->_query($query); | 
| @@ -603,8 +603,8 @@ discard block | ||
| 603 | 603 | function _executeDeleteAct($queryObject, $with_values = true) | 
| 604 | 604 |  	{ | 
| 605 | 605 | $query = $this->getDeleteSql($queryObject, $with_values, true); | 
| 606 | -		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 607 | - if(is_a($query, 'Object')) | |
| 606 | +		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 607 | + if (is_a($query, 'Object')) | |
| 608 | 608 |  		{ | 
| 609 | 609 | return; | 
| 610 | 610 | } | 
| @@ -624,30 +624,30 @@ discard block | ||
| 624 | 624 |  	{ | 
| 625 | 625 | $limit = $queryObject->getLimit(); | 
| 626 | 626 | $result = NULL; | 
| 627 | - if($limit && $limit->isPageHandler()) | |
| 627 | + if ($limit && $limit->isPageHandler()) | |
| 628 | 628 |  		{ | 
| 629 | 629 | return $this->queryPageLimit($queryObject, $result, $connection, $with_values); | 
| 630 | 630 | } | 
| 631 | 631 | else | 
| 632 | 632 |  		{ | 
| 633 | 633 | $query = $this->getSelectSql($queryObject, $with_values); | 
| 634 | - if(is_a($query, 'Object')) | |
| 634 | + if (is_a($query, 'Object')) | |
| 635 | 635 |  			{ | 
| 636 | 636 | return; | 
| 637 | 637 | } | 
| 638 | -			$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; | |
| 638 | +			$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; | |
| 639 | 639 | |
| 640 | 640 | $result = $this->_query($query, $connection); | 
| 641 | - if($this->isError()) | |
| 641 | + if ($this->isError()) | |
| 642 | 642 |  			{ | 
| 643 | 643 | return $this->queryError($queryObject); | 
| 644 | 644 | } | 
| 645 | 645 | |
| 646 | 646 | $data = $this->_fetch($result); | 
| 647 | - $buff = new Object (); | |
| 647 | + $buff = new Object(); | |
| 648 | 648 | $buff->data = $data; | 
| 649 | 649 | |
| 650 | - if($queryObject->usesClickCount()) | |
| 650 | + if ($queryObject->usesClickCount()) | |
| 651 | 651 |  			{ | 
| 652 | 652 | $update_query = $this->getClickCountQuery($queryObject); | 
| 653 | 653 | $this->_executeUpdateAct($update_query, $with_values); | 
| @@ -708,9 +708,9 @@ discard block | ||
| 708 | 708 | function queryError($queryObject) | 
| 709 | 709 |  	{ | 
| 710 | 710 | $limit = $queryObject->getLimit(); | 
| 711 | - if($limit && $limit->isPageHandler()) | |
| 711 | + if ($limit && $limit->isPageHandler()) | |
| 712 | 712 |  		{ | 
| 713 | - $buff = new Object (); | |
| 713 | + $buff = new Object(); | |
| 714 | 714 | $buff->total_count = 0; | 
| 715 | 715 | $buff->total_page = 0; | 
| 716 | 716 | $buff->page = 1; | 
| @@ -737,48 +737,48 @@ discard block | ||
| 737 | 737 | $limit = $queryObject->getLimit(); | 
| 738 | 738 | // Total count | 
| 739 | 739 | $temp_where = $queryObject->getWhereString($with_values, false); | 
| 740 | -		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where)); | |
| 740 | +		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where)); | |
| 741 | 741 | |
| 742 | 742 | // Check for distinct query and if found update count query structure | 
| 743 | 743 | $temp_select = $queryObject->getSelectString($with_values); | 
| 744 | 744 | $uses_distinct = stripos($temp_select, "distinct") !== false; | 
| 745 | 745 | $uses_groupby = $queryObject->getGroupByString() != ''; | 
| 746 | - if($uses_distinct || $uses_groupby) | |
| 746 | + if ($uses_distinct || $uses_groupby) | |
| 747 | 747 |  		{ | 
| 748 | 748 |  			$count_query = sprintf('select %s %s %s %s' | 
| 749 | 749 | , $temp_select == '*' ? '1' : $temp_select | 
| 750 | - , 'FROM ' . $queryObject->getFromString($with_values) | |
| 751 | - , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) | |
| 752 | - , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') | |
| 750 | + , 'FROM '.$queryObject->getFromString($with_values) | |
| 751 | + , ($temp_where === '' ? '' : ' WHERE '.$temp_where) | |
| 752 | + , ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '') | |
| 753 | 753 | ); | 
| 754 | 754 | |
| 755 | 755 | // If query uses grouping or distinct, count from original select | 
| 756 | 756 |  			$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); | 
| 757 | 757 | } | 
| 758 | 758 | |
| 759 | -		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; | |
| 759 | +		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; | |
| 760 | 760 | $result_count = $this->_query($count_query, $connection); | 
| 761 | 761 | $count_output = $this->_fetch($result_count); | 
| 762 | 762 | $total_count = (int) (isset($count_output->count) ? $count_output->count : NULL); | 
| 763 | 763 | |
| 764 | 764 | $list_count = $limit->list_count->getValue(); | 
| 765 | - if(!$list_count) | |
| 765 | + if (!$list_count) | |
| 766 | 766 |  		{ | 
| 767 | 767 | $list_count = 20; | 
| 768 | 768 | } | 
| 769 | 769 | $page_count = $limit->page_count->getValue(); | 
| 770 | - if(!$page_count) | |
| 770 | + if (!$page_count) | |
| 771 | 771 |  		{ | 
| 772 | 772 | $page_count = 10; | 
| 773 | 773 | } | 
| 774 | 774 | $page = $limit->page->getValue(); | 
| 775 | - if(!$page || $page < 1) | |
| 775 | + if (!$page || $page < 1) | |
| 776 | 776 |  		{ | 
| 777 | 777 | $page = 1; | 
| 778 | 778 | } | 
| 779 | 779 | |
| 780 | 780 | // total pages | 
| 781 | - if($total_count) | |
| 781 | + if ($total_count) | |
| 782 | 782 |  		{ | 
| 783 | 783 | $total_page = (int) (($total_count - 1) / $list_count) + 1; | 
| 784 | 784 | } | 
| @@ -788,10 +788,10 @@ discard block | ||
| 788 | 788 | } | 
| 789 | 789 | |
| 790 | 790 | // check the page variables | 
| 791 | - if($page > $total_page) | |
| 791 | + if ($page > $total_page) | |
| 792 | 792 |  		{ | 
| 793 | 793 | // If requested page is bigger than total number of pages, return empty list | 
| 794 | - $buff = new Object (); | |
| 794 | + $buff = new Object(); | |
| 795 | 795 | $buff->total_count = $total_count; | 
| 796 | 796 | $buff->total_page = $total_page; | 
| 797 | 797 | $buff->page = $page; | 
| @@ -803,9 +803,9 @@ discard block | ||
| 803 | 803 | |
| 804 | 804 | $query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count); | 
| 805 | 805 | |
| 806 | -		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | |
| 806 | +		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; | |
| 807 | 807 | $result = $this->_query($query, $connection); | 
| 808 | - if($this->isError()) | |
| 808 | + if ($this->isError()) | |
| 809 | 809 |  		{ | 
| 810 | 810 | return $this->queryError($queryObject); | 
| 811 | 811 | } | 
| @@ -813,7 +813,7 @@ discard block | ||
| 813 | 813 | $virtual_no = $total_count - ($page - 1) * $list_count; | 
| 814 | 814 | $data = $this->_fetch($result, $virtual_no); | 
| 815 | 815 | |
| 816 | - $buff = new Object (); | |
| 816 | + $buff = new Object(); | |
| 817 | 817 | $buff->total_count = $total_count; | 
| 818 | 818 | $buff->total_page = $total_page; | 
| 819 | 819 | $buff->page = $page; | 
| @@ -833,44 +833,44 @@ discard block | ||
| 833 | 833 | function getSelectPageSql($query, $with_values = true, $start_count = 0, $list_count = 0) | 
| 834 | 834 |  	{ | 
| 835 | 835 | $select = $query->getSelectString($with_values); | 
| 836 | - if($select == '') | |
| 836 | + if ($select == '') | |
| 837 | 837 |  		{ | 
| 838 | 838 | return new Object(-1, "Invalid query"); | 
| 839 | 839 | } | 
| 840 | - $select = 'SELECT ' . $select; | |
| 840 | + $select = 'SELECT '.$select; | |
| 841 | 841 | |
| 842 | 842 | $from = $query->getFromString($with_values); | 
| 843 | - if($from == '') | |
| 843 | + if ($from == '') | |
| 844 | 844 |  		{ | 
| 845 | 845 | return new Object(-1, "Invalid query"); | 
| 846 | 846 | } | 
| 847 | - $from = ' FROM ' . $from; | |
| 847 | + $from = ' FROM '.$from; | |
| 848 | 848 | |
| 849 | 849 | $where = $query->getWhereString($with_values); | 
| 850 | - if($where != '') | |
| 850 | + if ($where != '') | |
| 851 | 851 |  		{ | 
| 852 | - $where = ' WHERE ' . $where; | |
| 852 | + $where = ' WHERE '.$where; | |
| 853 | 853 | } | 
| 854 | 854 | |
| 855 | 855 | $groupBy = $query->getGroupByString(); | 
| 856 | - if($groupBy != '') | |
| 856 | + if ($groupBy != '') | |
| 857 | 857 |  		{ | 
| 858 | - $groupBy = ' GROUP BY ' . $groupBy; | |
| 858 | + $groupBy = ' GROUP BY '.$groupBy; | |
| 859 | 859 | } | 
| 860 | 860 | |
| 861 | 861 | $orderBy = $query->getOrderByString(); | 
| 862 | - if($orderBy != '') | |
| 862 | + if ($orderBy != '') | |
| 863 | 863 |  		{ | 
| 864 | - $orderBy = ' ORDER BY ' . $orderBy; | |
| 864 | + $orderBy = ' ORDER BY '.$orderBy; | |
| 865 | 865 | } | 
| 866 | 866 | |
| 867 | 867 | $limit = $query->getLimitString(); | 
| 868 | - if($limit != '') | |
| 868 | + if ($limit != '') | |
| 869 | 869 |  		{ | 
| 870 | 870 |  			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); | 
| 871 | 871 | } | 
| 872 | 872 | |
| 873 | - return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; | |
| 873 | + return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit; | |
| 874 | 874 | } | 
| 875 | 875 | |
| 876 | 876 | } | 
| @@ -46,7 +46,9 @@ discard block | ||
| 46 | 46 | function DBMysql($auto_connect = TRUE) | 
| 47 | 47 |  	{ | 
| 48 | 48 | $this->_setDBInfo(); | 
| 49 | - if($auto_connect) $this->_connect(); | |
| 49 | +		if($auto_connect) { | |
| 50 | + $this->_connect(); | |
| 51 | + } | |
| 50 | 52 | } | 
| 51 | 53 | |
| 52 | 54 | /** | 
| @@ -214,8 +216,7 @@ discard block | ||
| 214 | 216 | if($arrayIndexEndValue) | 
| 215 | 217 |  			{ | 
| 216 | 218 | $output[$arrayIndexEndValue--] = $tmp; | 
| 217 | - } | |
| 218 | - else | |
| 219 | + } else | |
| 219 | 220 |  			{ | 
| 220 | 221 | $output[] = $tmp; | 
| 221 | 222 | } | 
| @@ -225,8 +226,7 @@ discard block | ||
| 225 | 226 | if(isset($arrayIndexEndValue)) | 
| 226 | 227 |  			{ | 
| 227 | 228 | return $output; | 
| 228 | - } | |
| 229 | - else | |
| 229 | + } else | |
| 230 | 230 |  			{ | 
| 231 | 231 | return $output[0]; | 
| 232 | 232 | } | 
| @@ -311,8 +311,7 @@ discard block | ||
| 311 | 311 | if($size) | 
| 312 | 312 |  		{ | 
| 313 | 313 |  			$query .= sprintf(" %s(%s) ", $type, $size); | 
| 314 | - } | |
| 315 | - else | |
| 314 | + } else | |
| 316 | 315 |  		{ | 
| 317 | 316 |  			$query .= sprintf(" %s ", $type); | 
| 318 | 317 | } | 
| @@ -490,8 +489,7 @@ discard block | ||
| 490 | 489 | if(!is_array($xml_obj->table->column)) | 
| 491 | 490 |  		{ | 
| 492 | 491 | $columns[] = $xml_obj->table->column; | 
| 493 | - } | |
| 494 | - else | |
| 492 | + } else | |
| 495 | 493 |  		{ | 
| 496 | 494 | $columns = $xml_obj->table->column; | 
| 497 | 495 | } | 
| @@ -517,12 +515,10 @@ discard block | ||
| 517 | 515 | if($primary_key) | 
| 518 | 516 |  			{ | 
| 519 | 517 | $primary_list[] = $name; | 
| 520 | - } | |
| 521 | - else if($unique) | |
| 518 | + } else if($unique) | |
| 522 | 519 |  			{ | 
| 523 | 520 | $unique_list[$unique][] = $name; | 
| 524 | - } | |
| 525 | - else if($index) | |
| 521 | + } else if($index) | |
| 526 | 522 |  			{ | 
| 527 | 523 | $index_list[$index][] = $name; | 
| 528 | 524 | } | 
| @@ -552,8 +548,9 @@ discard block | ||
| 552 | 548 |  		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci"); | 
| 553 | 549 | |
| 554 | 550 | $output = $this->_query($schema); | 
| 555 | - if(!$output) | |
| 556 | - return false; | |
| 551 | +		if(!$output) { | |
| 552 | + return false; | |
| 553 | + } | |
| 557 | 554 | } | 
| 558 | 555 | |
| 559 | 556 | /** | 
| @@ -584,8 +581,11 @@ discard block | ||
| 584 | 581 | $query = $this->getUpdateSql($queryObject, $with_values, true); | 
| 585 | 582 | if(is_a($query, 'Object')) | 
| 586 | 583 |  		{ | 
| 587 | - if(!$query->toBool()) return $query; | |
| 588 | - else return; | |
| 584 | +			if(!$query->toBool()) { | |
| 585 | + return $query; | |
| 586 | +			} else { | |
| 587 | + return; | |
| 588 | + } | |
| 589 | 589 | } | 
| 590 | 590 | |
| 591 | 591 |  		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; | 
| @@ -627,8 +627,7 @@ discard block | ||
| 627 | 627 | if($limit && $limit->isPageHandler()) | 
| 628 | 628 |  		{ | 
| 629 | 629 | return $this->queryPageLimit($queryObject, $result, $connection, $with_values); | 
| 630 | - } | |
| 631 | - else | |
| 630 | + } else | |
| 632 | 631 |  		{ | 
| 633 | 632 | $query = $this->getSelectSql($queryObject, $with_values); | 
| 634 | 633 | if(is_a($query, 'Object')) | 
| @@ -717,8 +716,7 @@ discard block | ||
| 717 | 716 | $buff->data = array(); | 
| 718 | 717 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values | 
| 719 | 718 | return $buff; | 
| 720 | - } | |
| 721 | - else | |
| 719 | + } else | |
| 722 | 720 |  		{ | 
| 723 | 721 | return; | 
| 724 | 722 | } | 
| @@ -781,8 +779,7 @@ discard block | ||
| 781 | 779 | if($total_count) | 
| 782 | 780 |  		{ | 
| 783 | 781 | $total_page = (int) (($total_count - 1) / $list_count) + 1; | 
| 784 | - } | |
| 785 | - else | |
| 782 | + } else | |
| 786 | 783 |  		{ | 
| 787 | 784 | $total_page = 1; | 
| 788 | 785 | } | 
| @@ -131,7 +131,7 @@ | ||
| 131 | 131 | * opt : notnull, default, size\n | 
| 132 | 132 | * index : primary key, index, unique\n | 
| 133 | 133 | * @param string $xml_doc xml schema contents | 
| 134 | - * @return void|object | |
| 134 | + * @return null|false | |
| 135 | 135 | */ | 
| 136 | 136 | function _createTable($xml_doc) | 
| 137 | 137 |  	{ | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | function DBMysql_innodb($auto_connect = TRUE) | 
| 24 | 24 |  	{ | 
| 25 | 25 | $this->_setDBInfo(); | 
| 26 | - if($auto_connect) $this->_connect(); | |
| 26 | + if ($auto_connect) $this->_connect(); | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | /** | 
| @@ -55,13 +55,13 @@ discard block | ||
| 55 | 55 |  	{ | 
| 56 | 56 |  		$connection = $this->_getConnection('master'); | 
| 57 | 57 | |
| 58 | - if(!$transactionLevel) | |
| 58 | + if (!$transactionLevel) | |
| 59 | 59 |  		{ | 
| 60 | 60 |  			$this->_query("START TRANSACTION", $connection); | 
| 61 | 61 | } | 
| 62 | 62 | else | 
| 63 | 63 |  		{ | 
| 64 | -			$this->_query("SAVEPOINT SP" . $transactionLevel, $connection); | |
| 64 | +			$this->_query("SAVEPOINT SP".$transactionLevel, $connection); | |
| 65 | 65 | } | 
| 66 | 66 | return true; | 
| 67 | 67 | } | 
| @@ -77,9 +77,9 @@ discard block | ||
| 77 | 77 | |
| 78 | 78 | $point = $transactionLevel - 1; | 
| 79 | 79 | |
| 80 | - if($point) | |
| 80 | + if ($point) | |
| 81 | 81 |  		{ | 
| 82 | -			$this->_query("ROLLBACK TO SP" . $point, $connection); | |
| 82 | +			$this->_query("ROLLBACK TO SP".$point, $connection); | |
| 83 | 83 | } | 
| 84 | 84 | else | 
| 85 | 85 |  		{ | 
| @@ -109,14 +109,14 @@ discard block | ||
| 109 | 109 | */ | 
| 110 | 110 | function __query($query, $connection) | 
| 111 | 111 |  	{ | 
| 112 | - if(!$connection) | |
| 112 | + if (!$connection) | |
| 113 | 113 |  		{ | 
| 114 | 114 |  			exit('XE cannot handle DB connection.'); | 
| 115 | 115 | } | 
| 116 | 116 | // Run the query statement | 
| 117 | 117 | $result = @mysql_query($query, $connection); | 
| 118 | 118 | // Error Check | 
| 119 | - if(mysql_error($connection)) | |
| 119 | + if (mysql_error($connection)) | |
| 120 | 120 |  		{ | 
| 121 | 121 | $this->setError(mysql_errno($connection), mysql_error($connection)); | 
| 122 | 122 | } | 
| @@ -140,13 +140,13 @@ discard block | ||
| 140 | 140 | $xml_obj = $oXml->parse($xml_doc); | 
| 141 | 141 | // Create a table schema | 
| 142 | 142 | $table_name = $xml_obj->table->attrs->name; | 
| 143 | - if($this->isTableExists($table_name)) | |
| 143 | + if ($this->isTableExists($table_name)) | |
| 144 | 144 |  		{ | 
| 145 | 145 | return; | 
| 146 | 146 | } | 
| 147 | - $table_name = $this->prefix . $table_name; | |
| 147 | + $table_name = $this->prefix.$table_name; | |
| 148 | 148 | |
| 149 | - if(!is_array($xml_obj->table->column)) | |
| 149 | + if (!is_array($xml_obj->table->column)) | |
| 150 | 150 |  		{ | 
| 151 | 151 | $columns[] = $xml_obj->table->column; | 
| 152 | 152 | } | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | $columns = $xml_obj->table->column; | 
| 156 | 156 | } | 
| 157 | 157 | |
| 158 | - foreach($columns as $column) | |
| 158 | + foreach ($columns as $column) | |
| 159 | 159 |  		{ | 
| 160 | 160 | $name = $column->attrs->name; | 
| 161 | 161 | $type = $column->attrs->type; | 
| @@ -167,47 +167,47 @@ discard block | ||
| 167 | 167 | $default = $column->attrs->default; | 
| 168 | 168 | $auto_increment = $column->attrs->auto_increment; | 
| 169 | 169 | |
| 170 | -			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); | |
| 170 | +			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); | |
| 171 | 171 | |
| 172 | - if($primary_key) | |
| 172 | + if ($primary_key) | |
| 173 | 173 |  			{ | 
| 174 | 174 | $primary_list[] = $name; | 
| 175 | 175 | } | 
| 176 | - else if($unique) | |
| 176 | + else if ($unique) | |
| 177 | 177 |  			{ | 
| 178 | 178 | $unique_list[$unique][] = $name; | 
| 179 | 179 | } | 
| 180 | - else if($index) | |
| 180 | + else if ($index) | |
| 181 | 181 |  			{ | 
| 182 | 182 | $index_list[$index][] = $name; | 
| 183 | 183 | } | 
| 184 | 184 | } | 
| 185 | 185 | |
| 186 | - if(count($primary_list)) | |
| 186 | + if (count($primary_list)) | |
| 187 | 187 |  		{ | 
| 188 | -			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); | |
| 188 | +			$column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | - if(count($unique_list)) | |
| 191 | + if (count($unique_list)) | |
| 192 | 192 |  		{ | 
| 193 | - foreach($unique_list as $key => $val) | |
| 193 | + foreach ($unique_list as $key => $val) | |
| 194 | 194 |  			{ | 
| 195 | -				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); | |
| 195 | +				$column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); | |
| 196 | 196 | } | 
| 197 | 197 | } | 
| 198 | 198 | |
| 199 | - if(count($index_list)) | |
| 199 | + if (count($index_list)) | |
| 200 | 200 |  		{ | 
| 201 | - foreach($index_list as $key => $val) | |
| 201 | + foreach ($index_list as $key => $val) | |
| 202 | 202 |  			{ | 
| 203 | -				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); | |
| 203 | +				$column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); | |
| 204 | 204 | } | 
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | 207 |  		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"); | 
| 208 | 208 | |
| 209 | 209 | $output = $this->_query($schema); | 
| 210 | - if(!$output) | |
| 210 | + if (!$output) | |
| 211 | 211 |  		{ | 
| 212 | 212 | return false; | 
| 213 | 213 | } | 
| @@ -23,7 +23,9 @@ discard block | ||
| 23 | 23 | function DBMysql_innodb($auto_connect = TRUE) | 
| 24 | 24 |  	{ | 
| 25 | 25 | $this->_setDBInfo(); | 
| 26 | - if($auto_connect) $this->_connect(); | |
| 26 | +		if($auto_connect) { | |
| 27 | + $this->_connect(); | |
| 28 | + } | |
| 27 | 29 | } | 
| 28 | 30 | |
| 29 | 31 | /** | 
| @@ -58,8 +60,7 @@ discard block | ||
| 58 | 60 | if(!$transactionLevel) | 
| 59 | 61 |  		{ | 
| 60 | 62 |  			$this->_query("START TRANSACTION", $connection); | 
| 61 | - } | |
| 62 | - else | |
| 63 | + } else | |
| 63 | 64 |  		{ | 
| 64 | 65 |  			$this->_query("SAVEPOINT SP" . $transactionLevel, $connection); | 
| 65 | 66 | } | 
| @@ -80,8 +81,7 @@ discard block | ||
| 80 | 81 | if($point) | 
| 81 | 82 |  		{ | 
| 82 | 83 |  			$this->_query("ROLLBACK TO SP" . $point, $connection); | 
| 83 | - } | |
| 84 | - else | |
| 84 | + } else | |
| 85 | 85 |  		{ | 
| 86 | 86 |  			$this->_query("ROLLBACK", $connection); | 
| 87 | 87 | } | 
| @@ -149,8 +149,7 @@ discard block | ||
| 149 | 149 | if(!is_array($xml_obj->table->column)) | 
| 150 | 150 |  		{ | 
| 151 | 151 | $columns[] = $xml_obj->table->column; | 
| 152 | - } | |
| 153 | - else | |
| 152 | + } else | |
| 154 | 153 |  		{ | 
| 155 | 154 | $columns = $xml_obj->table->column; | 
| 156 | 155 | } | 
| @@ -172,12 +171,10 @@ discard block | ||
| 172 | 171 | if($primary_key) | 
| 173 | 172 |  			{ | 
| 174 | 173 | $primary_list[] = $name; | 
| 175 | - } | |
| 176 | - else if($unique) | |
| 174 | + } else if($unique) | |
| 177 | 175 |  			{ | 
| 178 | 176 | $unique_list[$unique][] = $name; | 
| 179 | - } | |
| 180 | - else if($index) | |
| 177 | + } else if($index) | |
| 181 | 178 |  			{ | 
| 182 | 179 | $index_list[$index][] = $name; | 
| 183 | 180 | } | 
| @@ -383,7 +383,7 @@ | ||
| 383 | 383 | * @param Object $queryObject | 
| 384 | 384 | * @param resource $connection | 
| 385 | 385 | * @param boolean $with_values | 
| 386 | - * @return Object | |
| 386 | + * @return Object|null | |
| 387 | 387 | */ | 
| 388 | 388 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) | 
| 389 | 389 |  	{ | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | function DBMysqli($auto_connect = TRUE) | 
| 24 | 24 |  	{ | 
| 25 | 25 | $this->_setDBInfo(); | 
| 26 | - if($auto_connect) $this->_connect(); | |
| 26 | + if ($auto_connect) $this->_connect(); | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | /** | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | function __connect($connection) | 
| 45 | 45 |  	{ | 
| 46 | 46 | // Attempt to connect | 
| 47 | - if($connection["db_port"]) | |
| 47 | + if ($connection["db_port"]) | |
| 48 | 48 |  		{ | 
| 49 | 49 | $result = @mysqli_connect($connection["db_hostname"] | 
| 50 | 50 | , $connection["db_userid"] | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | , $connection["db_database"]); | 
| 61 | 61 | } | 
| 62 | 62 | $error = mysqli_connect_errno(); | 
| 63 | - if($error) | |
| 63 | + if ($error) | |
| 64 | 64 |  		{ | 
| 65 | 65 | $this->setError($error, mysqli_connect_error()); | 
| 66 | 66 | return; | 
| @@ -87,11 +87,11 @@ discard block | ||
| 87 | 87 | */ | 
| 88 | 88 | function addQuotes($string) | 
| 89 | 89 |  	{ | 
| 90 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) | |
| 90 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) | |
| 91 | 91 |  		{ | 
| 92 | 92 |  			$string = stripslashes(str_replace("\\", "\\\\", $string)); | 
| 93 | 93 | } | 
| 94 | - if(!is_numeric($string)) | |
| 94 | + if (!is_numeric($string)) | |
| 95 | 95 |  		{ | 
| 96 | 96 |  			$connection = $this->_getConnection('master'); | 
| 97 | 97 | $string = mysqli_escape_string($connection, $string); | 
| @@ -108,23 +108,23 @@ discard block | ||
| 108 | 108 | */ | 
| 109 | 109 | function __query($query, $connection) | 
| 110 | 110 |  	{ | 
| 111 | - if($this->use_prepared_statements == 'Y') | |
| 111 | + if ($this->use_prepared_statements == 'Y') | |
| 112 | 112 |  		{ | 
| 113 | 113 | // 1. Prepare query | 
| 114 | 114 | $stmt = mysqli_prepare($connection, $query); | 
| 115 | - if($stmt) | |
| 115 | + if ($stmt) | |
| 116 | 116 |  			{ | 
| 117 | 117 | $types = ''; | 
| 118 | 118 | $params = array(); | 
| 119 | 119 | $this->_prepareQueryParameters($types, $params); | 
| 120 | 120 | |
| 121 | - if(!empty($params)) | |
| 121 | + if (!empty($params)) | |
| 122 | 122 |  				{ | 
| 123 | 123 | $args[0] = $stmt; | 
| 124 | 124 | $args[1] = $types; | 
| 125 | 125 | |
| 126 | 126 | $i = 2; | 
| 127 | - foreach($params as $key => $param) | |
| 127 | + foreach ($params as $key => $param) | |
| 128 | 128 |  					{ | 
| 129 | 129 | $copy[$key] = $param; | 
| 130 | 130 | $args[$i++] = &$copy[$key]; | 
| @@ -132,18 +132,18 @@ discard block | ||
| 132 | 132 | |
| 133 | 133 | // 2. Bind parameters | 
| 134 | 134 |  					$status = call_user_func_array('mysqli_stmt_bind_param', $args); | 
| 135 | - if(!$status) | |
| 135 | + if (!$status) | |
| 136 | 136 |  					{ | 
| 137 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true)); | |
| 137 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection).PHP_EOL.print_r($args, true)); | |
| 138 | 138 | } | 
| 139 | 139 | } | 
| 140 | 140 | |
| 141 | 141 | // 3. Execute query | 
| 142 | 142 | $status = mysqli_stmt_execute($stmt); | 
| 143 | 143 | |
| 144 | - if(!$status) | |
| 144 | + if (!$status) | |
| 145 | 145 |  				{ | 
| 146 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true)); | |
| 146 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection).PHP_EOL.print_r($args, true)); | |
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | // Return stmt for other processing - like retrieving resultset (_fetch) | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | $result = mysqli_query($connection, $query); | 
| 156 | 156 | // Error Check | 
| 157 | 157 | $error = mysqli_error($connection); | 
| 158 | - if($error) | |
| 158 | + if ($error) | |
| 159 | 159 |  		{ | 
| 160 | 160 | $this->setError(mysqli_errno($connection), $error); | 
| 161 | 161 | } | 
| @@ -174,23 +174,23 @@ discard block | ||
| 174 | 174 |  	{ | 
| 175 | 175 | $types = ''; | 
| 176 | 176 | $params = array(); | 
| 177 | - if(!$this->param) | |
| 177 | + if (!$this->param) | |
| 178 | 178 |  		{ | 
| 179 | 179 | return; | 
| 180 | 180 | } | 
| 181 | 181 | |
| 182 | - foreach($this->param as $k => $o) | |
| 182 | + foreach ($this->param as $k => $o) | |
| 183 | 183 |  		{ | 
| 184 | 184 | $value = $o->getUnescapedValue(); | 
| 185 | 185 | $type = $o->getType(); | 
| 186 | 186 | |
| 187 | 187 | // Skip column names -> this should be concatenated to query string | 
| 188 | - if($o->isColumnName()) | |
| 188 | + if ($o->isColumnName()) | |
| 189 | 189 |  			{ | 
| 190 | 190 | continue; | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | - switch($type) | |
| 193 | + switch ($type) | |
| 194 | 194 |  			{ | 
| 195 | 195 | case 'number' : | 
| 196 | 196 | $type = 'i'; | 
| @@ -202,9 +202,9 @@ discard block | ||
| 202 | 202 | $type = 's'; | 
| 203 | 203 | } | 
| 204 | 204 | |
| 205 | - if(is_array($value)) | |
| 205 | + if (is_array($value)) | |
| 206 | 206 |  			{ | 
| 207 | - foreach($value as $v) | |
| 207 | + foreach ($value as $v) | |
| 208 | 208 |  				{ | 
| 209 | 209 | $params[] = $v; | 
| 210 | 210 | $types .= $type; | 
| @@ -226,12 +226,12 @@ discard block | ||
| 226 | 226 | */ | 
| 227 | 227 | function _fetch($result, $arrayIndexEndValue = NULL) | 
| 228 | 228 |  	{ | 
| 229 | - if($this->use_prepared_statements != 'Y') | |
| 229 | + if ($this->use_prepared_statements != 'Y') | |
| 230 | 230 |  		{ | 
| 231 | 231 | return parent::_fetch($result, $arrayIndexEndValue); | 
| 232 | 232 | } | 
| 233 | 233 | $output = array(); | 
| 234 | - if(!$this->isConnected() || $this->isError() || !$result) | |
| 234 | + if (!$this->isConnected() || $this->isError() || !$result) | |
| 235 | 235 |  		{ | 
| 236 | 236 | return $output; | 
| 237 | 237 | } | 
| @@ -247,25 +247,25 @@ discard block | ||
| 247 | 247 | * MYSQLI_TYPE for longtext is 252 | 
| 248 | 248 | */ | 
| 249 | 249 | $longtext_exists = false; | 
| 250 | - foreach($fields as $field) | |
| 250 | + foreach ($fields as $field) | |
| 251 | 251 |  		{ | 
| 252 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails | |
| 252 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails | |
| 253 | 253 |  			{ | 
| 254 | - $field->name = 'repeat_' . $field->name; | |
| 254 | + $field->name = 'repeat_'.$field->name; | |
| 255 | 255 | } | 
| 256 | 256 | |
| 257 | 257 | // Array passed needs to contain references, not values | 
| 258 | 258 | $row[$field->name] = ""; | 
| 259 | 259 | $resultArray[$field->name] = &$row[$field->name]; | 
| 260 | 260 | |
| 261 | - if($field->type == 252) | |
| 261 | + if ($field->type == 252) | |
| 262 | 262 |  			{ | 
| 263 | 263 | $longtext_exists = true; | 
| 264 | 264 | } | 
| 265 | 265 | } | 
| 266 | 266 | $resultArray = array_merge(array($stmt), $resultArray); | 
| 267 | 267 | |
| 268 | - if($longtext_exists) | |
| 268 | + if ($longtext_exists) | |
| 269 | 269 |  		{ | 
| 270 | 270 | mysqli_stmt_store_result($stmt); | 
| 271 | 271 | } | 
| @@ -273,17 +273,17 @@ discard block | ||
| 273 | 273 |  		call_user_func_array('mysqli_stmt_bind_result', $resultArray); | 
| 274 | 274 | |
| 275 | 275 | $rows = array(); | 
| 276 | - while(mysqli_stmt_fetch($stmt)) | |
| 276 | + while (mysqli_stmt_fetch($stmt)) | |
| 277 | 277 |  		{ | 
| 278 | 278 | $resultObject = new stdClass(); | 
| 279 | 279 | |
| 280 | - foreach($resultArray as $key => $value) | |
| 280 | + foreach ($resultArray as $key => $value) | |
| 281 | 281 |  			{ | 
| 282 | - if($key === 0) | |
| 282 | + if ($key === 0) | |
| 283 | 283 |  				{ | 
| 284 | 284 | continue; // Skip stmt object | 
| 285 | 285 | } | 
| 286 | - if(strpos($key, 'repeat_')) | |
| 286 | + if (strpos($key, 'repeat_')) | |
| 287 | 287 |  				{ | 
| 288 | 288 | $key = substr($key, 6); | 
| 289 | 289 | } | 
| @@ -295,9 +295,9 @@ discard block | ||
| 295 | 295 | |
| 296 | 296 | mysqli_stmt_close($stmt); | 
| 297 | 297 | |
| 298 | - if($arrayIndexEndValue) | |
| 298 | + if ($arrayIndexEndValue) | |
| 299 | 299 |  		{ | 
| 300 | - foreach($rows as $row) | |
| 300 | + foreach ($rows as $row) | |
| 301 | 301 |  			{ | 
| 302 | 302 | $output[$arrayIndexEndValue--] = $row; | 
| 303 | 303 | } | 
| @@ -307,9 +307,9 @@ discard block | ||
| 307 | 307 | $output = $rows; | 
| 308 | 308 | } | 
| 309 | 309 | |
| 310 | - if(count($output) == 1) | |
| 310 | + if (count($output) == 1) | |
| 311 | 311 |  		{ | 
| 312 | - if(isset($arrayIndexEndValue)) | |
| 312 | + if (isset($arrayIndexEndValue)) | |
| 313 | 313 |  			{ | 
| 314 | 314 | return $output; | 
| 315 | 315 | } | 
| @@ -330,7 +330,7 @@ discard block | ||
| 330 | 330 | */ | 
| 331 | 331 | function _executeInsertAct($queryObject, $with_values = false) | 
| 332 | 332 |  	{ | 
| 333 | - if($this->use_prepared_statements != 'Y') | |
| 333 | + if ($this->use_prepared_statements != 'Y') | |
| 334 | 334 |  		{ | 
| 335 | 335 | return parent::_executeInsertAct($queryObject); | 
| 336 | 336 | } | 
| @@ -348,7 +348,7 @@ discard block | ||
| 348 | 348 | */ | 
| 349 | 349 | function _executeUpdateAct($queryObject, $with_values = false) | 
| 350 | 350 |  	{ | 
| 351 | - if($this->use_prepared_statements != 'Y') | |
| 351 | + if ($this->use_prepared_statements != 'Y') | |
| 352 | 352 |  		{ | 
| 353 | 353 | return parent::_executeUpdateAct($queryObject); | 
| 354 | 354 | } | 
| @@ -366,7 +366,7 @@ discard block | ||
| 366 | 366 | */ | 
| 367 | 367 | function _executeDeleteAct($queryObject, $with_values = false) | 
| 368 | 368 |  	{ | 
| 369 | - if($this->use_prepared_statements != 'Y') | |
| 369 | + if ($this->use_prepared_statements != 'Y') | |
| 370 | 370 |  		{ | 
| 371 | 371 | return parent::_executeDeleteAct($queryObject); | 
| 372 | 372 | } | 
| @@ -387,7 +387,7 @@ discard block | ||
| 387 | 387 | */ | 
| 388 | 388 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) | 
| 389 | 389 |  	{ | 
| 390 | - if($this->use_prepared_statements != 'Y') | |
| 390 | + if ($this->use_prepared_statements != 'Y') | |
| 391 | 391 |  		{ | 
| 392 | 392 | return parent::_executeSelectAct($queryObject, $connection); | 
| 393 | 393 | } | 
| @@ -23,7 +23,9 @@ discard block | ||
| 23 | 23 | function DBMysqli($auto_connect = TRUE) | 
| 24 | 24 |  	{ | 
| 25 | 25 | $this->_setDBInfo(); | 
| 26 | - if($auto_connect) $this->_connect(); | |
| 26 | +		if($auto_connect) { | |
| 27 | + $this->_connect(); | |
| 28 | + } | |
| 27 | 29 | } | 
| 28 | 30 | |
| 29 | 31 | /** | 
| @@ -51,8 +53,7 @@ discard block | ||
| 51 | 53 | , $connection["db_password"] | 
| 52 | 54 | , $connection["db_database"] | 
| 53 | 55 | , $connection["db_port"]); | 
| 54 | - } | |
| 55 | - else | |
| 56 | + } else | |
| 56 | 57 |  		{ | 
| 57 | 58 | $result = @mysqli_connect($connection["db_hostname"] | 
| 58 | 59 | , $connection["db_userid"] | 
| @@ -209,8 +210,7 @@ discard block | ||
| 209 | 210 | $params[] = $v; | 
| 210 | 211 | $types .= $type; | 
| 211 | 212 | } | 
| 212 | - } | |
| 213 | - else | |
| 213 | + } else | |
| 214 | 214 |  			{ | 
| 215 | 215 | $params[] = $value; | 
| 216 | 216 | $types .= $type; | 
| @@ -249,10 +249,12 @@ discard block | ||
| 249 | 249 | $longtext_exists = false; | 
| 250 | 250 | foreach($fields as $field) | 
| 251 | 251 |  		{ | 
| 252 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails | |
| 252 | +			if(isset($resultArray[$field->name])) { | |
| 253 | + // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails | |
| 253 | 254 |  			{ | 
| 254 | 255 | $field->name = 'repeat_' . $field->name; | 
| 255 | 256 | } | 
| 257 | + } | |
| 256 | 258 | |
| 257 | 259 | // Array passed needs to contain references, not values | 
| 258 | 260 | $row[$field->name] = ""; | 
| @@ -301,8 +303,7 @@ discard block | ||
| 301 | 303 |  			{ | 
| 302 | 304 | $output[$arrayIndexEndValue--] = $row; | 
| 303 | 305 | } | 
| 304 | - } | |
| 305 | - else | |
| 306 | + } else | |
| 306 | 307 |  		{ | 
| 307 | 308 | $output = $rows; | 
| 308 | 309 | } | 
| @@ -312,8 +313,7 @@ discard block | ||
| 312 | 313 | if(isset($arrayIndexEndValue)) | 
| 313 | 314 |  			{ | 
| 314 | 315 | return $output; | 
| 315 | - } | |
| 316 | - else | |
| 316 | + } else | |
| 317 | 317 |  			{ | 
| 318 | 318 | return $output[0]; | 
| 319 | 319 | } |