@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 | function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')  | 
                                                        
| 36 | 36 |  	{ | 
                                                        
| 37 | 37 | // If XE has not installed yet, set module as install  | 
                                                        
| 38 | - if(!Context::isInstalled())  | 
                                                        |
| 38 | + if (!Context::isInstalled())  | 
                                                        |
| 39 | 39 |  		{ | 
                                                        
| 40 | 40 | $this->module = 'install';  | 
                                                        
| 41 | 41 |  			$this->act = Context::get('act'); | 
                                                        
@@ -43,7 +43,7 @@ discard block  | 
                                                    ||
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance();  | 
                                                        
| 46 | - if($oContext->isSuccessInit == FALSE)  | 
                                                        |
| 46 | + if ($oContext->isSuccessInit == FALSE)  | 
                                                        |
| 47 | 47 |  		{ | 
                                                        
| 48 | 48 | // @see https://github.com/xpressengine/xe-core/issues/2304  | 
                                                        
| 49 | 49 | $this->error = 'msg_invalid_request';  | 
                                                        
@@ -56,26 +56,26 @@ discard block  | 
                                                    ||
| 56 | 56 |  		$this->mid = $mid ? $mid : Context::get('mid'); | 
                                                        
| 57 | 57 |  		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); | 
                                                        
| 58 | 58 |  		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); | 
                                                        
| 59 | -        if($entry = Context::get('entry')) | 
                                                        |
| 59 | +        if ($entry = Context::get('entry')) | 
                                                        |
| 60 | 60 |          { | 
                                                        
| 61 | 61 | $this->entry = Context::convertEncodingStr($entry);  | 
                                                        
| 62 | 62 | }  | 
                                                        
| 63 | 63 | |
| 64 | 64 | // Validate variables to prevent XSS  | 
                                                        
| 65 | 65 | $isInvalid = NULL;  | 
                                                        
| 66 | -		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) | 
                                                        |
| 66 | +		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) | 
                                                        |
| 67 | 67 |  		{ | 
                                                        
| 68 | 68 | $isInvalid = TRUE;  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | -		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) | 
                                                        |
| 70 | +		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) | 
                                                        |
| 71 | 71 |  		{ | 
                                                        
| 72 | 72 | $isInvalid = TRUE;  | 
                                                        
| 73 | 73 | }  | 
                                                        
| 74 | -		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) | 
                                                        |
| 74 | +		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) | 
                                                        |
| 75 | 75 |  		{ | 
                                                        
| 76 | 76 | $isInvalid = TRUE;  | 
                                                        
| 77 | 77 | }  | 
                                                        
| 78 | - if($isInvalid)  | 
                                                        |
| 78 | + if ($isInvalid)  | 
                                                        |
| 79 | 79 |  		{ | 
                                                        
| 80 | 80 | htmlHeader();  | 
                                                        
| 81 | 81 |  			echo Context::getLang("msg_invalid_request"); | 
                                                        
@@ -84,14 +84,14 @@ discard block  | 
                                                    ||
| 84 | 84 | exit;  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | |
| 87 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))  | 
                                                        |
| 87 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))  | 
                                                        |
| 88 | 88 |  		{ | 
                                                        
| 89 | -			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') | 
                                                        |
| 89 | +			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') | 
                                                        |
| 90 | 90 |  			{ | 
                                                        
| 91 | -				if(Context::get('_https_port')!=null) { | 
                                                        |
| 92 | -					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); | 
                                                        |
| 91 | +				if (Context::get('_https_port') != null) { | 
                                                        |
| 92 | +					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); | 
                                                        |
| 93 | 93 |  				} else { | 
                                                        
| 94 | -					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); | 
                                                        |
| 94 | +					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); | 
                                                        |
| 95 | 95 | }  | 
                                                        
| 96 | 96 | return;  | 
                                                        
| 97 | 97 | }  | 
                                                        
@@ -99,9 +99,9 @@ discard block  | 
                                                    ||
| 99 | 99 | |
| 100 | 100 | // call a trigger before moduleHandler init  | 
                                                        
| 101 | 101 |  		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); | 
                                                        
| 102 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)  | 
                                                        |
| 102 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)  | 
                                                        |
| 103 | 103 |  		{ | 
                                                        
| 104 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 104 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 105 | 105 |  			{ | 
                                                        
| 106 | 106 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING);  | 
                                                        
| 107 | 107 | register_shutdown_function(array($this, 'shutdownHandler'));  | 
                                                        
@@ -112,40 +112,40 @@ discard block  | 
                                                    ||
| 112 | 112 | $called_position = 'before_module_init';  | 
                                                        
| 113 | 113 |  		$oAddonController = getController('addon'); | 
                                                        
| 114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');  | 
                                                        
| 115 | - if(file_exists($addon_file)) include($addon_file);  | 
                                                        |
| 115 | + if (file_exists($addon_file)) include($addon_file);  | 
                                                        |
| 116 | 116 | }  | 
                                                        
| 117 | 117 | |
| 118 | 118 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)  | 
                                                        
| 119 | 119 |  	{ | 
                                                        
| 120 | - if(($errnumber & 3) == 0 || error_reporting() == 0)  | 
                                                        |
| 120 | + if (($errnumber & 3) == 0 || error_reporting() == 0)  | 
                                                        |
| 121 | 121 |  		{ | 
                                                        
| 122 | 122 | return false;  | 
                                                        
| 123 | 123 | }  | 
                                                        
| 124 | 124 | |
| 125 | 125 |  		set_error_handler(function() { }, ~0); | 
                                                        
| 126 | 126 | |
| 127 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php';  | 
                                                        |
| 128 | - if(!file_exists($debug_file))  | 
                                                        |
| 127 | + $debug_file = _XE_PATH_.'files/_debug_message.php';  | 
                                                        |
| 128 | + if (!file_exists($debug_file))  | 
                                                        |
| 129 | 129 |  		{ | 
                                                        
| 130 | 130 | $print[] = '<?php exit() ?>';  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | 133 | $errorname = self::getErrorType($errnumber);  | 
                                                        
| 134 | -		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; | 
                                                        |
| 134 | +		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; | 
                                                        |
| 135 | 135 |  		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; | 
                                                        
| 136 | 136 | $backtrace = debug_backtrace($backtrace_args);  | 
                                                        
| 137 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])  | 
                                                        |
| 137 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])  | 
                                                        |
| 138 | 138 |  		{ | 
                                                        
| 139 | 139 | array_shift($backtrace);  | 
                                                        
| 140 | 140 | }  | 
                                                        
| 141 | 141 | |
| 142 | - foreach($backtrace as $key => $value)  | 
                                                        |
| 142 | + foreach ($backtrace as $key => $value)  | 
                                                        |
| 143 | 143 |  		{ | 
                                                        
| 144 | - $message = ' - ' . $value['file'] . ' : ' . $value['line'];  | 
                                                        |
| 144 | + $message = ' - '.$value['file'].' : '.$value['line'];  | 
                                                        |
| 145 | 145 | $print[] = $message;  | 
                                                        
| 146 | 146 | }  | 
                                                        
| 147 | 147 | $print[] = PHP_EOL;  | 
                                                        
| 148 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);  | 
                                                        |
| 148 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);  | 
                                                        |
| 149 | 149 | restore_error_handler();  | 
                                                        
| 150 | 150 | |
| 151 | 151 | return true;  | 
                                                        
@@ -161,21 +161,21 @@ discard block  | 
                                                    ||
| 161 | 161 | |
| 162 | 162 |  		set_error_handler(function() { }, ~0); | 
                                                        
| 163 | 163 | |
| 164 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php';  | 
                                                        |
| 165 | - if(!file_exists($debug_file))  | 
                                                        |
| 164 | + $debug_file = _XE_PATH_.'files/_debug_message.php';  | 
                                                        |
| 165 | + if (!file_exists($debug_file))  | 
                                                        |
| 166 | 166 |  		{ | 
                                                        
| 167 | 167 | $print[] = '<?php exit() ?>';  | 
                                                        
| 168 | 168 | }  | 
                                                        
| 169 | 169 | |
| 170 | 170 | $errorname = self::getErrorType($errinfo['type']);  | 
                                                        
| 171 | 171 |  		$print[] = '['.date('Y-m-d H:i:s').']'; | 
                                                        
| 172 | - $print[] = $errorname . ' : ' . $errinfo['message'];  | 
                                                        |
| 172 | + $print[] = $errorname.' : '.$errinfo['message'];  | 
                                                        |
| 173 | 173 | |
| 174 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line'];  | 
                                                        |
| 174 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line'];  | 
                                                        |
| 175 | 175 | $print[] = $message;  | 
                                                        
| 176 | 176 | |
| 177 | 177 | $print[] = PHP_EOL;  | 
                                                        
| 178 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);  | 
                                                        |
| 178 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);  | 
                                                        |
| 179 | 179 | set_error_handler(array($this, 'dummyHandler'), ~0);  | 
                                                        
| 180 | 180 | |
| 181 | 181 | return true;  | 
                                                        
@@ -221,9 +221,9 @@ discard block  | 
                                                    ||
| 221 | 221 | $siteDomain = parse_url($site_module_info->domain);  | 
                                                        
| 222 | 222 | $siteDomain = $siteDomain['host'];  | 
                                                        
| 223 | 223 | |
| 224 | - foreach($urls as $url)  | 
                                                        |
| 224 | + foreach ($urls as $url)  | 
                                                        |
| 225 | 225 |  		{ | 
                                                        
| 226 | - if(empty($url))  | 
                                                        |
| 226 | + if (empty($url))  | 
                                                        |
| 227 | 227 |  			{ | 
                                                        
| 228 | 228 | continue;  | 
                                                        
| 229 | 229 | }  | 
                                                        
@@ -231,33 +231,33 @@ discard block  | 
                                                    ||
| 231 | 231 | $urlInfo = parse_url(urldecode($url));  | 
                                                        
| 232 | 232 | $host = $urlInfo['host'];  | 
                                                        
| 233 | 233 | |
| 234 | - if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain)))  | 
                                                        |
| 234 | + if ($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain)))  | 
                                                        |
| 235 | 235 |  			{ | 
                                                        
| 236 | 236 |  				throw new Exception('msg_default_url_is_null'); | 
                                                        
| 237 | 237 | }  | 
                                                        
| 238 | -			else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) | 
                                                        |
| 238 | +			else if ((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) | 
                                                        |
| 239 | 239 |  			{ | 
                                                        
| 240 | 240 |  				throw new exception('msg_invalid_request'); | 
                                                        
| 241 | 241 | }  | 
                                                        
| 242 | 242 | }  | 
                                                        
| 243 | 243 | |
| 244 | - if(!$this->document_srl && $this->mid && $this->entry)  | 
                                                        |
| 244 | + if (!$this->document_srl && $this->mid && $this->entry)  | 
                                                        |
| 245 | 245 |  		{ | 
                                                        
| 246 | 246 |  			$oDocumentModel = getModel('document'); | 
                                                        
| 247 | 247 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);  | 
                                                        
| 248 | - if($this->document_srl)  | 
                                                        |
| 248 | + if ($this->document_srl)  | 
                                                        |
| 249 | 249 |  			{ | 
                                                        
| 250 | 250 |  				Context::set('document_srl', $this->document_srl); | 
                                                        
| 251 | 251 | }  | 
                                                        
| 252 | 252 | }  | 
                                                        
| 253 | 253 | |
| 254 | 254 | // Get module's information based on document_srl, if it's specified  | 
                                                        
| 255 | - if($this->document_srl)  | 
                                                        |
| 255 | + if ($this->document_srl)  | 
                                                        |
| 256 | 256 |  		{ | 
                                                        
| 257 | 257 | |
| 258 | 258 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);  | 
                                                        
| 259 | 259 | // If the document does not exist, remove document_srl  | 
                                                        
| 260 | - if(!$module_info)  | 
                                                        |
| 260 | + if (!$module_info)  | 
                                                        |
| 261 | 261 |  			{ | 
                                                        
| 262 | 262 | unset($this->document_srl);  | 
                                                        
| 263 | 263 | }  | 
                                                        
@@ -265,13 +265,13 @@ discard block  | 
                                                    ||
| 265 | 265 |  			{ | 
                                                        
| 266 | 266 | // If it exists, compare mid based on the module information  | 
                                                        
| 267 | 267 | // if mids are not matching, set it as the document's mid  | 
                                                        
| 268 | - if(!$this->mid || ($this->mid != $module_info->mid))  | 
                                                        |
| 268 | + if (!$this->mid || ($this->mid != $module_info->mid))  | 
                                                        |
| 269 | 269 |  				{ | 
                                                        
| 270 | 270 | |
| 271 | - if(Context::getRequestMethod() == 'GET')  | 
                                                        |
| 271 | + if (Context::getRequestMethod() == 'GET')  | 
                                                        |
| 272 | 272 |  					{ | 
                                                        
| 273 | 273 | $this->mid = $module_info->mid;  | 
                                                        
| 274 | -						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); | 
                                                        |
| 274 | +						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); | 
                                                        |
| 275 | 275 | return FALSE;  | 
                                                        
| 276 | 276 | }  | 
                                                        
| 277 | 277 | else  | 
                                                        
@@ -282,7 +282,7 @@ discard block  | 
                                                    ||
| 282 | 282 | |
| 283 | 283 | }  | 
                                                        
| 284 | 284 | // if requested module is different from one of the document, remove the module information retrieved based on the document number  | 
                                                        
| 285 | - if($this->module && $module_info->module != $this->module)  | 
                                                        |
| 285 | + if ($this->module && $module_info->module != $this->module)  | 
                                                        |
| 286 | 286 |  				{ | 
                                                        
| 287 | 287 | unset($module_info);  | 
                                                        
| 288 | 288 | }  | 
                                                        
@@ -291,36 +291,36 @@ discard block  | 
                                                    ||
| 291 | 291 | }  | 
                                                        
| 292 | 292 | |
| 293 | 293 | // If module_info is not set yet, and there exists mid information, get module information based on the mid  | 
                                                        
| 294 | - if(!$module_info && $this->mid)  | 
                                                        |
| 294 | + if (!$module_info && $this->mid)  | 
                                                        |
| 295 | 295 |  		{ | 
                                                        
| 296 | 296 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);  | 
                                                        
| 297 | 297 | //if($this->module && $module_info->module != $this->module) unset($module_info);  | 
                                                        
| 298 | 298 | }  | 
                                                        
| 299 | 299 | |
| 300 | 300 | // redirect, if module_site_srl and site_srl are different  | 
                                                        
| 301 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)  | 
                                                        |
| 301 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)  | 
                                                        |
| 302 | 302 |  		{ | 
                                                        
| 303 | 303 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);  | 
                                                        
| 304 | -			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); | 
                                                        |
| 304 | +			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); | 
                                                        |
| 305 | 305 | return FALSE;  | 
                                                        
| 306 | 306 | }  | 
                                                        
| 307 | 307 | |
| 308 | 308 | // If module_info is not set still, and $module does not exist, find the default module  | 
                                                        
| 309 | - if(!$module_info && !$this->module && !$this->mid)  | 
                                                        |
| 309 | + if (!$module_info && !$this->module && !$this->mid)  | 
                                                        |
| 310 | 310 |  		{ | 
                                                        
| 311 | 311 | $module_info = $site_module_info;  | 
                                                        
| 312 | 312 | }  | 
                                                        
| 313 | 313 | |
| 314 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl)  | 
                                                        |
| 314 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl)  | 
                                                        |
| 315 | 315 |  		{ | 
                                                        
| 316 | 316 | $module_info = $site_module_info;  | 
                                                        
| 317 | 317 | }  | 
                                                        
| 318 | 318 | |
| 319 | 319 | // redirect, if site_srl of module_info is different from one of site's module_info  | 
                                                        
| 320 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())  | 
                                                        |
| 320 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())  | 
                                                        |
| 321 | 321 |  		{ | 
                                                        
| 322 | 322 | // If the module is of virtual site  | 
                                                        
| 323 | - if($module_info->site_srl)  | 
                                                        |
| 323 | + if ($module_info->site_srl)  | 
                                                        |
| 324 | 324 |  			{ | 
                                                        
| 325 | 325 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl);  | 
                                                        
| 326 | 326 |  				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); | 
                                                        
@@ -329,7 +329,7 @@ discard block  | 
                                                    ||
| 329 | 329 | else  | 
                                                        
| 330 | 330 |  			{ | 
                                                        
| 331 | 331 | $db_info = Context::getDBInfo();  | 
                                                        
| 332 | - if(!$db_info->default_url)  | 
                                                        |
| 332 | + if (!$db_info->default_url)  | 
                                                        |
| 333 | 333 |  				{ | 
                                                        
| 334 | 334 |  					return Context::getLang('msg_default_url_is_not_defined'); | 
                                                        
| 335 | 335 | }  | 
                                                        
@@ -338,12 +338,12 @@ discard block  | 
                                                    ||
| 338 | 338 |  					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); | 
                                                        
| 339 | 339 | }  | 
                                                        
| 340 | 340 | }  | 
                                                        
| 341 | -			header("location:" . $redirect_url); | 
                                                        |
| 341 | +			header("location:".$redirect_url); | 
                                                        |
| 342 | 342 | return FALSE;  | 
                                                        
| 343 | 343 | }  | 
                                                        
| 344 | 344 | |
| 345 | 345 | // If module info was set, retrieve variables from the module information  | 
                                                        
| 346 | - if($module_info)  | 
                                                        |
| 346 | + if ($module_info)  | 
                                                        |
| 347 | 347 |  		{ | 
                                                        
| 348 | 348 | $this->module = $module_info->module;  | 
                                                        
| 349 | 349 | $this->mid = $module_info->mid;  | 
                                                        
@@ -354,7 +354,7 @@ discard block  | 
                                                    ||
| 354 | 354 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';  | 
                                                        
| 355 | 355 | |
| 356 | 356 | // use the site default layout.  | 
                                                        
| 357 | -			if($module_info->{$targetSrl} == -1) | 
                                                        |
| 357 | +			if ($module_info->{$targetSrl} == -1) | 
                                                        |
| 358 | 358 |  			{ | 
                                                        
| 359 | 359 |  				$oLayoutAdminModel = getAdminModel('layout'); | 
                                                        
| 360 | 360 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);  | 
                                                        
@@ -372,7 +372,7 @@ discard block  | 
                                                    ||
| 372 | 372 | }  | 
                                                        
| 373 | 373 | |
| 374 | 374 | // Set module and mid into module_info  | 
                                                        
| 375 | - if(!isset($this->module_info))  | 
                                                        |
| 375 | + if (!isset($this->module_info))  | 
                                                        |
| 376 | 376 |  		{ | 
                                                        
| 377 | 377 | $this->module_info = new stdClass();  | 
                                                        
| 378 | 378 | }  | 
                                                        
@@ -383,21 +383,21 @@ discard block  | 
                                                    ||
| 383 | 383 | $this->module_info->site_srl = $site_module_info->site_srl;  | 
                                                        
| 384 | 384 | |
| 385 | 385 | // Still no module? it's an error  | 
                                                        
| 386 | - if(!$this->module)  | 
                                                        |
| 386 | + if (!$this->module)  | 
                                                        |
| 387 | 387 |  		{ | 
                                                        
| 388 | 388 | $this->error = 'msg_module_is_not_exists';  | 
                                                        
| 389 | 389 | $this->httpStatusCode = '404';  | 
                                                        
| 390 | 390 | }  | 
                                                        
| 391 | 391 | |
| 392 | 392 | // If mid exists, set mid into context  | 
                                                        
| 393 | - if($this->mid)  | 
                                                        |
| 393 | + if ($this->mid)  | 
                                                        |
| 394 | 394 |  		{ | 
                                                        
| 395 | 395 |  			Context::set('mid', $this->mid, TRUE); | 
                                                        
| 396 | 396 | }  | 
                                                        
| 397 | 397 | |
| 398 | 398 | // Call a trigger after moduleHandler init  | 
                                                        
| 399 | 399 |  		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); | 
                                                        
| 400 | - if(!$output->toBool())  | 
                                                        |
| 400 | + if (!$output->toBool())  | 
                                                        |
| 401 | 401 |  		{ | 
                                                        
| 402 | 402 | $this->error = $output->getMessage();  | 
                                                        
| 403 | 403 | return TRUE;  | 
                                                        
@@ -419,14 +419,14 @@ discard block  | 
                                                    ||
| 419 | 419 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';  | 
                                                        
| 420 | 420 | |
| 421 | 421 | // If error occurred while preparation, return a message instance  | 
                                                        
| 422 | - if($this->error)  | 
                                                        |
| 422 | + if ($this->error)  | 
                                                        |
| 423 | 423 |  		{ | 
                                                        
| 424 | 424 | $this->_setInputErrorToContext();  | 
                                                        
| 425 | 425 |  			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
| 426 | 426 | $oMessageObject->setError(-1);  | 
                                                        
| 427 | 427 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 428 | 428 | $oMessageObject->dispMessage();  | 
                                                        
| 429 | - if($this->httpStatusCode)  | 
                                                        |
| 429 | + if ($this->httpStatusCode)  | 
                                                        |
| 430 | 430 |  			{ | 
                                                        
| 431 | 431 | $oMessageObject->setHttpStatusCode($this->httpStatusCode);  | 
                                                        
| 432 | 432 | }  | 
                                                        
@@ -437,22 +437,22 @@ discard block  | 
                                                    ||
| 437 | 437 | $xml_info = $oModuleModel->getModuleActionXml($this->module);  | 
                                                        
| 438 | 438 | |
| 439 | 439 | // If not installed yet, modify act  | 
                                                        
| 440 | - if($this->module == "install")  | 
                                                        |
| 440 | + if ($this->module == "install")  | 
                                                        |
| 441 | 441 |  		{ | 
                                                        
| 442 | -			if(!$this->act || !$xml_info->action->{$this->act}) | 
                                                        |
| 442 | +			if (!$this->act || !$xml_info->action->{$this->act}) | 
                                                        |
| 443 | 443 |  			{ | 
                                                        
| 444 | 444 | $this->act = $xml_info->default_index_act;  | 
                                                        
| 445 | 445 | }  | 
                                                        
| 446 | 446 | }  | 
                                                        
| 447 | 447 | |
| 448 | 448 | // if act exists, find type of the action, if not use default index act  | 
                                                        
| 449 | - if(!$this->act)  | 
                                                        |
| 449 | + if (!$this->act)  | 
                                                        |
| 450 | 450 |  		{ | 
                                                        
| 451 | 451 | $this->act = $xml_info->default_index_act;  | 
                                                        
| 452 | 452 | }  | 
                                                        
| 453 | 453 | |
| 454 | 454 | // still no act means error  | 
                                                        
| 455 | - if(!$this->act)  | 
                                                        |
| 455 | + if (!$this->act)  | 
                                                        |
| 456 | 456 |  		{ | 
                                                        
| 457 | 457 | $this->error = 'msg_module_is_not_exists';  | 
                                                        
| 458 | 458 | $this->httpStatusCode = '404';  | 
                                                        
@@ -462,7 +462,7 @@ discard block  | 
                                                    ||
| 462 | 462 | $oMessageObject->setError(-1);  | 
                                                        
| 463 | 463 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 464 | 464 | $oMessageObject->dispMessage();  | 
                                                        
| 465 | - if($this->httpStatusCode)  | 
                                                        |
| 465 | + if ($this->httpStatusCode)  | 
                                                        |
| 466 | 466 |  			{ | 
                                                        
| 467 | 467 | $oMessageObject->setHttpStatusCode($this->httpStatusCode);  | 
                                                        
| 468 | 468 | }  | 
                                                        
@@ -480,17 +480,17 @@ discard block  | 
                                                    ||
| 480 | 480 |  			Context::addMetaTag('robots', 'noindex'); | 
                                                        
| 481 | 481 | }  | 
                                                        
| 482 | 482 | |
| 483 | - if(!$kind && $this->module == 'admin')  | 
                                                        |
| 483 | + if (!$kind && $this->module == 'admin')  | 
                                                        |
| 484 | 484 |  		{ | 
                                                        
| 485 | 485 | $kind = 'admin';  | 
                                                        
| 486 | 486 | }  | 
                                                        
| 487 | 487 | |
| 488 | 488 | // check REQUEST_METHOD in controller  | 
                                                        
| 489 | - if($type == 'controller')  | 
                                                        |
| 489 | + if ($type == 'controller')  | 
                                                        |
| 490 | 490 |  		{ | 
                                                        
| 491 | 491 |  			$allowedMethod = $xml_info->action->{$this->act}->method; | 
                                                        
| 492 | 492 | |
| 493 | - if(!$allowedMethod)  | 
                                                        |
| 493 | + if (!$allowedMethod)  | 
                                                        |
| 494 | 494 |  			{ | 
                                                        
| 495 | 495 | $allowedMethodList[0] = 'POST';  | 
                                                        
| 496 | 496 | }  | 
                                                        
@@ -499,7 +499,7 @@ discard block  | 
                                                    ||
| 499 | 499 |  				$allowedMethodList = explode('|', strtoupper($allowedMethod)); | 
                                                        
| 500 | 500 | }  | 
                                                        
| 501 | 501 | |
| 502 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))  | 
                                                        |
| 502 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))  | 
                                                        |
| 503 | 503 |  			{ | 
                                                        
| 504 | 504 | $this->error = "msg_invalid_request";  | 
                                                        
| 505 | 505 |  				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
@@ -510,7 +510,7 @@ discard block  | 
                                                    ||
| 510 | 510 | }  | 
                                                        
| 511 | 511 | }  | 
                                                        
| 512 | 512 | |
| 513 | - if($this->module_info->use_mobile != "Y")  | 
                                                        |
| 513 | + if ($this->module_info->use_mobile != "Y")  | 
                                                        |
| 514 | 514 |  		{ | 
                                                        
| 515 | 515 | Mobile::setMobile(FALSE);  | 
                                                        
| 516 | 516 | }  | 
                                                        
@@ -519,7 +519,7 @@ discard block  | 
                                                    ||
| 519 | 519 | |
| 520 | 520 | // check CSRF for non-GET actions  | 
                                                        
| 521 | 521 |  		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; | 
                                                        
| 522 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())  | 
                                                        |
| 522 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())  | 
                                                        |
| 523 | 523 |  		{ | 
                                                        
| 524 | 524 | $this->error = 'msg_invalid_request';  | 
                                                        
| 525 | 525 |  			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
@@ -530,7 +530,7 @@ discard block  | 
                                                    ||
| 530 | 530 | }  | 
                                                        
| 531 | 531 | |
| 532 | 532 | // Admin ip  | 
                                                        
| 533 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')  | 
                                                        |
| 533 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')  | 
                                                        |
| 534 | 534 |  		{ | 
                                                        
| 535 | 535 | $this->_setInputErrorToContext();  | 
                                                        
| 536 | 536 | $this->error = "msg_not_permitted_act";  | 
                                                        
@@ -542,13 +542,13 @@ discard block  | 
                                                    ||
| 542 | 542 | }  | 
                                                        
| 543 | 543 | |
| 544 | 544 | // if(type == view, and case for using mobilephone)  | 
                                                        
| 545 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())  | 
                                                        |
| 545 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())  | 
                                                        |
| 546 | 546 |  		{ | 
                                                        
| 547 | 547 | $orig_type = "view";  | 
                                                        
| 548 | 548 | $type = "mobile";  | 
                                                        
| 549 | 549 | // create a module instance  | 
                                                        
| 550 | 550 | $oModule = $this->getModuleInstance($this->module, $type, $kind);  | 
                                                        
| 551 | - if(!is_object($oModule) || !method_exists($oModule, $this->act))  | 
                                                        |
| 551 | + if (!is_object($oModule) || !method_exists($oModule, $this->act))  | 
                                                        |
| 552 | 552 |  			{ | 
                                                        
| 553 | 553 | $type = $orig_type;  | 
                                                        
| 554 | 554 | Mobile::setMobile(FALSE);  | 
                                                        
@@ -561,14 +561,14 @@ discard block  | 
                                                    ||
| 561 | 561 | $oModule = $this->getModuleInstance($this->module, $type, $kind);  | 
                                                        
| 562 | 562 | }  | 
                                                        
| 563 | 563 | |
| 564 | - if(!is_object($oModule))  | 
                                                        |
| 564 | + if (!is_object($oModule))  | 
                                                        |
| 565 | 565 |  		{ | 
                                                        
| 566 | 566 | $this->_setInputErrorToContext();  | 
                                                        
| 567 | 567 |  			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
| 568 | 568 | $oMessageObject->setError(-1);  | 
                                                        
| 569 | 569 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 570 | 570 | $oMessageObject->dispMessage();  | 
                                                        
| 571 | - if($this->httpStatusCode)  | 
                                                        |
| 571 | + if ($this->httpStatusCode)  | 
                                                        |
| 572 | 572 |  			{ | 
                                                        
| 573 | 573 | $oMessageObject->setHttpStatusCode($this->httpStatusCode);  | 
                                                        
| 574 | 574 | }  | 
                                                        
@@ -576,10 +576,10 @@ discard block  | 
                                                    ||
| 576 | 576 | }  | 
                                                        
| 577 | 577 | |
| 578 | 578 | // If there is no such action in the module object  | 
                                                        
| 579 | -		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) | 
                                                        |
| 579 | +		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) | 
                                                        |
| 580 | 580 |  		{ | 
                                                        
| 581 | 581 | |
| 582 | - if(!Context::isInstalled())  | 
                                                        |
| 582 | + if (!Context::isInstalled())  | 
                                                        |
| 583 | 583 |  			{ | 
                                                        
| 584 | 584 | $this->_setInputErrorToContext();  | 
                                                        
| 585 | 585 | $this->error = 'msg_invalid_request';  | 
                                                        
@@ -587,7 +587,7 @@ discard block  | 
                                                    ||
| 587 | 587 | $oMessageObject->setError(-1);  | 
                                                        
| 588 | 588 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 589 | 589 | $oMessageObject->dispMessage();  | 
                                                        
| 590 | - if($this->httpStatusCode)  | 
                                                        |
| 590 | + if ($this->httpStatusCode)  | 
                                                        |
| 591 | 591 |  				{ | 
                                                        
| 592 | 592 | $oMessageObject->setHttpStatusCode($this->httpStatusCode);  | 
                                                        
| 593 | 593 | }  | 
                                                        
@@ -596,12 +596,12 @@ discard block  | 
                                                    ||
| 596 | 596 | |
| 597 | 597 | $forward = NULL;  | 
                                                        
| 598 | 598 | // 1. Look for the module with action name  | 
                                                        
| 599 | -			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) | 
                                                        |
| 599 | +			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) | 
                                                        |
| 600 | 600 |  			{ | 
                                                        
| 601 | - $module = strtolower($matches[2] . $matches[3]);  | 
                                                        |
| 601 | + $module = strtolower($matches[2].$matches[3]);  | 
                                                        |
| 602 | 602 | $xml_info = $oModuleModel->getModuleActionXml($module);  | 
                                                        
| 603 | 603 | |
| 604 | -				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) | 
                                                        |
| 604 | +				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) | 
                                                        |
| 605 | 605 |  				{ | 
                                                        
| 606 | 606 | $forward = new stdClass();  | 
                                                        
| 607 | 607 | $forward->module = $module;  | 
                                                        
@@ -622,12 +622,12 @@ discard block  | 
                                                    ||
| 622 | 622 | }  | 
                                                        
| 623 | 623 | }  | 
                                                        
| 624 | 624 | |
| 625 | - if(!$forward)  | 
                                                        |
| 625 | + if (!$forward)  | 
                                                        |
| 626 | 626 |  			{ | 
                                                        
| 627 | 627 | $forward = $oModuleModel->getActionForward($this->act);  | 
                                                        
| 628 | 628 | }  | 
                                                        
| 629 | 629 | |
| 630 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)  | 
                                                        |
| 630 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)  | 
                                                        |
| 631 | 631 |  			{ | 
                                                        
| 632 | 632 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';  | 
                                                        
| 633 | 633 | $type = $forward->type;  | 
                                                        
@@ -635,7 +635,7 @@ discard block  | 
                                                    ||
| 635 | 635 | $tpl_path = $oModule->getTemplatePath();  | 
                                                        
| 636 | 636 | $orig_module = $oModule;  | 
                                                        
| 637 | 637 | |
| 638 | -				if($forward->meta_noindex === 'true') { | 
                                                        |
| 638 | +				if ($forward->meta_noindex === 'true') { | 
                                                        |
| 639 | 639 |  					Context::addMetaTag('robots', 'noindex'); | 
                                                        
| 640 | 640 | }  | 
                                                        
| 641 | 641 | |
@@ -643,7 +643,7 @@ discard block  | 
                                                    ||
| 643 | 643 | |
| 644 | 644 | // check CSRF for non-GET actions  | 
                                                        
| 645 | 645 |  				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; | 
                                                        
| 646 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())  | 
                                                        |
| 646 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())  | 
                                                        |
| 647 | 647 |  				{ | 
                                                        
| 648 | 648 | $this->error = 'msg_invalid_request';  | 
                                                        
| 649 | 649 |  					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
@@ -655,11 +655,11 @@ discard block  | 
                                                    ||
| 655 | 655 | |
| 656 | 656 | // SECISSUE also check foward act method  | 
                                                        
| 657 | 657 | // check REQUEST_METHOD in controller  | 
                                                        
| 658 | - if($type == 'controller')  | 
                                                        |
| 658 | + if ($type == 'controller')  | 
                                                        |
| 659 | 659 |  				{ | 
                                                        
| 660 | 660 |  					$allowedMethod = $xml_info->action->{$forward->act}->method; | 
                                                        
| 661 | 661 | |
| 662 | - if(!$allowedMethod)  | 
                                                        |
| 662 | + if (!$allowedMethod)  | 
                                                        |
| 663 | 663 |  					{ | 
                                                        
| 664 | 664 | $allowedMethodList[0] = 'POST';  | 
                                                        
| 665 | 665 | }  | 
                                                        
@@ -668,7 +668,7 @@ discard block  | 
                                                    ||
| 668 | 668 |  						$allowedMethodList = explode('|', strtoupper($allowedMethod)); | 
                                                        
| 669 | 669 | }  | 
                                                        
| 670 | 670 | |
| 671 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))  | 
                                                        |
| 671 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))  | 
                                                        |
| 672 | 672 |  					{ | 
                                                        
| 673 | 673 | $this->error = "msg_invalid_request";  | 
                                                        
| 674 | 674 |  						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
@@ -679,13 +679,13 @@ discard block  | 
                                                    ||
| 679 | 679 | }  | 
                                                        
| 680 | 680 | }  | 
                                                        
| 681 | 681 | |
| 682 | - if($type == "view" && Mobile::isFromMobilePhone())  | 
                                                        |
| 682 | + if ($type == "view" && Mobile::isFromMobilePhone())  | 
                                                        |
| 683 | 683 |  				{ | 
                                                        
| 684 | 684 | $orig_type = "view";  | 
                                                        
| 685 | 685 | $type = "mobile";  | 
                                                        
| 686 | 686 | // create a module instance  | 
                                                        
| 687 | 687 | $oModule = $this->getModuleInstance($forward->module, $type, $kind);  | 
                                                        
| 688 | - if(!is_object($oModule) || !method_exists($oModule, $this->act))  | 
                                                        |
| 688 | + if (!is_object($oModule) || !method_exists($oModule, $this->act))  | 
                                                        |
| 689 | 689 |  					{ | 
                                                        
| 690 | 690 | $type = $orig_type;  | 
                                                        
| 691 | 691 | Mobile::setMobile(FALSE);  | 
                                                        
@@ -697,25 +697,25 @@ discard block  | 
                                                    ||
| 697 | 697 | $oModule = $this->getModuleInstance($forward->module, $type, $kind);  | 
                                                        
| 698 | 698 | }  | 
                                                        
| 699 | 699 | |
| 700 | - if(!is_object($oModule))  | 
                                                        |
| 700 | + if (!is_object($oModule))  | 
                                                        |
| 701 | 701 |  				{ | 
                                                        
| 702 | 702 | $this->_setInputErrorToContext();  | 
                                                        
| 703 | 703 |  					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
| 704 | 704 | $oMessageObject->setError(-1);  | 
                                                        
| 705 | 705 |  					$oMessageObject->setMessage('msg_module_is_not_exists'); | 
                                                        
| 706 | 706 | $oMessageObject->dispMessage();  | 
                                                        
| 707 | - if($this->httpStatusCode)  | 
                                                        |
| 707 | + if ($this->httpStatusCode)  | 
                                                        |
| 708 | 708 |  					{ | 
                                                        
| 709 | 709 | $oMessageObject->setHttpStatusCode($this->httpStatusCode);  | 
                                                        
| 710 | 710 | }  | 
                                                        
| 711 | 711 | return $oMessageObject;  | 
                                                        
| 712 | 712 | }  | 
                                                        
| 713 | 713 | |
| 714 | - if($this->module == "admin" && $type == "view")  | 
                                                        |
| 714 | + if ($this->module == "admin" && $type == "view")  | 
                                                        |
| 715 | 715 |  				{ | 
                                                        
| 716 | - if($logged_info->is_admin == 'Y')  | 
                                                        |
| 716 | + if ($logged_info->is_admin == 'Y')  | 
                                                        |
| 717 | 717 |  					{ | 
                                                        
| 718 | - if($this->act != 'dispLayoutAdminLayoutModify')  | 
                                                        |
| 718 | + if ($this->act != 'dispLayoutAdminLayoutModify')  | 
                                                        |
| 719 | 719 |  						{ | 
                                                        
| 720 | 720 |  							$oAdminView = getAdminView('admin'); | 
                                                        
| 721 | 721 | $oAdminView->makeGnbUrl($forward->module);  | 
                                                        
@@ -735,10 +735,10 @@ discard block  | 
                                                    ||
| 735 | 735 | return $oMessageObject;  | 
                                                        
| 736 | 736 | }  | 
                                                        
| 737 | 737 | }  | 
                                                        
| 738 | - if($kind == 'admin')  | 
                                                        |
| 738 | + if ($kind == 'admin')  | 
                                                        |
| 739 | 739 |  				{ | 
                                                        
| 740 | 740 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info);  | 
                                                        
| 741 | - if(!$grant->manager)  | 
                                                        |
| 741 | + if (!$grant->manager)  | 
                                                        |
| 742 | 742 |  					{ | 
                                                        
| 743 | 743 | $this->_setInputErrorToContext();  | 
                                                        
| 744 | 744 | $this->error = 'msg_is_not_manager';  | 
                                                        
@@ -750,7 +750,7 @@ discard block  | 
                                                    ||
| 750 | 750 | }  | 
                                                        
| 751 | 751 | else  | 
                                                        
| 752 | 752 |  					{ | 
                                                        
| 753 | -						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') | 
                                                        |
| 753 | +						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') | 
                                                        |
| 754 | 754 |  						{ | 
                                                        
| 755 | 755 | $this->_setInputErrorToContext();  | 
                                                        
| 756 | 756 | $this->error = 'msg_is_not_administrator';  | 
                                                        
@@ -763,7 +763,7 @@ discard block  | 
                                                    ||
| 763 | 763 | }  | 
                                                        
| 764 | 764 | }  | 
                                                        
| 765 | 765 | }  | 
                                                        
| 766 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))  | 
                                                        |
| 766 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))  | 
                                                        |
| 767 | 767 |  			{ | 
                                                        
| 768 | 768 | $this->act = $xml_info->default_index_act;  | 
                                                        
| 769 | 769 | }  | 
                                                        
@@ -777,16 +777,16 @@ discard block  | 
                                                    ||
| 777 | 777 | }  | 
                                                        
| 778 | 778 | |
| 779 | 779 | // ruleset check...  | 
                                                        
| 780 | - if(!empty($ruleset))  | 
                                                        |
| 780 | + if (!empty($ruleset))  | 
                                                        |
| 781 | 781 |  		{ | 
                                                        
| 782 | 782 | $rulesetModule = $forward->module ? $forward->module : $this->module;  | 
                                                        
| 783 | 783 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);  | 
                                                        
| 784 | - if(!empty($rulesetFile))  | 
                                                        |
| 784 | + if (!empty($rulesetFile))  | 
                                                        |
| 785 | 785 |  			{ | 
                                                        
| 786 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG'])  | 
                                                        |
| 786 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])  | 
                                                        |
| 787 | 787 |  				{ | 
                                                        
| 788 | 788 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];  | 
                                                        
| 789 | - foreach($errorLang as $key => $val)  | 
                                                        |
| 789 | + foreach ($errorLang as $key => $val)  | 
                                                        |
| 790 | 790 |  					{ | 
                                                        
| 791 | 791 | Context::setLang($key, $val);  | 
                                                        
| 792 | 792 | }  | 
                                                        
@@ -795,7 +795,7 @@ discard block  | 
                                                    ||
| 795 | 795 | |
| 796 | 796 | $Validator = new Validator($rulesetFile);  | 
                                                        
| 797 | 797 | $result = $Validator->validate();  | 
                                                        
| 798 | - if(!$result)  | 
                                                        |
| 798 | + if (!$result)  | 
                                                        |
| 799 | 799 |  				{ | 
                                                        
| 800 | 800 | $lastError = $Validator->getLastError();  | 
                                                        
| 801 | 801 |  					$returnUrl = Context::get('error_return_url'); | 
                                                        
@@ -827,26 +827,26 @@ discard block  | 
                                                    ||
| 827 | 827 | 'dispLayoutPreviewWithModule' => 1  | 
                                                        
| 828 | 828 | );  | 
                                                        
| 829 | 829 | $db_use_mobile = Mobile::isMobileEnabled();  | 
                                                        
| 830 | -		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) | 
                                                        |
| 830 | +		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) | 
                                                        |
| 831 | 831 |  		{ | 
                                                        
| 832 | 832 | global $lang;  | 
                                                        
| 833 | 833 |  			$header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; | 
                                                        
| 834 | -			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; | 
                                                        |
| 834 | +			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; | 
                                                        |
| 835 | 835 | Context::addHtmlHeader($header);  | 
                                                        
| 836 | 836 | Context::addHtmlFooter($footer);  | 
                                                        
| 837 | 837 | }  | 
                                                        
| 838 | 838 | |
| 839 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin')  | 
                                                        |
| 839 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin')  | 
                                                        |
| 840 | 840 |  		{ | 
                                                        
| 841 | 841 |  			$module_config = $oModuleModel->getModuleConfig('module'); | 
                                                        
| 842 | - if($module_config->htmlFooter)  | 
                                                        |
| 842 | + if ($module_config->htmlFooter)  | 
                                                        |
| 843 | 843 |  			{ | 
                                                        
| 844 | 844 | Context::addHtmlFooter($module_config->htmlFooter);  | 
                                                        
| 845 | 845 | }  | 
                                                        
| 846 | - if($module_config->siteTitle)  | 
                                                        |
| 846 | + if ($module_config->siteTitle)  | 
                                                        |
| 847 | 847 |  			{ | 
                                                        
| 848 | 848 | $siteTitle = Context::getBrowserTitle();  | 
                                                        
| 849 | - if(!$siteTitle)  | 
                                                        |
| 849 | + if (!$siteTitle)  | 
                                                        |
| 850 | 850 |  				{ | 
                                                        
| 851 | 851 | Context::setBrowserTitle($module_config->siteTitle);  | 
                                                        
| 852 | 852 | }  | 
                                                        
@@ -863,18 +863,18 @@ discard block  | 
                                                    ||
| 863 | 863 | $procResult = $oModule->proc();  | 
                                                        
| 864 | 864 | |
| 865 | 865 |  		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); | 
                                                        
| 866 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))  | 
                                                        |
| 866 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))  | 
                                                        |
| 867 | 867 |  		{ | 
                                                        
| 868 | 868 | $error = $oModule->getError();  | 
                                                        
| 869 | 869 | $message = $oModule->getMessage();  | 
                                                        
| 870 | 870 | $messageType = $oModule->getMessageType();  | 
                                                        
| 871 | 871 | $redirectUrl = $oModule->getRedirectUrl();  | 
                                                        
| 872 | - if($messageType == 'error') debugPrint($message, 'ERROR');  | 
                                                        |
| 872 | + if ($messageType == 'error') debugPrint($message, 'ERROR');  | 
                                                        |
| 873 | 873 | |
| 874 | - if(!$procResult)  | 
                                                        |
| 874 | + if (!$procResult)  | 
                                                        |
| 875 | 875 |  			{ | 
                                                        
| 876 | 876 | $this->error = $message;  | 
                                                        
| 877 | -				if(!$redirectUrl && Context::get('error_return_url')) | 
                                                        |
| 877 | +				if (!$redirectUrl && Context::get('error_return_url')) | 
                                                        |
| 878 | 878 |  				{ | 
                                                        
| 879 | 879 |  					$redirectUrl = Context::get('error_return_url'); | 
                                                        
| 880 | 880 | }  | 
                                                        
@@ -887,13 +887,13 @@ discard block  | 
                                                    ||
| 887 | 887 | |
| 888 | 888 | $_SESSION['XE_VALIDATOR_ERROR'] = $error;  | 
                                                        
| 889 | 889 |  			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); | 
                                                        
| 890 | - if($message != 'success')  | 
                                                        |
| 890 | + if ($message != 'success')  | 
                                                        |
| 891 | 891 |  			{ | 
                                                        
| 892 | 892 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;  | 
                                                        
| 893 | 893 | }  | 
                                                        
| 894 | 894 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;  | 
                                                        
| 895 | 895 | |
| 896 | -			if(Context::get('xeVirtualRequestMethod') != 'xml') | 
                                                        |
| 896 | +			if (Context::get('xeVirtualRequestMethod') != 'xml') | 
                                                        |
| 897 | 897 |  			{ | 
                                                        
| 898 | 898 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;  | 
                                                        
| 899 | 899 | }  | 
                                                        
@@ -909,27 +909,27 @@ discard block  | 
                                                    ||
| 909 | 909 | * */  | 
                                                        
| 910 | 910 | function _setInputErrorToContext()  | 
                                                        
| 911 | 911 |  	{ | 
                                                        
| 912 | -		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) | 
                                                        |
| 912 | +		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) | 
                                                        |
| 913 | 913 |  		{ | 
                                                        
| 914 | 914 |  			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); | 
                                                        
| 915 | 915 | }  | 
                                                        
| 916 | -		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) | 
                                                        |
| 916 | +		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) | 
                                                        |
| 917 | 917 |  		{ | 
                                                        
| 918 | 918 |  			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); | 
                                                        
| 919 | 919 | }  | 
                                                        
| 920 | -		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) | 
                                                        |
| 920 | +		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) | 
                                                        |
| 921 | 921 |  		{ | 
                                                        
| 922 | 922 |  			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); | 
                                                        
| 923 | 923 | }  | 
                                                        
| 924 | -		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) | 
                                                        |
| 924 | +		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) | 
                                                        |
| 925 | 925 |  		{ | 
                                                        
| 926 | 926 |  			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); | 
                                                        
| 927 | 927 | }  | 
                                                        
| 928 | -		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) | 
                                                        |
| 928 | +		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) | 
                                                        |
| 929 | 929 |  		{ | 
                                                        
| 930 | 930 |  			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); | 
                                                        
| 931 | 931 | }  | 
                                                        
| 932 | - if(count($_SESSION['INPUT_ERROR']))  | 
                                                        |
| 932 | + if (count($_SESSION['INPUT_ERROR']))  | 
                                                        |
| 933 | 933 |  		{ | 
                                                        
| 934 | 934 |  			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); | 
                                                        
| 935 | 935 | }  | 
                                                        
@@ -959,7 +959,7 @@ discard block  | 
                                                    ||
| 959 | 959 |  	{ | 
                                                        
| 960 | 960 | $requestVars = Context::getRequestVars();  | 
                                                        
| 961 | 961 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);  | 
                                                        
| 962 | - foreach($requestVars AS $key => $value)  | 
                                                        |
| 962 | + foreach ($requestVars AS $key => $value)  | 
                                                        |
| 963 | 963 |  		{ | 
                                                        
| 964 | 964 | $_SESSION['INPUT_ERROR'][$key] = $value;  | 
                                                        
| 965 | 965 | }  | 
                                                        
@@ -973,41 +973,41 @@ discard block  | 
                                                    ||
| 973 | 973 | function displayContent($oModule = NULL)  | 
                                                        
| 974 | 974 |  	{ | 
                                                        
| 975 | 975 | // If the module is not set or not an object, set error  | 
                                                        
| 976 | - if(!$oModule || !is_object($oModule))  | 
                                                        |
| 976 | + if (!$oModule || !is_object($oModule))  | 
                                                        |
| 977 | 977 |  		{ | 
                                                        
| 978 | 978 | $this->error = 'msg_module_is_not_exists';  | 
                                                        
| 979 | 979 | $this->httpStatusCode = '404';  | 
                                                        
| 980 | 980 | }  | 
                                                        
| 981 | 981 | |
| 982 | 982 | // If connection to DB has a problem even though it's not install module, set error  | 
                                                        
| 983 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)  | 
                                                        |
| 983 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)  | 
                                                        |
| 984 | 984 |  		{ | 
                                                        
| 985 | 985 | $this->error = 'msg_dbconnect_failed';  | 
                                                        
| 986 | 986 | }  | 
                                                        
| 987 | 987 | |
| 988 | 988 | // Call trigger after moduleHandler proc  | 
                                                        
| 989 | 989 |  		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); | 
                                                        
| 990 | - if(!$output->toBool())  | 
                                                        |
| 990 | + if (!$output->toBool())  | 
                                                        |
| 991 | 991 |  		{ | 
                                                        
| 992 | 992 | $this->error = $output->getMessage();  | 
                                                        
| 993 | 993 | }  | 
                                                        
| 994 | 994 | |
| 995 | 995 | // Use message view object, if HTML call  | 
                                                        
| 996 | 996 |  		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); | 
                                                        
| 997 | - if(!isset($methodList[Context::getRequestMethod()]))  | 
                                                        |
| 997 | + if (!isset($methodList[Context::getRequestMethod()]))  | 
                                                        |
| 998 | 998 |  		{ | 
                                                        
| 999 | 999 | |
| 1000 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'])  | 
                                                        |
| 1000 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'])  | 
                                                        |
| 1001 | 1001 |  			{ | 
                                                        
| 1002 | 1002 | $display_handler = new DisplayHandler();  | 
                                                        
| 1003 | 1003 | $display_handler->_debugOutput();  | 
                                                        
| 1004 | 1004 | |
| 1005 | -				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); | 
                                                        |
| 1005 | +				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); | 
                                                        |
| 1006 | 1006 | return;  | 
                                                        
| 1007 | 1007 | }  | 
                                                        
| 1008 | 1008 | |
| 1009 | 1009 | // If error occurred, handle it  | 
                                                        
| 1010 | - if($this->error)  | 
                                                        |
| 1010 | + if ($this->error)  | 
                                                        |
| 1011 | 1011 |  			{ | 
                                                        
| 1012 | 1012 | // display content with message module instance  | 
                                                        
| 1013 | 1013 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';  | 
                                                        
@@ -1016,14 +1016,14 @@ discard block  | 
                                                    ||
| 1016 | 1016 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 1017 | 1017 | $oMessageObject->dispMessage();  | 
                                                        
| 1018 | 1018 | |
| 1019 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')  | 
                                                        |
| 1019 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')  | 
                                                        |
| 1020 | 1020 |  				{ | 
                                                        
| 1021 | 1021 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());  | 
                                                        
| 1022 | 1022 |  					$oMessageObject->setTemplateFile('http_status_code'); | 
                                                        
| 1023 | 1023 | }  | 
                                                        
| 1024 | 1024 | |
| 1025 | 1025 | // If module was called normally, change the templates of the module into ones of the message view module  | 
                                                        
| 1026 | - if($oModule)  | 
                                                        |
| 1026 | + if ($oModule)  | 
                                                        |
| 1027 | 1027 |  				{ | 
                                                        
| 1028 | 1028 | $oModule->setTemplatePath($oMessageObject->getTemplatePath());  | 
                                                        
| 1029 | 1029 | $oModule->setTemplateFile($oMessageObject->getTemplateFile());  | 
                                                        
@@ -1038,7 +1038,7 @@ discard block  | 
                                                    ||
| 1038 | 1038 | }  | 
                                                        
| 1039 | 1039 | |
| 1040 | 1040 | // Check if layout_srl exists for the module  | 
                                                        
| 1041 | - if(Mobile::isFromMobilePhone())  | 
                                                        |
| 1041 | + if (Mobile::isFromMobilePhone())  | 
                                                        |
| 1042 | 1042 |  			{ | 
                                                        
| 1043 | 1043 | $layout_srl = $oModule->module_info->mlayout_srl;  | 
                                                        
| 1044 | 1044 | }  | 
                                                        
@@ -1048,58 +1048,58 @@ discard block  | 
                                                    ||
| 1048 | 1048 | }  | 
                                                        
| 1049 | 1049 | |
| 1050 | 1050 | // if layout_srl is rollback by module, set default layout  | 
                                                        
| 1051 | - if($layout_srl == -1)  | 
                                                        |
| 1051 | + if ($layout_srl == -1)  | 
                                                        |
| 1052 | 1052 |  			{ | 
                                                        
| 1053 | 1053 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';  | 
                                                        
| 1054 | 1054 |  				$oLayoutAdminModel = getAdminModel('layout'); | 
                                                        
| 1055 | 1055 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);  | 
                                                        
| 1056 | 1056 | }  | 
                                                        
| 1057 | 1057 | |
| 1058 | - if($layout_srl && !$oModule->getLayoutFile())  | 
                                                        |
| 1058 | + if ($layout_srl && !$oModule->getLayoutFile())  | 
                                                        |
| 1059 | 1059 |  			{ | 
                                                        
| 1060 | 1060 | |
| 1061 | 1061 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file  | 
                                                        
| 1062 | 1062 |  				$oLayoutModel = getModel('layout'); | 
                                                        
| 1063 | 1063 | $layout_info = $oLayoutModel->getLayout($layout_srl);  | 
                                                        
| 1064 | - if($layout_info)  | 
                                                        |
| 1064 | + if ($layout_info)  | 
                                                        |
| 1065 | 1065 |  				{ | 
                                                        
| 1066 | 1066 | |
| 1067 | 1067 | // Input extra_vars into $layout_info  | 
                                                        
| 1068 | - if($layout_info->extra_var_count)  | 
                                                        |
| 1068 | + if ($layout_info->extra_var_count)  | 
                                                        |
| 1069 | 1069 |  					{ | 
                                                        
| 1070 | 1070 | |
| 1071 | - foreach($layout_info->extra_var as $var_id => $val)  | 
                                                        |
| 1071 | + foreach ($layout_info->extra_var as $var_id => $val)  | 
                                                        |
| 1072 | 1072 |  						{ | 
                                                        
| 1073 | - if($val->type == 'image')  | 
                                                        |
| 1073 | + if ($val->type == 'image')  | 
                                                        |
| 1074 | 1074 |  							{ | 
                                                        
| 1075 | -								if(strncmp('./files/attach/images/', $val->value, 22) === 0) | 
                                                        |
| 1075 | +								if (strncmp('./files/attach/images/', $val->value, 22) === 0) | 
                                                        |
| 1076 | 1076 |  								{ | 
                                                        
| 1077 | - $val->value = Context::getRequestUri() . substr($val->value, 2);  | 
                                                        |
| 1077 | + $val->value = Context::getRequestUri().substr($val->value, 2);  | 
                                                        |
| 1078 | 1078 | }  | 
                                                        
| 1079 | 1079 | }  | 
                                                        
| 1080 | 1080 |  							$layout_info->{$var_id} = $val->value; | 
                                                        
| 1081 | 1081 | }  | 
                                                        
| 1082 | 1082 | }  | 
                                                        
| 1083 | 1083 | // Set menus into context  | 
                                                        
| 1084 | - if($layout_info->menu_count)  | 
                                                        |
| 1084 | + if ($layout_info->menu_count)  | 
                                                        |
| 1085 | 1085 |  					{ | 
                                                        
| 1086 | - foreach($layout_info->menu as $menu_id => $menu)  | 
                                                        |
| 1086 | + foreach ($layout_info->menu as $menu_id => $menu)  | 
                                                        |
| 1087 | 1087 |  						{ | 
                                                        
| 1088 | 1088 | // set default menu set(included home menu)  | 
                                                        
| 1089 | - if(!$menu->menu_srl || $menu->menu_srl == -1)  | 
                                                        |
| 1089 | + if (!$menu->menu_srl || $menu->menu_srl == -1)  | 
                                                        |
| 1090 | 1090 |  							{ | 
                                                        
| 1091 | 1091 |  								$oMenuAdminController = getAdminController('menu'); | 
                                                        
| 1092 | 1092 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();  | 
                                                        
| 1093 | 1093 | |
| 1094 | - if(FileHandler::exists($homeMenuCacheFile))  | 
                                                        |
| 1094 | + if (FileHandler::exists($homeMenuCacheFile))  | 
                                                        |
| 1095 | 1095 |  								{ | 
                                                        
| 1096 | 1096 | include($homeMenuCacheFile);  | 
                                                        
| 1097 | 1097 | }  | 
                                                        
| 1098 | 1098 | |
| 1099 | - if(!$menu->menu_srl)  | 
                                                        |
| 1099 | + if (!$menu->menu_srl)  | 
                                                        |
| 1100 | 1100 |  								{ | 
                                                        
| 1101 | -									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); | 
                                                        |
| 1102 | -									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); | 
                                                        |
| 1101 | +									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); | 
                                                        |
| 1102 | +									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); | 
                                                        |
| 1103 | 1103 |  									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; | 
                                                        
| 1104 | 1104 | }  | 
                                                        
| 1105 | 1105 | else  | 
                                                        
@@ -1110,7 +1110,7 @@ discard block  | 
                                                    ||
| 1110 | 1110 | }  | 
                                                        
| 1111 | 1111 | |
| 1112 | 1112 | $php_file = FileHandler::exists($menu->php_file);  | 
                                                        
| 1113 | - if($php_file)  | 
                                                        |
| 1113 | + if ($php_file)  | 
                                                        |
| 1114 | 1114 |  							{ | 
                                                        
| 1115 | 1115 | include($php_file);  | 
                                                        
| 1116 | 1116 | }  | 
                                                        
@@ -1126,17 +1126,17 @@ discard block  | 
                                                    ||
| 1126 | 1126 | |
| 1127 | 1127 | // If layout was modified, use the modified version  | 
                                                        
| 1128 | 1128 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);  | 
                                                        
| 1129 | - if(file_exists($edited_layout))  | 
                                                        |
| 1129 | + if (file_exists($edited_layout))  | 
                                                        |
| 1130 | 1130 |  					{ | 
                                                        
| 1131 | 1131 | $oModule->setEditedLayoutFile($edited_layout);  | 
                                                        
| 1132 | 1132 | }  | 
                                                        
| 1133 | 1133 | }  | 
                                                        
| 1134 | 1134 | }  | 
                                                        
| 1135 | 1135 |  			$isLayoutDrop = Context::get('isLayoutDrop'); | 
                                                        
| 1136 | - if($isLayoutDrop)  | 
                                                        |
| 1136 | + if ($isLayoutDrop)  | 
                                                        |
| 1137 | 1137 |  			{ | 
                                                        
| 1138 | 1138 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';  | 
                                                        
| 1139 | - if($kind == 'admin')  | 
                                                        |
| 1139 | + if ($kind == 'admin')  | 
                                                        |
| 1140 | 1140 |  				{ | 
                                                        
| 1141 | 1141 |  					$oModule->setLayoutFile('popup_layout'); | 
                                                        
| 1142 | 1142 | }  | 
                                                        
@@ -1174,7 +1174,7 @@ discard block  | 
                                                    ||
| 1174 | 1174 | function &getModuleInstance($module, $type = 'view', $kind = '')  | 
                                                        
| 1175 | 1175 |  	{ | 
                                                        
| 1176 | 1176 | |
| 1177 | - if(__DEBUG__ == 3)  | 
                                                        |
| 1177 | + if (__DEBUG__ == 3)  | 
                                                        |
| 1178 | 1178 |  		{ | 
                                                        
| 1179 | 1179 | $start_time = getMicroTime();  | 
                                                        
| 1180 | 1180 | }  | 
                                                        
@@ -1184,51 +1184,51 @@ discard block  | 
                                                    ||
| 1184 | 1184 | $type = strtolower($type);  | 
                                                        
| 1185 | 1185 | |
| 1186 | 1186 |  		$kinds = array('svc' => 1, 'admin' => 1); | 
                                                        
| 1187 | - if(!isset($kinds[$kind]))  | 
                                                        |
| 1187 | + if (!isset($kinds[$kind]))  | 
                                                        |
| 1188 | 1188 |  		{ | 
                                                        
| 1189 | 1189 | $kind = 'svc';  | 
                                                        
| 1190 | 1190 | }  | 
                                                        
| 1191 | 1191 | |
| 1192 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;  | 
                                                        |
| 1192 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;  | 
                                                        |
| 1193 | 1193 | |
| 1194 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))  | 
                                                        |
| 1194 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))  | 
                                                        |
| 1195 | 1195 |  		{ | 
                                                        
| 1196 | 1196 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];  | 
                                                        
| 1197 | 1197 | }  | 
                                                        
| 1198 | 1198 | |
| 1199 | 1199 | // if there is no instance of the module in global variable, create a new one  | 
                                                        
| 1200 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))  | 
                                                        |
| 1200 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))  | 
                                                        |
| 1201 | 1201 |  		{ | 
                                                        
| 1202 | 1202 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);  | 
                                                        
| 1203 | 1203 | |
| 1204 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))  | 
                                                        |
| 1204 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))  | 
                                                        |
| 1205 | 1205 |  			{ | 
                                                        
| 1206 | 1206 | $module = $parent_module;  | 
                                                        
| 1207 | 1207 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);  | 
                                                        
| 1208 | 1208 | }  | 
                                                        
| 1209 | 1209 | |
| 1210 | 1210 | // Check if the base class and instance class exist  | 
                                                        
| 1211 | - if(!class_exists($module, true))  | 
                                                        |
| 1211 | + if (!class_exists($module, true))  | 
                                                        |
| 1212 | 1212 |  			{ | 
                                                        
| 1213 | 1213 | return NULL;  | 
                                                        
| 1214 | 1214 | }  | 
                                                        
| 1215 | - if(!class_exists($instance_name, true))  | 
                                                        |
| 1215 | + if (!class_exists($instance_name, true))  | 
                                                        |
| 1216 | 1216 |  			{ | 
                                                        
| 1217 | 1217 | return NULL;  | 
                                                        
| 1218 | 1218 | }  | 
                                                        
| 1219 | 1219 | |
| 1220 | 1220 | // Create an instance  | 
                                                        
| 1221 | 1221 | $oModule = new $instance_name();  | 
                                                        
| 1222 | - if(!is_object($oModule))  | 
                                                        |
| 1222 | + if (!is_object($oModule))  | 
                                                        |
| 1223 | 1223 |  			{ | 
                                                        
| 1224 | 1224 | return NULL;  | 
                                                        
| 1225 | 1225 | }  | 
                                                        
| 1226 | 1226 | |
| 1227 | 1227 | // Load language files for the class  | 
                                                        
| 1228 | - Context::loadLang($class_path . 'lang');  | 
                                                        |
| 1229 | - if($extend_module)  | 
                                                        |
| 1228 | + Context::loadLang($class_path.'lang');  | 
                                                        |
| 1229 | + if ($extend_module)  | 
                                                        |
| 1230 | 1230 |  			{ | 
                                                        
| 1231 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');  | 
                                                        |
| 1231 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');  | 
                                                        |
| 1232 | 1232 | }  | 
                                                        
| 1233 | 1233 | |
| 1234 | 1234 | // Set variables to the instance  | 
                                                        
@@ -1236,10 +1236,10 @@ discard block  | 
                                                    ||
| 1236 | 1236 | $oModule->setModulePath($class_path);  | 
                                                        
| 1237 | 1237 | |
| 1238 | 1238 | // If the module has a constructor, run it.  | 
                                                        
| 1239 | - if(!isset($GLOBALS['_called_constructor'][$instance_name]))  | 
                                                        |
| 1239 | + if (!isset($GLOBALS['_called_constructor'][$instance_name]))  | 
                                                        |
| 1240 | 1240 |  			{ | 
                                                        
| 1241 | 1241 | $GLOBALS['_called_constructor'][$instance_name] = TRUE;  | 
                                                        
| 1242 | - if(@method_exists($oModule, $instance_name))  | 
                                                        |
| 1242 | + if (@method_exists($oModule, $instance_name))  | 
                                                        |
| 1243 | 1243 |  				{ | 
                                                        
| 1244 | 1244 |  					$oModule->{$instance_name}(); | 
                                                        
| 1245 | 1245 | }  | 
                                                        
@@ -1249,7 +1249,7 @@ discard block  | 
                                                    ||
| 1249 | 1249 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;  | 
                                                        
| 1250 | 1250 | }  | 
                                                        
| 1251 | 1251 | |
| 1252 | - if(__DEBUG__ == 3)  | 
                                                        |
| 1252 | + if (__DEBUG__ == 3)  | 
                                                        |
| 1253 | 1253 |  		{ | 
                                                        
| 1254 | 1254 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;  | 
                                                        
| 1255 | 1255 | }  | 
                                                        
@@ -1265,17 +1265,17 @@ discard block  | 
                                                    ||
| 1265 | 1265 |  		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); | 
                                                        
| 1266 | 1266 | $highClassFile = FileHandler::getRealPath($highClassFile);  | 
                                                        
| 1267 | 1267 | |
| 1268 | -		$types = array('view','controller','model','api','wap','mobile','class'); | 
                                                        |
| 1269 | - if(!in_array($type, $types))  | 
                                                        |
| 1268 | +		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); | 
                                                        |
| 1269 | + if (!in_array($type, $types))  | 
                                                        |
| 1270 | 1270 |  		{ | 
                                                        
| 1271 | 1271 | $type = $types[0];  | 
                                                        
| 1272 | 1272 | }  | 
                                                        
| 1273 | - if($type == 'class')  | 
                                                        |
| 1273 | + if ($type == 'class')  | 
                                                        |
| 1274 | 1274 |  		{ | 
                                                        
| 1275 | 1275 | $instanceName = '%s';  | 
                                                        
| 1276 | 1276 | $classFile = '%s%s.%s.php';  | 
                                                        
| 1277 | 1277 | }  | 
                                                        
| 1278 | - elseif($kind == 'admin' && array_search($type, $types) < 3)  | 
                                                        |
| 1278 | + elseif ($kind == 'admin' && array_search($type, $types) < 3)  | 
                                                        |
| 1279 | 1279 |  		{ | 
                                                        
| 1280 | 1280 | $instanceName = '%sAdmin%s';  | 
                                                        
| 1281 | 1281 | $classFile = '%s%s.admin.%s.php';  | 
                                                        
@@ -1300,26 +1300,26 @@ discard block  | 
                                                    ||
| 1300 | 1300 | function triggerCall($trigger_name, $called_position, &$obj)  | 
                                                        
| 1301 | 1301 |  	{ | 
                                                        
| 1302 | 1302 | // skip if not installed  | 
                                                        
| 1303 | - if(!Context::isInstalled())  | 
                                                        |
| 1303 | + if (!Context::isInstalled())  | 
                                                        |
| 1304 | 1304 |  		{ | 
                                                        
| 1305 | 1305 | return new BaseObject();  | 
                                                        
| 1306 | 1306 | }  | 
                                                        
| 1307 | 1307 | |
| 1308 | 1308 |  		$oModuleModel = getModel('module'); | 
                                                        
| 1309 | 1309 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position);  | 
                                                        
| 1310 | - if(!$triggers || count($triggers) < 1)  | 
                                                        |
| 1310 | + if (!$triggers || count($triggers) < 1)  | 
                                                        |
| 1311 | 1311 |  		{ | 
                                                        
| 1312 | 1312 | return new BaseObject();  | 
                                                        
| 1313 | 1313 | }  | 
                                                        
| 1314 | 1314 | |
| 1315 | 1315 | //store before trigger call time  | 
                                                        
| 1316 | 1316 | $before_trigger_time = NULL;  | 
                                                        
| 1317 | - if(__LOG_SLOW_TRIGGER__> 0)  | 
                                                        |
| 1317 | + if (__LOG_SLOW_TRIGGER__ > 0)  | 
                                                        |
| 1318 | 1318 |  		{ | 
                                                        
| 1319 | 1319 | $before_trigger_time = microtime(true);  | 
                                                        
| 1320 | 1320 | }  | 
                                                        
| 1321 | 1321 | |
| 1322 | - foreach($triggers as $item)  | 
                                                        |
| 1322 | + foreach ($triggers as $item)  | 
                                                        |
| 1323 | 1323 |  		{ | 
                                                        
| 1324 | 1324 | $module = $item->module;  | 
                                                        
| 1325 | 1325 | $type = $item->type;  | 
                                                        
@@ -1327,7 +1327,7 @@ discard block  | 
                                                    ||
| 1327 | 1327 | |
| 1328 | 1328 | // todo why don't we call a normal class object ?  | 
                                                        
| 1329 | 1329 | $oModule = getModule($module, $type);  | 
                                                        
| 1330 | - if(!$oModule || !method_exists($oModule, $called_method))  | 
                                                        |
| 1330 | + if (!$oModule || !method_exists($oModule, $called_method))  | 
                                                        |
| 1331 | 1331 |  			{ | 
                                                        
| 1332 | 1332 | continue;  | 
                                                        
| 1333 | 1333 | }  | 
                                                        
@@ -1340,12 +1340,12 @@ discard block  | 
                                                    ||
| 1340 | 1340 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;  | 
                                                        
| 1341 | 1341 | |
| 1342 | 1342 | $slowlog = new stdClass;  | 
                                                        
| 1343 | - $slowlog->caller = $trigger_name . '.' . $called_position;  | 
                                                        |
| 1344 | - $slowlog->called = $module . '.' . $called_method;  | 
                                                        |
| 1343 | + $slowlog->caller = $trigger_name.'.'.$called_position;  | 
                                                        |
| 1344 | + $slowlog->called = $module.'.'.$called_method;  | 
                                                        |
| 1345 | 1345 | $slowlog->called_extension = $module;  | 
                                                        
| 1346 | -			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); | 
                                                        |
| 1346 | +			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); | 
                                                        |
| 1347 | 1347 | |
| 1348 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())  | 
                                                        |
| 1348 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())  | 
                                                        |
| 1349 | 1349 |  			{ | 
                                                        
| 1350 | 1350 | return $output;  | 
                                                        
| 1351 | 1351 | }  | 
                                                        
@@ -1430,9 +1430,9 @@ discard block  | 
                                                    ||
| 1430 | 1430 | '511' => 'Network Authentication Required',  | 
                                                        
| 1431 | 1431 | );  | 
                                                        
| 1432 | 1432 | $statusMessage = $statusMessageList[$code];  | 
                                                        
| 1433 | - if(!$statusMessage)  | 
                                                        |
| 1433 | + if (!$statusMessage)  | 
                                                        |
| 1434 | 1434 |  		{ | 
                                                        
| 1435 | - $statusMessage = 'HTTP ' . $code;  | 
                                                        |
| 1435 | + $statusMessage = 'HTTP '.$code;  | 
                                                        |
| 1436 | 1436 | }  | 
                                                        
| 1437 | 1437 | |
| 1438 | 1438 |  		Context::set('http_status_code', $code); | 
                                                        
@@ -112,7 +112,9 @@ discard block  | 
                                                    ||
| 112 | 112 | $called_position = 'before_module_init';  | 
                                                        
| 113 | 113 |  		$oAddonController = getController('addon'); | 
                                                        
| 114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');  | 
                                                        
| 115 | - if(file_exists($addon_file)) include($addon_file);  | 
                                                        |
| 115 | +		if(file_exists($addon_file)) { | 
                                                        |
| 116 | + include($addon_file);  | 
                                                        |
| 117 | + }  | 
                                                        |
| 116 | 118 | }  | 
                                                        
| 117 | 119 | |
| 118 | 120 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)  | 
                                                        
@@ -234,8 +236,7 @@ discard block  | 
                                                    ||
| 234 | 236 | if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain)))  | 
                                                        
| 235 | 237 |  			{ | 
                                                        
| 236 | 238 |  				throw new Exception('msg_default_url_is_null'); | 
                                                        
| 237 | - }  | 
                                                        |
| 238 | -			else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) | 
                                                        |
| 239 | +			} else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) | 
                                                        |
| 239 | 240 |  			{ | 
                                                        
| 240 | 241 |  				throw new exception('msg_invalid_request'); | 
                                                        
| 241 | 242 | }  | 
                                                        
@@ -260,8 +261,7 @@ discard block  | 
                                                    ||
| 260 | 261 | if(!$module_info)  | 
                                                        
| 261 | 262 |  			{ | 
                                                        
| 262 | 263 | unset($this->document_srl);  | 
                                                        
| 263 | - }  | 
                                                        |
| 264 | - else  | 
                                                        |
| 264 | + } else  | 
                                                        |
| 265 | 265 |  			{ | 
                                                        
| 266 | 266 | // If it exists, compare mid based on the module information  | 
                                                        
| 267 | 267 | // if mids are not matching, set it as the document's mid  | 
                                                        
@@ -273,8 +273,7 @@ discard block  | 
                                                    ||
| 273 | 273 | $this->mid = $module_info->mid;  | 
                                                        
| 274 | 274 |  						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); | 
                                                        
| 275 | 275 | return FALSE;  | 
                                                        
| 276 | - }  | 
                                                        |
| 277 | - else  | 
                                                        |
| 276 | + } else  | 
                                                        |
| 278 | 277 |  					{ | 
                                                        
| 279 | 278 | $this->mid = $module_info->mid;  | 
                                                        
| 280 | 279 |  						Context::set('mid', $this->mid); | 
                                                        
@@ -325,15 +324,13 @@ discard block  | 
                                                    ||
| 325 | 324 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl);  | 
                                                        
| 326 | 325 |  				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); | 
                                                        
| 327 | 326 | // If it's called from a virtual site, though it's not a module of the virtual site  | 
                                                        
| 328 | - }  | 
                                                        |
| 329 | - else  | 
                                                        |
| 327 | + } else  | 
                                                        |
| 330 | 328 |  			{ | 
                                                        
| 331 | 329 | $db_info = Context::getDBInfo();  | 
                                                        
| 332 | 330 | if(!$db_info->default_url)  | 
                                                        
| 333 | 331 |  				{ | 
                                                        
| 334 | 332 |  					return Context::getLang('msg_default_url_is_not_defined'); | 
                                                        
| 335 | - }  | 
                                                        |
| 336 | - else  | 
                                                        |
| 333 | + } else  | 
                                                        |
| 337 | 334 |  				{ | 
                                                        
| 338 | 335 |  					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); | 
                                                        
| 339 | 336 | }  | 
                                                        
@@ -358,8 +355,7 @@ discard block  | 
                                                    ||
| 358 | 355 |  			{ | 
                                                        
| 359 | 356 |  				$oLayoutAdminModel = getAdminModel('layout'); | 
                                                        
| 360 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);  | 
                                                        
| 361 | - }  | 
                                                        |
| 362 | - else  | 
                                                        |
| 358 | + } else  | 
                                                        |
| 363 | 359 |  			{ | 
                                                        
| 364 | 360 |  				$layoutSrl = $module_info->{$targetSrl}; | 
                                                        
| 365 | 361 | }  | 
                                                        
@@ -493,8 +489,7 @@ discard block  | 
                                                    ||
| 493 | 489 | if(!$allowedMethod)  | 
                                                        
| 494 | 490 |  			{ | 
                                                        
| 495 | 491 | $allowedMethodList[0] = 'POST';  | 
                                                        
| 496 | - }  | 
                                                        |
| 497 | - else  | 
                                                        |
| 492 | + } else  | 
                                                        |
| 498 | 493 |  			{ | 
                                                        
| 499 | 494 |  				$allowedMethodList = explode('|', strtoupper($allowedMethod)); | 
                                                        
| 500 | 495 | }  | 
                                                        
@@ -554,8 +549,7 @@ discard block  | 
                                                    ||
| 554 | 549 | Mobile::setMobile(FALSE);  | 
                                                        
| 555 | 550 | $oModule = $this->getModuleInstance($this->module, $type, $kind);  | 
                                                        
| 556 | 551 | }  | 
                                                        
| 557 | - }  | 
                                                        |
| 558 | - else  | 
                                                        |
| 552 | + } else  | 
                                                        |
| 559 | 553 |  		{ | 
                                                        
| 560 | 554 | // create a module instance  | 
                                                        
| 561 | 555 | $oModule = $this->getModuleInstance($this->module, $type, $kind);  | 
                                                        
@@ -609,8 +603,7 @@ discard block  | 
                                                    ||
| 609 | 603 |  					$forward->ruleset = $xml_info->action->{$this->act}->ruleset; | 
                                                        
| 610 | 604 |  					$forward->meta_noindex = $xml_info->action->{$this->act}->meta_noindex; | 
                                                        
| 611 | 605 | $forward->act = $this->act;  | 
                                                        
| 612 | - }  | 
                                                        |
| 613 | - else  | 
                                                        |
| 606 | + } else  | 
                                                        |
| 614 | 607 |  				{ | 
                                                        
| 615 | 608 | $this->error = 'msg_invalid_request';  | 
                                                        
| 616 | 609 |  					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); | 
                                                        
@@ -662,8 +655,7 @@ discard block  | 
                                                    ||
| 662 | 655 | if(!$allowedMethod)  | 
                                                        
| 663 | 656 |  					{ | 
                                                        
| 664 | 657 | $allowedMethodList[0] = 'POST';  | 
                                                        
| 665 | - }  | 
                                                        |
| 666 | - else  | 
                                                        |
| 658 | + } else  | 
                                                        |
| 667 | 659 |  					{ | 
                                                        
| 668 | 660 |  						$allowedMethodList = explode('|', strtoupper($allowedMethod)); | 
                                                        
| 669 | 661 | }  | 
                                                        
@@ -691,8 +683,7 @@ discard block  | 
                                                    ||
| 691 | 683 | Mobile::setMobile(FALSE);  | 
                                                        
| 692 | 684 | $oModule = $this->getModuleInstance($forward->module, $type, $kind);  | 
                                                        
| 693 | 685 | }  | 
                                                        
| 694 | - }  | 
                                                        |
| 695 | - else  | 
                                                        |
| 686 | + } else  | 
                                                        |
| 696 | 687 |  				{ | 
                                                        
| 697 | 688 | $oModule = $this->getModuleInstance($forward->module, $type, $kind);  | 
                                                        
| 698 | 689 | }  | 
                                                        
@@ -722,8 +713,7 @@ discard block  | 
                                                    ||
| 722 | 713 |  							$oModule->setLayoutPath("./modules/admin/tpl"); | 
                                                        
| 723 | 714 |  							$oModule->setLayoutFile("layout.html"); | 
                                                        
| 724 | 715 | }  | 
                                                        
| 725 | - }  | 
                                                        |
| 726 | - else  | 
                                                        |
| 716 | + } else  | 
                                                        |
| 727 | 717 |  					{ | 
                                                        
| 728 | 718 | $this->_setInputErrorToContext();  | 
                                                        
| 729 | 719 | |
@@ -747,8 +737,7 @@ discard block  | 
                                                    ||
| 747 | 737 | $oMessageObject->setMessage($this->error);  | 
                                                        
| 748 | 738 | $oMessageObject->dispMessage();  | 
                                                        
| 749 | 739 | return $oMessageObject;  | 
                                                        
| 750 | - }  | 
                                                        |
| 751 | - else  | 
                                                        |
| 740 | + } else  | 
                                                        |
| 752 | 741 |  					{ | 
                                                        
| 753 | 742 |  						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') | 
                                                        
| 754 | 743 |  						{ | 
                                                        
@@ -762,12 +751,10 @@ discard block  | 
                                                    ||
| 762 | 751 | }  | 
                                                        
| 763 | 752 | }  | 
                                                        
| 764 | 753 | }  | 
                                                        
| 765 | - }  | 
                                                        |
| 766 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))  | 
                                                        |
| 754 | + } else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))  | 
                                                        |
| 767 | 755 |  			{ | 
                                                        
| 768 | 756 | $this->act = $xml_info->default_index_act;  | 
                                                        
| 769 | - }  | 
                                                        |
| 770 | - else  | 
                                                        |
| 757 | + } else  | 
                                                        |
| 771 | 758 |  			{ | 
                                                        
| 772 | 759 | $this->error = 'msg_invalid_request';  | 
                                                        
| 773 | 760 | $oModule->setError(-1);  | 
                                                        
@@ -869,7 +856,9 @@ discard block  | 
                                                    ||
| 869 | 856 | $message = $oModule->getMessage();  | 
                                                        
| 870 | 857 | $messageType = $oModule->getMessageType();  | 
                                                        
| 871 | 858 | $redirectUrl = $oModule->getRedirectUrl();  | 
                                                        
| 872 | - if($messageType == 'error') debugPrint($message, 'ERROR');  | 
                                                        |
| 859 | +			if($messageType == 'error') { | 
                                                        |
| 860 | + debugPrint($message, 'ERROR');  | 
                                                        |
| 861 | + }  | 
                                                        |
| 873 | 862 | |
| 874 | 863 | if(!$procResult)  | 
                                                        
| 875 | 864 |  			{ | 
                                                        
@@ -879,8 +868,7 @@ discard block  | 
                                                    ||
| 879 | 868 |  					$redirectUrl = Context::get('error_return_url'); | 
                                                        
| 880 | 869 | }  | 
                                                        
| 881 | 870 | $this->_setInputValueToSession();  | 
                                                        
| 882 | - }  | 
                                                        |
| 883 | - else  | 
                                                        |
| 871 | + } else  | 
                                                        |
| 884 | 872 |  			{ | 
                                                        
| 885 | 873 | |
| 886 | 874 | }  | 
                                                        
@@ -1028,8 +1016,7 @@ discard block  | 
                                                    ||
| 1028 | 1016 | $oModule->setTemplatePath($oMessageObject->getTemplatePath());  | 
                                                        
| 1029 | 1017 | $oModule->setTemplateFile($oMessageObject->getTemplateFile());  | 
                                                        
| 1030 | 1018 | // Otherwise, set message instance as the target module  | 
                                                        
| 1031 | - }  | 
                                                        |
| 1032 | - else  | 
                                                        |
| 1019 | + } else  | 
                                                        |
| 1033 | 1020 |  				{ | 
                                                        
| 1034 | 1021 | $oModule = $oMessageObject;  | 
                                                        
| 1035 | 1022 | }  | 
                                                        
@@ -1041,8 +1028,7 @@ discard block  | 
                                                    ||
| 1041 | 1028 | if(Mobile::isFromMobilePhone())  | 
                                                        
| 1042 | 1029 |  			{ | 
                                                        
| 1043 | 1030 | $layout_srl = $oModule->module_info->mlayout_srl;  | 
                                                        
| 1044 | - }  | 
                                                        |
| 1045 | - else  | 
                                                        |
| 1031 | + } else  | 
                                                        |
| 1046 | 1032 |  			{ | 
                                                        
| 1047 | 1033 | $layout_srl = $oModule->module_info->layout_srl;  | 
                                                        
| 1048 | 1034 | }  | 
                                                        
@@ -1101,8 +1087,7 @@ discard block  | 
                                                    ||
| 1101 | 1087 |  									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); | 
                                                        
| 1102 | 1088 |  									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); | 
                                                        
| 1103 | 1089 |  									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; | 
                                                        
| 1104 | - }  | 
                                                        |
| 1105 | - else  | 
                                                        |
| 1090 | + } else  | 
                                                        |
| 1106 | 1091 |  								{ | 
                                                        
| 1107 | 1092 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);  | 
                                                        
| 1108 | 1093 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);  | 
                                                        
@@ -1139,8 +1124,7 @@ discard block  | 
                                                    ||
| 1139 | 1124 | if($kind == 'admin')  | 
                                                        
| 1140 | 1125 |  				{ | 
                                                        
| 1141 | 1126 |  					$oModule->setLayoutFile('popup_layout'); | 
                                                        
| 1142 | - }  | 
                                                        |
| 1143 | - else  | 
                                                        |
| 1127 | + } else  | 
                                                        |
| 1144 | 1128 |  				{ | 
                                                        
| 1145 | 1129 |  					$oModule->setLayoutPath('common/tpl'); | 
                                                        
| 1146 | 1130 |  					$oModule->setLayoutFile('default_layout'); | 
                                                        
@@ -1274,13 +1258,11 @@ discard block  | 
                                                    ||
| 1274 | 1258 |  		{ | 
                                                        
| 1275 | 1259 | $instanceName = '%s';  | 
                                                        
| 1276 | 1260 | $classFile = '%s%s.%s.php';  | 
                                                        
| 1277 | - }  | 
                                                        |
| 1278 | - elseif($kind == 'admin' && array_search($type, $types) < 3)  | 
                                                        |
| 1261 | + } elseif($kind == 'admin' && array_search($type, $types) < 3)  | 
                                                        |
| 1279 | 1262 |  		{ | 
                                                        
| 1280 | 1263 | $instanceName = '%sAdmin%s';  | 
                                                        
| 1281 | 1264 | $classFile = '%s%s.admin.%s.php';  | 
                                                        
| 1282 | - }  | 
                                                        |
| 1283 | - else  | 
                                                        |
| 1265 | + } else  | 
                                                        |
| 1284 | 1266 |  		{ | 
                                                        
| 1285 | 1267 | $instanceName = '%s%s';  | 
                                                        
| 1286 | 1268 | $classFile = '%s%s.%s.php';  | 
                                                        
@@ -1343,7 +1325,9 @@ discard block  | 
                                                    ||
| 1343 | 1325 | $slowlog->caller = $trigger_name . '.' . $called_position;  | 
                                                        
| 1344 | 1326 | $slowlog->called = $module . '.' . $called_method;  | 
                                                        
| 1345 | 1327 | $slowlog->called_extension = $module;  | 
                                                        
| 1346 | -			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); | 
                                                        |
| 1328 | +			if($trigger_name != 'XE.writeSlowlog') { | 
                                                        |
| 1329 | +				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); | 
                                                        |
| 1330 | + }  | 
                                                        |
| 1347 | 1331 | |
| 1348 | 1332 | if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())  | 
                                                        
| 1349 | 1333 |  			{ |