GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 135708...2b55b1 )
by gyeong-won
07:51
created
modules/document/document.view.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * Document printing
23 23
 	 * I make it out to find the geulman;;
24
-	 * @return void|Object
24
+	 * @return Object|null
25 25
 	 */
26 26
 	function dispDocumentPrint()
27 27
 	{
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	/**
54 54
 	 * Preview
55
-	 * @return void
55
+	 * @return Object|null
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	/**
76 76
 	 * Selected by the administrator for the document management
77
-	 * @return void|Object
77
+	 * @return Object|null
78 78
 	 */
79 79
 	function dispDocumentManageDocument()
80 80
 	{
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	/**
157 157
 	 * Document temp saved list
158
-	 * @return void
158
+	 * @return ModuleObject|null
159 159
 	 */
160 160
 	function dispTempSavedList()
161 161
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
39
+		if (!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request');
40 40
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
41
+		if (!$oDocument->isAccessible()) return new Object(-1, 'msg_not_permitted');
42 42
 		// Information setting module
43 43
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 44
 		// Browser title settings
45 45
 		Context::setBrowserTitle($oDocument->getTitleText());
46 46
 		Context::set('oDocument', $oDocument);
47 47
 
48
-		Context::set('layout','none');
48
+		Context::set('layout', 'none');
49 49
 		$this->setTemplatePath($this->module_path.'tpl');
50 50
 		$this->setTemplateFile('print_page');
51 51
 	}
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
59
-		if(!checkCSRF())
59
+		if (!checkCSRF())
60 60
 		{
61 61
 			return new Object(-1, 'msg_invalid_request');
62 62
 		} 
63 63
 
64
-		if(Context::get('logged_info')->is_admin != 'Y')
64
+		if (Context::get('logged_info')->is_admin != 'Y')
65 65
 		{
66 66
 			Context::set('content', removeHackTag(Context::get('content')));
67 67
 		}
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	function dispDocumentManageDocument()
80 80
 	{
81
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
81
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
82 82
 		// Taken from a list of selected sessions
83 83
 		$flag_list = $_SESSION['document_management'];
84
-		if(count($flag_list))
84
+		if (count($flag_list))
85 85
 		{
86
-			foreach($flag_list as $key => $val)
86
+			foreach ($flag_list as $key => $val)
87 87
 			{
88
-				if(!is_bool($val)) continue;
88
+				if (!is_bool($val)) continue;
89 89
 				$document_srl_list[] = $key;
90 90
 			}
91 91
 		}
92 92
 
93
-		if(count($document_srl_list))
93
+		if (count($document_srl_list))
94 94
 		{
95 95
 			$oDocumentModel = getModel('document');
96 96
 			$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$oModuleModel = getModel('module');
101 101
 		// The combination of module categories list and the list of modules
102
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
102
+		if (count($module_list) > 1) Context::set('module_list', $module_categories);
103 103
 
104
-		$module_srl=Context::get('module_srl');
105
-		Context::set('module_srl',$module_srl);
104
+		$module_srl = Context::get('module_srl');
105
+		Context::set('module_srl', $module_srl);
106 106
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
107
-		Context::set('mid',$module_info->mid);
108
-		Context::set('browser_title',$module_info->browser_title);
107
+		Context::set('mid', $module_info->mid);
108
+		Context::set('browser_title', $module_info->browser_title);
109 109
 
110 110
 		// Select Pop-up layout
111 111
 		$this->setLayoutPath('./common/tpl');
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 		$current_module_srl = Context::get('module_srl');
127 127
 		$current_module_srls = Context::get('module_srls');
128 128
 
129
-		if(!$current_module_srl && !$current_module_srls)
129
+		if (!$current_module_srl && !$current_module_srls)
130 130
 		{
131 131
 			// Get information of the current module
132 132
 			$current_module_info = Context::get('current_module_info');
133 133
 			$current_module_srl = $current_module_info->module_srl;
134
-			if(!$current_module_srl) return new Object();
134
+			if (!$current_module_srl) return new Object();
135 135
 		}
136 136
 
137 137
 		$oModuleModel = getModel('module');
138
-		if($current_module_srl)
138
+		if ($current_module_srl)
139 139
 		{
140 140
 			$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
141 141
 		}
142
-		if(!$document_config)
142
+		if (!$document_config)
143 143
 		{
144 144
 			$document_config = new stdClass();
145 145
 		}
146
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
146
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
147 147
 		Context::set('document_config', $document_config);
148 148
 
149 149
 		$oTemplate = &TemplateHandler::getInstance();
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oMemberModel = getModel('member');
165 165
 		// A message appears if the user is not logged-in
166
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
166
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
167 167
 		// Get the saved document (module_srl is set to member_srl instead)
168 168
 		$logged_info = Context::get('logged_info');
169 169
 		$args = new stdClass();
170 170
 		$args->member_srl = $logged_info->member_srl;
171 171
 		$args->statusList = array($this->getConfigStatus('temp'));
172
-		$args->page = (int)Context::get('page');
172
+		$args->page = (int) Context::get('page');
173 173
 		$args->list_count = 10;
174 174
 
175 175
 		$oDocumentModel = getModel('document');
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($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,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// call a trigger before moduleHandler init
104 104
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
105
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
106 106
 		{
107
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110 110
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -115,40 +115,40 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if (file_exists($addon_file)) include($addon_file);
119 119
 	}
120 120
 
121 121
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
122 122
 	{
123
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
123
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
124 124
 		{
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		set_error_handler(function() { }, ~0);
129 129
 
130
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
131
-		if(!file_exists($debug_file))
130
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
131
+		if (!file_exists($debug_file))
132 132
 		{
133 133
 			$print[] = '<?php exit() ?>';
134 134
 		}
135 135
 
136 136
 		$errorname = self::getErrorType($errnumber);
137
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
137
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
138 138
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
139 139
 		$backtrace = debug_backtrace($backtrace_args);
140
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
140
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
141 141
 		{
142 142
 			array_shift($backtrace);
143 143
 		}
144 144
 
145
-		foreach($backtrace as $key => $value)
145
+		foreach ($backtrace as $key => $value)
146 146
 		{
147
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
147
+			$message = '    - '.$value['file'].' : '.$value['line'];
148 148
 			$print[] = $message;
149 149
 		}
150 150
 		$print[] = PHP_EOL;
151
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
151
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
152 152
 		restore_error_handler();
153 153
 
154 154
 		return true;
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 
165 165
 		set_error_handler(function() { }, ~0);
166 166
 
167
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
168
-		if(!file_exists($debug_file))
167
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
168
+		if (!file_exists($debug_file))
169 169
 		{
170 170
 			$print[] = '<?php exit() ?>';
171 171
 		}
172 172
 
173 173
 		$errorname = self::getErrorType($errinfo['type']);
174 174
 		$print[] = '['.date('Y-m-d H:i:s').']';
175
-		$print[] = $errorname . ' : ' . $errinfo['message'];
175
+		$print[] = $errorname.' : '.$errinfo['message'];
176 176
 
177
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
177
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
178 178
 		$print[] = $message;
179 179
 
180 180
 		$print[] = PHP_EOL;
181
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
181
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
182 182
 		set_error_handler(array($this, 'dummyHandler'), ~0);
183 183
 
184 184
 		return true;
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
223 223
 		$defaultHost = $defaultUrlInfo['host'];
224 224
 
225
-		foreach($urls as $url)
225
+		foreach ($urls as $url)
226 226
 		{
227
-			if(empty($url))
227
+			if (empty($url))
228 228
 			{
229 229
 				continue;
230 230
 			}
@@ -232,29 +232,29 @@  discard block
 block discarded – undo
232 232
 			$urlInfo = parse_url($url);
233 233
 			$host = $urlInfo['host'];
234 234
 
235
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
235
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
236 236
 			{
237 237
 				throw new Exception('msg_default_url_is_null');
238 238
 			}
239 239
 		}
240 240
 
241
-		if(!$this->document_srl && $this->mid && $this->entry)
241
+		if (!$this->document_srl && $this->mid && $this->entry)
242 242
 		{
243 243
 			$oDocumentModel = getModel('document');
244 244
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
245
-			if($this->document_srl)
245
+			if ($this->document_srl)
246 246
 			{
247 247
 				Context::set('document_srl', $this->document_srl);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		// Get module's information based on document_srl, if it's specified
252
-		if($this->document_srl)
252
+		if ($this->document_srl)
253 253
 		{
254 254
 
255 255
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
256 256
 			// If the document does not exist, remove document_srl
257
-			if(!$module_info)
257
+			if (!$module_info)
258 258
 			{
259 259
 				unset($this->document_srl);
260 260
 			}
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			{
263 263
 				// If it exists, compare mid based on the module information
264 264
 				// if mids are not matching, set it as the document's mid
265
-				if(!$this->mid || ($this->mid != $module_info->mid))
265
+				if (!$this->mid || ($this->mid != $module_info->mid))
266 266
 				{
267 267
 
268
-					if(Context::getRequestMethod() == 'GET')
268
+					if (Context::getRequestMethod() == 'GET')
269 269
 					{
270 270
 						$this->mid = $module_info->mid;
271
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
271
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 272
 						return FALSE;
273 273
 					}
274 274
 					else
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 				}
281 281
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
282
-				if($this->module && $module_info->module != $this->module)
282
+				if ($this->module && $module_info->module != $this->module)
283 283
 				{
284 284
 					unset($module_info);
285 285
 				}
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
291
-		if(!$module_info && $this->mid)
291
+		if (!$module_info && $this->mid)
292 292
 		{
293 293
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
294 294
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
295 295
 		}
296 296
 
297 297
 		// redirect, if module_site_srl and site_srl are different
298
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
298
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
299 299
 		{
300 300
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
301
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
301
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
302 302
 			return FALSE;
303 303
 		}
304 304
 
305 305
 		// If module_info is not set still, and $module does not exist, find the default module
306
-		if(!$module_info && !$this->module && !$this->mid)
306
+		if (!$module_info && !$this->module && !$this->mid)
307 307
 		{
308 308
 			$module_info = $site_module_info;
309 309
 		}
310 310
 
311
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
311
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316 316
 		// redirect, if site_srl of module_info is different from one of site's module_info
317
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
317
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
318 318
 		{
319 319
 			// If the module is of virtual site
320
-			if($module_info->site_srl)
320
+			if ($module_info->site_srl)
321 321
 			{
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$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'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			else
327 327
 			{
328 328
 				$db_info = Context::getDBInfo();
329
-				if(!$db_info->default_url)
329
+				if (!$db_info->default_url)
330 330
 				{
331 331
 					return Context::getLang('msg_default_url_is_not_defined');
332 332
 				}
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 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'));
336 336
 				}
337 337
 			}
338
-			header("location:" . $redirect_url);
338
+			header("location:".$redirect_url);
339 339
 			return FALSE;
340 340
 		}
341 341
 
342 342
 		// If module info was set, retrieve variables from the module information
343
-		if($module_info)
343
+		if ($module_info)
344 344
 		{
345 345
 			$this->module = $module_info->module;
346 346
 			$this->mid = $module_info->mid;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
352 352
 
353 353
 			// use the site default layout.
354
-			if($module_info->{$targetSrl} == -1)
354
+			if ($module_info->{$targetSrl} == -1)
355 355
 			{
356 356
 				$oLayoutAdminModel = getAdminModel('layout');
357 357
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// Set module and mid into module_info
372
-		if(!isset($this->module_info))
372
+		if (!isset($this->module_info))
373 373
 		{
374 374
 			$this->module_info = new stdClass();
375 375
 		}
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		$this->module_info->site_srl = $site_module_info->site_srl;
381 381
 
382 382
 		// Still no module? it's an error
383
-		if(!$this->module)
383
+		if (!$this->module)
384 384
 		{
385 385
 			$this->error = 'msg_module_is_not_exists';
386 386
 			$this->httpStatusCode = '404';
387 387
 		}
388 388
 
389 389
 		// If mid exists, set mid into context
390
-		if($this->mid)
390
+		if ($this->mid)
391 391
 		{
392 392
 			Context::set('mid', $this->mid, TRUE);
393 393
 		}
394 394
 
395 395
 		// Call a trigger after moduleHandler init
396 396
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
397
-		if(!$output->toBool())
397
+		if (!$output->toBool())
398 398
 		{
399 399
 			$this->error = $output->getMessage();
400 400
 			return TRUE;
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
417 417
 
418 418
 		// If error occurred while preparation, return a message instance
419
-		if($this->error)
419
+		if ($this->error)
420 420
 		{
421 421
 			$this->_setInputErrorToContext();
422 422
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
423 423
 			$oMessageObject->setError(-1);
424 424
 			$oMessageObject->setMessage($this->error);
425 425
 			$oMessageObject->dispMessage();
426
-			if($this->httpStatusCode)
426
+			if ($this->httpStatusCode)
427 427
 			{
428 428
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
429 429
 			}
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
435 435
 
436 436
 		// If not installed yet, modify act
437
-		if($this->module == "install")
437
+		if ($this->module == "install")
438 438
 		{
439
-			if(!$this->act || !$xml_info->action->{$this->act})
439
+			if (!$this->act || !$xml_info->action->{$this->act})
440 440
 			{
441 441
 				$this->act = $xml_info->default_index_act;
442 442
 			}
443 443
 		}
444 444
 
445 445
 		// if act exists, find type of the action, if not use default index act
446
-		if(!$this->act)
446
+		if (!$this->act)
447 447
 		{
448 448
 			$this->act = $xml_info->default_index_act;
449 449
 		}
450 450
 
451 451
 		// still no act means error
452
-		if(!$this->act)
452
+		if (!$this->act)
453 453
 		{
454 454
 			$this->error = 'msg_module_is_not_exists';
455 455
 			$this->httpStatusCode = '404';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 		$type = $xml_info->action->{$this->act}->type;
471 471
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
472 472
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
473
-		if(!$kind && $this->module == 'admin')
473
+		if (!$kind && $this->module == 'admin')
474 474
 		{
475 475
 			$kind = 'admin';
476 476
 		}
477 477
 
478 478
 		// check REQUEST_METHOD in controller
479
-		if($type == 'controller')
479
+		if ($type == 'controller')
480 480
 		{
481 481
 			$allowedMethod = $xml_info->action->{$this->act}->method;
482 482
 
483
-			if(!$allowedMethod)
483
+			if (!$allowedMethod)
484 484
 			{
485 485
 				$allowedMethodList[0] = 'POST';
486 486
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 490
 			}
491 491
 
492
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
492
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
493 493
 			{
494 494
 				$this->error = "msg_invalid_request";
495 495
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if($this->module_info->use_mobile != "Y")
503
+		if ($this->module_info->use_mobile != "Y")
504 504
 		{
505 505
 			Mobile::setMobile(FALSE);
506 506
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$logged_info = Context::get('logged_info');
509 509
 
510 510
 		// check CSRF for POST actions
511
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
511
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
512 512
 			$this->error = 'msg_invalid_request';
513 513
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
514 514
 			$oMessageObject->setError(-1);
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		}
519 519
 
520 520
 		// Admin ip
521
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
521
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
522 522
 		{
523 523
 			$this->_setInputErrorToContext();
524 524
 			$this->error = "msg_not_permitted_act";
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 		}
531 531
 
532 532
 		// if(type == view, and case for using mobilephone)
533
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
533
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
534 534
 		{
535 535
 			$orig_type = "view";
536 536
 			$type = "mobile";
537 537
 			// create a module instance
538 538
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
539
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
539
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
540 540
 			{
541 541
 				$type = $orig_type;
542 542
 				Mobile::setMobile(FALSE);
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
550 550
 		}
551 551
 
552
-		if(!is_object($oModule))
552
+		if (!is_object($oModule))
553 553
 		{
554 554
 			$this->_setInputErrorToContext();
555 555
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
556 556
 			$oMessageObject->setError(-1);
557 557
 			$oMessageObject->setMessage($this->error);
558 558
 			$oMessageObject->dispMessage();
559
-			if($this->httpStatusCode)
559
+			if ($this->httpStatusCode)
560 560
 			{
561 561
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
562 562
 			}
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 		}
565 565
 
566 566
 		// If there is no such action in the module object
567
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
567
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
568 568
 		{
569 569
 
570
-			if(!Context::isInstalled())
570
+			if (!Context::isInstalled())
571 571
 			{
572 572
 				$this->_setInputErrorToContext();
573 573
 				$this->error = 'msg_invalid_request';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 				$oMessageObject->setError(-1);
576 576
 				$oMessageObject->setMessage($this->error);
577 577
 				$oMessageObject->dispMessage();
578
-				if($this->httpStatusCode)
578
+				if ($this->httpStatusCode)
579 579
 				{
580 580
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
581 581
 				}
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
 
585 585
 			$forward = NULL;
586 586
 			// 1. Look for the module with action name
587
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
587
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
588 588
 			{
589
-				$module = strtolower($matches[2] . $matches[3]);
589
+				$module = strtolower($matches[2].$matches[3]);
590 590
 				$xml_info = $oModuleModel->getModuleActionXml($module);
591 591
 
592
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
592
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
593 593
 				{
594 594
 					$forward = new stdClass();
595 595
 					$forward->module = $module;
@@ -609,12 +609,12 @@  discard block
 block discarded – undo
609 609
 				}
610 610
 			}
611 611
 
612
-			if(!$forward)
612
+			if (!$forward)
613 613
 			{
614 614
 				$forward = $oModuleModel->getActionForward($this->act);
615 615
 			}
616 616
 
617
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
617
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
618 618
 			{
619 619
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
620 620
 				$type = $forward->type;
@@ -626,11 +626,11 @@  discard block
 block discarded – undo
626 626
 
627 627
 				// SECISSUE also check foward act method
628 628
 				// check REQUEST_METHOD in controller
629
-				if($type == 'controller')
629
+				if ($type == 'controller')
630 630
 				{
631 631
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
632 632
 
633
-					if(!$allowedMethod)
633
+					if (!$allowedMethod)
634 634
 					{
635 635
 						$allowedMethodList[0] = 'POST';
636 636
 					}
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
640 640
 					}
641 641
 
642
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
642
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
643 643
 					{
644 644
 						$this->error = "msg_invalid_request";
645 645
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 					}
651 651
 				}
652 652
 
653
-				if($type == "view" && Mobile::isFromMobilePhone())
653
+				if ($type == "view" && Mobile::isFromMobilePhone())
654 654
 				{
655 655
 					$orig_type = "view";
656 656
 					$type = "mobile";
657 657
 					// create a module instance
658 658
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
659
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
659
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
660 660
 					{
661 661
 						$type = $orig_type;
662 662
 						Mobile::setMobile(FALSE);
@@ -668,25 +668,25 @@  discard block
 block discarded – undo
668 668
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
669 669
 				}
670 670
 
671
-				if(!is_object($oModule))
671
+				if (!is_object($oModule))
672 672
 				{
673 673
 					$this->_setInputErrorToContext();
674 674
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
675 675
 					$oMessageObject->setError(-1);
676 676
 					$oMessageObject->setMessage('msg_module_is_not_exists');
677 677
 					$oMessageObject->dispMessage();
678
-					if($this->httpStatusCode)
678
+					if ($this->httpStatusCode)
679 679
 					{
680 680
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
681 681
 					}
682 682
 					return $oMessageObject;
683 683
 				}
684 684
 
685
-				if($this->module == "admin" && $type == "view")
685
+				if ($this->module == "admin" && $type == "view")
686 686
 				{
687
-					if($logged_info->is_admin == 'Y')
687
+					if ($logged_info->is_admin == 'Y')
688 688
 					{
689
-						if($this->act != 'dispLayoutAdminLayoutModify')
689
+						if ($this->act != 'dispLayoutAdminLayoutModify')
690 690
 						{
691 691
 							$oAdminView = getAdminView('admin');
692 692
 							$oAdminView->makeGnbUrl($forward->module);
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 						return $oMessageObject;
707 707
 					}
708 708
 				}
709
-				if($kind == 'admin')
709
+				if ($kind == 'admin')
710 710
 				{
711 711
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
712
-					if(!$grant->manager)
712
+					if (!$grant->manager)
713 713
 					{
714 714
 						$this->_setInputErrorToContext();
715 715
 						$this->error = 'msg_is_not_manager';
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 					}
722 722
 					else
723 723
 					{
724
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
724
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
725 725
 						{
726 726
 							$this->_setInputErrorToContext();
727 727
 							$this->error = 'msg_is_not_administrator';
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 					}
735 735
 				}
736 736
 			}
737
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
737
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
738 738
 			{
739 739
 				$this->act = $xml_info->default_index_act;
740 740
 			}
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 		}
749 749
 
750 750
 		// ruleset check...
751
-		if(!empty($ruleset))
751
+		if (!empty($ruleset))
752 752
 		{
753 753
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
754 754
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
755
-			if(!empty($rulesetFile))
755
+			if (!empty($rulesetFile))
756 756
 			{
757
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
757
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
758 758
 				{
759 759
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
760
-					foreach($errorLang as $key => $val)
760
+					foreach ($errorLang as $key => $val)
761 761
 					{
762 762
 						Context::setLang($key, $val);
763 763
 					}
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 				$Validator = new Validator($rulesetFile);
768 768
 				$result = $Validator->validate();
769
-				if(!$result)
769
+				if (!$result)
770 770
 				{
771 771
 					$lastError = $Validator->getLastError();
772 772
 					$returnUrl = Context::get('error_return_url');
@@ -798,26 +798,26 @@  discard block
 block discarded – undo
798 798
 				'dispLayoutPreviewWithModule' => 1
799 799
 		);
800 800
 		$db_use_mobile = Mobile::isMobileEnabled();
801
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
801
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
802 802
 		{
803 803
 			global $lang;
804 804
 			$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>';
805
-			$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>';
805
+			$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>';
806 806
 			Context::addHtmlHeader($header);
807 807
 			Context::addHtmlFooter($footer);
808 808
 		}
809 809
 
810
-		if($type == "view" && $kind != 'admin')
810
+		if ($type == "view" && $kind != 'admin')
811 811
 		{
812 812
 			$module_config = $oModuleModel->getModuleConfig('module');
813
-			if($module_config->htmlFooter)
813
+			if ($module_config->htmlFooter)
814 814
 			{
815 815
 				Context::addHtmlFooter($module_config->htmlFooter);
816 816
 			}
817
-			if($module_config->siteTitle)
817
+			if ($module_config->siteTitle)
818 818
 			{
819 819
 				$siteTitle = Context::getBrowserTitle();
820
-				if(!$siteTitle)
820
+				if (!$siteTitle)
821 821
 				{
822 822
 					Context::setBrowserTitle($module_config->siteTitle);
823 823
 				}
@@ -830,18 +830,18 @@  discard block
 block discarded – undo
830 830
 		$procResult = $oModule->proc();
831 831
 
832 832
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
833
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
833
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
834 834
 		{
835 835
 			$error = $oModule->getError();
836 836
 			$message = $oModule->getMessage();
837 837
 			$messageType = $oModule->getMessageType();
838 838
 			$redirectUrl = $oModule->getRedirectUrl();
839
-			if($messageType == 'error') debugPrint($message, 'ERROR');
839
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
840 840
 
841
-			if(!$procResult)
841
+			if (!$procResult)
842 842
 			{
843 843
 				$this->error = $message;
844
-				if(!$redirectUrl && Context::get('error_return_url'))
844
+				if (!$redirectUrl && Context::get('error_return_url'))
845 845
 				{
846 846
 					$redirectUrl = Context::get('error_return_url');
847 847
 				}
@@ -854,13 +854,13 @@  discard block
 block discarded – undo
854 854
 
855 855
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
856 856
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
857
-			if($message != 'success')
857
+			if ($message != 'success')
858 858
 			{
859 859
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
860 860
 			}
861 861
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
862 862
 
863
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
863
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
864 864
 			{
865 865
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
866 866
 			}
@@ -876,27 +876,27 @@  discard block
 block discarded – undo
876 876
 	 * */
877 877
 	function _setInputErrorToContext()
878 878
 	{
879
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
879
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
880 880
 		{
881 881
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
882 882
 		}
883
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
883
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
884 884
 		{
885 885
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
886 886
 		}
887
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
887
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
888 888
 		{
889 889
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
890 890
 		}
891
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
891
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
892 892
 		{
893 893
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
894 894
 		}
895
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
895
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
896 896
 		{
897 897
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
898 898
 		}
899
-		if(count($_SESSION['INPUT_ERROR']))
899
+		if (count($_SESSION['INPUT_ERROR']))
900 900
 		{
901 901
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
902 902
 		}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	{
927 927
 		$requestVars = Context::getRequestVars();
928 928
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
929
-		foreach($requestVars AS $key => $value)
929
+		foreach ($requestVars AS $key => $value)
930 930
 		{
931 931
 			$_SESSION['INPUT_ERROR'][$key] = $value;
932 932
 		}
@@ -940,41 +940,41 @@  discard block
 block discarded – undo
940 940
 	function displayContent($oModule = NULL)
941 941
 	{
942 942
 		// If the module is not set or not an object, set error
943
-		if(!$oModule || !is_object($oModule))
943
+		if (!$oModule || !is_object($oModule))
944 944
 		{
945 945
 			$this->error = 'msg_module_is_not_exists';
946 946
 			$this->httpStatusCode = '404';
947 947
 		}
948 948
 
949 949
 		// If connection to DB has a problem even though it's not install module, set error
950
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
950
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
951 951
 		{
952 952
 			$this->error = 'msg_dbconnect_failed';
953 953
 		}
954 954
 
955 955
 		// Call trigger after moduleHandler proc
956 956
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
957
-		if(!$output->toBool())
957
+		if (!$output->toBool())
958 958
 		{
959 959
 			$this->error = $output->getMessage();
960 960
 		}
961 961
 
962 962
 		// Use message view object, if HTML call
963 963
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
964
-		if(!isset($methodList[Context::getRequestMethod()]))
964
+		if (!isset($methodList[Context::getRequestMethod()]))
965 965
 		{
966 966
 
967
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
967
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
968 968
 			{
969 969
 				$display_handler = new DisplayHandler();
970 970
 				$display_handler->_debugOutput();
971 971
 
972
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
972
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
973 973
 				return;
974 974
 			}
975 975
 
976 976
 			// If error occurred, handle it
977
-			if($this->error)
977
+			if ($this->error)
978 978
 			{
979 979
 				// display content with message module instance
980 980
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -983,14 +983,14 @@  discard block
 block discarded – undo
983 983
 				$oMessageObject->setMessage($this->error);
984 984
 				$oMessageObject->dispMessage();
985 985
 
986
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
986
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
987 987
 				{
988 988
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
989 989
 					$oMessageObject->setTemplateFile('http_status_code');
990 990
 				}
991 991
 
992 992
 				// If module was called normally, change the templates of the module into ones of the message view module
993
-				if($oModule)
993
+				if ($oModule)
994 994
 				{
995 995
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
996 996
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			}
1006 1006
 
1007 1007
 			// Check if layout_srl exists for the module
1008
-			if(Mobile::isFromMobilePhone())
1008
+			if (Mobile::isFromMobilePhone())
1009 1009
 			{
1010 1010
 				$layout_srl = $oModule->module_info->mlayout_srl;
1011 1011
 			}
@@ -1015,58 +1015,58 @@  discard block
 block discarded – undo
1015 1015
 			}
1016 1016
 
1017 1017
 			// if layout_srl is rollback by module, set default layout
1018
-			if($layout_srl == -1)
1018
+			if ($layout_srl == -1)
1019 1019
 			{
1020 1020
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1021 1021
 				$oLayoutAdminModel = getAdminModel('layout');
1022 1022
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1023 1023
 			}
1024 1024
 
1025
-			if($layout_srl && !$oModule->getLayoutFile())
1025
+			if ($layout_srl && !$oModule->getLayoutFile())
1026 1026
 			{
1027 1027
 
1028 1028
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1029 1029
 				$oLayoutModel = getModel('layout');
1030 1030
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1031
-				if($layout_info)
1031
+				if ($layout_info)
1032 1032
 				{
1033 1033
 
1034 1034
 					// Input extra_vars into $layout_info
1035
-					if($layout_info->extra_var_count)
1035
+					if ($layout_info->extra_var_count)
1036 1036
 					{
1037 1037
 
1038
-						foreach($layout_info->extra_var as $var_id => $val)
1038
+						foreach ($layout_info->extra_var as $var_id => $val)
1039 1039
 						{
1040
-							if($val->type == 'image')
1040
+							if ($val->type == 'image')
1041 1041
 							{
1042
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1042
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1043 1043
 								{
1044
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1044
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1045 1045
 								}
1046 1046
 							}
1047 1047
 							$layout_info->{$var_id} = $val->value;
1048 1048
 						}
1049 1049
 					}
1050 1050
 					// Set menus into context
1051
-					if($layout_info->menu_count)
1051
+					if ($layout_info->menu_count)
1052 1052
 					{
1053
-						foreach($layout_info->menu as $menu_id => $menu)
1053
+						foreach ($layout_info->menu as $menu_id => $menu)
1054 1054
 						{
1055 1055
 							// set default menu set(included home menu)
1056
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1056
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1057 1057
 							{
1058 1058
 								$oMenuAdminController = getAdminController('menu');
1059 1059
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1060 1060
 
1061
-								if(FileHandler::exists($homeMenuCacheFile))
1061
+								if (FileHandler::exists($homeMenuCacheFile))
1062 1062
 								{
1063 1063
 									include($homeMenuCacheFile);
1064 1064
 								}
1065 1065
 
1066
-								if(!$menu->menu_srl)
1066
+								if (!$menu->menu_srl)
1067 1067
 								{
1068
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1069
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1068
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1069
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1070 1070
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1071 1071
 								}
1072 1072
 								else
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 							}
1078 1078
 
1079 1079
 							$php_file = FileHandler::exists($menu->php_file);
1080
-							if($php_file)
1080
+							if ($php_file)
1081 1081
 							{
1082 1082
 								include($php_file);
1083 1083
 							}
@@ -1093,17 +1093,17 @@  discard block
 block discarded – undo
1093 1093
 
1094 1094
 					// If layout was modified, use the modified version
1095 1095
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1096
-					if(file_exists($edited_layout))
1096
+					if (file_exists($edited_layout))
1097 1097
 					{
1098 1098
 						$oModule->setEditedLayoutFile($edited_layout);
1099 1099
 					}
1100 1100
 				}
1101 1101
 			}
1102 1102
 			$isLayoutDrop = Context::get('isLayoutDrop');
1103
-			if($isLayoutDrop)
1103
+			if ($isLayoutDrop)
1104 1104
 			{
1105 1105
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1106
-				if($kind == 'admin')
1106
+				if ($kind == 'admin')
1107 1107
 				{
1108 1108
 					$oModule->setLayoutFile('popup_layout');
1109 1109
 				}
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1142 1142
 	{
1143 1143
 
1144
-		if(__DEBUG__ == 3)
1144
+		if (__DEBUG__ == 3)
1145 1145
 		{
1146 1146
 			$start_time = getMicroTime();
1147 1147
 		}
@@ -1151,51 +1151,51 @@  discard block
 block discarded – undo
1151 1151
 		$type = strtolower($type);
1152 1152
 
1153 1153
 		$kinds = array('svc' => 1, 'admin' => 1);
1154
-		if(!isset($kinds[$kind]))
1154
+		if (!isset($kinds[$kind]))
1155 1155
 		{
1156 1156
 			$kind = 'svc';
1157 1157
 		}
1158 1158
 
1159
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1159
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1160 1160
 
1161
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1161
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1162 1162
 		{
1163 1163
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1164 1164
 		}
1165 1165
 
1166 1166
 		// if there is no instance of the module in global variable, create a new one
1167
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1167
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1168 1168
 		{
1169 1169
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1170 1170
 
1171
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1171
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1172 1172
 			{
1173 1173
 				$module = $parent_module;
1174 1174
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1175 1175
 			}
1176 1176
 
1177 1177
 			// Check if the base class and instance class exist
1178
-			if(!class_exists($module, true))
1178
+			if (!class_exists($module, true))
1179 1179
 			{
1180 1180
 				return NULL;
1181 1181
 			}
1182
-			if(!class_exists($instance_name, true))
1182
+			if (!class_exists($instance_name, true))
1183 1183
 			{
1184 1184
 				return NULL;
1185 1185
 			}
1186 1186
 
1187 1187
 			// Create an instance
1188 1188
 			$oModule = new $instance_name();
1189
-			if(!is_object($oModule))
1189
+			if (!is_object($oModule))
1190 1190
 			{
1191 1191
 				return NULL;
1192 1192
 			}
1193 1193
 
1194 1194
 			// Load language files for the class
1195
-			Context::loadLang($class_path . 'lang');
1196
-			if($extend_module)
1195
+			Context::loadLang($class_path.'lang');
1196
+			if ($extend_module)
1197 1197
 			{
1198
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1198
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1199 1199
 			}
1200 1200
 
1201 1201
 			// Set variables to the instance
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
 			$oModule->setModulePath($class_path);
1204 1204
 
1205 1205
 			// If the module has a constructor, run it.
1206
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1206
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1207 1207
 			{
1208 1208
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1209
-				if(@method_exists($oModule, $instance_name))
1209
+				if (@method_exists($oModule, $instance_name))
1210 1210
 				{
1211 1211
 					$oModule->{$instance_name}();
1212 1212
 				}
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1217 1217
 		}
1218 1218
 
1219
-		if(__DEBUG__ == 3)
1219
+		if (__DEBUG__ == 3)
1220 1220
 		{
1221 1221
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1222 1222
 		}
@@ -1232,17 +1232,17 @@  discard block
 block discarded – undo
1232 1232
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1233 1233
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1234 1234
 
1235
-		$types = array('view','controller','model','api','wap','mobile','class');
1236
-		if(!in_array($type, $types))
1235
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1236
+		if (!in_array($type, $types))
1237 1237
 		{
1238 1238
 			$type = $types[0];
1239 1239
 		}
1240
-		if($type == 'class')
1240
+		if ($type == 'class')
1241 1241
 		{
1242 1242
 			$instanceName = '%s';
1243 1243
 			$classFile = '%s%s.%s.php';
1244 1244
 		}
1245
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1245
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1246 1246
 		{
1247 1247
 			$instanceName = '%sAdmin%s';
1248 1248
 			$classFile = '%s%s.admin.%s.php';
@@ -1267,26 +1267,26 @@  discard block
 block discarded – undo
1267 1267
 	function triggerCall($trigger_name, $called_position, &$obj)
1268 1268
 	{
1269 1269
 		// skip if not installed
1270
-		if(!Context::isInstalled())
1270
+		if (!Context::isInstalled())
1271 1271
 		{
1272 1272
 			return new Object();
1273 1273
 		}
1274 1274
 
1275 1275
 		$oModuleModel = getModel('module');
1276 1276
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1277
-		if(!$triggers || count($triggers) < 1)
1277
+		if (!$triggers || count($triggers) < 1)
1278 1278
 		{
1279 1279
 			return new Object();
1280 1280
 		}
1281 1281
 
1282 1282
 		//store before trigger call time
1283 1283
 		$before_trigger_time = NULL;
1284
-		if(__LOG_SLOW_TRIGGER__> 0)
1284
+		if (__LOG_SLOW_TRIGGER__ > 0)
1285 1285
 		{
1286 1286
 			$before_trigger_time = microtime(true);
1287 1287
 		}
1288 1288
 
1289
-		foreach($triggers as $item)
1289
+		foreach ($triggers as $item)
1290 1290
 		{
1291 1291
 			$module = $item->module;
1292 1292
 			$type = $item->type;
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 
1295 1295
 			// todo why don't we call a normal class object ?
1296 1296
 			$oModule = getModule($module, $type);
1297
-			if(!$oModule || !method_exists($oModule, $called_method))
1297
+			if (!$oModule || !method_exists($oModule, $called_method))
1298 1298
 			{
1299 1299
 				continue;
1300 1300
 			}
@@ -1307,12 +1307,12 @@  discard block
 block discarded – undo
1307 1307
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1308 1308
 
1309 1309
 			$slowlog = new stdClass;
1310
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1311
-			$slowlog->called = $module . '.' . $called_method;
1310
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1311
+			$slowlog->called = $module.'.'.$called_method;
1312 1312
 			$slowlog->called_extension = $module;
1313
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1313
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1314 1314
 
1315
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1315
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1316 1316
 			{
1317 1317
 				return $output;
1318 1318
 			}
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 			'511' => 'Network Authentication Required',
1398 1398
 		);
1399 1399
 		$statusMessage = $statusMessageList[$code];
1400
-		if(!$statusMessage)
1400
+		if (!$statusMessage)
1401 1401
 		{
1402
-			$statusMessage = 'HTTP ' . $code;
1402
+			$statusMessage = 'HTTP '.$code;
1403 1403
 		}
1404 1404
 
1405 1405
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Spacing   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		include($self::getConfigFile());
456 456
 
457 457
 		// If master_db information does not exist, the config file needs to be updated
458
-		if(!isset($db_info->master_db))
458
+		if (!isset($db_info->master_db))
459 459
 		{
460 460
 			$db_info->master_db = array();
461 461
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
474 474
 			unset($db_info->db_table_prefix);
475 475
 
476
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
476
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
477 477
 			{
478 478
 				$db_info->master_db["db_table_prefix"] .= '_';
479 479
 			}
@@ -485,33 +485,33 @@  discard block
 block discarded – undo
485 485
 			$oInstallController->makeConfigFile();
486 486
 		}
487 487
 
488
-		if(!$db_info->use_prepared_statements)
488
+		if (!$db_info->use_prepared_statements)
489 489
 		{
490 490
 			$db_info->use_prepared_statements = 'Y';
491 491
 		}
492 492
 
493
-		if(!$db_info->time_zone)
493
+		if (!$db_info->time_zone)
494 494
 			$db_info->time_zone = date('O');
495 495
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 496
 
497
-		if($db_info->qmail_compatibility != 'Y')
497
+		if ($db_info->qmail_compatibility != 'Y')
498 498
 			$db_info->qmail_compatibility = 'N';
499 499
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 500
 
501
-		if(!$db_info->use_db_session)
501
+		if (!$db_info->use_db_session)
502 502
 			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
503
+		if (!$db_info->use_ssl)
504 504
 			$db_info->use_ssl = 'none';
505 505
 		$this->set('_use_ssl', $db_info->use_ssl);
506 506
 
507 507
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
508 508
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
509 509
 
510
-		if(!$db_info->sitelock_whitelist) {
510
+		if (!$db_info->sitelock_whitelist) {
511 511
 			$db_info->sitelock_whitelist = '127.0.0.1';
512 512
 		}
513 513
 
514
-		if(is_string($db_info->sitelock_whitelist)) {
514
+		if (is_string($db_info->sitelock_whitelist)) {
515 515
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
516 516
 		}
517 517
 
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
 	function loadLangSupported()
583 583
 	{
584 584
 		static $lang_supported = null;
585
-		if(!$lang_supported)
585
+		if (!$lang_supported)
586 586
 		{
587
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
588
-			foreach($langs as $val)
587
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
588
+			foreach ($langs as $val)
589 589
 			{
590 590
 				list($lang_prefix, $lang_text) = explode(',', $val);
591 591
 				$lang_text = trim($lang_text);
@@ -603,17 +603,17 @@  discard block
 block discarded – undo
603 603
 	function loadLangSelected()
604 604
 	{
605 605
 		static $lang_selected = null;
606
-		if(!$lang_selected)
606
+		if (!$lang_selected)
607 607
 		{
608
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
609
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
610
-			if(!FileHandler::hasContent($selected_lang_file))
608
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
609
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
610
+			if (!FileHandler::hasContent($selected_lang_file))
611 611
 			{
612
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
612
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
613 613
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
614 614
 			}
615 615
 
616
-			if(!FileHandler::hasContent($selected_lang_file))
616
+			if (!FileHandler::hasContent($selected_lang_file))
617 617
 			{
618 618
 				$buff = FileHandler::readFile($orig_lang_file);
619 619
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			else
623 623
 			{
624 624
 				$langs = file($selected_lang_file);
625
-				foreach($langs as $val)
625
+				foreach ($langs as $val)
626 626
 				{
627 627
 					list($lang_prefix, $lang_text) = explode(',', $val);
628 628
 					$lang_text = trim($lang_text);
@@ -641,56 +641,56 @@  discard block
 block discarded – undo
641 641
 	function checkSSO()
642 642
 	{
643 643
 		// pass if it's not GET request or XE is not yet installed
644
-		if($this->db_info->use_sso != 'Y' || isCrawler())
644
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
645 645
 		{
646 646
 			return TRUE;
647 647
 		}
648 648
 		$checkActList = array('rss' => 1, 'atom' => 1);
649
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
649
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
650 650
 		{
651 651
 			return TRUE;
652 652
 		}
653 653
 
654 654
 		// pass if default URL is not set
655 655
 		$default_url = trim($this->db_info->default_url);
656
-		if(!$default_url)
656
+		if (!$default_url)
657 657
 		{
658 658
 			return TRUE;
659 659
 		}
660 660
 
661
-		if(substr_compare($default_url, '/', -1) !== 0)
661
+		if (substr_compare($default_url, '/', -1) !== 0)
662 662
 		{
663 663
 			$default_url .= '/';
664 664
 		}
665 665
 
666 666
 		// for sites recieving SSO valdiation
667
-		if($default_url == self::getRequestUri())
667
+		if ($default_url == self::getRequestUri())
668 668
 		{
669
-			if(self::get('url'))
669
+			if (self::get('url'))
670 670
 			{
671 671
 				$url = base64_decode(self::get('url'));
672 672
 				$url_info = parse_url($url);
673
-				if(!Password::checkSignature($url, self::get('sig')))
673
+				if (!Password::checkSignature($url, self::get('sig')))
674 674
 				{
675 675
 					echo self::get('lang')->msg_invalid_request;
676 676
 					return false;
677 677
 				}
678 678
 
679 679
 				$oModuleModel = getModel('module');
680
-				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
680
+				$domain = $url_info['host'].$url_info['path'];
681
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682 682
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 683
 
684
-				if($site_info->site_srl)
684
+				if ($site_info->site_srl)
685 685
 				{
686
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
686
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
687
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
688 688
 				}
689 689
 				else
690 690
 				{
691 691
 					$redirect_url = $url;
692 692
 				}
693
-				header('location:' . $redirect_url);
693
+				header('location:'.$redirect_url);
694 694
 
695 695
 				return FALSE;
696 696
 			}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 		else
700 700
 		{
701 701
 			// result handling : set session_name()
702
-			if($session_name = self::get('SSOID'))
702
+			if ($session_name = self::get('SSOID'))
703 703
 			{
704
-				if(!Password::checkSignature($session_name, self::get('sig')))
704
+				if (!Password::checkSignature($session_name, self::get('sig')))
705 705
 				{
706 706
 					echo self::get('lang')->msg_invalid_request;
707 707
 					return false;
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
 				setcookie(session_name(), $session_name);
711 711
 
712 712
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
713
-				header('location:' . $url);
713
+				header('location:'.$url);
714 714
 				return FALSE;
715 715
 				// send SSO request
716 716
 			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
717
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 718
 			{
719 719
 				setcookie('sso', md5(self::getRequestUri()));
720 720
 				$origin_url = self::getRequestUrl();
721 721
 				$origin_sig = Password::createSignature($origin_url);
722 722
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
723
-				header('location:' . $url);
723
+				header('location:'.$url);
724 724
 				return FALSE;
725 725
 			}
726 726
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		$self = self::getInstance();
749 749
 
750
-		if(!$self->isFTPRegisted())
750
+		if (!$self->isFTPRegisted())
751 751
 		{
752 752
 			return null;
753 753
 		}
@@ -765,15 +765,15 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	function addBrowserTitle($site_title)
767 767
 	{
768
-		if(!$site_title)
768
+		if (!$site_title)
769 769
 		{
770 770
 			return;
771 771
 		}
772 772
 		$self = self::getInstance();
773 773
 
774
-		if($self->site_title)
774
+		if ($self->site_title)
775 775
 		{
776
-			$self->site_title .= ' - ' . $site_title;
776
+			$self->site_title .= ' - '.$site_title;
777 777
 		}
778 778
 		else
779 779
 		{
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 */
790 790
 	function setBrowserTitle($site_title)
791 791
 	{
792
-		if(!$site_title)
792
+		if (!$site_title)
793 793
 		{
794 794
 			return;
795 795
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		$oModuleModel = getModel('module');
822 822
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
823 823
 
824
-		if(isset($moduleConfig->siteTitle))
824
+		if (isset($moduleConfig->siteTitle))
825 825
 		{
826 826
 			return $moduleConfig->siteTitle;
827 827
 		}
@@ -848,30 +848,30 @@  discard block
 block discarded – undo
848 848
 		global $lang;
849 849
 
850 850
 		$self = self::getInstance();
851
-		if(!$self->lang_type)
851
+		if (!$self->lang_type)
852 852
 		{
853 853
 			return;
854 854
 		}
855
-		if(!is_object($lang))
855
+		if (!is_object($lang))
856 856
 		{
857 857
 			$lang = new stdClass;
858 858
 		}
859 859
 
860
-		if(!($filename = $self->_loadXmlLang($path)))
860
+		if (!($filename = $self->_loadXmlLang($path)))
861 861
 		{
862 862
 			$filename = $self->_loadPhpLang($path);
863 863
 		}
864 864
 
865
-		if(!is_array($self->loaded_lang_files))
865
+		if (!is_array($self->loaded_lang_files))
866 866
 		{
867 867
 			$self->loaded_lang_files = array();
868 868
 		}
869
-		if(in_array($filename, $self->loaded_lang_files))
869
+		if (in_array($filename, $self->loaded_lang_files))
870 870
 		{
871 871
 			return;
872 872
 		}
873 873
 
874
-		if($filename && is_readable($filename))
874
+		if ($filename && is_readable($filename))
875 875
 		{
876 876
 			$self->loaded_lang_files[] = $filename;
877 877
 			include($filename);
@@ -892,24 +892,24 @@  discard block
 block discarded – undo
892 892
 	{
893 893
 		global $lang;
894 894
 
895
-		if(!$path) return;
895
+		if (!$path) return;
896 896
 
897
-		$_path = 'eval://' . $path;
897
+		$_path = 'eval://'.$path;
898 898
 
899
-		if(in_array($_path, $this->loaded_lang_files))
899
+		if (in_array($_path, $this->loaded_lang_files))
900 900
 		{
901 901
 			return;
902 902
 		}
903 903
 
904
-		if(substr_compare($path, '/', -1) !== 0)
904
+		if (substr_compare($path, '/', -1) !== 0)
905 905
 		{
906 906
 			$path .= '/';
907 907
 		}
908 908
 
909
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
909
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
910 910
 		$content = $oXmlLangParser->getCompileContent();
911 911
 
912
-		if($content)
912
+		if ($content)
913 913
 		{
914 914
 			$this->loaded_lang_files[] = $_path;
915 915
 			eval($content);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadXmlLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
929
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
930 930
 		return $oXmlLangParser->compile();
931 931
 	}
932 932
 
@@ -938,22 +938,22 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	function _loadPhpLang($path)
940 940
 	{
941
-		if(!$path) return;
941
+		if (!$path) return;
942 942
 
943
-		if(substr_compare($path, '/', -1) !== 0)
943
+		if (substr_compare($path, '/', -1) !== 0)
944 944
 		{
945 945
 			$path .= '/';
946 946
 		}
947
-		$path_tpl = $path . '%s.lang.php';
947
+		$path_tpl = $path.'%s.lang.php';
948 948
 		$file = sprintf($path_tpl, $this->lang_type);
949 949
 
950 950
 		$langs = array('ko', 'en'); // this will be configurable.
951
-		while(!is_readable($file) && $langs[0])
951
+		while (!is_readable($file) && $langs[0])
952 952
 		{
953 953
 			$file = sprintf($path_tpl, array_shift($langs));
954 954
 		}
955 955
 
956
-		if(!is_readable($file))
956
+		if (!is_readable($file))
957 957
 		{
958 958
 			return FALSE;
959 959
 		}
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	function getLang($code)
997 997
 	{
998
-		if(!$code)
998
+		if (!$code)
999 999
 		{
1000 1000
 			return;
1001 1001
 		}
1002
-		if($GLOBALS['lang']->{$code})
1002
+		if ($GLOBALS['lang']->{$code})
1003 1003
 		{
1004 1004
 			return $GLOBALS['lang']->{$code};
1005 1005
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	function setLang($code, $val)
1017 1017
 	{
1018
-		if(!isset($GLOBALS['lang']))
1018
+		if (!isset($GLOBALS['lang']))
1019 1019
 		{
1020 1020
 			$GLOBALS['lang'] = new stdClass();
1021 1021
 		}
@@ -1043,17 +1043,17 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$obj = clone $source_obj;
1045 1045
 
1046
-		foreach($charset_list as $charset)
1046
+		foreach ($charset_list as $charset)
1047 1047
 		{
1048
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1048
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1049 1049
 			$flag = self::checkConvertFlag($flag = TRUE);
1050
-			if($flag)
1050
+			if ($flag)
1051 1051
 			{
1052
-				if($charset == 'UTF-8')
1052
+				if ($charset == 'UTF-8')
1053 1053
 				{
1054 1054
 					return $obj;
1055 1055
 				}
1056
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1056
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1057 1057
 				return $obj;
1058 1058
 			}
1059 1059
 		}
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1073
 	{
1074 1074
 		static $flag = TRUE;
1075
-		if($charset)
1075
+		if ($charset)
1076 1076
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1077
+			if (is_array($val))
1078
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1079
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1080 1080
 			else $flag = FALSE;
1081 1081
 		}
1082 1082
 		else
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
 	{
1101 1101
 		if (is_array($val))
1102 1102
 		{
1103
-			array_walk($val,'Context::doConvertEncoding',$charset);
1103
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1104 1104
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1105
+		else $val = iconv($charset, 'UTF-8', $val);
1106 1106
 	}
1107 1107
 
1108 1108
 	/**
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	 */
1114 1114
 	function convertEncodingStr($str)
1115 1115
 	{
1116
-        if(!$str) return null;
1116
+        if (!$str) return null;
1117 1117
 		$obj = new stdClass();
1118 1118
 		$obj->str = $str;
1119 1119
 		$obj = self::convertEncoding($obj);
@@ -1122,9 +1122,9 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 	function decodeIdna($domain)
1124 1124
 	{
1125
-		if(strpos($domain, 'xn--') !== FALSE)
1125
+		if (strpos($domain, 'xn--') !== FALSE)
1126 1126
 		{
1127
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1127
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1128 1128
 			$IDN = new idna_convert(array('idn_version' => 2008));
1129 1129
 			$domain = $IDN->decode($domain);
1130 1130
 		}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	{
1156 1156
 		$self = self::getInstance();
1157 1157
 
1158
-		if($self->response_method)
1158
+		if ($self->response_method)
1159 1159
 		{
1160 1160
 			return $self->response_method;
1161 1161
 		}
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1196 1196
 
1197 1197
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1198
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1198
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1199 1199
 		{
1200 1200
 			$this->isSuccessInit = FALSE;
1201 1201
 		}
@@ -1208,30 +1208,30 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	function _setRequestArgument()
1210 1210
 	{
1211
-		if(!count($_REQUEST))
1211
+		if (!count($_REQUEST))
1212 1212
 		{
1213 1213
 			return;
1214 1214
 		}
1215 1215
 
1216 1216
 		$requestMethod = $this->getRequestMethod();
1217
-		foreach($_REQUEST as $key => $val)
1217
+		foreach ($_REQUEST as $key => $val)
1218 1218
 		{
1219
-			if($val === '' || self::get($key))
1219
+			if ($val === '' || self::get($key))
1220 1220
 			{
1221 1221
 				continue;
1222 1222
 			}
1223 1223
 			$key = htmlentities($key);
1224 1224
 			$val = $this->_filterRequestVar($key, $val);
1225 1225
 
1226
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1226
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1230
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1231 1231
 			{
1232 1232
 				$set_to_vars = TRUE;
1233 1233
 			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1235
 			{
1236 1236
 				$set_to_vars = TRUE;
1237 1237
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 				$set_to_vars = FALSE;
1241 1241
 			}
1242 1242
 
1243
-			if($set_to_vars)
1243
+			if ($set_to_vars)
1244 1244
 			{
1245 1245
 				$this->_recursiveCheckVar($val);
1246 1246
 			}
@@ -1251,20 +1251,20 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
 	function _recursiveCheckVar($val)
1253 1253
 	{
1254
-		if(is_string($val))
1254
+		if (is_string($val))
1255 1255
 		{
1256
-			foreach($this->patterns as $pattern)
1256
+			foreach ($this->patterns as $pattern)
1257 1257
 			{
1258
-				if(preg_match($pattern, $val))
1258
+				if (preg_match($pattern, $val))
1259 1259
 				{
1260 1260
 					$this->isSuccessInit = FALSE;
1261 1261
 					return;
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265
-		else if(is_array($val))
1265
+		else if (is_array($val))
1266 1266
 		{
1267
-			foreach($val as $val2)
1267
+			foreach ($val as $val2)
1268 1268
 			{
1269 1269
 				$this->_recursiveCheckVar($val2);
1270 1270
 			}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	function _setJSONRequestArgument()
1280 1280
 	{
1281
-		if($this->getRequestMethod() != 'JSON')
1281
+		if ($this->getRequestMethod() != 'JSON')
1282 1282
 		{
1283 1283
 			return;
1284 1284
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		$params = array();
1287 1287
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1288 1288
 
1289
-		foreach($params as $key => $val)
1289
+		foreach ($params as $key => $val)
1290 1290
 		{
1291 1291
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1292 1292
 		}
@@ -1299,13 +1299,13 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	function _setXmlRpcArgument()
1301 1301
 	{
1302
-		if($this->getRequestMethod() != 'XMLRPC')
1302
+		if ($this->getRequestMethod() != 'XMLRPC')
1303 1303
 		{
1304 1304
 			return;
1305 1305
 		}
1306 1306
 
1307 1307
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1308
-		if(Security::detectingXEE($xml))
1308
+		if (Security::detectingXEE($xml))
1309 1309
 		{
1310 1310
 			header("HTTP/1.0 400 Bad Request");
1311 1311
 			exit;
@@ -1317,12 +1317,12 @@  discard block
 block discarded – undo
1317 1317
 		$params = $xml_obj->methodcall->params;
1318 1318
 		unset($params->node_name, $params->attrs, $params->body);
1319 1319
 
1320
-		if(!count(get_object_vars($params)))
1320
+		if (!count(get_object_vars($params)))
1321 1321
 		{
1322 1322
 			return;
1323 1323
 		}
1324 1324
 
1325
-		foreach($params as $key => $val)
1325
+		foreach ($params as $key => $val)
1326 1326
 		{
1327 1327
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1328 1328
 		}
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 	 */
1338 1338
 	function _filterXmlVars($key, $val)
1339 1339
 	{
1340
-		if(is_array($val))
1340
+		if (is_array($val))
1341 1341
 		{
1342 1342
 			$stack = array();
1343
-			foreach($val as $k => $v)
1343
+			foreach ($val as $k => $v)
1344 1344
 			{
1345 1345
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1346 1346
 			}
@@ -1350,20 +1350,20 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 		$body = $val->body;
1352 1352
 		unset($val->node_name, $val->attrs, $val->body);
1353
-		if(!count(get_object_vars($val)))
1353
+		if (!count(get_object_vars($val)))
1354 1354
 		{
1355 1355
 			return $this->_filterRequestVar($key, $body, 0);
1356 1356
 		}
1357 1357
 
1358 1358
 		$stack = new stdClass();
1359
-		foreach($val as $k => $v)
1359
+		foreach ($val as $k => $v)
1360 1360
 		{
1361 1361
 			$output = $this->_filterXmlVars($k, $v);
1362
-			if(is_object($v) && $v->attrs->type == 'array')
1362
+			if (is_object($v) && $v->attrs->type == 'array')
1363 1363
 			{
1364 1364
 				$output = array($output);
1365 1365
 			}
1366
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1366
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1367 1367
 			{
1368 1368
 				return $output;
1369 1369
 			}
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 			$stack->{$k} = $output;
1372 1372
 		}
1373 1373
 
1374
-		if(!count(get_object_vars($stack)))
1374
+		if (!count(get_object_vars($stack)))
1375 1375
 		{
1376 1376
 			return NULL;
1377 1377
 		}
@@ -1390,32 +1390,32 @@  discard block
 block discarded – undo
1390 1390
 	 */
1391 1391
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1392 1392
 	{
1393
-		if(!($isArray = is_array($val)))
1393
+		if (!($isArray = is_array($val)))
1394 1394
 		{
1395 1395
 			$val = array($val);
1396 1396
 		}
1397 1397
 
1398 1398
 		$result = array();
1399
-		foreach($val as $k => $v)
1399
+		foreach ($val as $k => $v)
1400 1400
 		{
1401 1401
 			$k = htmlentities($k);
1402
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1402
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1403
 			{
1404 1404
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405 1405
 			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1406
+			elseif ($key === 'mid' || $key === 'search_keyword')
1407 1407
 			{
1408 1408
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409 1409
 			}
1410
-			elseif($key === 'vid')
1410
+			elseif ($key === 'vid')
1411 1411
 			{
1412 1412
 				$result[$k] = urlencode($v);
1413 1413
 			}
1414
-			elseif($key === 'xe_validator_id')
1414
+			elseif ($key === 'xe_validator_id')
1415 1415
 			{
1416 1416
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417 1417
 			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1418
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1419
 			{
1420 1420
 				unset($result[$k]);
1421 1421
 			}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 			{
1424 1424
 				$result[$k] = $v;
1425 1425
 
1426
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1426
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1427 1427
 				{
1428 1428
 					if (is_array($result[$k]))
1429 1429
 					{
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438
-				if(is_array($result[$k]))
1438
+				if (is_array($result[$k]))
1439 1439
 				{
1440 1440
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441 1441
 				}
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
 	 */
1468 1468
 	function _setUploadedArgument()
1469 1469
 	{
1470
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1470
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1471 1471
 		{
1472 1472
 			return;
1473 1473
 		}
1474 1474
 
1475
-		foreach($_FILES as $key => $val)
1475
+		foreach ($_FILES as $key => $val)
1476 1476
 		{
1477 1477
 			$tmp_name = $val['tmp_name'];
1478
-			if(!is_array($tmp_name))
1478
+			if (!is_array($tmp_name))
1479 1479
 			{
1480
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1480
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1481 1481
 				{
1482 1482
 					continue;
1483 1483
 				}
@@ -1487,9 +1487,9 @@  discard block
 block discarded – undo
1487 1487
 			}
1488 1488
 			else
1489 1489
 			{
1490
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1490
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1491 1491
 				{
1492
-					if($val['size'][$i] > 0)
1492
+					if ($val['size'][$i] > 0)
1493 1493
 					{
1494 1494
 						$file['name'] = $val['name'][$i];
1495 1495
 						$file['type'] = $val['type'][$i];
@@ -1521,16 +1521,16 @@  discard block
 block discarded – undo
1521 1521
 	function getRequestUrl()
1522 1522
 	{
1523 1523
 		static $url = null;
1524
-		if(is_null($url))
1524
+		if (is_null($url))
1525 1525
 		{
1526 1526
 			$url = self::getRequestUri();
1527
-			if(count($_GET) > 0)
1527
+			if (count($_GET) > 0)
1528 1528
 			{
1529
-				foreach($_GET as $key => $val)
1529
+				foreach ($_GET as $key => $val)
1530 1530
 				{
1531
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1531
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1532 1532
 				}
1533
-				$url .= '?' . join('&', $vars);
1533
+				$url .= '?'.join('&', $vars);
1534 1534
 			}
1535 1535
 		}
1536 1536
 		return $url;
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 		$self = self::getInstance();
1546 1546
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1547 1547
 
1548
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1548
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1549 1549
 		{
1550 1550
 			unset($js_callback_func);
1551 1551
 			unset($_GET['xe_js_callback']);
@@ -1573,22 +1573,22 @@  discard block
 block discarded – undo
1573 1573
 		$self = self::getInstance();
1574 1574
 
1575 1575
 		// retrieve virtual site information
1576
-		if(is_null($site_module_info))
1576
+		if (is_null($site_module_info))
1577 1577
 		{
1578 1578
 			$site_module_info = self::get('site_module_info');
1579 1579
 		}
1580 1580
 
1581 1581
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1582
-		if($domain && isSiteID($domain))
1582
+		if ($domain && isSiteID($domain))
1583 1583
 		{
1584 1584
 			$vid = $domain;
1585 1585
 			$domain = '';
1586 1586
 		}
1587 1587
 
1588 1588
 		// If $domain, $vid are not set, use current site information
1589
-		if(!$domain && !$vid)
1589
+		if (!$domain && !$vid)
1590 1590
 		{
1591
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1591
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1592 1592
 			{
1593 1593
 				$vid = $site_module_info->domain;
1594 1594
 			}
@@ -1599,21 +1599,21 @@  discard block
 block discarded – undo
1599 1599
 		}
1600 1600
 
1601 1601
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1602
-		if($domain)
1602
+		if ($domain)
1603 1603
 		{
1604 1604
 			$domain_info = parse_url($domain);
1605
-			if(is_null($current_info))
1605
+			if (is_null($current_info))
1606 1606
 			{
1607
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1607
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1608 1608
 			}
1609
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1609
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1610 1610
 			{
1611 1611
 				unset($domain);
1612 1612
 			}
1613 1613
 			else
1614 1614
 			{
1615 1615
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1616
-				if(substr_compare($domain, '/', -1) !== 0)
1616
+				if (substr_compare($domain, '/', -1) !== 0)
1617 1617
 				{
1618 1618
 					$domain .= '/';
1619 1619
 				}
@@ -1623,10 +1623,10 @@  discard block
 block discarded – undo
1623 1623
 		$get_vars = array();
1624 1624
 
1625 1625
 		// If there is no GET variables or first argument is '' to reset variables
1626
-		if(!$self->get_vars || $args_list[0] == '')
1626
+		if (!$self->get_vars || $args_list[0] == '')
1627 1627
 		{
1628 1628
 			// rearrange args_list
1629
-			if(is_array($args_list) && $args_list[0] == '')
1629
+			if (is_array($args_list) && $args_list[0] == '')
1630 1630
 			{
1631 1631
 				array_shift($args_list);
1632 1632
 			}
@@ -1638,13 +1638,13 @@  discard block
 block discarded – undo
1638 1638
 		}
1639 1639
 
1640 1640
 		// arrange args_list
1641
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1641
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1642 1642
 		{
1643 1643
 			$key = $args_list[$i];
1644 1644
 			$val = trim($args_list[$i + 1]);
1645 1645
 
1646 1646
 			// If value is not set, remove the key
1647
-			if(!isset($val) || !strlen($val))
1647
+			if (!isset($val) || !strlen($val))
1648 1648
 			{
1649 1649
 				unset($get_vars[$key]);
1650 1650
 				continue;
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 
1656 1656
 		// remove vid, rnd
1657 1657
 		unset($get_vars['rnd']);
1658
-		if($vid)
1658
+		if ($vid)
1659 1659
 		{
1660 1660
 			$get_vars['vid'] = $vid;
1661 1661
 		}
@@ -1672,17 +1672,17 @@  discard block
 block discarded – undo
1672 1672
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1673 1673
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1674 1674
 		);
1675
-		if($act_alias[$act])
1675
+		if ($act_alias[$act])
1676 1676
 		{
1677 1677
 			$get_vars['act'] = $act_alias[$act];
1678 1678
 		}
1679 1679
 
1680 1680
 		// organize URL
1681 1681
 		$query = '';
1682
-		if(count($get_vars) > 0)
1682
+		if (count($get_vars) > 0)
1683 1683
 		{
1684 1684
 			// if using rewrite mod
1685
-			if($self->allow_rewrite)
1685
+			if ($self->allow_rewrite)
1686 1686
 			{
1687 1687
 				$var_keys = array_keys($get_vars);
1688 1688
 				sort($var_keys);
@@ -1702,8 +1702,8 @@  discard block
 block discarded – undo
1702 1702
 					'vid' => $vid,
1703 1703
 					'mid' => $mid,
1704 1704
 					'mid.vid' => "$vid/$mid",
1705
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1706
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1705
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1706
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1707 1707
 					'document_srl' => $srl,
1708 1708
 					'document_srl.mid' => "$mid/$srl",
1709 1709
 					'document_srl.vid' => "$vid/$srl",
@@ -1720,66 +1720,66 @@  discard block
 block discarded – undo
1720 1720
 				$query = $target_map[$target];
1721 1721
 			}
1722 1722
 
1723
-			if(!$query)
1723
+			if (!$query)
1724 1724
 			{
1725 1725
 				$queries = array();
1726
-				foreach($get_vars as $key => $val)
1726
+				foreach ($get_vars as $key => $val)
1727 1727
 				{
1728
-					if(is_array($val) && count($val) > 0)
1728
+					if (is_array($val) && count($val) > 0)
1729 1729
 					{
1730
-						foreach($val as $k => $v)
1730
+						foreach ($val as $k => $v)
1731 1731
 						{
1732
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1732
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1733 1733
 						}
1734 1734
 					}
1735
-					elseif(!is_array($val))
1735
+					elseif (!is_array($val))
1736 1736
 					{
1737
-						$queries[] = $key . '=' . urlencode($val);
1737
+						$queries[] = $key.'='.urlencode($val);
1738 1738
 					}
1739 1739
 				}
1740
-				if(count($queries) > 0)
1740
+				if (count($queries) > 0)
1741 1741
 				{
1742
-					$query = 'index.php?' . join('&', $queries);
1742
+					$query = 'index.php?'.join('&', $queries);
1743 1743
 				}
1744 1744
 			}
1745 1745
 		}
1746 1746
 
1747 1747
 		// If using SSL always
1748 1748
 		$_use_ssl = $self->get('_use_ssl');
1749
-		if($_use_ssl == 'always')
1749
+		if ($_use_ssl == 'always')
1750 1750
 		{
1751
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1751
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1752 1752
 			// optional SSL use
1753 1753
 		}
1754
-		elseif($_use_ssl == 'optional')
1754
+		elseif ($_use_ssl == 'optional')
1755 1755
 		{
1756 1756
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1757
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1757
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1758 1758
 			// no SSL
1759 1759
 		}
1760 1760
 		else
1761 1761
 		{
1762 1762
 			// currently on SSL but target is not based on SSL
1763
-			if($_SERVER['HTTPS'] == 'on')
1763
+			if ($_SERVER['HTTPS'] == 'on')
1764 1764
 			{
1765
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1765
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1766 1766
 			}
1767
-			else if($domain) // if $domain is set
1767
+			else if ($domain) // if $domain is set
1768 1768
 			{
1769
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1769
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1770 1770
 			}
1771 1771
 			else
1772 1772
 			{
1773
-				$query = getScriptPath() . $query;
1773
+				$query = getScriptPath().$query;
1774 1774
 			}
1775 1775
 		}
1776 1776
 
1777
-		if(!$encode)
1777
+		if (!$encode)
1778 1778
 		{
1779 1779
 			return $query;
1780 1780
 		}
1781 1781
 
1782
-		if(!$autoEncode)
1782
+		if (!$autoEncode)
1783 1783
 		{
1784 1784
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1785 1785
 		}
@@ -1788,16 +1788,16 @@  discard block
 block discarded – undo
1788 1788
 		$encode_queries = array();
1789 1789
 		$parsedUrl = parse_url($query);
1790 1790
 		parse_str($parsedUrl['query'], $output);
1791
-		foreach($output as $key => $value)
1791
+		foreach ($output as $key => $value)
1792 1792
 		{
1793
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1793
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1794 1794
 			{
1795 1795
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1796 1796
 			}
1797
-			$encode_queries[] = $key . '=' . $value;
1797
+			$encode_queries[] = $key.'='.$value;
1798 1798
 		}
1799 1799
 
1800
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1800
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1801 1801
 	}
1802 1802
 
1803 1803
 	/**
@@ -1812,17 +1812,17 @@  discard block
 block discarded – undo
1812 1812
 		static $url = array();
1813 1813
 
1814 1814
 		// Check HTTP Request
1815
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1815
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1816 1816
 		{
1817 1817
 			return;
1818 1818
 		}
1819 1819
 
1820
-		if(self::get('_use_ssl') == 'always')
1820
+		if (self::get('_use_ssl') == 'always')
1821 1821
 		{
1822 1822
 			$ssl_mode = ENFORCE_SSL;
1823 1823
 		}
1824 1824
 
1825
-		if($domain)
1825
+		if ($domain)
1826 1826
 		{
1827 1827
 			$domain_key = md5($domain);
1828 1828
 		}
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
 			$domain_key = 'default';
1832 1832
 		}
1833 1833
 
1834
-		if(isset($url[$ssl_mode][$domain_key]))
1834
+		if (isset($url[$ssl_mode][$domain_key]))
1835 1835
 		{
1836 1836
 			return $url[$ssl_mode][$domain_key];
1837 1837
 		}
1838 1838
 
1839 1839
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1840 1840
 
1841
-		switch($ssl_mode)
1841
+		switch ($ssl_mode)
1842 1842
 		{
1843 1843
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1844 1844
 				break;
@@ -1848,34 +1848,34 @@  discard block
 block discarded – undo
1848 1848
 				break;
1849 1849
 		}
1850 1850
 
1851
-		if($domain)
1851
+		if ($domain)
1852 1852
 		{
1853 1853
 			$target_url = trim($domain);
1854
-			if(substr_compare($target_url, '/', -1) !== 0)
1854
+			if (substr_compare($target_url, '/', -1) !== 0)
1855 1855
 			{
1856
-				$target_url.= '/';
1856
+				$target_url .= '/';
1857 1857
 			}
1858 1858
 		}
1859 1859
 		else
1860 1860
 		{
1861
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1861
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1862 1862
 		}
1863 1863
 
1864
-		$url_info = parse_url('http://' . $target_url);
1864
+		$url_info = parse_url('http://'.$target_url);
1865 1865
 
1866
-		if($current_use_ssl != $use_ssl)
1866
+		if ($current_use_ssl != $use_ssl)
1867 1867
 		{
1868 1868
 			unset($url_info['port']);
1869 1869
 		}
1870 1870
 
1871
-		if($use_ssl)
1871
+		if ($use_ssl)
1872 1872
 		{
1873 1873
 			$port = self::get('_https_port');
1874
-			if($port && $port != 443)
1874
+			if ($port && $port != 443)
1875 1875
 			{
1876 1876
 				$url_info['port'] = $port;
1877 1877
 			}
1878
-			elseif($url_info['port'] == 443)
1878
+			elseif ($url_info['port'] == 443)
1879 1879
 			{
1880 1880
 				unset($url_info['port']);
1881 1881
 			}
@@ -1883,17 +1883,17 @@  discard block
 block discarded – undo
1883 1883
 		else
1884 1884
 		{
1885 1885
 			$port = self::get('_http_port');
1886
-			if($port && $port != 80)
1886
+			if ($port && $port != 80)
1887 1887
 			{
1888 1888
 				$url_info['port'] = $port;
1889 1889
 			}
1890
-			elseif($url_info['port'] == 80)
1890
+			elseif ($url_info['port'] == 80)
1891 1891
 			{
1892 1892
 				unset($url_info['port']);
1893 1893
 			}
1894 1894
 		}
1895 1895
 
1896
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1896
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1897 1897
 
1898 1898
 		return $url[$ssl_mode][$domain_key];
1899 1899
 	}
@@ -1910,16 +1910,16 @@  discard block
 block discarded – undo
1910 1910
 	{
1911 1911
 		$self = self::getInstance();
1912 1912
 		$self->context->{$key} = $val;
1913
-		if($set_to_get_vars === FALSE)
1913
+		if ($set_to_get_vars === FALSE)
1914 1914
 		{
1915 1915
 			return;
1916 1916
 		}
1917
-		if($val === NULL || $val === '')
1917
+		if ($val === NULL || $val === '')
1918 1918
 		{
1919 1919
 			unset($self->get_vars->{$key});
1920 1920
 			return;
1921 1921
 		}
1922
-		if($set_to_get_vars || $self->get_vars->{$key})
1922
+		if ($set_to_get_vars || $self->get_vars->{$key})
1923 1923
 		{
1924 1924
 			$self->get_vars->{$key} = $val;
1925 1925
 		}
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 	{
1936 1936
 		$self = self::getInstance();
1937 1937
 
1938
-		if(!isset($self->context->{$key}))
1938
+		if (!isset($self->context->{$key}))
1939 1939
 		{
1940 1940
 			return null;
1941 1941
 		}
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
 	function gets()
1951 1951
 	{
1952 1952
 		$num_args = func_num_args();
1953
-		if($num_args < 1)
1953
+		if ($num_args < 1)
1954 1954
 		{
1955 1955
 			return;
1956 1956
 		}
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
 
1959 1959
 		$args_list = func_get_args();
1960 1960
 		$output = new stdClass();
1961
-		foreach($args_list as $v)
1961
+		foreach ($args_list as $v)
1962 1962
 		{
1963 1963
 			$output->{$v} = $self->get($v);
1964 1964
 		}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 	function getRequestVars()
1985 1985
 	{
1986 1986
 		$self = self::getInstance();
1987
-		if($self->get_vars)
1987
+		if ($self->get_vars)
1988 1988
 		{
1989 1989
 			return clone($self->get_vars);
1990 1990
 		}
@@ -2001,13 +2001,13 @@  discard block
 block discarded – undo
2001 2001
 	{
2002 2002
 		$self = self::getInstance();
2003 2003
 
2004
-		if(!is_readable($self->sslActionCacheFile))
2004
+		if (!is_readable($self->sslActionCacheFile))
2005 2005
 		{
2006 2006
 			$buff = '<?php if(!defined("__XE__"))exit;';
2007 2007
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2008 2008
 		}
2009 2009
 
2010
-		if(!isset($self->ssl_actions[$action]))
2010
+		if (!isset($self->ssl_actions[$action]))
2011 2011
 		{
2012 2012
 			$self->ssl_actions[$action] = 1;
2013 2013
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2025,16 +2025,16 @@  discard block
 block discarded – undo
2025 2025
 	{
2026 2026
 		$self = self::getInstance();
2027 2027
 
2028
-		if(!is_readable($self->sslActionCacheFile))
2028
+		if (!is_readable($self->sslActionCacheFile))
2029 2029
 		{
2030 2030
 			unset($self->ssl_actions);
2031 2031
 			$buff = '<?php if(!defined("__XE__"))exit;';
2032 2032
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2033 2033
 		}
2034 2034
 
2035
-		foreach($action_array as $action)
2035
+		foreach ($action_array as $action)
2036 2036
 		{
2037
-			if(!isset($self->ssl_actions[$action]))
2037
+			if (!isset($self->ssl_actions[$action]))
2038 2038
 			{
2039 2039
 				$self->ssl_actions[$action] = 1;
2040 2040
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 	{
2054 2054
 		$self = self::getInstance();
2055 2055
 
2056
-		if($self->isExistsSSLAction($action))
2056
+		if ($self->isExistsSSLAction($action))
2057 2057
 		{
2058 2058
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2059 2059
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 	function getSSLActions()
2071 2071
 	{
2072 2072
 		$self = self::getInstance();
2073
-		if($self->getSslStatus() == 'optional')
2073
+		if ($self->getSslStatus() == 'optional')
2074 2074
 		{
2075 2075
 			return $self->ssl_actions;
2076 2076
 		}
@@ -2097,12 +2097,12 @@  discard block
 block discarded – undo
2097 2097
 	 */
2098 2098
 	function normalizeFilePath($file)
2099 2099
 	{
2100
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2100
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2101 2101
 		{
2102
-			$file = './' . $file;
2102
+			$file = './'.$file;
2103 2103
 		}
2104 2104
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2105
-		while(strpos($file, '/../') !== FALSE)
2105
+		while (strpos($file, '/../') !== FALSE)
2106 2106
 		{
2107 2107
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2108 2108
 		}
@@ -2121,13 +2121,13 @@  discard block
 block discarded – undo
2121 2121
 	{
2122 2122
 		$file = self::normalizeFilePath($file);
2123 2123
 		$script_path = getScriptPath();
2124
-		if(strpos($file, './') === 0)
2124
+		if (strpos($file, './') === 0)
2125 2125
 		{
2126
-			$file = $script_path . substr($file, 2);
2126
+			$file = $script_path.substr($file, 2);
2127 2127
 		}
2128
-		elseif(strpos($file, '../') === 0)
2128
+		elseif (strpos($file, '../') === 0)
2129 2129
 		{
2130
-			$file = self::normalizeFilePath($script_path . $file);
2130
+			$file = self::normalizeFilePath($script_path.$file);
2131 2131
 		}
2132 2132
 
2133 2133
 		return $file;
@@ -2197,12 +2197,12 @@  discard block
 block discarded – undo
2197 2197
 	 */
2198 2198
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2199 2199
 	{
2200
-		if($isRuleset)
2200
+		if ($isRuleset)
2201 2201
 		{
2202
-			if(strpos($file, '#') !== FALSE)
2202
+			if (strpos($file, '#') !== FALSE)
2203 2203
 			{
2204 2204
 				$file = str_replace('#', '', $file);
2205
-				if(!is_readable($file))
2205
+				if (!is_readable($file))
2206 2206
 				{
2207 2207
 					$file = $autoPath;
2208 2208
 				}
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 		ksort($files);
2268 2268
 		$files = array_values($files);
2269 2269
 		$filenames = array();
2270
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2270
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2271 2271
 		{
2272
-			if(in_array($files[$i]['file'], $filenames))
2272
+			if (in_array($files[$i]['file'], $filenames))
2273 2273
 			{
2274 2274
 				unset($files[$i]);
2275 2275
 			}
@@ -2354,14 +2354,14 @@  discard block
 block discarded – undo
2354 2354
 	 */
2355 2355
 	function getJavascriptPluginInfo($pluginName)
2356 2356
 	{
2357
-		if($plugin_name == 'ui.datepicker')
2357
+		if ($plugin_name == 'ui.datepicker')
2358 2358
 		{
2359 2359
 			$plugin_name = 'ui';
2360 2360
 		}
2361 2361
 
2362
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2363
-		$info_file = $plugin_path . 'plugin.load';
2364
-		if(!is_readable($info_file))
2362
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2363
+		$info_file = $plugin_path.'plugin.load';
2364
+		if (!is_readable($info_file))
2365 2365
 		{
2366 2366
 			return;
2367 2367
 		}
@@ -2371,32 +2371,32 @@  discard block
 block discarded – undo
2371 2371
 		$result->jsList = array();
2372 2372
 		$result->cssList = array();
2373 2373
 
2374
-		foreach($list as $filename)
2374
+		foreach ($list as $filename)
2375 2375
 		{
2376 2376
 			$filename = trim($filename);
2377
-			if(!$filename)
2377
+			if (!$filename)
2378 2378
 			{
2379 2379
 				continue;
2380 2380
 			}
2381 2381
 
2382
-			if(strncasecmp('./', $filename, 2) === 0)
2382
+			if (strncasecmp('./', $filename, 2) === 0)
2383 2383
 			{
2384 2384
 				$filename = substr($filename, 2);
2385 2385
 			}
2386 2386
 
2387
-			if(substr_compare($filename, '.js', -3) === 0)
2387
+			if (substr_compare($filename, '.js', -3) === 0)
2388 2388
 			{
2389
-				$result->jsList[] = $plugin_path . $filename;
2389
+				$result->jsList[] = $plugin_path.$filename;
2390 2390
 			}
2391
-			elseif(substr_compare($filename, '.css', -4) === 0)
2391
+			elseif (substr_compare($filename, '.css', -4) === 0)
2392 2392
 			{
2393
-				$result->cssList[] = $plugin_path . $filename;
2393
+				$result->cssList[] = $plugin_path.$filename;
2394 2394
 			}
2395 2395
 		}
2396 2396
 
2397
-		if(is_dir($plugin_path . 'lang'))
2397
+		if (is_dir($plugin_path.'lang'))
2398 2398
 		{
2399
-			$result->langPath = $plugin_path . 'lang';
2399
+			$result->langPath = $plugin_path.'lang';
2400 2400
 		}
2401 2401
 
2402 2402
 		return $result;
@@ -2412,50 +2412,50 @@  discard block
 block discarded – undo
2412 2412
 		static $loaded_plugins = array();
2413 2413
 
2414 2414
 		$self = self::getInstance();
2415
-		if($plugin_name == 'ui.datepicker')
2415
+		if ($plugin_name == 'ui.datepicker')
2416 2416
 		{
2417 2417
 			$plugin_name = 'ui';
2418 2418
 		}
2419 2419
 
2420
-		if($loaded_plugins[$plugin_name])
2420
+		if ($loaded_plugins[$plugin_name])
2421 2421
 		{
2422 2422
 			return;
2423 2423
 		}
2424 2424
 		$loaded_plugins[$plugin_name] = TRUE;
2425 2425
 
2426
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2427
-		$info_file = $plugin_path . 'plugin.load';
2428
-		if(!is_readable($info_file))
2426
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2427
+		$info_file = $plugin_path.'plugin.load';
2428
+		if (!is_readable($info_file))
2429 2429
 		{
2430 2430
 			return;
2431 2431
 		}
2432 2432
 
2433 2433
 		$list = file($info_file);
2434
-		foreach($list as $filename)
2434
+		foreach ($list as $filename)
2435 2435
 		{
2436 2436
 			$filename = trim($filename);
2437
-			if(!$filename)
2437
+			if (!$filename)
2438 2438
 			{
2439 2439
 				continue;
2440 2440
 			}
2441 2441
 
2442
-			if(strncasecmp('./', $filename, 2) === 0)
2442
+			if (strncasecmp('./', $filename, 2) === 0)
2443 2443
 			{
2444 2444
 				$filename = substr($filename, 2);
2445 2445
 			}
2446
-			if(substr_compare($filename, '.js', -3) === 0)
2446
+			if (substr_compare($filename, '.js', -3) === 0)
2447 2447
 			{
2448
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2448
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2449 2449
 			}
2450
-			if(substr_compare($filename, '.css', -4) === 0)
2450
+			if (substr_compare($filename, '.css', -4) === 0)
2451 2451
 			{
2452
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2452
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2453 2453
 			}
2454 2454
 		}
2455 2455
 
2456
-		if(is_dir($plugin_path . 'lang'))
2456
+		if (is_dir($plugin_path.'lang'))
2457 2457
 		{
2458
-			$self->loadLang($plugin_path . 'lang');
2458
+			$self->loadLang($plugin_path.'lang');
2459 2459
 		}
2460 2460
 	}
2461 2461
 
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 	function addHtmlHeader($header)
2469 2469
 	{
2470 2470
 		$self = self::getInstance();
2471
-		$self->html_header .= "\n" . $header;
2471
+		$self->html_header .= "\n".$header;
2472 2472
 	}
2473 2473
 
2474 2474
 	function clearHtmlHeader()
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
 	function addBodyHeader($header)
2521 2521
 	{
2522 2522
 		$self = self::getInstance();
2523
-		$self->body_header .= "\n" . $header;
2523
+		$self->body_header .= "\n".$header;
2524 2524
 	}
2525 2525
 
2526 2526
 	/**
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
 	function addHtmlFooter($footer)
2543 2543
 	{
2544 2544
 		$self = self::getInstance();
2545
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2545
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2546 2546
 	}
2547 2547
 
2548 2548
 	/**
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 	 */
2564 2564
 	function getConfigFile()
2565 2565
 	{
2566
-		return _XE_PATH_ . 'files/config/db.config.php';
2566
+		return _XE_PATH_.'files/config/db.config.php';
2567 2567
 	}
2568 2568
 
2569 2569
 	/**
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 	 */
2574 2574
 	function getFTPConfigFile()
2575 2575
 	{
2576
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2576
+		return _XE_PATH_.'files/config/ftp.config.php';
2577 2577
 	}
2578 2578
 
2579 2579
 	/**
@@ -2625,14 +2625,14 @@  discard block
 block discarded – undo
2625 2625
 		$_path = explode('/', $path);
2626 2626
 		$_base = explode('/', $base_url);
2627 2627
 
2628
-		if(!$_base[count($_base) - 1])
2628
+		if (!$_base[count($_base) - 1])
2629 2629
 		{
2630 2630
 			array_pop($_base);
2631 2631
 		}
2632 2632
 
2633
-		foreach($_xe as $idx => $dir)
2633
+		foreach ($_xe as $idx => $dir)
2634 2634
 		{
2635
-			if($_path[0] != $dir)
2635
+			if ($_path[0] != $dir)
2636 2636
 			{
2637 2637
 				break;
2638 2638
 			}
@@ -2640,9 +2640,9 @@  discard block
 block discarded – undo
2640 2640
 		}
2641 2641
 
2642 2642
 		$idx = count($_xe) - $idx - 1;
2643
-		while($idx--)
2643
+		while ($idx--)
2644 2644
 		{
2645
-			if(count($_base) > 0)
2645
+			if (count($_base) > 0)
2646 2646
 			{
2647 2647
 				array_shift($_base);
2648 2648
 			}
@@ -2652,13 +2652,13 @@  discard block
 block discarded – undo
2652 2652
 			}
2653 2653
 		}
2654 2654
 
2655
-		if(count($_base) > 0)
2655
+		if (count($_base) > 0)
2656 2656
 		{
2657 2657
 			array_unshift($_path, join('/', $_base));
2658 2658
 		}
2659 2659
 
2660
-		$path = '/' . join('/', $_path);
2661
-		if(substr_compare($path, '/', -1) !== 0)
2660
+		$path = '/'.join('/', $_path);
2661
+		if (substr_compare($path, '/', -1) !== 0)
2662 2662
 		{
2663 2663
 			$path .= '/';
2664 2664
 		}
@@ -2673,13 +2673,13 @@  discard block
 block discarded – undo
2673 2673
 	{
2674 2674
 		$self = self::getInstance();
2675 2675
 
2676
-		if(!is_array($self->meta_tags))
2676
+		if (!is_array($self->meta_tags))
2677 2677
 		{
2678 2678
 			$self->meta_tags = array();
2679 2679
 		}
2680 2680
 
2681 2681
 		$ret = array();
2682
-		foreach($self->meta_tags as $key => $val)
2682
+		foreach ($self->meta_tags as $key => $val)
2683 2683
 		{
2684 2684
 			list($name, $is_http_equiv) = explode("\t", $key);
2685 2685
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2700 2700
 	{
2701 2701
 		$self = self::getInstance();
2702
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2702
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2703 2703
 	}
2704 2704
 
2705 2705
 }
Please login to merge, or discard this patch.
Braces   +87 added lines, -102 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -490,18 +491,22 @@  discard block
 block discarded – undo
490 491
 			$db_info->use_prepared_statements = 'Y';
491 492
 		}
492 493
 
493
-		if(!$db_info->time_zone)
494
-			$db_info->time_zone = date('O');
494
+		if(!$db_info->time_zone) {
495
+					$db_info->time_zone = date('O');
496
+		}
495 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 498
 
497
-		if($db_info->qmail_compatibility != 'Y')
498
-			$db_info->qmail_compatibility = 'N';
499
+		if($db_info->qmail_compatibility != 'Y') {
500
+					$db_info->qmail_compatibility = 'N';
501
+		}
499 502
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 503
 
501
-		if(!$db_info->use_db_session)
502
-			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
504
-			$db_info->use_ssl = 'none';
504
+		if(!$db_info->use_db_session) {
505
+					$db_info->use_db_session = 'N';
506
+		}
507
+		if(!$db_info->use_ssl) {
508
+					$db_info->use_ssl = 'none';
509
+		}
505 510
 		$this->set('_use_ssl', $db_info->use_ssl);
506 511
 
507 512
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -618,8 +623,7 @@  discard block
 block discarded – undo
618 623
 				$buff = FileHandler::readFile($orig_lang_file);
619 624
 				FileHandler::writeFile($selected_lang_file, $buff);
620 625
 				$lang_selected = self::loadLangSupported();
621
-			}
622
-			else
626
+			} else
623 627
 			{
624 628
 				$langs = file($selected_lang_file);
625 629
 				foreach($langs as $val)
@@ -678,15 +682,16 @@  discard block
 block discarded – undo
678 682
 
679 683
 				$oModuleModel = getModel('module');
680 684
 				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				if(substr_compare($domain, '/', -1) === 0) {
686
+					$domain = substr($domain, 0, -1);
687
+				}
682 688
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 689
 
684 690
 				if($site_info->site_srl)
685 691
 				{
686 692
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687 693
 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
688
-				}
689
-				else
694
+				} else
690 695
 				{
691 696
 					$redirect_url = $url;
692 697
 				}
@@ -695,8 +700,7 @@  discard block
 block discarded – undo
695 700
 				return FALSE;
696 701
 			}
697 702
 			// for sites requesting SSO validation
698
-		}
699
-		else
703
+		} else
700 704
 		{
701 705
 			// result handling : set session_name()
702 706
 			if($session_name = self::get('SSOID'))
@@ -713,8 +717,7 @@  discard block
 block discarded – undo
713 717
 				header('location:' . $url);
714 718
 				return FALSE;
715 719
 				// send SSO request
716
-			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 721
 			{
719 722
 				setcookie('sso', md5(self::getRequestUri()));
720 723
 				$origin_url = self::getRequestUrl();
@@ -774,8 +777,7 @@  discard block
 block discarded – undo
774 777
 		if($self->site_title)
775 778
 		{
776 779
 			$self->site_title .= ' - ' . $site_title;
777
-		}
778
-		else
780
+		} else
779 781
 		{
780 782
 			$self->site_title = $site_title;
781 783
 		}
@@ -875,8 +877,7 @@  discard block
 block discarded – undo
875 877
 		{
876 878
 			$self->loaded_lang_files[] = $filename;
877 879
 			include($filename);
878
-		}
879
-		else
880
+		} else
880 881
 		{
881 882
 			$self->_evalxmlLang($path);
882 883
 		}
@@ -892,7 +893,9 @@  discard block
 block discarded – undo
892 893
 	{
893 894
 		global $lang;
894 895
 
895
-		if(!$path) return;
896
+		if(!$path) {
897
+			return;
898
+		}
896 899
 
897 900
 		$_path = 'eval://' . $path;
898 901
 
@@ -924,7 +927,9 @@  discard block
 block discarded – undo
924 927
 	 */
925 928
 	function _loadXmlLang($path)
926 929
 	{
927
-		if(!$path) return;
930
+		if(!$path) {
931
+			return;
932
+		}
928 933
 
929 934
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
930 935
 		return $oXmlLangParser->compile();
@@ -938,7 +943,9 @@  discard block
 block discarded – undo
938 943
 	 */
939 944
 	function _loadPhpLang($path)
940 945
 	{
941
-		if(!$path) return;
946
+		if(!$path) {
947
+			return;
948
+		}
942 949
 
943 950
 		if(substr_compare($path, '/', -1) !== 0)
944 951
 		{
@@ -1074,12 +1081,14 @@  discard block
 block discarded – undo
1074 1081
 		static $flag = TRUE;
1075 1082
 		if($charset)
1076 1083
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1080
-			else $flag = FALSE;
1081
-		}
1082
-		else
1084
+			if(is_array($val)) {
1085
+							array_walk($val,'Context::checkConvertFlag',$charset);
1086
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1087
+				$flag = FALSE;
1088
+			} else {
1089
+				$flag = FALSE;
1090
+			}
1091
+		} else
1083 1092
 		{
1084 1093
 			$return = $flag;
1085 1094
 			$flag = TRUE;
@@ -1101,8 +1110,9 @@  discard block
 block discarded – undo
1101 1110
 		if (is_array($val))
1102 1111
 		{
1103 1112
 			array_walk($val,'Context::doConvertEncoding',$charset);
1113
+		} else {
1114
+			$val = iconv($charset,'UTF-8',$val);
1104 1115
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1106 1116
 	}
1107 1117
 
1108 1118
 	/**
@@ -1113,7 +1123,9 @@  discard block
 block discarded – undo
1113 1123
 	 */
1114 1124
 	function convertEncodingStr($str)
1115 1125
 	{
1116
-        if(!$str) return null;
1126
+        if(!$str) {
1127
+        	return null;
1128
+        }
1117 1129
 		$obj = new stdClass();
1118 1130
 		$obj->str = $str;
1119 1131
 		$obj = self::convertEncoding($obj);
@@ -1226,16 +1238,13 @@  discard block
 block discarded – undo
1226 1238
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1227 1239
 			{
1228 1240
 				$set_to_vars = TRUE;
1229
-			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1241
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1231 1242
 			{
1232 1243
 				$set_to_vars = TRUE;
1233
-			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1245
 			{
1236 1246
 				$set_to_vars = TRUE;
1237
-			}
1238
-			else
1247
+			} else
1239 1248
 			{
1240 1249
 				$set_to_vars = FALSE;
1241 1250
 			}
@@ -1261,8 +1270,7 @@  discard block
 block discarded – undo
1261 1270
 					return;
1262 1271
 				}
1263 1272
 			}
1264
-		}
1265
-		else if(is_array($val))
1273
+		} else if(is_array($val))
1266 1274
 		{
1267 1275
 			foreach($val as $val2)
1268 1276
 			{
@@ -1402,24 +1410,19 @@  discard block
 block discarded – undo
1402 1410
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1411
 			{
1404 1412
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405
-			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1413
+			} elseif($key === 'mid' || $key === 'search_keyword')
1407 1414
 			{
1408 1415
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409
-			}
1410
-			elseif($key === 'vid')
1416
+			} elseif($key === 'vid')
1411 1417
 			{
1412 1418
 				$result[$k] = urlencode($v);
1413
-			}
1414
-			elseif($key === 'xe_validator_id')
1419
+			} elseif($key === 'xe_validator_id')
1415 1420
 			{
1416 1421
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417
-			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1422
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1423
 			{
1420 1424
 				unset($result[$k]);
1421
-			}
1422
-			else
1425
+			} else
1423 1426
 			{
1424 1427
 				$result[$k] = $v;
1425 1428
 
@@ -1428,8 +1431,7 @@  discard block
 block discarded – undo
1428 1431
 					if (is_array($result[$k]))
1429 1432
 					{
1430 1433
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1431
-					}
1432
-					else
1434
+					} else
1433 1435
 					{
1434 1436
 						$result[$k] = stripslashes($result[$k]);
1435 1437
 					}
@@ -1438,8 +1440,7 @@  discard block
 block discarded – undo
1438 1440
 				if(is_array($result[$k]))
1439 1441
 				{
1440 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441
-				}
1442
-				else
1443
+				} else
1443 1444
 				{
1444 1445
 					$result[$k] = trim($result[$k]);
1445 1446
 				}
@@ -1484,8 +1485,7 @@  discard block
 block discarded – undo
1484 1485
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1485 1486
 				$this->set($key, $val, TRUE);
1486 1487
 				$this->is_uploaded = TRUE;
1487
-			}
1488
-			else
1488
+			} else
1489 1489
 			{
1490 1490
 				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1491 1491
 				{
@@ -1591,8 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1592 1592
 			{
1593 1593
 				$vid = $site_module_info->domain;
1594
-			}
1595
-			else
1594
+			} else
1596 1595
 			{
1597 1596
 				$domain = $site_module_info->domain;
1598 1597
 			}
@@ -1609,8 +1608,7 @@  discard block
 block discarded – undo
1609 1608
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1610 1609
 			{
1611 1610
 				unset($domain);
1612
-			}
1613
-			else
1611
+			} else
1614 1612
 			{
1615 1613
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1616 1614
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1630,8 +1628,7 @@  discard block
 block discarded – undo
1630 1628
 			{
1631 1629
 				array_shift($args_list);
1632 1630
 			}
1633
-		}
1634
-		else
1631
+		} else
1635 1632
 		{
1636 1633
 			// Otherwise, make GET variables into array
1637 1634
 			$get_vars = get_object_vars($self->get_vars);
@@ -1658,8 +1655,7 @@  discard block
 block discarded – undo
1658 1655
 		if($vid)
1659 1656
 		{
1660 1657
 			$get_vars['vid'] = $vid;
1661
-		}
1662
-		else
1658
+		} else
1663 1659
 		{
1664 1660
 			unset($get_vars['vid']);
1665 1661
 		}
@@ -1731,8 +1727,7 @@  discard block
 block discarded – undo
1731 1727
 						{
1732 1728
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1733 1729
 						}
1734
-					}
1735
-					elseif(!is_array($val))
1730
+					} elseif(!is_array($val))
1736 1731
 					{
1737 1732
 						$queries[] = $key . '=' . urlencode($val);
1738 1733
 					}
@@ -1750,25 +1745,23 @@  discard block
 block discarded – undo
1750 1745
 		{
1751 1746
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1752 1747
 			// optional SSL use
1753
-		}
1754
-		elseif($_use_ssl == 'optional')
1748
+		} elseif($_use_ssl == 'optional')
1755 1749
 		{
1756 1750
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1757 1751
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1758 1752
 			// no SSL
1759
-		}
1760
-		else
1753
+		} else
1761 1754
 		{
1762 1755
 			// currently on SSL but target is not based on SSL
1763 1756
 			if($_SERVER['HTTPS'] == 'on')
1764 1757
 			{
1765 1758
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1766
-			}
1767
-			else if($domain) // if $domain is set
1759
+			} else if($domain) {
1760
+				// if $domain is set
1768 1761
 			{
1769 1762
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1770 1763
 			}
1771
-			else
1764
+			} else
1772 1765
 			{
1773 1766
 				$query = getScriptPath() . $query;
1774 1767
 			}
@@ -1825,8 +1818,7 @@  discard block
 block discarded – undo
1825 1818
 		if($domain)
1826 1819
 		{
1827 1820
 			$domain_key = md5($domain);
1828
-		}
1829
-		else
1821
+		} else
1830 1822
 		{
1831 1823
 			$domain_key = 'default';
1832 1824
 		}
@@ -1855,8 +1847,7 @@  discard block
 block discarded – undo
1855 1847
 			{
1856 1848
 				$target_url.= '/';
1857 1849
 			}
1858
-		}
1859
-		else
1850
+		} else
1860 1851
 		{
1861 1852
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1862 1853
 		}
@@ -1874,20 +1865,17 @@  discard block
 block discarded – undo
1874 1865
 			if($port && $port != 443)
1875 1866
 			{
1876 1867
 				$url_info['port'] = $port;
1877
-			}
1878
-			elseif($url_info['port'] == 443)
1868
+			} elseif($url_info['port'] == 443)
1879 1869
 			{
1880 1870
 				unset($url_info['port']);
1881 1871
 			}
1882
-		}
1883
-		else
1872
+		} else
1884 1873
 		{
1885 1874
 			$port = self::get('_http_port');
1886 1875
 			if($port && $port != 80)
1887 1876
 			{
1888 1877
 				$url_info['port'] = $port;
1889
-			}
1890
-			elseif($url_info['port'] == 80)
1878
+			} elseif($url_info['port'] == 80)
1891 1879
 			{
1892 1880
 				unset($url_info['port']);
1893 1881
 			}
@@ -2124,8 +2112,7 @@  discard block
 block discarded – undo
2124 2112
 		if(strpos($file, './') === 0)
2125 2113
 		{
2126 2114
 			$file = $script_path . substr($file, 2);
2127
-		}
2128
-		elseif(strpos($file, '../') === 0)
2115
+		} elseif(strpos($file, '../') === 0)
2129 2116
 		{
2130 2117
 			$file = self::normalizeFilePath($script_path . $file);
2131 2118
 		}
@@ -2387,8 +2374,7 @@  discard block
 block discarded – undo
2387 2374
 			if(substr_compare($filename, '.js', -3) === 0)
2388 2375
 			{
2389 2376
 				$result->jsList[] = $plugin_path . $filename;
2390
-			}
2391
-			elseif(substr_compare($filename, '.css', -4) === 0)
2377
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2392 2378
 			{
2393 2379
 				$result->cssList[] = $plugin_path . $filename;
2394 2380
 			}
@@ -2645,8 +2631,7 @@  discard block
 block discarded – undo
2645 2631
 			if(count($_base) > 0)
2646 2632
 			{
2647 2633
 				array_shift($_base);
2648
-			}
2649
-			else
2634
+			} else
2650 2635
 			{
2651 2636
 				array_unshift($_base, '..');
2652 2637
 			}
Please login to merge, or discard this patch.
classes/display/VirtualXMLDisplayHandler.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,35 +17,35 @@
 block discarded – undo
17 17
 		$request_url = Context::getRequestUri();
18 18
 		$output = new stdClass();
19 19
 
20
-		if(substr_compare($request_url, '/', -1) !== 0)
20
+		if (substr_compare($request_url, '/', -1) !== 0)
21 21
 		{
22 22
 			$request_url .= '/';
23 23
 		}
24 24
 
25
-		if($error === 0)
25
+		if ($error === 0)
26 26
 		{
27
-			if($message != 'success') $output->message = $message;
27
+			if ($message != 'success') $output->message = $message;
28 28
 
29 29
 			$output->url = ($redirect_url) ? $redirect_url : $request_uri;
30 30
 		}
31 31
 		else
32 32
 		{
33
-			if($message != 'fail') $output->message = $message;
33
+			if ($message != 'fail') $output->message = $message;
34 34
 		}
35 35
 
36 36
 		$html = array();
37 37
 		$html[] = '<!DOCTYPE html><html><head><title>Moved...</title><meta charset="utf-8" /><script>';
38 38
 
39
-		if($output->message)
39
+		if ($output->message)
40 40
 		{
41
-			$html[] = 'alert(' . json_encode($output->message, JSON_UNESCAPED_SLASHES) . ');';
41
+			$html[] = 'alert('.json_encode($output->message, JSON_UNESCAPED_SLASHES).');';
42 42
 		}
43 43
 
44
-		if($output->url)
44
+		if ($output->url)
45 45
 		{
46 46
 			$url = json_encode(preg_replace('/#(.+)$/i', '', $output->url), JSON_UNESCAPED_SLASHES);
47 47
 			$html[] = 'var win = (window.opener) ? window.opener : window.parent;';
48
-			$html[] = 'win.location.href = ' . $url;
48
+			$html[] = 'win.location.href = '.$url;
49 49
 			$html[] = 'if(window.opener) self.close();';
50 50
 		}
51 51
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,13 +24,16 @@
 block discarded – undo
24 24
 
25 25
 		if($error === 0)
26 26
 		{
27
-			if($message != 'success') $output->message = $message;
27
+			if($message != 'success') {
28
+				$output->message = $message;
29
+			}
28 30
 
29 31
 			$output->url = ($redirect_url) ? $redirect_url : $request_uri;
30
-		}
31
-		else
32
+		} else
32 33
 		{
33
-			if($message != 'fail') $output->message = $message;
34
+			if($message != 'fail') {
35
+				$output->message = $message;
36
+			}
34 37
 		}
35 38
 
36 39
 		$html = array();
Please login to merge, or discard this patch.
classes/mobile/Mobile.class.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	function &getInstance()
24 24
 	{
25 25
 		static $theInstance;
26
-		if(!isset($theInstance))
26
+		if (!isset($theInstance))
27 27
 		{
28 28
 			$theInstance = new Mobile();
29 29
 		}
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	function _isFromMobilePhone()
50 50
 	{
51
-		if($this->ismobile !== NULL)
51
+		if ($this->ismobile !== NULL)
52 52
 		{
53 53
 			return $this->ismobile;
54 54
 		}
55
-		if(Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"])
55
+		if (Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"])
56 56
 		{
57 57
 			return ($this->ismobile = false);
58 58
 		}
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 		$this->ismobile = FALSE;
64 64
 
65 65
 		$m = Context::get('m');
66
-		if(strlen($m) == 1)
66
+		if (strlen($m) == 1)
67 67
 		{
68
-			if($m == "1")
68
+			if ($m == "1")
69 69
 			{
70 70
 				$this->ismobile = TRUE;
71 71
 			}
72
-			elseif($m == "0")
72
+			elseif ($m == "0")
73 73
 			{
74 74
 				$this->ismobile = FALSE;
75 75
 			}
76 76
 		}
77
-		elseif(isset($_COOKIE['mobile']))
77
+		elseif (isset($_COOKIE['mobile']))
78 78
 		{
79
-			if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
79
+			if ($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
80 80
 			{
81
-				if($_COOKIE['mobile'] == 'true')
81
+				if ($_COOKIE['mobile'] == 'true')
82 82
 				{
83 83
 					$this->ismobile = TRUE;
84 84
 				}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				$this->ismobile = FALSE;
93 93
 				setcookie("mobile", FALSE);
94 94
 				setcookie("user-agent", FALSE);
95
-				if(!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent())
95
+				if (!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent())
96 96
 				{
97 97
 					$this->ismobile = TRUE;
98 98
 				}
@@ -100,36 +100,36 @@  discard block
 block discarded – undo
100 100
 		}
101 101
 		else
102 102
 		{
103
-			if($this->isMobilePadCheckByAgent())
103
+			if ($this->isMobilePadCheckByAgent())
104 104
 			{
105 105
 				$this->ismobile = FALSE;
106 106
 			}
107 107
 			else
108 108
 			{
109
-				if($this->isMobileCheckByAgent())
109
+				if ($this->isMobileCheckByAgent())
110 110
 				{
111 111
 					$this->ismobile = TRUE;
112 112
 				}
113 113
 			}
114 114
 		}
115 115
 
116
-		if($this->ismobile !== NULL)
116
+		if ($this->ismobile !== NULL)
117 117
 		{
118
-			if($this->ismobile == TRUE)
118
+			if ($this->ismobile == TRUE)
119 119
 			{
120
-				if($_COOKIE['mobile'] != 'true')
120
+				if ($_COOKIE['mobile'] != 'true')
121 121
 				{
122 122
 					$_COOKIE['mobile'] = 'true';
123 123
 					setcookie("mobile", 'true');
124 124
 				}
125 125
 			}
126
-			elseif($_COOKIE['mobile'] != 'false')
126
+			elseif ($_COOKIE['mobile'] != 'false')
127 127
 			{
128 128
 				$_COOKIE['mobile'] = 'false';
129 129
 				setcookie("mobile", 'false');
130 130
 			}
131 131
 
132
-			if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
132
+			if ($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
133 133
 			{
134 134
 				setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']));
135 135
 			}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	function isMobileCheckByAgent()
147 147
 	{
148 148
 		static $UACheck;
149
-		if(isset($UACheck))
149
+		if (isset($UACheck))
150 150
 		{
151 151
 			return $UACheck;
152 152
 		}
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 		$oMobile = Mobile::getInstance();
155 155
 		$mobileAgent = array('iPod', 'iPhone', 'Android', 'BlackBerry', 'SymbianOS', 'Bada', 'Tizen', 'Kindle', 'Wii', 'SCH-', 'SPH-', 'CANU-', 'Windows Phone', 'Windows CE', 'POLARIS', 'Palm', 'Dorothy Browser', 'Mobile', 'Opera Mobi', 'Opera Mini', 'Minimo', 'AvantGo', 'NetFront', 'Nokia', 'LGPlayer', 'SonyEricsson', 'HTC');
156 156
 
157
-		if($oMobile->isMobilePadCheckByAgent())
157
+		if ($oMobile->isMobilePadCheckByAgent())
158 158
 		{
159 159
 			$UACheck = TRUE;
160 160
 			return TRUE;
161 161
 		}
162 162
 
163
-		foreach($mobileAgent as $agent)
163
+		foreach ($mobileAgent as $agent)
164 164
 		{
165
-			if(stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
165
+			if (stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
166 166
 			{
167 167
 				$UACheck = TRUE;
168 168
 				return TRUE;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	function isMobilePadCheckByAgent()
181 181
 	{
182 182
 		static $UACheck;
183
-		if(isset($UACheck))
183
+		if (isset($UACheck))
184 184
 		{
185 185
 			return $UACheck;
186 186
 		}
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
 		// $exceptionAgent[0] contains exception agents for all exceptions.
191 191
 		$exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile');
192 192
 
193
-		foreach($padAgent as $agent)
193
+		foreach ($padAgent as $agent)
194 194
 		{
195
-			if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
195
+			if (strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
196 196
 			{
197
-				if(!isset($exceptionAgent[$agent]))
197
+				if (!isset($exceptionAgent[$agent]))
198 198
 				{
199 199
 					$UACheck = TRUE;
200 200
 					return TRUE;
201 201
 				}
202
-				elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
202
+				elseif (strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
203 203
 				{
204 204
 					// If the agent is the Android, that can be either tablet and mobile phone.
205
-					foreach($exceptionAgent[0] as $val)
205
+					foreach ($exceptionAgent[0] as $val)
206 206
 					{
207
-						if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
207
+						if (strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
208 208
 						{
209 209
 							$UACheck = FALSE;
210 210
 							return FALSE;
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -68,26 +68,22 @@  discard block
 block discarded – undo
68 68
 			if($m == "1")
69 69
 			{
70 70
 				$this->ismobile = TRUE;
71
-			}
72
-			elseif($m == "0")
71
+			} elseif($m == "0")
73 72
 			{
74 73
 				$this->ismobile = FALSE;
75 74
 			}
76
-		}
77
-		elseif(isset($_COOKIE['mobile']))
75
+		} elseif(isset($_COOKIE['mobile']))
78 76
 		{
79 77
 			if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
80 78
 			{
81 79
 				if($_COOKIE['mobile'] == 'true')
82 80
 				{
83 81
 					$this->ismobile = TRUE;
84
-				}
85
-				else
82
+				} else
86 83
 				{
87 84
 					$this->ismobile = FALSE;
88 85
 				}
89
-			}
90
-			else
86
+			} else
91 87
 			{
92 88
 				$this->ismobile = FALSE;
93 89
 				setcookie("mobile", FALSE);
@@ -97,14 +93,12 @@  discard block
 block discarded – undo
97 93
 					$this->ismobile = TRUE;
98 94
 				}
99 95
 			}
100
-		}
101
-		else
96
+		} else
102 97
 		{
103 98
 			if($this->isMobilePadCheckByAgent())
104 99
 			{
105 100
 				$this->ismobile = FALSE;
106
-			}
107
-			else
101
+			} else
108 102
 			{
109 103
 				if($this->isMobileCheckByAgent())
110 104
 				{
@@ -122,8 +116,7 @@  discard block
 block discarded – undo
122 116
 					$_COOKIE['mobile'] = 'true';
123 117
 					setcookie("mobile", 'true');
124 118
 				}
125
-			}
126
-			elseif($_COOKIE['mobile'] != 'false')
119
+			} elseif($_COOKIE['mobile'] != 'false')
127 120
 			{
128 121
 				$_COOKIE['mobile'] = 'false';
129 122
 				setcookie("mobile", 'false');
@@ -198,8 +191,7 @@  discard block
 block discarded – undo
198 191
 				{
199 192
 					$UACheck = TRUE;
200 193
 					return TRUE;
201
-				}
202
-				elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
194
+				} elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
203 195
 				{
204 196
 					// If the agent is the Android, that can be either tablet and mobile phone.
205 197
 					foreach($exceptionAgent[0] as $val)
Please login to merge, or discard this patch.
modules/module/module.model.php 2 patches
Spacing   +363 added lines, -363 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$hostname = $request_url_parse['host'];
101 101
 			$path = $request_url_parse['path'];
102 102
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
105
+			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124
-				$object_key = 'site_info:' . md5($domain);
124
+				$object_key = 'site_info:'.md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225 225
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230
-				$object_key = 'mid_info:' . $module_srl;
230
+				$object_key = 'mid_info:'.$module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
232 232
 				$module_info = $oCacheHandler->get($module_info_cache_key);
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
244
-				$object_key = 'mid_info:' . $module_info->module_srl;
244
+				$object_key = 'mid_info:'.$module_info->module_srl;
245 245
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
246 246
 				$oCacheHandler->put($module_info_cache_key, $module_info);
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326 326
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331
-				$object_key = 'mid_info:' . $module_srl;
331
+				$object_key = 'mid_info:'.$module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
340
-				$object_key = 'mid_info:' . $output->data->module_srl;
340
+				$object_key = 'mid_info:'.$output->data->module_srl;
341 341
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 342
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343 343
 			}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,22 +918,22 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937 937
 
938 938
 					$index = $action->attrs->index;
939 939
 					$admin_index = $action->attrs->admin_index;
@@ -947,14 +947,14 @@  discard block
 block discarded – undo
947 947
 					$info->action->{$name}->standalone = $standalone;
948 948
 					$info->action->{$name}->ruleset = $ruleset;
949 949
 					$info->action->{$name}->method = $method;
950
-					if($action->attrs->menu_name)
950
+					if ($action->attrs->menu_name)
951 951
 					{
952
-						if($menu_index == 'true')
952
+						if ($menu_index == 'true')
953 953
 						{
954 954
 							$info->menu->{$action->attrs->menu_name}->index = $name;
955 955
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
956 956
 						}
957
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
957
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
958 958
 						{
959 959
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
960 960
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -971,22 +971,22 @@  discard block
 block discarded – undo
971 971
 					$buff[] = sprintf('$info->action->%s->ruleset=\'%s\';', $name, $ruleset);
972 972
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
973 973
 
974
-					if($index=='true')
974
+					if ($index == 'true')
975 975
 					{
976 976
 						$default_index_act = $name;
977 977
 						$info->default_index_act = $name;
978 978
 					}
979
-					if($admin_index=='true')
979
+					if ($admin_index == 'true')
980 980
 					{
981 981
 						$admin_index_act = $name;
982 982
 						$info->admin_index_act = $name;
983 983
 					}
984
-					if($setup_index=='true')
984
+					if ($setup_index == 'true')
985 985
 					{
986 986
 						$setup_index_act = $name;
987 987
 						$info->setup_index_act = $name;
988 988
 					}
989
-					if($simple_setup_index=='true')
989
+					if ($simple_setup_index == 'true')
990 990
 					{
991 991
 						$simple_setup_index_act = $name;
992 992
 						$info->simple_setup_index_act = $name;
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			return $info;
1008 1008
 		}
1009 1009
 
1010
-		if(file_exists($cache_file)) return include($cache_file);
1010
+		if (file_exists($cache_file)) return include($cache_file);
1011 1011
 	}
1012 1012
 
1013 1013
 	/**
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	{
1019 1019
 		$module = Context::get('module_type');
1020 1020
 
1021
-		if($module == 'ARTICLE')
1021
+		if ($module == 'ARTICLE')
1022 1022
 		{
1023 1023
 			$module = 'page';
1024 1024
 		}
@@ -1038,26 +1038,26 @@  discard block
 block discarded – undo
1038 1038
 	 */
1039 1039
 	function getSkins($path, $dir = 'skins')
1040 1040
 	{
1041
-		if(substr($path, -1) == '/')
1041
+		if (substr($path, -1) == '/')
1042 1042
 		{
1043 1043
 			$path = substr($path, 0, -1);
1044 1044
 		}
1045 1045
 
1046 1046
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1047 1047
 		$list = FileHandler::readDir($skin_path);
1048
-		if(!count($list)) return;
1048
+		if (!count($list)) return;
1049 1049
 
1050 1050
 		natcasesort($list);
1051 1051
 
1052
-		foreach($list as $skin_name)
1052
+		foreach ($list as $skin_name)
1053 1053
 		{
1054
-			if(!is_dir($skin_path . $skin_name))
1054
+			if (!is_dir($skin_path.$skin_name))
1055 1055
 			{
1056 1056
 				continue;
1057 1057
 			}
1058 1058
 			unset($skin_info);
1059 1059
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1060
-			if(!$skin_info)
1060
+			if (!$skin_info)
1061 1061
 			{
1062 1062
 				$skin_info = new stdClass();
1063 1063
 				$skin_info->title = $skin_name;
@@ -1070,15 +1070,15 @@  discard block
 block discarded – undo
1070 1070
 		$tmpPath = trim($tmpPath);
1071 1071
 		$module = array_pop(explode(' ', $tmpPath));
1072 1072
 
1073
-		if($dir == 'skins')
1073
+		if ($dir == 'skins')
1074 1074
 		{
1075 1075
 			$oAdminModel = getAdminModel('admin');
1076 1076
 			$themesInfo = $oAdminModel->getThemeList();
1077 1077
 
1078
-			foreach($themesInfo as $themeName => $info)
1078
+			foreach ($themesInfo as $themeName => $info)
1079 1079
 			{
1080 1080
 				$skinInfos = $info->skin_infos;
1081
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1081
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1082 1082
 				{
1083 1083
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1084 1084
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1090,13 +1090,13 @@  discard block
 block discarded – undo
1090 1090
 		$oMenuAdminModel = getAdminModel('menu');
1091 1091
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1092 1092
 		$moduleName = $module;
1093
-		if($moduleName === 'page')
1093
+		if ($moduleName === 'page')
1094 1094
 		{
1095 1095
 			$moduleName = 'ARTICLE';
1096 1096
 		}
1097
-		if(array_key_exists($moduleName, $installedMenuTypes))
1097
+		if (array_key_exists($moduleName, $installedMenuTypes))
1098 1098
 		{
1099
-			if($dir == 'skins')
1099
+			if ($dir == 'skins')
1100 1100
 			{
1101 1101
 				$type = 'P';
1102 1102
 			}
@@ -1106,12 +1106,12 @@  discard block
 block discarded – undo
1106 1106
 			}
1107 1107
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1108 1108
 
1109
-			if(isset($defaultSkinName))
1109
+			if (isset($defaultSkinName))
1110 1110
 			{
1111 1111
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1112 1112
 
1113 1113
 				$useDefault = new stdClass();
1114
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1114
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1115 1115
 
1116 1116
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1117 1117
 
@@ -1128,20 +1128,20 @@  discard block
 block discarded – undo
1128 1128
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1129 1129
 	{
1130 1130
 		// Read xml file having skin information
1131
-		if(substr($path,-1)!='/') $path .= '/';
1131
+		if (substr($path, -1) != '/') $path .= '/';
1132 1132
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1133
-		if(!file_exists($skin_xml_file)) return;
1133
+		if (!file_exists($skin_xml_file)) return;
1134 1134
 		// Create XmlParser object
1135 1135
 		$oXmlParser = new XmlParser();
1136 1136
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1137 1137
 		// Return if no skin information is
1138
-		if(!$_xml_obj->skin) return;
1138
+		if (!$_xml_obj->skin) return;
1139 1139
 		$xml_obj = $_xml_obj->skin;
1140 1140
 		// Skin Name
1141 1141
 		$skin_info = new stdClass();
1142 1142
 		$skin_info->title = $xml_obj->title->body;
1143 1143
 		// Author information
1144
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1144
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1145 1145
 		{
1146 1146
 			// skin format v0.2
1147 1147
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1152,10 +1152,10 @@  discard block
 block discarded – undo
1152 1152
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1153 1153
 			$skin_info->description = $xml_obj->description->body;
1154 1154
 
1155
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1155
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1156 1156
 			else $author_list = $xml_obj->author;
1157 1157
 
1158
-			foreach($author_list as $author)
1158
+			foreach ($author_list as $author)
1159 1159
 			{
1160 1160
 				$author_obj = new stdClass();
1161 1161
 				$author_obj->name = $author->name->body;
@@ -1164,25 +1164,25 @@  discard block
 block discarded – undo
1164 1164
 				$skin_info->author[] = $author_obj;
1165 1165
 			}
1166 1166
 			// List extra vars
1167
-			if($xml_obj->extra_vars)
1167
+			if ($xml_obj->extra_vars)
1168 1168
 			{
1169 1169
 				$extra_var_groups = $xml_obj->extra_vars->group;
1170
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1170
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1172 1172
 
1173
-				foreach($extra_var_groups as $group)
1173
+				foreach ($extra_var_groups as $group)
1174 1174
 				{
1175 1175
 					$extra_vars = $group->var;
1176
-					if(!$extra_vars)
1176
+					if (!$extra_vars)
1177 1177
 					{
1178 1178
 						continue;
1179 1179
 					}
1180
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1180
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1181 1181
 
1182
-					foreach($extra_vars as $key => $val)
1182
+					foreach ($extra_vars as $key => $val)
1183 1183
 					{
1184 1184
 						$obj = new stdClass();
1185
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1185
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1186 1186
 
1187 1187
 						$obj->group = $group->title->body;
1188 1188
 						$obj->name = $val->attrs->name;
@@ -1191,14 +1191,14 @@  discard block
 block discarded – undo
1191 1191
 						$obj->description = $val->description->body;
1192 1192
 						$obj->value = $extra_vals->{$obj->name};
1193 1193
 						$obj->default = $val->attrs->default;
1194
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1195
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1194
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1195
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1196 1196
 						// Get an option list from 'select'type
1197
-						if(is_array($val->options))
1197
+						if (is_array($val->options))
1198 1198
 						{
1199 1199
 							$option_count = count($val->options);
1200 1200
 
1201
-							for($i = 0; $i < $option_count; $i++)
1201
+							for ($i = 0; $i < $option_count; $i++)
1202 1202
 							{
1203 1203
 								$obj->options[$i] = new stdClass();
1204 1204
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1235,18 +1235,18 @@  discard block
 block discarded – undo
1235 1235
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1236 1236
 			// Variables used in the skin
1237 1237
 			$extra_var_groups = $xml_obj->extra_vars->group;
1238
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1238
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1240 1240
 
1241
-			foreach($extra_var_groups as $group)
1241
+			foreach ($extra_var_groups as $group)
1242 1242
 			{
1243 1243
 				$extra_vars = $group->var;
1244 1244
 
1245
-				if($extra_vars)
1245
+				if ($extra_vars)
1246 1246
 				{
1247
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1247
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1248 1248
 
1249
-					foreach($extra_vars as $var)
1249
+					foreach ($extra_vars as $var)
1250 1250
 					{
1251 1251
 						unset($obj);
1252 1252
 						unset($options);
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 						$title = $var->title->body;
1258 1258
 						$description = $var->description->body;
1259 1259
 						// Get an option list from 'select'type.
1260
-						if(is_array($var->default))
1260
+						if (is_array($var->default))
1261 1261
 						{
1262 1262
 							$option_count = count($var->default);
1263 1263
 
1264
-							for($i = 0; $i < $option_count; $i++)
1264
+							for ($i = 0; $i < $option_count; $i++)
1265 1265
 							{
1266 1266
 								$options[$i]->title = $var->default[$i]->body;
1267 1267
 								$options[$i]->value = $var->default[$i]->body;
@@ -1295,19 +1295,19 @@  discard block
 block discarded – undo
1295 1295
 
1296 1296
 		// colorset
1297 1297
 		$colorset = $xml_obj->colorset->color;
1298
-		if($colorset)
1298
+		if ($colorset)
1299 1299
 		{
1300
-			if(!is_array($colorset)) $colorset = array($colorset);
1300
+			if (!is_array($colorset)) $colorset = array($colorset);
1301 1301
 
1302
-			foreach($colorset as $color)
1302
+			foreach ($colorset as $color)
1303 1303
 			{
1304 1304
 				$name = $color->attrs->name;
1305 1305
 				$title = $color->title->body;
1306 1306
 				$screenshot = $color->attrs->src;
1307
-				if($screenshot)
1307
+				if ($screenshot)
1308 1308
 				{
1309 1309
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1310
-					if(!file_exists($screenshot)) $screenshot = "";
1310
+					if (!file_exists($screenshot)) $screenshot = "";
1311 1311
 				}
1312 1312
 				else $screenshot = "";
1313 1313
 
@@ -1319,19 +1319,19 @@  discard block
 block discarded – undo
1319 1319
 			}
1320 1320
 		}
1321 1321
 		// Menu type (settings for layout)
1322
-		if($xml_obj->menus->menu)
1322
+		if ($xml_obj->menus->menu)
1323 1323
 		{
1324 1324
 			$menus = $xml_obj->menus->menu;
1325
-			if(!is_array($menus)) $menus = array($menus);
1325
+			if (!is_array($menus)) $menus = array($menus);
1326 1326
 
1327 1327
 			$menu_count = count($menus);
1328 1328
 			$skin_info->menu_count = $menu_count;
1329
-			for($i=0;$i<$menu_count;$i++)
1329
+			for ($i = 0; $i < $menu_count; $i++)
1330 1330
 			{
1331 1331
 				unset($obj);
1332 1332
 
1333 1333
 				$obj->name = $menus[$i]->attrs->name;
1334
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1334
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1335 1335
 				$obj->title = $menus[$i]->title->body;
1336 1336
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1337 1337
 
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 		}
1341 1341
 
1342 1342
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1343
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1343
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1344 1344
 		return $skin_info;
1345 1345
 	}
1346 1346
 
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 	{
1352 1352
 		$args = new stdClass;
1353 1353
 		$args->site_srl = $site_srl;
1354
-		if(!is_null($module)) $args->module = $module;
1354
+		if (!is_null($module)) $args->module = $module;
1355 1355
 		$output = executeQuery('module.getModuleCount', $args);
1356 1356
 		return $output->data->count;
1357 1357
 	}
@@ -1365,26 +1365,26 @@  discard block
 block discarded – undo
1365 1365
 		$config = false;
1366 1366
 		// cache controll
1367 1367
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1368
-		if($oCacheHandler->isSupport())
1368
+		if ($oCacheHandler->isSupport())
1369 1369
 		{
1370
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1370
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1371 1371
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1372 1372
 			$config = $oCacheHandler->get($cache_key);
1373 1373
 		}
1374 1374
 
1375
-		if($config === false)
1375
+		if ($config === false)
1376 1376
 		{
1377
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1377
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1378 1378
 			{
1379 1379
 				$args = new stdClass();
1380 1380
 				$args->module = $module;
1381 1381
 				$args->site_srl = $site_srl;
1382 1382
 				$output = executeQuery('module.getModuleConfig', $args);
1383
-				if($output->data->config) $config = unserialize($output->data->config);
1383
+				if ($output->data->config) $config = unserialize($output->data->config);
1384 1384
 				else $config = null;
1385 1385
 
1386 1386
 				//insert in cache
1387
-				if($oCacheHandler->isSupport())
1387
+				if ($oCacheHandler->isSupport())
1388 1388
 				{
1389 1389
 					$oCacheHandler->put($cache_key, $config);
1390 1390
 				}
@@ -1405,26 +1405,26 @@  discard block
 block discarded – undo
1405 1405
 		$config = false;
1406 1406
 		// cache controll
1407 1407
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1408
-		if($oCacheHandler->isSupport())
1408
+		if ($oCacheHandler->isSupport())
1409 1409
 		{
1410 1410
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1411 1411
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1412 1412
 			$config = $oCacheHandler->get($cache_key);
1413 1413
 		}
1414 1414
 
1415
-		if($config === false)
1415
+		if ($config === false)
1416 1416
 		{
1417
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1417
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1418 1418
 			{
1419 1419
 				$args = new stdClass();
1420 1420
 				$args->module = $module;
1421 1421
 				$args->module_srl = $module_srl;
1422 1422
 				$output = executeQuery('module.getModulePartConfig', $args);
1423
-				if($output->data->config) $config = unserialize($output->data->config);
1423
+				if ($output->data->config) $config = unserialize($output->data->config);
1424 1424
 				else $config = null;
1425 1425
 
1426 1426
 				//insert in cache
1427
-				if($oCacheHandler->isSupport())
1427
+				if ($oCacheHandler->isSupport())
1428 1428
 				{
1429 1429
 					$oCacheHandler->put($cache_key, $config);
1430 1430
 				}
@@ -1443,11 +1443,11 @@  discard block
 block discarded – undo
1443 1443
 	{
1444 1444
 		$args = new stdClass();
1445 1445
 		$args->module = $module;
1446
-		if($site_srl) $args->site_srl = $site_srl;
1446
+		if ($site_srl) $args->site_srl = $site_srl;
1447 1447
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1448
-		if(!$output->toBool() || !$output->data) return array();
1448
+		if (!$output->toBool() || !$output->data) return array();
1449 1449
 
1450
-		foreach($output->data as $key => $val)
1450
+		foreach ($output->data as $key => $val)
1451 1451
 		{
1452 1452
 			$result[$val->module_srl] = unserialize($val->config);
1453 1453
 		}
@@ -1463,12 +1463,12 @@  discard block
 block discarded – undo
1463 1463
 		$args->moduleCategorySrl = $moduleCategorySrl;
1464 1464
 		// Get data from the DB
1465 1465
 		$output = executeQuery('module.getModuleCategories', $args);
1466
-		if(!$output->toBool()) return $output;
1466
+		if (!$output->toBool()) return $output;
1467 1467
 		$list = $output->data;
1468
-		if(!$list) return;
1469
-		if(!is_array($list)) $list = array($list);
1468
+		if (!$list) return;
1469
+		if (!is_array($list)) $list = array($list);
1470 1470
 
1471
-		foreach($list as $val)
1471
+		foreach ($list as $val)
1472 1472
 		{
1473 1473
 			$category_list[$val->module_category_srl] = $val;
1474 1474
 		}
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 		$args = new stdClass;
1485 1485
 		$args->module_category_srl = $module_category_srl;
1486 1486
 		$output = executeQuery('module.getModuleCategory', $args);
1487
-		if(!$output->toBool()) return $output;
1487
+		if (!$output->toBool()) return $output;
1488 1488
 		return $output->data;
1489 1489
 	}
1490 1490
 
@@ -1496,10 +1496,10 @@  discard block
 block discarded – undo
1496 1496
 		// Get a list of downloaded and installed modules
1497 1497
 		$searched_list = FileHandler::readDir('./modules');
1498 1498
 		$searched_count = count($searched_list);
1499
-		if(!$searched_count) return;
1499
+		if (!$searched_count) return;
1500 1500
 		sort($searched_list);
1501 1501
 
1502
-		for($i=0;$i<$searched_count;$i++)
1502
+		for ($i = 0; $i < $searched_count; $i++)
1503 1503
 		{
1504 1504
 			// Module name
1505 1505
 			$module_name = $searched_list[$i];
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 			$info = $this->getModuleInfoXml($module_name);
1510 1510
 			unset($obj);
1511 1511
 
1512
-			if(!isset($info)) continue;
1512
+			if (!isset($info)) continue;
1513 1513
 			$info->module = $module_name;
1514 1514
 			$info->created_table_count = $created_table_count;
1515 1515
 			$info->table_count = $table_count;
@@ -1526,19 +1526,19 @@  discard block
 block discarded – undo
1526 1526
 		$info = null;
1527 1527
 
1528 1528
 		$moduledir = ModuleHandler::getModulePath($module_name);
1529
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1529
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1530 1530
 		{
1531 1531
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1532 1532
 			$table_count = count($tmp_files);
1533 1533
 			// Check if the table is created
1534 1534
 			$created_table_count = 0;
1535
-			for($j=0;$j<count($tmp_files);$j++)
1535
+			for ($j = 0; $j < count($tmp_files); $j++)
1536 1536
 			{
1537
-				list($table_name) = explode(".",$tmp_files[$j]);
1538
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1537
+				list($table_name) = explode(".", $tmp_files[$j]);
1538
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1539 1539
 			}
1540 1540
 			// Check if DB is installed
1541
-			if($table_count > $created_table_count) return true;
1541
+			if ($table_count > $created_table_count) return true;
1542 1542
 			else return false;
1543 1543
 		}
1544 1544
 		return false;
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 	{
1549 1549
 		// Check if it is upgraded to module.class.php on each module
1550 1550
 		$oDummy = getModule($module_name, 'class');
1551
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1551
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1552 1552
 		{
1553 1553
 			return $oDummy->checkUpdate();
1554 1554
 		}
@@ -1567,31 +1567,31 @@  discard block
 block discarded – undo
1567 1567
 		sort($searched_list);
1568 1568
 
1569 1569
 		$searched_count = count($searched_list);
1570
-		if(!$searched_count) return;
1570
+		if (!$searched_count) return;
1571 1571
 
1572
-		for($i=0;$i<$searched_count;$i++)
1572
+		for ($i = 0; $i < $searched_count; $i++)
1573 1573
 		{
1574 1574
 			// module name
1575 1575
 			$module_name = $searched_list[$i];
1576 1576
 
1577 1577
 			$path = ModuleHandler::getModulePath($module_name);
1578
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1578
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1579 1579
 
1580 1580
 			// Get the number of xml files to create a table in schemas
1581 1581
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1582 1582
 			$table_count = count($tmp_files);
1583 1583
 			// Check if the table is created
1584 1584
 			$created_table_count = 0;
1585
-			for($j=0;$j<$table_count;$j++)
1585
+			for ($j = 0; $j < $table_count; $j++)
1586 1586
 			{
1587
-				list($table_name) = explode('.',$tmp_files[$j]);
1588
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1587
+				list($table_name) = explode('.', $tmp_files[$j]);
1588
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1589 1589
 			}
1590 1590
 			// Get information of the module
1591 1591
 			$info = NULL;
1592 1592
 			$info = $this->getModuleInfoXml($module_name);
1593 1593
 
1594
-			if(!$info) continue;
1594
+			if (!$info) continue;
1595 1595
 
1596 1596
 			$info->module = $module_name;
1597 1597
 			$info->category = $info->category;
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
 			$info->path = $path;
1601 1601
 			$info->admin_index_act = $info->admin_index_act;
1602 1602
 			// Check if DB is installed
1603
-			if($table_count > $created_table_count) $info->need_install = true;
1603
+			if ($table_count > $created_table_count) $info->need_install = true;
1604 1604
 			else $info->need_install = false;
1605 1605
 			// Check if it is upgraded to module.class.php on each module
1606 1606
 			$oDummy = null;
1607 1607
 			$oDummy = getModule($module_name, 'class');
1608
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1608
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1609 1609
 			{
1610 1610
 				$info->need_update = $oDummy->checkUpdate();
1611 1611
 			}
@@ -1626,15 +1626,15 @@  discard block
 block discarded – undo
1626 1626
 	 */
1627 1627
 	function syncModuleToSite(&$data)
1628 1628
 	{
1629
-		if(!$data) return;
1629
+		if (!$data) return;
1630 1630
 
1631
-		if(is_array($data))
1631
+		if (is_array($data))
1632 1632
 		{
1633
-			foreach($data as $key => $val)
1633
+			foreach ($data as $key => $val)
1634 1634
 			{
1635 1635
 				$module_srls[] = $val->module_srl;
1636 1636
 			}
1637
-			if(!count($module_srls)) return;
1637
+			if (!count($module_srls)) return;
1638 1638
 		}
1639 1639
 		else
1640 1640
 		{
@@ -1642,17 +1642,17 @@  discard block
 block discarded – undo
1642 1642
 		}
1643 1643
 
1644 1644
 		$args = new stdClass();
1645
-		$args->module_srls = implode(',',$module_srls);
1645
+		$args->module_srls = implode(',', $module_srls);
1646 1646
 		$output = executeQueryArray('module.getModuleSites', $args);
1647
-		if(!$output->data) return array();
1648
-		foreach($output->data as $key => $val)
1647
+		if (!$output->data) return array();
1648
+		foreach ($output->data as $key => $val)
1649 1649
 		{
1650 1650
 			$modules[$val->module_srl] = $val;
1651 1651
 		}
1652 1652
 
1653
-		if(is_array($data))
1653
+		if (is_array($data))
1654 1654
 		{
1655
-			foreach($data as $key => $val)
1655
+			foreach ($data as $key => $val)
1656 1656
 			{
1657 1657
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1658 1658
 			}
@@ -1668,14 +1668,14 @@  discard block
 block discarded – undo
1668 1668
 	 */
1669 1669
 	function isSiteAdmin($member_info, $site_srl = null)
1670 1670
 	{
1671
-		if(!$member_info->member_srl) return false;
1672
-		if($member_info->is_admin == 'Y') return true;
1671
+		if (!$member_info->member_srl) return false;
1672
+		if ($member_info->is_admin == 'Y') return true;
1673 1673
 
1674 1674
 		$args = new stdClass();
1675
-		if(!isset($site_srl))
1675
+		if (!isset($site_srl))
1676 1676
 		{
1677 1677
 			$site_module_info = Context::get('site_module_info');
1678
-			if(!$site_module_info) return;
1678
+			if (!$site_module_info) return;
1679 1679
 			$args->site_srl = $site_module_info->site_srl;
1680 1680
 		}
1681 1681
 		else
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
 		$args->member_srl = $member_info->member_srl;
1687 1687
 		$output = executeQuery('module.isSiteAdmin', $args);
1688
-		if($output->data->member_srl == $args->member_srl) return true;
1688
+		if ($output->data->member_srl == $args->member_srl) return true;
1689 1689
 		return false;
1690 1690
 	}
1691 1691
 
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 		$obj = new stdClass();
1709 1709
 		$obj->module_srl = $module_srl;
1710 1710
 		$output = executeQueryArray('module.getAdminID', $obj);
1711
-		if(!$output->toBool() || !$output->data) return;
1711
+		if (!$output->toBool() || !$output->data) return;
1712 1712
 
1713 1713
 		return $output->data;
1714 1714
 	}
@@ -1721,20 +1721,20 @@  discard block
 block discarded – undo
1721 1721
 	{
1722 1722
 		$extra_vars = array();
1723 1723
 		$get_module_srls = array();
1724
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1724
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1725 1725
 
1726 1726
 		$vars = false;
1727 1727
 		// cache controll
1728 1728
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1729
-		if($oCacheHandler->isSupport())
1729
+		if ($oCacheHandler->isSupport())
1730 1730
 		{
1731
-			foreach($list_module_srl as $module_srl)
1731
+			foreach ($list_module_srl as $module_srl)
1732 1732
 			{
1733 1733
 				$object_key = 'module_extra_vars:'.$module_srl;
1734 1734
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1735 1735
 				$vars = $oCacheHandler->get($cache_key);
1736 1736
 
1737
-				if($vars)
1737
+				if ($vars)
1738 1738
 				{
1739 1739
 					$extra_vars[$module_srl] = $vars;
1740 1740
 				}
@@ -1749,35 +1749,35 @@  discard block
 block discarded – undo
1749 1749
 			$get_module_srls = $list_module_srl;
1750 1750
 		}
1751 1751
 
1752
-		if(count($get_module_srls) > 0)
1752
+		if (count($get_module_srls) > 0)
1753 1753
 		{
1754 1754
 			$args = new stdClass();
1755 1755
 			$args->module_srl = implode(',', $get_module_srls);
1756 1756
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1757 1757
 
1758
-			if(!$output->toBool())
1758
+			if (!$output->toBool())
1759 1759
 			{
1760 1760
 				return;
1761 1761
 			}
1762 1762
 
1763
-			if(!$output->data)
1763
+			if (!$output->data)
1764 1764
 			{
1765
-				foreach($get_module_srls as $module_srl)
1765
+				foreach ($get_module_srls as $module_srl)
1766 1766
 				{
1767 1767
 					$extra_vars[$module_srl] = new stdClass;
1768 1768
 				}
1769 1769
 			}
1770
-			foreach($output->data as $key => $val)
1770
+			foreach ($output->data as $key => $val)
1771 1771
 			{
1772
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1772
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1773 1773
 
1774
-				if(!isset($extra_vars[$val->module_srl]))
1774
+				if (!isset($extra_vars[$val->module_srl]))
1775 1775
 				{
1776 1776
 					$extra_vars[$val->module_srl] = new stdClass();
1777 1777
 				}
1778 1778
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1779 1779
 
1780
-				if($oCacheHandler->isSupport())
1780
+				if ($oCacheHandler->isSupport())
1781 1781
 				{
1782 1782
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1783 1783
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1796,27 +1796,27 @@  discard block
 block discarded – undo
1796 1796
 	{
1797 1797
 		$skin_vars = false;
1798 1798
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1799
-		if($oCacheHandler->isSupport())
1799
+		if ($oCacheHandler->isSupport())
1800 1800
 		{
1801 1801
 			$object_key = 'module_skin_vars:'.$module_srl;
1802 1802
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1803 1803
 			$skin_vars = $oCacheHandler->get($cache_key);
1804 1804
 		}
1805 1805
 
1806
-		if($skin_vars === false)
1806
+		if ($skin_vars === false)
1807 1807
 		{
1808 1808
 			$args = new stdClass();
1809 1809
 			$args->module_srl = $module_srl;
1810
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1811
-			if(!$output->toBool()) return;
1810
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1811
+			if (!$output->toBool()) return;
1812 1812
 
1813 1813
 			$skin_vars = array();
1814
-			foreach($output->data as $vars)
1814
+			foreach ($output->data as $vars)
1815 1815
 			{
1816 1816
 				$skin_vars[$vars->name] = $vars;
1817 1817
 			}
1818 1818
 
1819
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1819
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1820 1820
 		}
1821 1821
 
1822 1822
 		return $skin_vars;
@@ -1828,32 +1828,32 @@  discard block
 block discarded – undo
1828 1828
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1829 1829
 	{
1830 1830
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1831
-		if(!$site_srl) $site_srl = 0;
1831
+		if (!$site_srl) $site_srl = 0;
1832 1832
 
1833 1833
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834
-		if(is_readable($designInfoFile))
1834
+		if (is_readable($designInfoFile))
1835 1835
 		{
1836 1836
 			include($designInfoFile);
1837 1837
 
1838 1838
 			$skinName = $designInfo->module->{$module_name}->{$target};
1839 1839
 		}
1840
-		if(!$skinName)
1840
+		if (!$skinName)
1841 1841
 		{
1842 1842
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1843 1843
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1844 1844
 
1845
-			if(is_dir($moduleSkinPath.'default'))
1845
+			if (is_dir($moduleSkinPath.'default'))
1846 1846
 			{
1847 1847
 				$skinName = 'default';
1848 1848
 			}
1849
-			else if(is_dir($moduleSkinPath.'xe_default'))
1849
+			else if (is_dir($moduleSkinPath.'xe_default'))
1850 1850
 			{
1851 1851
 				$skinName = 'xe_default';
1852 1852
 			}
1853 1853
 			else
1854 1854
 			{
1855 1855
 				$skins = FileHandler::readDir($moduleSkinPath);
1856
-				if(count($skins) > 0)
1856
+				if (count($skins) > 0)
1857 1857
 				{
1858 1858
 					$skinName = $skins[0];
1859 1859
 				}
@@ -1863,9 +1863,9 @@  discard block
 block discarded – undo
1863 1863
 				}
1864 1864
 			}
1865 1865
 
1866
-			if($updateCache && $skinName)
1866
+			if ($updateCache && $skinName)
1867 1867
 			{
1868
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1868
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1869 1869
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1870 1870
 
1871 1871
 				$oAdminController = getAdminController('admin');
@@ -1881,10 +1881,10 @@  discard block
 block discarded – undo
1881 1881
 	 */
1882 1882
 	function syncSkinInfoToModuleInfo(&$module_info)
1883 1883
 	{
1884
-		if(!$module_info->module_srl) return;
1884
+		if (!$module_info->module_srl) return;
1885 1885
 
1886 1886
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1887
-		if(Mobile::isFromMobilePhone())
1887
+		if (Mobile::isFromMobilePhone())
1888 1888
 		{
1889 1889
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1890 1890
 		}
@@ -1893,11 +1893,11 @@  discard block
 block discarded – undo
1893 1893
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1894 1894
 		}
1895 1895
 
1896
-		if(!$skin_vars) return;
1896
+		if (!$skin_vars) return;
1897 1897
 
1898
-		foreach($skin_vars as $name => $val)
1898
+		foreach ($skin_vars as $name => $val)
1899 1899
 		{
1900
-			if(isset($module_info->{$name})) continue;
1900
+			if (isset($module_info->{$name})) continue;
1901 1901
 			$module_info->{$name} = $val->value;
1902 1902
 		}
1903 1903
 	}
@@ -1911,27 +1911,27 @@  discard block
 block discarded – undo
1911 1911
 	{
1912 1912
 		$skin_vars = false;
1913 1913
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1914
-		if($oCacheHandler->isSupport())
1914
+		if ($oCacheHandler->isSupport())
1915 1915
 		{
1916 1916
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1917 1917
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1918 1918
 			$skin_vars = $oCacheHandler->get($cache_key);
1919 1919
 		}
1920 1920
 
1921
-		if($skin_vars === false)
1921
+		if ($skin_vars === false)
1922 1922
 		{
1923 1923
 			$args = new stdClass();
1924 1924
 			$args->module_srl = $module_srl;
1925
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1926
-			if(!$output->toBool() || !$output->data) return;
1925
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1926
+			if (!$output->toBool() || !$output->data) return;
1927 1927
 
1928 1928
 			$skin_vars = array();
1929
-			foreach($output->data as $vars)
1929
+			foreach ($output->data as $vars)
1930 1930
 			{
1931 1931
 				$skin_vars[$vars->name] = $vars;
1932 1932
 			}
1933 1933
 
1934
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1934
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1935 1935
 		}
1936 1936
 
1937 1937
 		return $skin_vars;
@@ -1943,32 +1943,32 @@  discard block
 block discarded – undo
1943 1943
 	 */
1944 1944
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1945 1945
 	{
1946
-		if(!$module_info->module_srl) return;
1946
+		if (!$module_info->module_srl) return;
1947 1947
 		$skin_vars = false;
1948 1948
 		// cache controll
1949 1949
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1950
-		if($oCacheHandler->isSupport())
1950
+		if ($oCacheHandler->isSupport())
1951 1951
 		{
1952 1952
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1953 1953
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1954 1954
 			$skin_vars = $oCacheHandler->get($cache_key);
1955 1955
 		}
1956
-		if($skin_vars === false)
1956
+		if ($skin_vars === false)
1957 1957
 		{
1958 1958
 			$args = new stdClass;
1959 1959
 			$args->module_srl = $module_info->module_srl;
1960
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1961
-			if(!$output->toBool()) return;
1960
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1961
+			if (!$output->toBool()) return;
1962 1962
 			$skin_vars = $output->data;
1963 1963
 
1964 1964
 			//insert in cache
1965
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1965
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1966 1966
 		}
1967
-		if(!$skin_vars) return;
1967
+		if (!$skin_vars) return;
1968 1968
 
1969
-		foreach($output->data as $val)
1969
+		foreach ($output->data as $val)
1970 1970
 		{
1971
-			if(isset($module_info->{$val->name})) continue;
1971
+			if (isset($module_info->{$val->name})) continue;
1972 1972
 			$module_info->{$val->name} = $val->value;
1973 1973
 		}
1974 1974
 	}
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
 	{
1981 1981
 		$grant = new stdClass();
1982 1982
 
1983
-		if(!$xml_info)
1983
+		if (!$xml_info)
1984 1984
 		{
1985 1985
 			$module = $module_info->module;
1986 1986
 			$xml_info = $this->getModuleActionXml($module);
@@ -1988,9 +1988,9 @@  discard block
 block discarded – undo
1988 1988
 		// Set variables to grant group permission
1989 1989
 		$module_srl = $module_info->module_srl;
1990 1990
 		$grant_info = $xml_info->grant;
1991
-		if($member_info->member_srl)
1991
+		if ($member_info->member_srl)
1992 1992
 		{
1993
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1993
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1994 1994
 			else $group_list = array();
1995 1995
 		}
1996 1996
 		else
@@ -1998,10 +1998,10 @@  discard block
 block discarded – undo
1998 1998
 			$group_list = array();
1999 1999
 		}
2000 2000
 		// If module_srl doesn't exist(if unable to set permissions)
2001
-		if(!$module_srl)
2001
+		if (!$module_srl)
2002 2002
 		{
2003 2003
 			$grant->access = true;
2004
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2004
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2005 2005
 			{
2006 2006
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2007 2007
 			}
@@ -2012,23 +2012,23 @@  discard block
 block discarded – undo
2012 2012
 		{
2013 2013
 			// If module_srl exists
2014 2014
 			// Get a type of granted permission
2015
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2015
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false;
2016 2016
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2017 2017
 			// If a just logged-in member is, check if the member is a module administrator
2018
-			if(!$grant->manager && $member_info->member_srl)
2018
+			if (!$grant->manager && $member_info->member_srl)
2019 2019
 			{
2020 2020
 				$args = new stdClass();
2021 2021
 				$args->module_srl = $module_srl;
2022 2022
 				$args->member_srl = $member_info->member_srl;
2023
-				$output = executeQuery('module.getModuleAdmin',$args);
2024
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2023
+				$output = executeQuery('module.getModuleAdmin', $args);
2024
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2025 2025
 			}
2026 2026
 			// If not an administrator, get information from the DB and grant manager privilege.
2027
-			if(!$grant->manager)
2027
+			if (!$grant->manager)
2028 2028
 			{
2029 2029
 				$args = new stdClass();
2030 2030
 				// If planet, get permission settings from the planet home
2031
-				if($module_info->module == 'planet')
2031
+				if ($module_info->module == 'planet')
2032 2032
 				{
2033 2033
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2034 2034
 				}
@@ -2041,37 +2041,37 @@  discard block
 block discarded – undo
2041 2041
 
2042 2042
 				$grant_exists = $granted = array();
2043 2043
 
2044
-				if($output->data)
2044
+				if ($output->data)
2045 2045
 				{
2046 2046
 					// Arrange names and groups who has privileges
2047
-					foreach($output->data as $val)
2047
+					foreach ($output->data as $val)
2048 2048
 					{
2049 2049
 						$grant_exists[$val->name] = true;
2050
-						if($granted[$val->name]) continue;
2050
+						if ($granted[$val->name]) continue;
2051 2051
 						// Log-in member only
2052
-						if($val->group_srl == -1)
2052
+						if ($val->group_srl == -1)
2053 2053
 						{
2054 2054
 							$granted[$val->name] = true;
2055
-							if($member_info->member_srl) $grant->{$val->name} = true;
2055
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2056 2056
 							// Site-joined member only
2057 2057
 						}
2058
-						elseif($val->group_srl == -2)
2058
+						elseif ($val->group_srl == -2)
2059 2059
 						{
2060 2060
 							$granted[$val->name] = true;
2061 2061
 							// Do not grant any permission for non-logged member
2062
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2062
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2063 2063
 							// Log-in member
2064 2064
 							else
2065 2065
 							{
2066 2066
 								$site_module_info = Context::get('site_module_info');
2067 2067
 								// Permission granted if no information of the currently connected site exists
2068
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2068
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2069 2069
 								// Permission is not granted if information of the currently connected site exists
2070
-								elseif(count($group_list)) $grant->{$val->name} = true;
2070
+								elseif (count($group_list)) $grant->{$val->name} = true;
2071 2071
 							}
2072 2072
 							// All of non-logged members
2073 2073
 						}
2074
-						elseif($val->group_srl == 0)
2074
+						elseif ($val->group_srl == 0)
2075 2075
 						{
2076 2076
 							$granted[$val->name] = true;
2077 2077
 							$grant->{$val->name} = true;
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 						}
2080 2080
 						else
2081 2081
 						{
2082
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2082
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2083 2083
 							{
2084 2084
 								$grant->{$val->name} = true;
2085 2085
 								$granted[$val->name] = true;
@@ -2088,29 +2088,29 @@  discard block
 block discarded – undo
2088 2088
 					}
2089 2089
 				}
2090 2090
 				// Separate processing for the virtual group access
2091
-				if(!$grant_exists['access']) $grant->access = true;
2092
-				if(count($grant_info))
2091
+				if (!$grant_exists['access']) $grant->access = true;
2092
+				if (count($grant_info))
2093 2093
 				{
2094
-					foreach($grant_info as  $grant_name => $grant_item)
2094
+					foreach ($grant_info as  $grant_name => $grant_item)
2095 2095
 					{
2096
-						if($grant_exists[$grant_name]) continue;
2097
-						switch($grant_item->default)
2096
+						if ($grant_exists[$grant_name]) continue;
2097
+						switch ($grant_item->default)
2098 2098
 						{
2099 2099
 							case 'guest' :
2100 2100
 								$grant->{$grant_name} = true;
2101 2101
 								break;
2102 2102
 							case 'member' :
2103
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2103
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2104 2104
 								else $grant->{$grant_name} = false;
2105 2105
 								break;
2106 2106
 							case 'site' :
2107 2107
 								$site_module_info = Context::get('site_module_info');
2108
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2108
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2109 2109
 								else $grant->{$grant_name} = false;
2110 2110
 								break;
2111 2111
 							case 'manager' :
2112 2112
 							case 'root' :
2113
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2113
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2114 2114
 								else $grant->{$grant_name} = false;
2115 2115
 								break;
2116 2116
 						}
@@ -2118,12 +2118,12 @@  discard block
 block discarded – undo
2118 2118
 				}
2119 2119
 			}
2120 2120
 			// Set true to grant all privileges if an administrator is
2121
-			if($grant->manager)
2121
+			if ($grant->manager)
2122 2122
 			{
2123 2123
 				$grant->access = true;
2124
-				if(count($grant_info))
2124
+				if (count($grant_info))
2125 2125
 				{
2126
-					foreach($grant_info as $key => $val)
2126
+					foreach ($grant_info as $key => $val)
2127 2127
 					{
2128 2128
 						$grant->{$key} = true;
2129 2129
 					}
@@ -2155,27 +2155,27 @@  discard block
 block discarded – undo
2155 2155
 
2156 2156
 	function unserializeAttributes($module_filebox_list)
2157 2157
 	{
2158
-		if(is_array($module_filebox_list->data))
2158
+		if (is_array($module_filebox_list->data))
2159 2159
 		{
2160
-			foreach($module_filebox_list->data as &$item)
2160
+			foreach ($module_filebox_list->data as &$item)
2161 2161
 			{
2162
-				if(empty($item->comment))
2162
+				if (empty($item->comment))
2163 2163
 				{
2164 2164
 					continue;
2165 2165
 				}
2166 2166
 
2167 2167
 				$attributes = explode(';', $item->comment);
2168
-				foreach($attributes as $attribute)
2168
+				foreach ($attributes as $attribute)
2169 2169
 				{
2170 2170
 					$values = explode(':', $attribute);
2171
-					if((count($values) % 2) ==1)
2171
+					if ((count($values) % 2) == 1)
2172 2172
 					{
2173
-						for($i=2;$i<count($values);$i++)
2173
+						for ($i = 2; $i < count($values); $i++)
2174 2174
 						{
2175
-							$values[1].=":".$values[$i];
2175
+							$values[1] .= ":".$values[$i];
2176 2176
 						}
2177 2177
 					}
2178
-					$atts[$values[0]]=$values[1];
2178
+					$atts[$values[0]] = $values[1];
2179 2179
 				}
2180 2180
 				$item->attributes = $atts;
2181 2181
 				unset($atts);
@@ -2187,16 +2187,16 @@  discard block
 block discarded – undo
2187 2187
 	function getFileBoxListHtml()
2188 2188
 	{
2189 2189
 		$logged_info = Context::get('logged_info');
2190
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2190
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2191 2191
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2192
-		$link_params = explode('&',$link['query']);
2192
+		$link_params = explode('&', $link['query']);
2193 2193
 		foreach ($link_params as $param)
2194 2194
 		{
2195
-			$param = explode("=",$param);
2196
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2195
+			$param = explode("=", $param);
2196
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2197 2197
 		}
2198 2198
 		$oWidgetModel = getModel('widget');
2199
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2199
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2200 2200
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2201 2201
 
2202 2202
 		$oModuleModel = getModel('module');
@@ -2212,24 +2212,24 @@  discard block
 block discarded – undo
2212 2212
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2213 2213
 
2214 2214
 		$oTemplate = &TemplateHandler::getInstance();
2215
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2215
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2216 2216
 
2217 2217
 		$this->add('html', $html);
2218 2218
 	}
2219 2219
 
2220 2220
 	function getModuleFileBoxPath($module_filebox_srl)
2221 2221
 	{
2222
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2222
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2223 2223
 	}
2224 2224
 
2225 2225
 	/**
2226 2226
 	 * @brief Return ruleset cache file path
2227 2227
 	 * @param module, act
2228 2228
 	 */
2229
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2229
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2230 2230
 	{
2231 2231
 		// load dynamic ruleset xml file
2232
-		if(strpos($ruleset, '@') !== false)
2232
+		if (strpos($ruleset, '@') !== false)
2233 2233
 		{
2234 2234
 			$rulsetFile = str_replace('@', '', $ruleset);
2235 2235
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2239,20 +2239,20 @@  discard block
 block discarded – undo
2239 2239
 		{
2240 2240
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2241 2241
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2242
-			if(is_readable($xml_file))
2242
+			if (is_readable($xml_file))
2243 2243
 				return FileHandler::getRealPath($xml_file);
2244
-			else{
2244
+			else {
2245 2245
 				$ruleset = str_replace('#', '', $ruleset);
2246 2246
 			}
2247 2247
 
2248 2248
 		}
2249 2249
 		// Get a path of the requested module. Return if not exists.
2250 2250
 		$class_path = ModuleHandler::getModulePath($module);
2251
-		if(!$class_path) return;
2251
+		if (!$class_path) return;
2252 2252
 
2253 2253
 		// Check if module.xml exists in the path. Return if not exist
2254 2254
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2255
-		if(!file_exists($xml_file)) return;
2255
+		if (!file_exists($xml_file)) return;
2256 2256
 
2257 2257
 		return $xml_file;
2258 2258
 	}
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 		$requestVars = Context::getRequestVars();
2265 2265
 
2266 2266
 		$args = new stdClass;
2267
-		$args->site_srl = (int)$requestVars->site_srl;
2267
+		$args->site_srl = (int) $requestVars->site_srl;
2268 2268
 		$args->page = 1; // /< Page
2269 2269
 		$args->list_count = 100; // /< the number of posts to display on a single page
2270 2270
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2276,9 +2276,9 @@  discard block
 block discarded – undo
2276 2276
 
2277 2277
 		$list = array();
2278 2278
 
2279
-		if($output->toBool())
2279
+		if ($output->toBool())
2280 2280
 		{
2281
-			foreach((array)$output->data as $code_info)
2281
+			foreach ((array) $output->data as $code_info)
2282 2282
 			{
2283 2283
 				unset($codeInfo);
2284 2284
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
Braces   +457 added lines, -203 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$hostname = $request_url_parse['host'];
101 113
 			$path = $request_url_parse['path'];
102 114
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,11 +435,14 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
443
+		if(isset($module_info->browser_title)) {
444
+			$oModuleController->replaceDefinedLangCode($module_info->browser_title);
445
+		}
407 446
 
408 447
 		$this->applyDefaultSkin($module_info);
409 448
 		return $this->addModuleExtraVars($module_info);
@@ -451,11 +490,15 @@  discard block
 block discarded – undo
451 490
 	 */
452 491
 	function getModulesInfo($module_srls, $columnList = array())
453 492
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
493
+		if(is_array($module_srls)) {
494
+			$module_srls = implode(',',$module_srls);
495
+		}
455 496
 		$args = new stdClass();
456 497
 		$args->module_srls = $module_srls;
457 498
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
499
+		if(!$output->toBool()) {
500
+			return;
501
+		}
459 502
 		return $this->addModuleExtraVars($output->data);
460 503
 	}
461 504
 
@@ -465,31 +508,44 @@  discard block
 block discarded – undo
465 508
 	function addModuleExtraVars($module_info)
466 509
 	{
467 510
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
469
-		else $target_module_info = $module_info;
511
+		if(!is_array($module_info)) {
512
+			$target_module_info = array($module_info);
513
+		} else {
514
+			$target_module_info = $module_info;
515
+		}
470 516
 		// Get module_srl
471 517
 		$module_srls = array();
472 518
 		foreach($target_module_info as $key => $val)
473 519
 		{
474 520
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
521
+			if(!$module_srl) {
522
+				continue;
523
+			}
476 524
 			$module_srls[] = $val->module_srl;
477 525
 		}
478 526
 		// Extract extra information of the module and skin
479 527
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
528
+		if(!count($module_srls) || !count($extra_vars)) {
529
+			return $module_info;
530
+		}
481 531
 
482 532
 		foreach($target_module_info as $key => $val)
483 533
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
534
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
535
+				continue;
536
+			}
485 537
 			foreach($extra_vars[$val->module_srl] as $k => $v)
486 538
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
539
+				if($target_module_info[$key]->{$k}) {
540
+					continue;
541
+				}
488 542
 				$target_module_info[$key]->{$k} = $v;
489 543
 			}
490 544
 		}
491 545
 
492
-		if(is_array($module_info)) return $target_module_info;
546
+		if(is_array($module_info)) {
547
+			return $target_module_info;
548
+		}
493 549
 		return $target_module_info[0];
494 550
 	}
495 551
 
@@ -518,7 +574,9 @@  discard block
 block discarded – undo
518 574
 			}
519 575
 
520 576
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
577
+			if(!$output->toBool()) {
578
+				return $output;
579
+			}
522 580
 			$list = $output->data;
523 581
 
524 582
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -526,9 +584,13 @@  discard block
 block discarded – undo
526 584
 				$oCacheHandler->put($cache_key, $list);
527 585
 			}
528 586
 		}
529
-		if(!$list) return;
587
+		if(!$list) {
588
+			return;
589
+		}
530 590
 
531
-		if(!is_array($list)) $list = array($list);
591
+		if(!is_array($list)) {
592
+			$list = array($list);
593
+		}
532 594
 
533 595
 		foreach($list as $val)
534 596
 		{
@@ -544,10 +606,14 @@  discard block
 block discarded – undo
544 606
 	function getModuleSrlList($args = null, $columnList = array())
545 607
 	{
546 608
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
609
+		if(!$output->toBool()) {
610
+			return $output;
611
+		}
548 612
 
549 613
 		$list = $output->data;
550
-		if(!$list) return;
614
+		if(!$list) {
615
+			return;
616
+		}
551 617
 
552 618
 		return $list;
553 619
 	}
@@ -557,20 +623,32 @@  discard block
 block discarded – undo
557 623
 	 */
558 624
 	function getModuleSrlByMid($mid)
559 625
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
626
+		if($mid && !is_array($mid)) {
627
+			$mid = explode(',',$mid);
628
+		}
629
+		if(is_array($mid)) {
630
+			$mid = "'".implode("','",$mid)."'";
631
+		}
562 632
 
563 633
 		$site_module_info = Context::get('site_module_info');
564 634
 
565 635
 		$args = new stdClass;
566 636
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
637
+		if($site_module_info) {
638
+			$args->site_srl = $site_module_info->site_srl;
639
+		}
568 640
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
641
+		if(!$output->toBool()) {
642
+			return $output;
643
+		}
570 644
 
571 645
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
646
+		if(!$list) {
647
+			return;
648
+		}
649
+		if(!is_array($list)) {
650
+			$list = array($list);
651
+		}
574 652
 
575 653
 		foreach($list as $key => $val)
576 654
 		{
@@ -599,8 +677,12 @@  discard block
 block discarded – undo
599 677
 		{
600 678
 			$args = new stdClass();
601 679
 			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
680
+			if(!$output->toBool()) {
681
+				return new stdClass;
682
+			}
683
+			if(!$output->data) {
684
+				$output->data = array();
685
+			}
604 686
 
605 687
 			$action_forward = array();
606 688
 			foreach($output->data as $item)
@@ -617,8 +699,7 @@  discard block
 block discarded – undo
617 699
 		if($action_forward[$act])
618 700
 		{
619 701
 			return $action_forward[$act];
620
-		}
621
-		else
702
+		} else
622 703
 		{
623 704
 			return new stdClass();
624 705
 		}
@@ -726,8 +807,7 @@  discard block
 block discarded – undo
726 807
 			if(file_exists($cache_file))
727 808
 			{
728 809
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729
-			}
730
-			else
810
+			} else
731 811
 			{
732 812
 				$GLOBALS['__MODULE_EXTEND__'] = array();
733 813
 			}
@@ -743,16 +823,22 @@  discard block
 block discarded – undo
743 823
 	{
744 824
 		// Get a path of the requested module. Return if not exists.
745 825
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
826
+		if(!$module_path) {
827
+			return;
828
+		}
747 829
 		// Read the xml file for module skin information
748 830
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
831
+		if(!file_exists($xml_file)) {
832
+			return;
833
+		}
750 834
 
751 835
 		$oXmlParser = new XmlParser();
752 836
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 837
 		$xml_obj = $tmp_xml_obj->module;
754 838
 
755
-		if(!$xml_obj) return;
839
+		if(!$xml_obj) {
840
+			return;
841
+		}
756 842
 
757 843
 		// Module Information
758 844
 		$module_info = new stdClass();
@@ -764,14 +850,19 @@  discard block
 block discarded – undo
764 850
 			$module_info->version = $xml_obj->version->body;
765 851
 			$module_info->homepage = $xml_obj->link->body;
766 852
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
853
+			if(!$module_info->category) {
854
+				$module_info->category = 'service';
855
+			}
768 856
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 857
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 858
 			$module_info->license = $xml_obj->license->body;
771 859
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 860
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774
-			else $author_list = $xml_obj->author;
861
+			if(!is_array($xml_obj->author)) {
862
+				$author_list[] = $xml_obj->author;
863
+			} else {
864
+				$author_list = $xml_obj->author;
865
+			}
775 866
 
776 867
 			foreach($author_list as $author)
777 868
 			{
@@ -781,15 +872,16 @@  discard block
 block discarded – undo
781 872
 				$author_obj->homepage = $author->attrs->link;
782 873
 				$module_info->author[] = $author_obj;
783 874
 			}
784
-		}
785
-		else
875
+		} else
786 876
 		{
787 877
 			// module format 0.1
788 878
 			$module_info->title = $xml_obj->title->body;
789 879
 			$module_info->description = $xml_obj->author->description->body;
790 880
 			$module_info->version = $xml_obj->attrs->version;
791 881
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
882
+			if(!$module_info->category) {
883
+				$module_info->category = 'service';
884
+			}
793 885
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 886
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 887
 			$author_obj = new stdClass();
@@ -818,11 +910,15 @@  discard block
 block discarded – undo
818 910
 	{
819 911
 		// Get a path of the requested module. Return if not exists.
820 912
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
913
+		if(!$class_path) {
914
+			return;
915
+		}
822 916
 
823 917
 		// Check if module.xml exists in the path. Return if not exist
824 918
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
919
+		if(!file_exists($xml_file)) {
920
+			return;
921
+		}
826 922
 
827 923
 		// Check if cached file exists
828 924
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -841,7 +937,10 @@  discard block
 block discarded – undo
841 937
 
842 938
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 939
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
940
+			if(!count($xml_obj->module)) {
941
+				return;
942
+			}
943
+			// /< Error occurs if module tag doesn't included in the xml
845 944
 
846 945
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 946
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -853,8 +952,11 @@  discard block
 block discarded – undo
853 952
 			// Arrange permission information
854 953
 			if($grants)
855 954
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
857
-				else $grant_list[] = $grants;
955
+				if(is_array($grants)) {
956
+					$grant_list = $grants;
957
+				} else {
958
+					$grant_list[] = $grants;
959
+				}
858 960
 
859 961
 				$info->grant = new stdClass();
860 962
 				$buff[] = '$info->grant = new stdClass;';
@@ -876,8 +978,11 @@  discard block
 block discarded – undo
876 978
 			// Permissions to grant
877 979
 			if($permissions)
878 980
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
880
-				else $permission_list[] = $permissions;
981
+				if(is_array($permissions)) {
982
+					$permission_list = $permissions;
983
+				} else {
984
+					$permission_list[] = $permissions;
985
+				}
881 986
 
882 987
 				$buff[] = '$info->permission = new stdClass;';
883 988
 
@@ -895,8 +1000,11 @@  discard block
 block discarded – undo
895 1000
 			// for admin menus
896 1001
 			if($menus)
897 1002
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
899
-				else $menu_list[] = $menus;
1003
+				if(is_array($menus)) {
1004
+					$menu_list = $menus;
1005
+				} else {
1006
+					$menu_list[] = $menus;
1007
+				}
900 1008
 
901 1009
 				$buff[] = '$info->menu = new stdClass;';
902 1010
 				$info->menu = new stdClass();
@@ -920,8 +1028,11 @@  discard block
 block discarded – undo
920 1028
 			// actions
921 1029
 			if($actions)
922 1030
 			{
923
-				if(is_array($actions)) $action_list = $actions;
924
-				else $action_list[] = $actions;
1031
+				if(is_array($actions)) {
1032
+					$action_list = $actions;
1033
+				} else {
1034
+					$action_list[] = $actions;
1035
+				}
925 1036
 
926 1037
 				$buff[] = '$info->action = new stdClass;';
927 1038
 				$info->action = new stdClass();
@@ -1007,7 +1118,9 @@  discard block
 block discarded – undo
1007 1118
 			return $info;
1008 1119
 		}
1009 1120
 
1010
-		if(file_exists($cache_file)) return include($cache_file);
1121
+		if(file_exists($cache_file)) {
1122
+			return include($cache_file);
1123
+		}
1011 1124
 	}
1012 1125
 
1013 1126
 	/**
@@ -1045,7 +1158,9 @@  discard block
 block discarded – undo
1045 1158
 
1046 1159
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1047 1160
 		$list = FileHandler::readDir($skin_path);
1048
-		if(!count($list)) return;
1161
+		if(!count($list)) {
1162
+			return;
1163
+		}
1049 1164
 
1050 1165
 		natcasesort($list);
1051 1166
 
@@ -1099,8 +1214,7 @@  discard block
 block discarded – undo
1099 1214
 			if($dir == 'skins')
1100 1215
 			{
1101 1216
 				$type = 'P';
1102
-			}
1103
-			else
1217
+			} else
1104 1218
 			{
1105 1219
 				$type = 'M';
1106 1220
 			}
@@ -1128,14 +1242,20 @@  discard block
 block discarded – undo
1128 1242
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1129 1243
 	{
1130 1244
 		// Read xml file having skin information
1131
-		if(substr($path,-1)!='/') $path .= '/';
1245
+		if(substr($path,-1)!='/') {
1246
+			$path .= '/';
1247
+		}
1132 1248
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1133
-		if(!file_exists($skin_xml_file)) return;
1249
+		if(!file_exists($skin_xml_file)) {
1250
+			return;
1251
+		}
1134 1252
 		// Create XmlParser object
1135 1253
 		$oXmlParser = new XmlParser();
1136 1254
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1137 1255
 		// Return if no skin information is
1138
-		if(!$_xml_obj->skin) return;
1256
+		if(!$_xml_obj->skin) {
1257
+			return;
1258
+		}
1139 1259
 		$xml_obj = $_xml_obj->skin;
1140 1260
 		// Skin Name
1141 1261
 		$skin_info = new stdClass();
@@ -1152,8 +1272,11 @@  discard block
 block discarded – undo
1152 1272
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1153 1273
 			$skin_info->description = $xml_obj->description->body;
1154 1274
 
1155
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1156
-			else $author_list = $xml_obj->author;
1275
+			if(!is_array($xml_obj->author)) {
1276
+				$author_list[] = $xml_obj->author;
1277
+			} else {
1278
+				$author_list = $xml_obj->author;
1279
+			}
1157 1280
 
1158 1281
 			foreach($author_list as $author)
1159 1282
 			{
@@ -1167,8 +1290,12 @@  discard block
 block discarded – undo
1167 1290
 			if($xml_obj->extra_vars)
1168 1291
 			{
1169 1292
 				$extra_var_groups = $xml_obj->extra_vars->group;
1170
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1293
+				if(!$extra_var_groups) {
1294
+					$extra_var_groups = $xml_obj->extra_vars;
1295
+				}
1296
+				if(!is_array($extra_var_groups)) {
1297
+					$extra_var_groups = array($extra_var_groups);
1298
+				}
1172 1299
 
1173 1300
 				foreach($extra_var_groups as $group)
1174 1301
 				{
@@ -1177,7 +1304,9 @@  discard block
 block discarded – undo
1177 1304
 					{
1178 1305
 						continue;
1179 1306
 					}
1180
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1307
+					if(!is_array($group->var)) {
1308
+						$extra_vars = array($group->var);
1309
+					}
1181 1310
 
1182 1311
 					foreach($extra_vars as $key => $val)
1183 1312
 					{
@@ -1204,8 +1333,7 @@  discard block
 block discarded – undo
1204 1333
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1205 1334
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1206 1335
 							}
1207
-						}
1208
-						else
1336
+						} else
1209 1337
 						{
1210 1338
 							$obj->options[0] = new stdClass();
1211 1339
 							$obj->options[0]->title = $val->options->title->body;
@@ -1216,8 +1344,7 @@  discard block
 block discarded – undo
1216 1344
 					}
1217 1345
 				}
1218 1346
 			}
1219
-		}
1220
-		else
1347
+		} else
1221 1348
 		{
1222 1349
 			// skin format v0.1
1223 1350
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1235,8 +1362,12 @@  discard block
 block discarded – undo
1235 1362
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1236 1363
 			// Variables used in the skin
1237 1364
 			$extra_var_groups = $xml_obj->extra_vars->group;
1238
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1365
+			if(!$extra_var_groups) {
1366
+				$extra_var_groups = $xml_obj->extra_vars;
1367
+			}
1368
+			if(!is_array($extra_var_groups)) {
1369
+				$extra_var_groups = array($extra_var_groups);
1370
+			}
1240 1371
 
1241 1372
 			foreach($extra_var_groups as $group)
1242 1373
 			{
@@ -1244,7 +1375,9 @@  discard block
 block discarded – undo
1244 1375
 
1245 1376
 				if($extra_vars)
1246 1377
 				{
1247
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1378
+					if(!is_array($extra_vars)) {
1379
+						$extra_vars = array($extra_vars);
1380
+					}
1248 1381
 
1249 1382
 					foreach($extra_vars as $var)
1250 1383
 					{
@@ -1266,8 +1399,7 @@  discard block
 block discarded – undo
1266 1399
 								$options[$i]->title = $var->default[$i]->body;
1267 1400
 								$options[$i]->value = $var->default[$i]->body;
1268 1401
 							}
1269
-						}
1270
-						else
1402
+						} else
1271 1403
 						{
1272 1404
 							$options[0]->title = $var->default->body;
1273 1405
 							$options[0]->value = $var->default->body;
@@ -1297,7 +1429,9 @@  discard block
 block discarded – undo
1297 1429
 		$colorset = $xml_obj->colorset->color;
1298 1430
 		if($colorset)
1299 1431
 		{
1300
-			if(!is_array($colorset)) $colorset = array($colorset);
1432
+			if(!is_array($colorset)) {
1433
+				$colorset = array($colorset);
1434
+			}
1301 1435
 
1302 1436
 			foreach($colorset as $color)
1303 1437
 			{
@@ -1307,9 +1441,12 @@  discard block
 block discarded – undo
1307 1441
 				if($screenshot)
1308 1442
 				{
1309 1443
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1310
-					if(!file_exists($screenshot)) $screenshot = "";
1444
+					if(!file_exists($screenshot)) {
1445
+						$screenshot = "";
1446
+					}
1447
+				} else {
1448
+					$screenshot = "";
1311 1449
 				}
1312
-				else $screenshot = "";
1313 1450
 
1314 1451
 				$obj = new stdClass();
1315 1452
 				$obj->name = $name;
@@ -1322,7 +1459,9 @@  discard block
 block discarded – undo
1322 1459
 		if($xml_obj->menus->menu)
1323 1460
 		{
1324 1461
 			$menus = $xml_obj->menus->menu;
1325
-			if(!is_array($menus)) $menus = array($menus);
1462
+			if(!is_array($menus)) {
1463
+				$menus = array($menus);
1464
+			}
1326 1465
 
1327 1466
 			$menu_count = count($menus);
1328 1467
 			$skin_info->menu_count = $menu_count;
@@ -1331,7 +1470,9 @@  discard block
 block discarded – undo
1331 1470
 				unset($obj);
1332 1471
 
1333 1472
 				$obj->name = $menus[$i]->attrs->name;
1334
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1473
+				if($menus[$i]->attrs->default == "true") {
1474
+					$obj->default = true;
1475
+				}
1335 1476
 				$obj->title = $menus[$i]->title->body;
1336 1477
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1337 1478
 
@@ -1351,7 +1492,9 @@  discard block
 block discarded – undo
1351 1492
 	{
1352 1493
 		$args = new stdClass;
1353 1494
 		$args->site_srl = $site_srl;
1354
-		if(!is_null($module)) $args->module = $module;
1495
+		if(!is_null($module)) {
1496
+			$args->module = $module;
1497
+		}
1355 1498
 		$output = executeQuery('module.getModuleCount', $args);
1356 1499
 		return $output->data->count;
1357 1500
 	}
@@ -1380,8 +1523,11 @@  discard block
 block discarded – undo
1380 1523
 				$args->module = $module;
1381 1524
 				$args->site_srl = $site_srl;
1382 1525
 				$output = executeQuery('module.getModuleConfig', $args);
1383
-				if($output->data->config) $config = unserialize($output->data->config);
1384
-				else $config = null;
1526
+				if($output->data->config) {
1527
+					$config = unserialize($output->data->config);
1528
+				} else {
1529
+					$config = null;
1530
+				}
1385 1531
 
1386 1532
 				//insert in cache
1387 1533
 				if($oCacheHandler->isSupport())
@@ -1420,8 +1566,11 @@  discard block
 block discarded – undo
1420 1566
 				$args->module = $module;
1421 1567
 				$args->module_srl = $module_srl;
1422 1568
 				$output = executeQuery('module.getModulePartConfig', $args);
1423
-				if($output->data->config) $config = unserialize($output->data->config);
1424
-				else $config = null;
1569
+				if($output->data->config) {
1570
+					$config = unserialize($output->data->config);
1571
+				} else {
1572
+					$config = null;
1573
+				}
1425 1574
 
1426 1575
 				//insert in cache
1427 1576
 				if($oCacheHandler->isSupport())
@@ -1443,9 +1592,13 @@  discard block
 block discarded – undo
1443 1592
 	{
1444 1593
 		$args = new stdClass();
1445 1594
 		$args->module = $module;
1446
-		if($site_srl) $args->site_srl = $site_srl;
1595
+		if($site_srl) {
1596
+			$args->site_srl = $site_srl;
1597
+		}
1447 1598
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1448
-		if(!$output->toBool() || !$output->data) return array();
1599
+		if(!$output->toBool() || !$output->data) {
1600
+			return array();
1601
+		}
1449 1602
 
1450 1603
 		foreach($output->data as $key => $val)
1451 1604
 		{
@@ -1463,10 +1616,16 @@  discard block
 block discarded – undo
1463 1616
 		$args->moduleCategorySrl = $moduleCategorySrl;
1464 1617
 		// Get data from the DB
1465 1618
 		$output = executeQuery('module.getModuleCategories', $args);
1466
-		if(!$output->toBool()) return $output;
1619
+		if(!$output->toBool()) {
1620
+			return $output;
1621
+		}
1467 1622
 		$list = $output->data;
1468
-		if(!$list) return;
1469
-		if(!is_array($list)) $list = array($list);
1623
+		if(!$list) {
1624
+			return;
1625
+		}
1626
+		if(!is_array($list)) {
1627
+			$list = array($list);
1628
+		}
1470 1629
 
1471 1630
 		foreach($list as $val)
1472 1631
 		{
@@ -1484,7 +1643,9 @@  discard block
 block discarded – undo
1484 1643
 		$args = new stdClass;
1485 1644
 		$args->module_category_srl = $module_category_srl;
1486 1645
 		$output = executeQuery('module.getModuleCategory', $args);
1487
-		if(!$output->toBool()) return $output;
1646
+		if(!$output->toBool()) {
1647
+			return $output;
1648
+		}
1488 1649
 		return $output->data;
1489 1650
 	}
1490 1651
 
@@ -1496,7 +1657,9 @@  discard block
 block discarded – undo
1496 1657
 		// Get a list of downloaded and installed modules
1497 1658
 		$searched_list = FileHandler::readDir('./modules');
1498 1659
 		$searched_count = count($searched_list);
1499
-		if(!$searched_count) return;
1660
+		if(!$searched_count) {
1661
+			return;
1662
+		}
1500 1663
 		sort($searched_list);
1501 1664
 
1502 1665
 		for($i=0;$i<$searched_count;$i++)
@@ -1509,7 +1672,9 @@  discard block
 block discarded – undo
1509 1672
 			$info = $this->getModuleInfoXml($module_name);
1510 1673
 			unset($obj);
1511 1674
 
1512
-			if(!isset($info)) continue;
1675
+			if(!isset($info)) {
1676
+				continue;
1677
+			}
1513 1678
 			$info->module = $module_name;
1514 1679
 			$info->created_table_count = $created_table_count;
1515 1680
 			$info->table_count = $table_count;
@@ -1535,11 +1700,16 @@  discard block
 block discarded – undo
1535 1700
 			for($j=0;$j<count($tmp_files);$j++)
1536 1701
 			{
1537 1702
 				list($table_name) = explode(".",$tmp_files[$j]);
1538
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1703
+				if($oDB->isTableExists($table_name)) {
1704
+					$created_table_count ++;
1705
+				}
1539 1706
 			}
1540 1707
 			// Check if DB is installed
1541
-			if($table_count > $created_table_count) return true;
1542
-			else return false;
1708
+			if($table_count > $created_table_count) {
1709
+				return true;
1710
+			} else {
1711
+				return false;
1712
+			}
1543 1713
 		}
1544 1714
 		return false;
1545 1715
 	}
@@ -1567,7 +1737,9 @@  discard block
 block discarded – undo
1567 1737
 		sort($searched_list);
1568 1738
 
1569 1739
 		$searched_count = count($searched_list);
1570
-		if(!$searched_count) return;
1740
+		if(!$searched_count) {
1741
+			return;
1742
+		}
1571 1743
 
1572 1744
 		for($i=0;$i<$searched_count;$i++)
1573 1745
 		{
@@ -1575,7 +1747,9 @@  discard block
 block discarded – undo
1575 1747
 			$module_name = $searched_list[$i];
1576 1748
 
1577 1749
 			$path = ModuleHandler::getModulePath($module_name);
1578
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1750
+			if(!is_dir(FileHandler::getRealPath($path))) {
1751
+				continue;
1752
+			}
1579 1753
 
1580 1754
 			// Get the number of xml files to create a table in schemas
1581 1755
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1585,13 +1759,17 @@  discard block
 block discarded – undo
1585 1759
 			for($j=0;$j<$table_count;$j++)
1586 1760
 			{
1587 1761
 				list($table_name) = explode('.',$tmp_files[$j]);
1588
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1762
+				if($oDB->isTableExists($table_name)) {
1763
+					$created_table_count ++;
1764
+				}
1589 1765
 			}
1590 1766
 			// Get information of the module
1591 1767
 			$info = NULL;
1592 1768
 			$info = $this->getModuleInfoXml($module_name);
1593 1769
 
1594
-			if(!$info) continue;
1770
+			if(!$info) {
1771
+				continue;
1772
+			}
1595 1773
 
1596 1774
 			$info->module = $module_name;
1597 1775
 			$info->category = $info->category;
@@ -1600,16 +1778,18 @@  discard block
 block discarded – undo
1600 1778
 			$info->path = $path;
1601 1779
 			$info->admin_index_act = $info->admin_index_act;
1602 1780
 			// Check if DB is installed
1603
-			if($table_count > $created_table_count) $info->need_install = true;
1604
-			else $info->need_install = false;
1781
+			if($table_count > $created_table_count) {
1782
+				$info->need_install = true;
1783
+			} else {
1784
+				$info->need_install = false;
1785
+			}
1605 1786
 			// Check if it is upgraded to module.class.php on each module
1606 1787
 			$oDummy = null;
1607 1788
 			$oDummy = getModule($module_name, 'class');
1608 1789
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1609 1790
 			{
1610 1791
 				$info->need_update = $oDummy->checkUpdate();
1611
-			}
1612
-			else
1792
+			} else
1613 1793
 			{
1614 1794
 				continue;
1615 1795
 			}
@@ -1626,7 +1806,9 @@  discard block
 block discarded – undo
1626 1806
 	 */
1627 1807
 	function syncModuleToSite(&$data)
1628 1808
 	{
1629
-		if(!$data) return;
1809
+		if(!$data) {
1810
+			return;
1811
+		}
1630 1812
 
1631 1813
 		if(is_array($data))
1632 1814
 		{
@@ -1634,9 +1816,10 @@  discard block
 block discarded – undo
1634 1816
 			{
1635 1817
 				$module_srls[] = $val->module_srl;
1636 1818
 			}
1637
-			if(!count($module_srls)) return;
1638
-		}
1639
-		else
1819
+			if(!count($module_srls)) {
1820
+				return;
1821
+			}
1822
+		} else
1640 1823
 		{
1641 1824
 			$module_srls[] = $data->module_srl;
1642 1825
 		}
@@ -1644,7 +1827,9 @@  discard block
 block discarded – undo
1644 1827
 		$args = new stdClass();
1645 1828
 		$args->module_srls = implode(',',$module_srls);
1646 1829
 		$output = executeQueryArray('module.getModuleSites', $args);
1647
-		if(!$output->data) return array();
1830
+		if(!$output->data) {
1831
+			return array();
1832
+		}
1648 1833
 		foreach($output->data as $key => $val)
1649 1834
 		{
1650 1835
 			$modules[$val->module_srl] = $val;
@@ -1656,8 +1841,7 @@  discard block
 block discarded – undo
1656 1841
 			{
1657 1842
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1658 1843
 			}
1659
-		}
1660
-		else
1844
+		} else
1661 1845
 		{
1662 1846
 			$data->domain = $modules[$data->module_srl]->domain;
1663 1847
 		}
@@ -1668,24 +1852,31 @@  discard block
 block discarded – undo
1668 1852
 	 */
1669 1853
 	function isSiteAdmin($member_info, $site_srl = null)
1670 1854
 	{
1671
-		if(!$member_info->member_srl) return false;
1672
-		if($member_info->is_admin == 'Y') return true;
1855
+		if(!$member_info->member_srl) {
1856
+			return false;
1857
+		}
1858
+		if($member_info->is_admin == 'Y') {
1859
+			return true;
1860
+		}
1673 1861
 
1674 1862
 		$args = new stdClass();
1675 1863
 		if(!isset($site_srl))
1676 1864
 		{
1677 1865
 			$site_module_info = Context::get('site_module_info');
1678
-			if(!$site_module_info) return;
1866
+			if(!$site_module_info) {
1867
+				return;
1868
+			}
1679 1869
 			$args->site_srl = $site_module_info->site_srl;
1680
-		}
1681
-		else
1870
+		} else
1682 1871
 		{
1683 1872
 			$args->site_srl = $site_srl;
1684 1873
 		}
1685 1874
 
1686 1875
 		$args->member_srl = $member_info->member_srl;
1687 1876
 		$output = executeQuery('module.isSiteAdmin', $args);
1688
-		if($output->data->member_srl == $args->member_srl) return true;
1877
+		if($output->data->member_srl == $args->member_srl) {
1878
+			return true;
1879
+		}
1689 1880
 		return false;
1690 1881
 	}
1691 1882
 
@@ -1708,7 +1899,9 @@  discard block
 block discarded – undo
1708 1899
 		$obj = new stdClass();
1709 1900
 		$obj->module_srl = $module_srl;
1710 1901
 		$output = executeQueryArray('module.getAdminID', $obj);
1711
-		if(!$output->toBool() || !$output->data) return;
1902
+		if(!$output->toBool() || !$output->data) {
1903
+			return;
1904
+		}
1712 1905
 
1713 1906
 		return $output->data;
1714 1907
 	}
@@ -1721,7 +1914,9 @@  discard block
 block discarded – undo
1721 1914
 	{
1722 1915
 		$extra_vars = array();
1723 1916
 		$get_module_srls = array();
1724
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1917
+		if(!is_array($list_module_srl)) {
1918
+			$list_module_srl = array($list_module_srl);
1919
+		}
1725 1920
 
1726 1921
 		$vars = false;
1727 1922
 		// cache controll
@@ -1737,14 +1932,12 @@  discard block
 block discarded – undo
1737 1932
 				if($vars)
1738 1933
 				{
1739 1934
 					$extra_vars[$module_srl] = $vars;
1740
-				}
1741
-				else
1935
+				} else
1742 1936
 				{
1743 1937
 					$get_module_srls[] = $module_srl;
1744 1938
 				}
1745 1939
 			}
1746
-		}
1747
-		else
1940
+		} else
1748 1941
 		{
1749 1942
 			$get_module_srls = $list_module_srl;
1750 1943
 		}
@@ -1769,7 +1962,9 @@  discard block
 block discarded – undo
1769 1962
 			}
1770 1963
 			foreach($output->data as $key => $val)
1771 1964
 			{
1772
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1965
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1966
+					continue;
1967
+				}
1773 1968
 
1774 1969
 				if(!isset($extra_vars[$val->module_srl]))
1775 1970
 				{
@@ -1808,7 +2003,9 @@  discard block
 block discarded – undo
1808 2003
 			$args = new stdClass();
1809 2004
 			$args->module_srl = $module_srl;
1810 2005
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1811
-			if(!$output->toBool()) return;
2006
+			if(!$output->toBool()) {
2007
+				return;
2008
+			}
1812 2009
 
1813 2010
 			$skin_vars = array();
1814 2011
 			foreach($output->data as $vars)
@@ -1816,7 +2013,9 @@  discard block
 block discarded – undo
1816 2013
 				$skin_vars[$vars->name] = $vars;
1817 2014
 			}
1818 2015
 
1819
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2016
+			if($oCacheHandler->isSupport()) {
2017
+				$oCacheHandler->put($cache_key, $skin_vars);
2018
+			}
1820 2019
 		}
1821 2020
 
1822 2021
 		return $skin_vars;
@@ -1828,7 +2027,9 @@  discard block
 block discarded – undo
1828 2027
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1829 2028
 	{
1830 2029
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1831
-		if(!$site_srl) $site_srl = 0;
2030
+		if(!$site_srl) {
2031
+			$site_srl = 0;
2032
+		}
1832 2033
 
1833 2034
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834 2035
 		if(is_readable($designInfoFile))
@@ -1845,19 +2046,16 @@  discard block
 block discarded – undo
1845 2046
 			if(is_dir($moduleSkinPath.'default'))
1846 2047
 			{
1847 2048
 				$skinName = 'default';
1848
-			}
1849
-			else if(is_dir($moduleSkinPath.'xe_default'))
2049
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1850 2050
 			{
1851 2051
 				$skinName = 'xe_default';
1852
-			}
1853
-			else
2052
+			} else
1854 2053
 			{
1855 2054
 				$skins = FileHandler::readDir($moduleSkinPath);
1856 2055
 				if(count($skins) > 0)
1857 2056
 				{
1858 2057
 					$skinName = $skins[0];
1859
-				}
1860
-				else
2058
+				} else
1861 2059
 				{
1862 2060
 					$skinName = NULL;
1863 2061
 				}
@@ -1865,7 +2063,9 @@  discard block
 block discarded – undo
1865 2063
 
1866 2064
 			if($updateCache && $skinName)
1867 2065
 			{
1868
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2066
+				if(!isset($designInfo->module->{$module_name})) {
2067
+					$designInfo->module->{$module_name} = new stdClass();
2068
+				}
1869 2069
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1870 2070
 
1871 2071
 				$oAdminController = getAdminController('admin');
@@ -1881,23 +2081,28 @@  discard block
 block discarded – undo
1881 2081
 	 */
1882 2082
 	function syncSkinInfoToModuleInfo(&$module_info)
1883 2083
 	{
1884
-		if(!$module_info->module_srl) return;
2084
+		if(!$module_info->module_srl) {
2085
+			return;
2086
+		}
1885 2087
 
1886 2088
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1887 2089
 		if(Mobile::isFromMobilePhone())
1888 2090
 		{
1889 2091
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1890
-		}
1891
-		else
2092
+		} else
1892 2093
 		{
1893 2094
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1894 2095
 		}
1895 2096
 
1896
-		if(!$skin_vars) return;
2097
+		if(!$skin_vars) {
2098
+			return;
2099
+		}
1897 2100
 
1898 2101
 		foreach($skin_vars as $name => $val)
1899 2102
 		{
1900
-			if(isset($module_info->{$name})) continue;
2103
+			if(isset($module_info->{$name})) {
2104
+				continue;
2105
+			}
1901 2106
 			$module_info->{$name} = $val->value;
1902 2107
 		}
1903 2108
 	}
@@ -1923,7 +2128,9 @@  discard block
 block discarded – undo
1923 2128
 			$args = new stdClass();
1924 2129
 			$args->module_srl = $module_srl;
1925 2130
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1926
-			if(!$output->toBool() || !$output->data) return;
2131
+			if(!$output->toBool() || !$output->data) {
2132
+				return;
2133
+			}
1927 2134
 
1928 2135
 			$skin_vars = array();
1929 2136
 			foreach($output->data as $vars)
@@ -1931,7 +2138,9 @@  discard block
 block discarded – undo
1931 2138
 				$skin_vars[$vars->name] = $vars;
1932 2139
 			}
1933 2140
 
1934
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2141
+			if($oCacheHandler->isSupport()) {
2142
+				$oCacheHandler->put($cache_key, $skin_vars);
2143
+			}
1935 2144
 		}
1936 2145
 
1937 2146
 		return $skin_vars;
@@ -1943,7 +2152,9 @@  discard block
 block discarded – undo
1943 2152
 	 */
1944 2153
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1945 2154
 	{
1946
-		if(!$module_info->module_srl) return;
2155
+		if(!$module_info->module_srl) {
2156
+			return;
2157
+		}
1947 2158
 		$skin_vars = false;
1948 2159
 		// cache controll
1949 2160
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1958,17 +2169,25 @@  discard block
 block discarded – undo
1958 2169
 			$args = new stdClass;
1959 2170
 			$args->module_srl = $module_info->module_srl;
1960 2171
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1961
-			if(!$output->toBool()) return;
2172
+			if(!$output->toBool()) {
2173
+				return;
2174
+			}
1962 2175
 			$skin_vars = $output->data;
1963 2176
 
1964 2177
 			//insert in cache
1965
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2178
+			if($oCacheHandler->isSupport()) {
2179
+				$oCacheHandler->put($cache_key, $skin_vars);
2180
+			}
2181
+		}
2182
+		if(!$skin_vars) {
2183
+			return;
1966 2184
 		}
1967
-		if(!$skin_vars) return;
1968 2185
 
1969 2186
 		foreach($output->data as $val)
1970 2187
 		{
1971
-			if(isset($module_info->{$val->name})) continue;
2188
+			if(isset($module_info->{$val->name})) {
2189
+				continue;
2190
+			}
1972 2191
 			$module_info->{$val->name} = $val->value;
1973 2192
 		}
1974 2193
 	}
@@ -1990,10 +2209,12 @@  discard block
 block discarded – undo
1990 2209
 		$grant_info = $xml_info->grant;
1991 2210
 		if($member_info->member_srl)
1992 2211
 		{
1993
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1994
-			else $group_list = array();
1995
-		}
1996
-		else
2212
+			if(is_array($member_info->group_list)) {
2213
+				$group_list = array_keys($member_info->group_list);
2214
+			} else {
2215
+				$group_list = array();
2216
+			}
2217
+		} else
1997 2218
 		{
1998 2219
 			$group_list = array();
1999 2220
 		}
@@ -2007,8 +2228,7 @@  discard block
 block discarded – undo
2007 2228
 			}
2008 2229
 
2009 2230
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2010
-		}
2011
-		else
2231
+		} else
2012 2232
 		{
2013 2233
 			// If module_srl exists
2014 2234
 			// Get a type of granted permission
@@ -2021,7 +2241,9 @@  discard block
 block discarded – undo
2021 2241
 				$args->module_srl = $module_srl;
2022 2242
 				$args->member_srl = $member_info->member_srl;
2023 2243
 				$output = executeQuery('module.getModuleAdmin',$args);
2024
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2244
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2245
+					$grant->manager = true;
2246
+				}
2025 2247
 			}
2026 2248
 			// If not an administrator, get information from the DB and grant manager privilege.
2027 2249
 			if(!$grant->manager)
@@ -2031,8 +2253,7 @@  discard block
 block discarded – undo
2031 2253
 				if($module_info->module == 'planet')
2032 2254
 				{
2033 2255
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2034
-				}
2035
-				else
2256
+				} else
2036 2257
 				{
2037 2258
 					$args = new stdClass;
2038 2259
 					$args->module_srl = $module_srl;
@@ -2047,37 +2268,44 @@  discard block
 block discarded – undo
2047 2268
 					foreach($output->data as $val)
2048 2269
 					{
2049 2270
 						$grant_exists[$val->name] = true;
2050
-						if($granted[$val->name]) continue;
2271
+						if($granted[$val->name]) {
2272
+							continue;
2273
+						}
2051 2274
 						// Log-in member only
2052 2275
 						if($val->group_srl == -1)
2053 2276
 						{
2054 2277
 							$granted[$val->name] = true;
2055
-							if($member_info->member_srl) $grant->{$val->name} = true;
2278
+							if($member_info->member_srl) {
2279
+								$grant->{$val->name} = true;
2280
+							}
2056 2281
 							// Site-joined member only
2057
-						}
2058
-						elseif($val->group_srl == -2)
2282
+						} elseif($val->group_srl == -2)
2059 2283
 						{
2060 2284
 							$granted[$val->name] = true;
2061 2285
 							// Do not grant any permission for non-logged member
2062
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2286
+							if(!$member_info->member_srl) {
2287
+								$grant->{$val->name} = false;
2288
+							}
2063 2289
 							// Log-in member
2064 2290
 							else
2065 2291
 							{
2066 2292
 								$site_module_info = Context::get('site_module_info');
2067 2293
 								// Permission granted if no information of the currently connected site exists
2068
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2294
+								if(!$site_module_info->site_srl) {
2295
+									$grant->{$val->name} = true;
2296
+								}
2069 2297
 								// Permission is not granted if information of the currently connected site exists
2070
-								elseif(count($group_list)) $grant->{$val->name} = true;
2298
+								elseif(count($group_list)) {
2299
+									$grant->{$val->name} = true;
2300
+								}
2071 2301
 							}
2072 2302
 							// All of non-logged members
2073
-						}
2074
-						elseif($val->group_srl == 0)
2303
+						} elseif($val->group_srl == 0)
2075 2304
 						{
2076 2305
 							$granted[$val->name] = true;
2077 2306
 							$grant->{$val->name} = true;
2078 2307
 							// If a target is a group
2079
-						}
2080
-						else
2308
+						} else
2081 2309
 						{
2082 2310
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2083 2311
 							{
@@ -2088,30 +2316,43 @@  discard block
 block discarded – undo
2088 2316
 					}
2089 2317
 				}
2090 2318
 				// Separate processing for the virtual group access
2091
-				if(!$grant_exists['access']) $grant->access = true;
2319
+				if(!$grant_exists['access']) {
2320
+					$grant->access = true;
2321
+				}
2092 2322
 				if(count($grant_info))
2093 2323
 				{
2094 2324
 					foreach($grant_info as  $grant_name => $grant_item)
2095 2325
 					{
2096
-						if($grant_exists[$grant_name]) continue;
2326
+						if($grant_exists[$grant_name]) {
2327
+							continue;
2328
+						}
2097 2329
 						switch($grant_item->default)
2098 2330
 						{
2099 2331
 							case 'guest' :
2100 2332
 								$grant->{$grant_name} = true;
2101 2333
 								break;
2102 2334
 							case 'member' :
2103
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2104
-								else $grant->{$grant_name} = false;
2335
+								if($member_info->member_srl) {
2336
+									$grant->{$grant_name} = true;
2337
+								} else {
2338
+									$grant->{$grant_name} = false;
2339
+								}
2105 2340
 								break;
2106 2341
 							case 'site' :
2107 2342
 								$site_module_info = Context::get('site_module_info');
2108
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2109
-								else $grant->{$grant_name} = false;
2343
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2344
+									$grant->{$grant_name} = true;
2345
+								} else {
2346
+									$grant->{$grant_name} = false;
2347
+								}
2110 2348
 								break;
2111 2349
 							case 'manager' :
2112 2350
 							case 'root' :
2113
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2114
-								else $grant->{$grant_name} = false;
2351
+								if($member_info->is_admin == 'Y') {
2352
+									$grant->{$grant_name} = true;
2353
+								} else {
2354
+									$grant->{$grant_name} = false;
2355
+								}
2115 2356
 								break;
2116 2357
 						}
2117 2358
 					}
@@ -2187,16 +2428,22 @@  discard block
 block discarded – undo
2187 2428
 	function getFileBoxListHtml()
2188 2429
 	{
2189 2430
 		$logged_info = Context::get('logged_info');
2190
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2431
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2432
+			return new Object(-1, 'msg_not_permitted');
2433
+		}
2191 2434
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2192 2435
 		$link_params = explode('&',$link['query']);
2193 2436
 		foreach ($link_params as $param)
2194 2437
 		{
2195 2438
 			$param = explode("=",$param);
2196
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2439
+			if($param[0] == 'selected_widget') {
2440
+				$selected_widget = $param[1];
2441
+			}
2197 2442
 		}
2198 2443
 		$oWidgetModel = getModel('widget');
2199
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2444
+		if($selected_widget) {
2445
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2446
+		}
2200 2447
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2201 2448
 
2202 2449
 		$oModuleModel = getModel('module');
@@ -2204,7 +2451,9 @@  discard block
 block discarded – undo
2204 2451
 		Context::set('filebox_list', $output->data);
2205 2452
 
2206 2453
 		$page = Context::get('page');
2207
-		if (!$page) $page = 1;
2454
+		if (!$page) {
2455
+			$page = 1;
2456
+		}
2208 2457
 		Context::set('page', $page);
2209 2458
 		Context::set('page_navigation', $output->page_navigation);
2210 2459
 
@@ -2234,25 +2483,28 @@  discard block
 block discarded – undo
2234 2483
 			$rulsetFile = str_replace('@', '', $ruleset);
2235 2484
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2236 2485
 			return FileHandler::getRealPath($xml_file);
2237
-		}
2238
-		else if (strpos($ruleset, '#') !== false)
2486
+		} else if (strpos($ruleset, '#') !== false)
2239 2487
 		{
2240 2488
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2241 2489
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2242
-			if(is_readable($xml_file))
2243
-				return FileHandler::getRealPath($xml_file);
2244
-			else{
2490
+			if(is_readable($xml_file)) {
2491
+							return FileHandler::getRealPath($xml_file);
2492
+			} else{
2245 2493
 				$ruleset = str_replace('#', '', $ruleset);
2246 2494
 			}
2247 2495
 
2248 2496
 		}
2249 2497
 		// Get a path of the requested module. Return if not exists.
2250 2498
 		$class_path = ModuleHandler::getModulePath($module);
2251
-		if(!$class_path) return;
2499
+		if(!$class_path) {
2500
+			return;
2501
+		}
2252 2502
 
2253 2503
 		// Check if module.xml exists in the path. Return if not exist
2254 2504
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2255
-		if(!file_exists($xml_file)) return;
2505
+		if(!file_exists($xml_file)) {
2506
+			return;
2507
+		}
2256 2508
 
2257 2509
 		return $xml_file;
2258 2510
 	}
@@ -2302,7 +2554,9 @@  discard block
 block discarded – undo
2302 2554
 	function getLangByLangcode()
2303 2555
 	{
2304 2556
 		$langCode = Context::get('langCode');
2305
-		if (!$langCode) return;
2557
+		if (!$langCode) {
2558
+			return;
2559
+		}
2306 2560
 
2307 2561
 		$oModuleController = getController('module');
2308 2562
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/member/member.controller.php 2 patches
Spacing   +443 added lines, -443 removed lines patch added patch discarded remove patch
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	function procMemberLogin($user_id = null, $password = null, $keep_signed = null)
36 36
 	{
37
-		if(!$user_id && !$password && Context::getRequestMethod() == 'GET')
37
+		if (!$user_id && !$password && Context::getRequestMethod() == 'GET')
38 38
 		{
39 39
 			$this->setRedirectUrl(getNotEncodedUrl(''));
40 40
 			return new Object(-1, 'null_user_id');
41 41
 		}
42 42
 
43 43
 		// Variables
44
-		if(!$user_id) $user_id = Context::get('user_id');
44
+		if (!$user_id) $user_id = Context::get('user_id');
45 45
 		$user_id = trim($user_id);
46 46
 
47
-		if(!$password) $password = Context::get('password');
47
+		if (!$password) $password = Context::get('password');
48 48
 		$password = trim($password);
49 49
 
50
-		if(!$keep_signed) $keep_signed = Context::get('keep_signed');
50
+		if (!$keep_signed) $keep_signed = Context::get('keep_signed');
51 51
 		// Return an error when id and password doesn't exist
52
-		if(!$user_id) return new Object(-1,'null_user_id');
53
-		if(!$password) return new Object(-1,'null_password');
52
+		if (!$user_id) return new Object(-1, 'null_user_id');
53
+		if (!$password) return new Object(-1, 'null_password');
54 54
 
55
-		$output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false);
55
+		$output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ? true : false);
56 56
 		if (!$output->toBool()) return $output;
57 57
 
58 58
 		$oModuleModel = getModel('module');
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		$limit_date = $config->change_password_date;
63 63
 
64 64
 		// Check if change_password_date is set
65
-		if($limit_date > 0)
65
+		if ($limit_date > 0)
66 66
 		{
67 67
 			$oMemberModel = getModel('member');
68
-			if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day')))
68
+			if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day')))
69 69
 			{
70 70
 				$msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date);
71
-				return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg));
71
+				return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new Object(-1, $msg));
72 72
 			}
73 73
 		}
74 74
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$args->member_srl = $this->memberInfo->member_srl;
78 78
 		executeQuery('member.deleteAuthMail', $args);
79 79
 
80
-		if(!$config->after_login_url)
80
+		if (!$config->after_login_url)
81 81
 		{
82 82
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
83 83
 		}
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 		// Call a trigger before log-out (before)
99 99
 		$logged_info = Context::get('logged_info');
100 100
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info);
101
-		if(!$trigger_output->toBool()) return $trigger_output;
101
+		if (!$trigger_output->toBool()) return $trigger_output;
102 102
 		// Destroy session information
103 103
 		$this->destroySessionInfo();
104 104
 		// Call a trigger after log-out (after)
105 105
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info);
106
-		if(!$trigger_output->toBool()) return $trigger_output;
106
+		if (!$trigger_output->toBool()) return $trigger_output;
107 107
 
108 108
 		$output = new Object();
109 109
 
110 110
 		$oModuleModel = getModel('module');
111 111
 		$config = $oModuleModel->getModuleConfig('member');
112
-		if($config->after_logout_url)
112
+		if ($config->after_logout_url)
113 113
 			$output->redirect_url = $config->after_logout_url;
114 114
 
115 115
 		$this->_clearMemberCache($logged_info->member_srl);
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	function procMemberScrapDocument()
126 126
 	{
127 127
 		// Check login information
128
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
128
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
129 129
 		$logged_info = Context::get('logged_info');
130 130
 
131
-		$document_srl = (int)Context::get('document_srl');
132
-		if(!$document_srl) $document_srl = (int)Context::get('target_srl');
133
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
131
+		$document_srl = (int) Context::get('document_srl');
132
+		if (!$document_srl) $document_srl = (int) Context::get('target_srl');
133
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
134 134
 		// Get document
135 135
 		$oDocumentModel = getModel('document');
136 136
 		$oDocument = $oDocumentModel->getDocument($document_srl);
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 		$args->title = $oDocument->get('title');
146 146
 		// Check if already scrapped
147 147
 		$output = executeQuery('member.getScrapDocument', $args);
148
-		if($output->data->count) return new Object(-1, 'msg_alreay_scrapped');
148
+		if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped');
149 149
 		// Insert
150 150
 		$output = executeQuery('member.addScrapDocument', $args);
151
-		if(!$output->toBool()) return $output;
151
+		if (!$output->toBool()) return $output;
152 152
 
153 153
 		$this->setError(-1);
154 154
 		$this->setMessage('success_registed');
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 	function procMemberDeleteScrap()
163 163
 	{
164 164
 		// Check login information
165
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
165
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
166 166
 		$logged_info = Context::get('logged_info');
167 167
 
168
-		$document_srl = (int)Context::get('document_srl');
169
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
168
+		$document_srl = (int) Context::get('document_srl');
169
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
170 170
 		// Variables
171 171
 		$args = new stdClass;
172 172
 		$args->member_srl = $logged_info->member_srl;
@@ -192,23 +192,23 @@  discard block
 block discarded – undo
192 192
 	function procMemberDeleteSavedDocument()
193 193
 	{
194 194
 		// Check login information
195
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
195
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
196 196
 		$logged_info = Context::get('logged_info');
197 197
 
198
-		$document_srl = (int)Context::get('document_srl');
199
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
198
+		$document_srl = (int) Context::get('document_srl');
199
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
200 200
 
201 201
 		$oDocumentModel = getModel('document');
202 202
 		$oDocument = $oDocumentModel->getDocument($document_srl);
203 203
 		if ($oDocument->get('member_srl') != $logged_info->member_srl)
204 204
 		{
205
-			return new Object(-1,'msg_invalid_request');
205
+			return new Object(-1, 'msg_invalid_request');
206 206
 		}
207 207
 
208 208
 		$configStatusList = $oDocumentModel->getStatusList();
209 209
 		if ($oDocument->get('status') != $configStatusList['temp'])
210 210
 		{
211
-			return new Object(-1,'msg_invalid_request');
211
+			return new Object(-1, 'msg_invalid_request');
212 212
 		}
213 213
 
214 214
 		$oDocumentController = getController('document');
@@ -224,37 +224,37 @@  discard block
 block discarded – undo
224 224
 	{
225 225
 		$name = Context::get('name');
226 226
 		$value = Context::get('value');
227
-		if(!$value) return;
227
+		if (!$value) return;
228 228
 
229 229
 		$oMemberModel = getModel('member');
230 230
 		// Check if logged-in
231 231
 		$logged_info = Context::get('logged_info');
232 232
 
233 233
 
234
-		switch($name)
234
+		switch ($name)
235 235
 		{
236 236
 			case 'user_id' :
237 237
 				// Check denied ID
238
-				if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id');
238
+				if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id');
239 239
 				// Check if duplicated
240 240
 				$member_srl = $oMemberModel->getMemberSrlByUserID($value);
241
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id');
241
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id');
242 242
 				break;
243 243
 			case 'nick_name' :
244 244
 				// Check denied ID
245
-				if($oMemberModel->isDeniedNickName($value))
245
+				if ($oMemberModel->isDeniedNickName($value))
246 246
 				{
247
-					return new Object(0,'denied_nick_name');
247
+					return new Object(0, 'denied_nick_name');
248 248
 				}
249 249
 				// Check if duplicated
250 250
 				$member_srl = $oMemberModel->getMemberSrlByNickName($value);
251
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name');
251
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name');
252 252
 
253 253
 				break;
254 254
 			case 'email_address' :
255 255
 				// Check if duplicated
256 256
 				$member_srl = $oMemberModel->getMemberSrlByEmailAddress($value);
257
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address');
257
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address');
258 258
 				break;
259 259
 		}
260 260
 	}
@@ -266,25 +266,25 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	function procMemberInsert()
268 268
 	{
269
-		if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request");
270
-		$oMemberModel = &getModel ('member');
269
+		if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request");
270
+		$oMemberModel = &getModel('member');
271 271
 		$config = $oMemberModel->getMemberConfig();
272 272
 
273 273
 		// call a trigger (before)
274
-		$trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config);
275
-		if(!$trigger_output->toBool ()) return $trigger_output;
274
+		$trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config);
275
+		if (!$trigger_output->toBool()) return $trigger_output;
276 276
 		// Check if an administrator allows a membership
277
-		if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled');
277
+		if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
278 278
 		// Check if the user accept the license terms (only if terms exist)
279
-		if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement');
279
+		if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement');
280 280
 
281 281
 		// Extract the necessary information in advance
282 282
 		$getVars = array();
283
-		if($config->signupForm)
283
+		if ($config->signupForm)
284 284
 		{
285
-			foreach($config->signupForm as $formInfo)
285
+			foreach ($config->signupForm as $formInfo)
286 286
 			{
287
-				if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
287
+				if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
288 288
 				{
289 289
 					$getVars[] = $formInfo->name;
290 290
 				}
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
 		}
293 293
 
294 294
 		$args = new stdClass;
295
-		foreach($getVars as $val)
295
+		foreach ($getVars as $val)
296 296
 		{
297 297
 			$args->{$val} = Context::get($val);
298
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
298
+			if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
299 299
 		}
300 300
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
301
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
301
+		if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
302 302
 
303 303
 		$args->find_account_answer = Context::get('find_account_answer');
304 304
 		$args->allow_mailing = Context::get('allow_mailing');
305 305
 		$args->allow_message = Context::get('allow_message');
306 306
 
307
-		if($args->password1) $args->password = $args->password1;
307
+		if ($args->password1) $args->password = $args->password1;
308 308
 
309 309
 		// check password strength
310
-		if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
310
+		if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
311 311
 		{
312 312
 			$message = Context::getLang('about_password_strength');
313 313
 			return new Object(-1, $message[$config->password_strength]);
@@ -333,58 +333,58 @@  discard block
 block discarded – undo
333 333
 		unset($all_args->secret_text);
334 334
 
335 335
 		// Set the user state as "denied" when using mail authentication
336
-		if($config->enable_confirm == 'Y') $args->denied = 'Y';
336
+		if ($config->enable_confirm == 'Y') $args->denied = 'Y';
337 337
 		// Add extra vars after excluding necessary information from all the requested arguments
338 338
 		$extra_vars = delObjectVars($all_args, $args);
339 339
 		$args->extra_vars = serialize($extra_vars);
340 340
 
341 341
 		// remove whitespace
342 342
 		$checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address');
343
-		foreach($checkInfos as $val)
343
+		foreach ($checkInfos as $val)
344 344
 		{
345
-			if(isset($args->{$val}))
345
+			if (isset($args->{$val}))
346 346
 			{
347 347
 				$args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val});
348 348
 			}
349 349
 		}
350 350
 		$output = $this->insertMember($args);
351
-		if(!$output->toBool()) return $output;
351
+		if (!$output->toBool()) return $output;
352 352
 
353 353
 		// insert ProfileImage, ImageName, ImageMark
354 354
 		$profile_image = $_FILES['profile_image'];
355
-		if(is_uploaded_file($profile_image['tmp_name']))
355
+		if (is_uploaded_file($profile_image['tmp_name']))
356 356
 		{
357 357
 			$this->insertProfileImage($args->member_srl, $profile_image['tmp_name']);
358 358
 		}
359 359
 
360 360
 		$image_mark = $_FILES['image_mark'];
361
-		if(is_uploaded_file($image_mark['tmp_name']))
361
+		if (is_uploaded_file($image_mark['tmp_name']))
362 362
 		{
363 363
 			$this->insertImageMark($args->member_srl, $image_mark['tmp_name']);
364 364
 		}
365 365
 
366 366
 		$image_name = $_FILES['image_name'];
367
-		if(is_uploaded_file($image_name['tmp_name']))
367
+		if (is_uploaded_file($image_name['tmp_name']))
368 368
 		{
369 369
 			$this->insertImageName($args->member_srl, $image_name['tmp_name']);
370 370
 		}
371 371
 
372 372
 		// If a virtual site, join the site
373 373
 		$site_module_info = Context::get('site_module_info');
374
-		if($site_module_info->site_srl > 0)
374
+		if ($site_module_info->site_srl > 0)
375 375
 		{
376 376
 			$columnList = array('site_srl', 'group_srl');
377 377
 			$default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList);
378
-			if($default_group->group_srl)
378
+			if ($default_group->group_srl)
379 379
 			{
380 380
 				$this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl);
381 381
 			}
382 382
 
383 383
 		}
384 384
 		// Log-in
385
-		if($config->enable_confirm != 'Y')
385
+		if ($config->enable_confirm != 'Y')
386 386
 		{
387
-			if($config->identifier == 'email_address')
387
+			if ($config->identifier == 'email_address')
388 388
 			{
389 389
 				$output = $this->doLogin($args->email_address);
390 390
 			}
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 			{
393 393
 				$output = $this->doLogin($args->user_id);
394 394
 			}
395
-			if(!$output->toBool()) {
396
-				if($output->error == -9)
395
+			if (!$output->toBool()) {
396
+				if ($output->error == -9)
397 397
 					$output->error = -11;
398 398
 				return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output);
399 399
 			}
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 
402 402
 		// Results
403 403
 		$this->add('member_srl', $args->member_srl);
404
-		if($config->redirect_url) $this->add('redirect_url', $config->redirect_url);
405
-		if($config->enable_confirm == 'Y')
404
+		if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url);
405
+		if ($config->enable_confirm == 'Y')
406 406
 		{
407 407
 			$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address);
408 408
 			$this->setMessage($msg);
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 		else $this->setMessage('success_registed');
412 412
 		// Call a trigger (after)
413 413
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config);
414
-		if(!$trigger_output->toBool()) return $trigger_output;
414
+		if (!$trigger_output->toBool()) return $trigger_output;
415 415
 
416
-		if($config->redirect_url)
416
+		if ($config->redirect_url)
417 417
 		{
418 418
 			$returnUrl = $config->redirect_url;
419 419
 		}
420 420
 		else
421 421
 		{
422
-			if(Context::get('success_return_url'))
422
+			if (Context::get('success_return_url'))
423 423
 			{
424 424
 				$returnUrl = Context::get('success_return_url');
425 425
 			}
426
-			else if($_COOKIE['XE_REDIRECT_URL'])
426
+			else if ($_COOKIE['XE_REDIRECT_URL'])
427 427
 			{
428 428
 				$returnUrl = $_COOKIE['XE_REDIRECT_URL'];
429 429
 				setcookie("XE_REDIRECT_URL", '', 1);
@@ -437,26 +437,26 @@  discard block
 block discarded – undo
437 437
 
438 438
 	function procMemberModifyInfoBefore()
439 439
 	{
440
-		if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD')
440
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD')
441 441
 		{
442 442
 			return $this->stop('msg_invalid_request');
443 443
 		}
444 444
 
445
-		if(!Context::get('is_logged'))
445
+		if (!Context::get('is_logged'))
446 446
 		{
447 447
 			return $this->stop('msg_not_logged');
448 448
 		}
449 449
 
450 450
 		$password = Context::get('password');
451 451
 
452
-		if(!$password)
452
+		if (!$password)
453 453
 		{
454 454
 			return $this->stop('msg_invalid_request');
455 455
 		}
456 456
 
457 457
 		$oMemberModel = getModel('member');
458 458
 
459
-		if(!$this->memberInfo->password)
459
+		if (!$this->memberInfo->password)
460 460
 		{
461 461
 			// Get information of logged-in user
462 462
 			$logged_info = Context::get('logged_info');
@@ -467,14 +467,14 @@  discard block
 block discarded – undo
467 467
 			$this->memberInfo->password = $memberInfo->password;
468 468
 		}
469 469
 		// Verify the current password
470
-		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password))
470
+		if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password))
471 471
 		{
472 472
 			return new Object(-1, 'invalid_password');
473 473
 		}
474 474
 
475 475
 		$_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD';
476 476
 
477
-		if(Context::get('success_return_url'))
477
+		if (Context::get('success_return_url'))
478 478
 		{
479 479
 			$redirectUrl = Context::get('success_return_url');
480 480
 		}
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	 */
493 493
 	function procMemberModifyInfo()
494 494
 	{
495
-		if(!Context::get('is_logged'))
495
+		if (!Context::get('is_logged'))
496 496
 		{
497 497
 			return $this->stop('msg_not_logged');
498 498
 		}
499 499
 
500
-		if($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
500
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
501 501
 		{
502 502
 			return $this->stop('msg_invalid_request');
503 503
 		}
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 
506 506
 		// Extract the necessary information in advance
507 507
 		$oMemberModel = getModel('member');
508
-		$config = $oMemberModel->getMemberConfig ();
509
-		$getVars = array('find_account_answer','allow_mailing','allow_message');
510
-		if($config->signupForm)
508
+		$config = $oMemberModel->getMemberConfig();
509
+		$getVars = array('find_account_answer', 'allow_mailing', 'allow_message');
510
+		if ($config->signupForm)
511 511
 		{
512
-			foreach($config->signupForm as $formInfo)
512
+			foreach ($config->signupForm as $formInfo)
513 513
 			{
514
-				if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
514
+				if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
515 515
 				{
516 516
 					$getVars[] = $formInfo->name;
517 517
 				}
@@ -519,16 +519,16 @@  discard block
 block discarded – undo
519 519
 		}
520 520
 
521 521
 		$args = new stdClass;
522
-		foreach($getVars as $val)
522
+		foreach ($getVars as $val)
523 523
 		{
524 524
 			$args->{$val} = Context::get($val);
525
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
525
+			if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
526 526
 		}
527 527
 		// Login Information
528 528
 		$logged_info = Context::get('logged_info');
529 529
 		$args->member_srl = $logged_info->member_srl;
530 530
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
531
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
531
+		if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
532 532
 		// Remove some unnecessary variables from all the vars
533 533
 		$all_args = Context::getRequestVars();
534 534
 		unset($all_args->module);
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 
553 553
 		// remove whitespace
554 554
 		$checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address');
555
-		foreach($checkInfos as $val)
555
+		foreach ($checkInfos as $val)
556 556
 		{
557
-			if(isset($args->{$val}))
557
+			if (isset($args->{$val}))
558 558
 			{
559 559
 				$args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val});
560 560
 			}
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
 
563 563
 		// Execute insert or update depending on the value of member_srl
564 564
 		$output = $this->updateMember($args);
565
-		if(!$output->toBool()) return $output;
565
+		if (!$output->toBool()) return $output;
566 566
 
567 567
 		$profile_image = $_FILES['profile_image'];
568
-		if(is_uploaded_file($profile_image['tmp_name']))
568
+		if (is_uploaded_file($profile_image['tmp_name']))
569 569
 		{
570 570
 			$this->insertProfileImage($args->member_srl, $profile_image['tmp_name']);
571 571
 		}
572 572
 
573 573
 		$image_mark = $_FILES['image_mark'];
574
-		if(is_uploaded_file($image_mark['tmp_name']))
574
+		if (is_uploaded_file($image_mark['tmp_name']))
575 575
 		{
576 576
 			$this->insertImageMark($args->member_srl, $image_mark['tmp_name']);
577 577
 		}
578 578
 
579 579
 		$image_name = $_FILES['image_name'];
580
-		if(is_uploaded_file($image_name['tmp_name']))
580
+		if (is_uploaded_file($image_name['tmp_name']))
581 581
 		{
582 582
 			$this->insertImageName($args->member_srl, $image_name['tmp_name']);
583 583
 		}
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 
593 593
 		// Call a trigger after successfully log-in (after)
594 594
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo);
595
-		if(!$trigger_output->toBool()) return $trigger_output;
595
+		if (!$trigger_output->toBool()) return $trigger_output;
596 596
 
597 597
 		$this->setSessionInfo();
598 598
 		// Return result
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	function procMemberModifyPassword()
615 615
 	{
616
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
616
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
617 617
 		// Extract the necessary information in advance
618 618
 		$current_password = trim(Context::get('current_password'));
619 619
 		$password = trim(Context::get('password1'));
@@ -627,17 +627,17 @@  discard block
 block discarded – undo
627 627
 
628 628
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
629 629
 		// Verify the cuttent password
630
-		if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password');
630
+		if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password');
631 631
 
632 632
 		// Check if a new password is as same as the previous password
633
-		if($current_password == $password) return new Object(-1, 'invalid_new_password');
633
+		if ($current_password == $password) return new Object(-1, 'invalid_new_password');
634 634
 
635 635
 		// Execute insert or update depending on the value of member_srl
636 636
 		$args = new stdClass;
637 637
 		$args->member_srl = $member_srl;
638 638
 		$args->password = $password;
639 639
 		$output = $this->updateMemberPassword($args);
640
-		if(!$output->toBool()) return $output;
640
+		if (!$output->toBool()) return $output;
641 641
 
642 642
 		$this->add('member_srl', $args->member_srl);
643 643
 		$this->setMessage('success_updated');
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 */
654 654
 	function procMemberLeave()
655 655
 	{
656
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
656
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
657 657
 		// Extract the necessary information in advance
658 658
 		$password = trim(Context::get('password'));
659 659
 		// Get information of logged-in user
@@ -662,17 +662,17 @@  discard block
 block discarded – undo
662 662
 		// Create a member model object
663 663
 		$oMemberModel = getModel('member');
664 664
 		// Get information of member_srl
665
-		if(!$this->memberInfo->password)
665
+		if (!$this->memberInfo->password)
666 666
 		{
667 667
 			$columnList = array('member_srl', 'password');
668 668
 			$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
669 669
 			$this->memberInfo->password = $memberInfo->password;
670 670
 		}
671 671
 		// Verify the cuttent password
672
-		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
672
+		if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
673 673
 
674 674
 		$output = $this->deleteMember($member_srl);
675
-		if(!$output->toBool()) return $output;
675
+		if (!$output->toBool()) return $output;
676 676
 		// Destroy all session information
677 677
 		$this->destroySessionInfo();
678 678
 		// Return success message
@@ -691,17 +691,17 @@  discard block
 block discarded – undo
691 691
 	{
692 692
 		// Check if the file is successfully uploaded
693 693
 		$file = $_FILES['profile_image'];
694
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image');
694
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image');
695 695
 		// Ignore if member_srl is invalid or doesn't exist.
696 696
 		$member_srl = Context::get('member_srl');
697
-		if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image');
697
+		if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image');
698 698
 
699 699
 		$logged_info = Context::get('logged_info');
700
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image');
700
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image');
701 701
 		// Return if member module is set not to use an image name or the user is not an administrator ;
702 702
 		$oModuleModel = getModel('module');
703 703
 		$config = $oModuleModel->getModuleConfig('member');
704
-		if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image');
704
+		if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image');
705 705
 
706 706
 		$this->insertProfileImage($member_srl, $file['tmp_name']);
707 707
 		// Page refresh
@@ -723,25 +723,25 @@  discard block
 block discarded – undo
723 723
 	{
724 724
 
725 725
 		// Check uploaded file
726
-		if(!checkUploadedFile($target_file)) return;
726
+		if (!checkUploadedFile($target_file)) return;
727 727
 
728 728
 		$oMemberModel = getModel('member');
729 729
 		$config = $oMemberModel->getMemberConfig();
730 730
 
731 731
 		// Get an image size
732 732
 		$max_width = $config->profile_image_max_width;
733
-		if(!$max_width) $max_width = "90";
733
+		if (!$max_width) $max_width = "90";
734 734
 		$max_height = $config->profile_image_max_height;
735
-		if(!$max_height) $max_height = "90";
735
+		if (!$max_height) $max_height = "90";
736 736
 		// Get a target path to save
737 737
 		$target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl));
738 738
 		FileHandler::makeDir($target_path);
739 739
 
740 740
 		// Get file information
741 741
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
742
-		if(IMAGETYPE_PNG == $type) $ext = 'png';
743
-		elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg';
744
-		elseif(IMAGETYPE_GIF == $type) $ext = 'gif';
742
+		if (IMAGETYPE_PNG == $type) $ext = 'png';
743
+		elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg';
744
+		elseif (IMAGETYPE_GIF == $type) $ext = 'gif';
745 745
 		else
746 746
 		{
747 747
 			return;
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext);
753 753
 		// Convert if the image size is larger than a given size or if the format is not a gif
754
-		if(($width > $max_width || $height > $max_height ) && $type != 1)
754
+		if (($width > $max_width || $height > $max_height) && $type != 1)
755 755
 		{
756 756
 			FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext);
757 757
 		}
@@ -770,17 +770,17 @@  discard block
 block discarded – undo
770 770
 	{
771 771
 		// Check if the file is successfully uploaded
772 772
 		$file = $_FILES['image_name'];
773
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name');
773
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name');
774 774
 		// Ignore if member_srl is invalid or doesn't exist.
775 775
 		$member_srl = Context::get('member_srl');
776
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_name');
776
+		if (!$member_srl) return $this->stop('msg_not_uploaded_image_name');
777 777
 
778 778
 		$logged_info = Context::get('logged_info');
779
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name');
779
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name');
780 780
 		// Return if member module is set not to use an image name or the user is not an administrator ;
781 781
 		$oModuleModel = getModel('module');
782 782
 		$config = $oModuleModel->getModuleConfig('member');
783
-		if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name');
783
+		if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name');
784 784
 
785 785
 		$this->insertImageName($member_srl, $file['tmp_name']);
786 786
 		// Page refresh
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
 	function insertImageName($member_srl, $target_file)
802 802
 	{
803 803
 		// Check uploaded file
804
-		if(!checkUploadedFile($target_file)) return;
804
+		if (!checkUploadedFile($target_file)) return;
805 805
 
806 806
 		$oModuleModel = getModel('module');
807 807
 		$config = $oModuleModel->getModuleConfig('member');
808 808
 		// Get an image size
809 809
 		$max_width = $config->image_name_max_width;
810
-		if(!$max_width) $max_width = "90";
810
+		if (!$max_width) $max_width = "90";
811 811
 		$max_height = $config->image_name_max_height;
812
-		if(!$max_height) $max_height = "20";
812
+		if (!$max_height) $max_height = "20";
813 813
 		// Get a target path to save
814 814
 		$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl));
815 815
 		FileHandler::makeDir($target_path);
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		// Get file information
819 819
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
820 820
 		// Convert if the image size is larger than a given size or if the format is not a gif
821
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
821
+		if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
822 822
 		else @copy($target_file, $target_filename);
823 823
 	}
824 824
 
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
 	function procMemberDeleteProfileImage($_memberSrl = 0)
831 831
 	{
832 832
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
833
-		if(!$member_srl)
833
+		if (!$member_srl)
834 834
 		{
835
-			return new Object(0,'success');
835
+			return new Object(0, 'success');
836 836
 		}
837 837
 
838 838
 		$logged_info = Context::get('logged_info');
839 839
 
840
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
840
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
841 841
 		{
842 842
 			$oMemberModel = getModel('member');
843 843
 			$profile_image = $oMemberModel->getProfileImage($member_srl);
844 844
 			FileHandler::removeFile($profile_image->file);
845 845
 		}
846
-		return new Object(0,'success');
846
+		return new Object(0, 'success');
847 847
 	}
848 848
 
849 849
 	/**
@@ -854,20 +854,20 @@  discard block
 block discarded – undo
854 854
 	function procMemberDeleteImageName($_memberSrl = 0)
855 855
 	{
856 856
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
857
-		if(!$member_srl)
857
+		if (!$member_srl)
858 858
 		{
859
-			return new Object(0,'success');
859
+			return new Object(0, 'success');
860 860
 		}
861 861
 
862 862
 		$logged_info = Context::get('logged_info');
863 863
 
864
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
864
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
865 865
 		{
866 866
 			$oMemberModel = getModel('member');
867 867
 			$image_name = $oMemberModel->getImageName($member_srl);
868 868
 			FileHandler::removeFile($image_name->file);
869 869
 		}
870
-		return new Object(0,'success');
870
+		return new Object(0, 'success');
871 871
 	}
872 872
 
873 873
 	/**
@@ -879,17 +879,17 @@  discard block
 block discarded – undo
879 879
 	{
880 880
 		// Check if the file is successfully uploaded
881 881
 		$file = $_FILES['image_mark'];
882
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark');
882
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark');
883 883
 		// Ignore if member_srl is invalid or doesn't exist.
884 884
 		$member_srl = Context::get('member_srl');
885
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark');
885
+		if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark');
886 886
 
887 887
 		$logged_info = Context::get('logged_info');
888
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark');
888
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark');
889 889
 		// Membership in the images mark the module using the ban was set by an administrator or return;
890 890
 		$oModuleModel = getModel('module');
891 891
 		$config = $oModuleModel->getModuleConfig('member');
892
-		if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark');
892
+		if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark');
893 893
 
894 894
 		$this->insertImageMark($member_srl, $file['tmp_name']);
895 895
 		// Page refresh
@@ -910,15 +910,15 @@  discard block
 block discarded – undo
910 910
 	function insertImageMark($member_srl, $target_file)
911 911
 	{
912 912
 		// Check uploaded file
913
-		if(!checkUploadedFile($target_file)) return;
913
+		if (!checkUploadedFile($target_file)) return;
914 914
 
915 915
 		$oModuleModel = getModel('module');
916 916
 		$config = $oModuleModel->getModuleConfig('member');
917 917
 		// Get an image size
918 918
 		$max_width = $config->image_mark_max_width;
919
-		if(!$max_width) $max_width = "20";
919
+		if (!$max_width) $max_width = "20";
920 920
 		$max_height = $config->image_mark_max_height;
921
-		if(!$max_height) $max_height = "20";
921
+		if (!$max_height) $max_height = "20";
922 922
 
923 923
 		$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl));
924 924
 		FileHandler::makeDir($target_path);
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 		// Get file information
928 928
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
929 929
 
930
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
930
+		if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
931 931
 		else @copy($target_file, $target_filename);
932 932
 	}
933 933
 
@@ -939,20 +939,20 @@  discard block
 block discarded – undo
939 939
 	function procMemberDeleteImageMark($_memberSrl = 0)
940 940
 	{
941 941
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
942
-		if(!$member_srl)
942
+		if (!$member_srl)
943 943
 		{
944
-			return new Object(0,'success');
944
+			return new Object(0, 'success');
945 945
 		}
946 946
 
947 947
 		$logged_info = Context::get('logged_info');
948 948
 
949
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
949
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
950 950
 		{
951 951
 			$oMemberModel = getModel('member');
952 952
 			$image_mark = $oMemberModel->getImageMark($member_srl);
953 953
 			FileHandler::removeFile($image_mark->file);
954 954
 		}
955
-		return new Object(0,'success');
955
+		return new Object(0, 'success');
956 956
 	}
957 957
 
958 958
 	/**
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 	function procMemberFindAccount()
964 964
 	{
965 965
 		$email_address = Context::get('email_address');
966
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
966
+		if (!$email_address) return new Object(-1, 'msg_invalid_request');
967 967
 
968 968
 		$oMemberModel = getModel('member');
969 969
 		$oModuleModel = getModel('module');
970 970
 
971 971
 		// Check if a member having the same email address exists
972 972
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
973
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
973
+		if (!$member_srl) return new Object(-1, 'msg_email_not_exists');
974 974
 
975 975
 		// Get information of the member
976 976
 		$columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name');
977 977
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
978 978
 
979 979
 		// Check if possible to find member's ID and password
980
-		if($member_info->denied == 'Y')
980
+		if ($member_info->denied == 'Y')
981 981
 		{
982 982
 			$chk_args = new stdClass;
983 983
 			$chk_args->member_srl = $member_info->member_srl;
984 984
 			$output = executeQuery('member.chkAuthMail', $chk_args);
985
-			if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed');
985
+			if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed');
986 986
 		}
987 987
 
988 988
 		// Insert data into the authentication DB
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
 		$args->is_register = 'N';
996 996
 
997 997
 		$output = executeQuery('member.insertAuthMail', $args);
998
-		if(!$output->toBool()) return $output;
998
+		if (!$output->toBool()) return $output;
999 999
 		// Get content of the email to send a member
1000 1000
 		Context::set('auth_args', $args);
1001 1001
 
1002 1002
 		$member_config = $oModuleModel->getModuleConfig('member');
1003 1003
 		$memberInfo = array();
1004 1004
 		global $lang;
1005
-		if(is_array($member_config->signupForm))
1005
+		if (is_array($member_config->signupForm))
1006 1006
 		{
1007
-			$exceptForm=array('password', 'find_account_question');
1008
-			foreach($member_config->signupForm as $form)
1007
+			$exceptForm = array('password', 'find_account_question');
1008
+			foreach ($member_config->signupForm as $form)
1009 1009
 			{
1010
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1010
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1011 1011
 				{
1012 1012
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1013 1013
 				}
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
 		}
1023 1023
 		Context::set('memberInfo', $memberInfo);
1024 1024
 
1025
-		if(!$member_config->skin) $member_config->skin = "default";
1026
-		if(!$member_config->colorset) $member_config->colorset = "white";
1025
+		if (!$member_config->skin) $member_config->skin = "default";
1026
+		if (!$member_config->colorset) $member_config->colorset = "white";
1027 1027
 
1028 1028
 		Context::set('member_config', $member_config);
1029 1029
 
1030 1030
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1031
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1031
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1032 1032
 
1033
-		$find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key);
1033
+		$find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key);
1034 1034
 		Context::set('find_url', $find_url);
1035 1035
 
1036 1036
 		$oTemplate = &TemplateHandler::getInstance();
@@ -1040,19 +1040,19 @@  discard block
 block discarded – undo
1040 1040
 		$member_config = $oModuleModel->getModuleConfig('member');
1041 1041
 		// Send a mail
1042 1042
 		$oMail = new Mail();
1043
-		$oMail->setTitle( Context::getLang('msg_find_account_title') );
1043
+		$oMail->setTitle(Context::getLang('msg_find_account_title'));
1044 1044
 		$oMail->setContent($content);
1045
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1046
-		$oMail->setReceiptor( $member_info->user_name, $member_info->email_address );
1045
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1046
+		$oMail->setReceiptor($member_info->user_name, $member_info->email_address);
1047 1047
 		$oMail->send();
1048 1048
 		// Return message
1049 1049
 		$msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address);
1050
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
1050
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
1051 1051
 		{
1052 1052
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount');
1053 1053
 			$this->setRedirectUrl($returnUrl);
1054 1054
 		}
1055
-		return new Object(0,$msg);
1055
+		return new Object(0, $msg);
1056 1056
 	}
1057 1057
 
1058 1058
 	/**
@@ -1070,28 +1070,28 @@  discard block
 block discarded – undo
1070 1070
 		$find_account_question = trim(Context::get('find_account_question'));
1071 1071
 		$find_account_answer = trim(Context::get('find_account_answer'));
1072 1072
 
1073
-		if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request');
1073
+		if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request');
1074 1074
 
1075 1075
 		$oModuleModel = getModel('module');
1076 1076
 		// Check if a member having the same email address exists
1077 1077
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1078
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
1078
+		if (!$member_srl) return new Object(-1, 'msg_email_not_exists');
1079 1079
 		// Get information of the member
1080 1080
 		$columnList = array('member_srl', 'find_account_question', 'find_account_answer');
1081 1081
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
1082 1082
 
1083 1083
 		// Display a message if no answer is entered
1084
-		if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists');
1084
+		if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists');
1085 1085
 
1086
-		if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches');
1086
+		if (trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches');
1087 1087
 
1088
-		if($config->identifier == 'email_address')
1088
+		if ($config->identifier == 'email_address')
1089 1089
 		{
1090 1090
 			$user_id = $email_address;
1091 1091
 		}
1092 1092
 
1093 1093
 		// Update to a temporary password and set change_password_date to 1
1094
-		$oPassword =  new Password();
1094
+		$oPassword = new Password();
1095 1095
 		$temp_password = $oPassword->createTemporaryPassword(8);
1096 1096
 
1097 1097
 		$args = new stdClass();
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 		$args->password = $temp_password;
1100 1100
 		$args->change_password_date = '1';
1101 1101
 		$output = $this->updateMemberPassword($args);
1102
-		if(!$output->toBool()) return $output;
1102
+		if (!$output->toBool()) return $output;
1103 1103
 
1104
-		$_SESSION['xe_temp_password_' . $user_id] = $temp_password;
1104
+		$_SESSION['xe_temp_password_'.$user_id] = $temp_password;
1105 1105
 
1106
-		$this->add('user_id',$user_id);
1106
+		$this->add('user_id', $user_id);
1107 1107
 
1108 1108
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
1109 1109
 		$this->setRedirectUrl($returnUrl.'&user_id='.$user_id);
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 		$member_srl = Context::get('member_srl');
1124 1124
 		$auth_key = Context::get('auth_key');
1125 1125
 
1126
-		if(!$member_srl || !$auth_key)
1126
+		if (!$member_srl || !$auth_key)
1127 1127
 		{
1128 1128
 			return $this->stop('msg_invalid_request');
1129 1129
 		}
@@ -1134,9 +1134,9 @@  discard block
 block discarded – undo
1134 1134
 		$args->auth_key = $auth_key;
1135 1135
 		$output = executeQuery('member.getAuthMail', $args);
1136 1136
 
1137
-		if(!$output->toBool() || $output->data->auth_key != $auth_key)
1137
+		if (!$output->toBool() || $output->data->auth_key != $auth_key)
1138 1138
 		{
1139
-			if(strlen($output->data->auth_key) !== strlen($auth_key))
1139
+			if (strlen($output->data->auth_key) !== strlen($auth_key))
1140 1140
 			{
1141 1141
 				executeQuery('member.deleteAuthMail', $args);
1142 1142
 			}
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 			return $this->stop('msg_invalid_auth_key');
1145 1145
 		}
1146 1146
 
1147
-		if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400)
1147
+		if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400)
1148 1148
 		{
1149 1149
 			executeQuery('member.deleteAuthMail', $args);
1150 1150
 			return $this->stop('msg_invalid_auth_key');
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		$args->password = $output->data->new_password;
1154 1154
 
1155 1155
 		// If credentials are correct, change the password to a new one
1156
-		if($output->data->is_register == 'Y')
1156
+		if ($output->data->is_register == 'Y')
1157 1157
 		{
1158 1158
 			$args->denied = 'N';
1159 1159
 		}
@@ -1166,13 +1166,13 @@  discard block
 block discarded – undo
1166 1166
 		$is_register = $output->data->is_register;
1167 1167
 
1168 1168
 		$output = executeQuery('member.updateMemberPassword', $args);
1169
-		if(!$output->toBool())
1169
+		if (!$output->toBool())
1170 1170
 		{
1171 1171
 			return $this->stop($output->getMessage());
1172 1172
 		}
1173 1173
 
1174 1174
 		// Remove all values having the member_srl from authentication table
1175
-		executeQuery('member.deleteAuthMail',$args);
1175
+		executeQuery('member.deleteAuthMail', $args);
1176 1176
 
1177 1177
 		$this->_clearMemberCache($args->member_srl);
1178 1178
 
@@ -1191,33 +1191,33 @@  discard block
 block discarded – undo
1191 1191
 	{
1192 1192
 		// Get an email_address
1193 1193
 		$email_address = Context::get('email_address');
1194
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
1194
+		if (!$email_address) return new Object(-1, 'msg_invalid_request');
1195 1195
 		// Log test by using email_address
1196 1196
 		$oMemberModel = getModel('member');
1197 1197
 
1198 1198
 		$args = new stdClass;
1199 1199
 		$args->email_address = $email_address;
1200 1200
 		$memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1201
-		if(!$memberSrl) return new Object(-1, 'msg_not_exists_member');
1201
+		if (!$memberSrl) return new Object(-1, 'msg_not_exists_member');
1202 1202
 
1203 1203
 		$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address');
1204 1204
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList);
1205 1205
 
1206 1206
 		$oModuleModel = getModel('module');
1207 1207
 		$member_config = $oModuleModel->getModuleConfig('member');
1208
-		if(!$member_config->skin) $member_config->skin = "default";
1209
-		if(!$member_config->colorset) $member_config->colorset = "white";
1208
+		if (!$member_config->skin) $member_config->skin = "default";
1209
+		if (!$member_config->colorset) $member_config->colorset = "white";
1210 1210
 
1211 1211
 		// Check if a authentication mail has been sent previously
1212 1212
 		$chk_args = new stdClass;
1213 1213
 		$chk_args->member_srl = $member_info->member_srl;
1214 1214
 		$output = executeQuery('member.chkAuthMail', $chk_args);
1215
-		if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request');
1215
+		if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request');
1216 1216
 
1217 1217
 		$auth_args = new stdClass;
1218 1218
 		$auth_args->member_srl = $member_info->member_srl;
1219 1219
 		$output = executeQueryArray('member.getAuthMailInfo', $auth_args);
1220
-		if(!$output->data || !$output->data[0]->auth_key)  return new Object(-1, 'msg_invalid_request');
1220
+		if (!$output->data || !$output->data[0]->auth_key)  return new Object(-1, 'msg_invalid_request');
1221 1221
 		$auth_info = $output->data[0];
1222 1222
 
1223 1223
 		// Update the regdate of authmail entry
@@ -1228,12 +1228,12 @@  discard block
 block discarded – undo
1228 1228
 
1229 1229
 		$memberInfo = array();
1230 1230
 		global $lang;
1231
-		if(is_array($member_config->signupForm))
1231
+		if (is_array($member_config->signupForm))
1232 1232
 		{
1233
-			$exceptForm=array('password', 'find_account_question');
1234
-			foreach($member_config->signupForm as $form)
1233
+			$exceptForm = array('password', 'find_account_question');
1234
+			foreach ($member_config->signupForm as $form)
1235 1235
 			{
1236
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1236
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1237 1237
 				{
1238 1238
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1239 1239
 				}
@@ -1252,19 +1252,19 @@  discard block
 block discarded – undo
1252 1252
 		Context::set('member_config', $member_config);
1253 1253
 
1254 1254
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1255
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1255
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1256 1256
 
1257
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key);
1257
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key);
1258 1258
 		Context::set('auth_url', $auth_url);
1259 1259
 
1260 1260
 		$oTemplate = &TemplateHandler::getInstance();
1261 1261
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
1262 1262
 		// Send a mail
1263 1263
 		$oMail = new Mail();
1264
-		$oMail->setTitle( Context::getLang('msg_confirm_account_title') );
1264
+		$oMail->setTitle(Context::getLang('msg_confirm_account_title'));
1265 1265
 		$oMail->setContent($content);
1266
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1267
-		$oMail->setReceiptor( $args->user_name, $args->email_address );
1266
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1267
+		$oMail->setReceiptor($args->user_name, $args->email_address);
1268 1268
 		$oMail->send();
1269 1269
 
1270 1270
 		$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address);
@@ -1279,23 +1279,23 @@  discard block
 block discarded – undo
1279 1279
 		$memberInfo = $_SESSION['auth_member_info'];
1280 1280
 		unset($_SESSION['auth_member_info']);
1281 1281
 
1282
-		if(!$memberInfo)
1282
+		if (!$memberInfo)
1283 1283
 		{
1284 1284
 			return $this->stop('msg_invalid_request');
1285 1285
 		}
1286 1286
 
1287 1287
 		$newEmail = Context::get('email_address');
1288 1288
 
1289
-		if(!$newEmail)
1289
+		if (!$newEmail)
1290 1290
 		{
1291 1291
 			return $this->stop('msg_invalid_request');
1292 1292
 		}
1293 1293
 
1294 1294
 		$oMemberModel = getModel('member');
1295 1295
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
1296
-		if($member_srl)
1296
+		if ($member_srl)
1297 1297
 		{
1298
-			return new Object(-1,'msg_exists_email_address');
1298
+			return new Object(-1, 'msg_exists_email_address');
1299 1299
 		}
1300 1300
 
1301 1301
 		// remove all key by member_srl
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
 		$args->member_srl = $memberInfo->member_srl;
1304 1304
 		$output = executeQuery('member.deleteAuthMail', $args);
1305 1305
 
1306
-		if(!$output->toBool())
1306
+		if (!$output->toBool())
1307 1307
 		{
1308 1308
 			return $output;
1309 1309
 		}
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 		list($args->email_id, $args->email_host) = explode('@', $newEmail);
1314 1314
 
1315 1315
 		$output = executeQuery('member.updateMemberEmailAddress', $args);
1316
-		if(!$output->toBool())
1316
+		if (!$output->toBool())
1317 1317
 		{
1318 1318
 			return $this->stop($output->getMessage());
1319 1319
 		}
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 		$auth_args->is_register = 'Y';
1331 1331
 
1332 1332
 		$output = executeQuery('member.insertAuthMail', $auth_args);
1333
-		if(!$output->toBool()) return $output;
1333
+		if (!$output->toBool()) return $output;
1334 1334
 
1335 1335
 		$memberInfo->email_address = $newEmail;
1336 1336
 
@@ -1354,12 +1354,12 @@  discard block
 block discarded – undo
1354 1354
 		$memberInfo = array();
1355 1355
 
1356 1356
 		global $lang;
1357
-		if(is_array($member_config->signupForm))
1357
+		if (is_array($member_config->signupForm))
1358 1358
 		{
1359
-			$exceptForm=array('password', 'find_account_question');
1360
-			foreach($member_config->signupForm as $form)
1359
+			$exceptForm = array('password', 'find_account_question');
1360
+			foreach ($member_config->signupForm as $form)
1361 1361
 			{
1362
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1362
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1363 1363
 				{
1364 1364
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1365 1365
 				}
@@ -1374,25 +1374,25 @@  discard block
 block discarded – undo
1374 1374
 		}
1375 1375
 		Context::set('memberInfo', $memberInfo);
1376 1376
 
1377
-		if(!$member_config->skin) $member_config->skin = "default";
1378
-		if(!$member_config->colorset) $member_config->colorset = "white";
1377
+		if (!$member_config->skin) $member_config->skin = "default";
1378
+		if (!$member_config->colorset) $member_config->colorset = "white";
1379 1379
 
1380 1380
 		Context::set('member_config', $member_config);
1381 1381
 
1382 1382
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1383
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1383
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1384 1384
 
1385
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
1385
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
1386 1386
 		Context::set('auth_url', $auth_url);
1387 1387
 
1388 1388
 		$oTemplate = &TemplateHandler::getInstance();
1389 1389
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
1390 1390
 		// Send a mail
1391 1391
 		$oMail = new Mail();
1392
-		$oMail->setTitle( Context::getLang('msg_confirm_account_title') );
1392
+		$oMail->setTitle(Context::getLang('msg_confirm_account_title'));
1393 1393
 		$oMail->setContent($content);
1394
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1395
-		$oMail->setReceiptor( $member_info->user_name, $member_info->email_address );
1394
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1395
+		$oMail->setReceiptor($member_info->user_name, $member_info->email_address);
1396 1396
 		$oMail->send();
1397 1397
 	}
1398 1398
 
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 	{
1406 1406
 		$site_module_info = Context::get('site_module_info');
1407 1407
 		$logged_info = Context::get('logged_info');
1408
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1408
+		if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request');
1409 1409
 
1410 1410
 		$oMemberModel = getModel('member');
1411 1411
 		$columnList = array('site_srl', 'group_srl', 'title');
@@ -1424,13 +1424,13 @@  discard block
 block discarded – undo
1424 1424
 	{
1425 1425
 		$site_module_info = Context::get('site_module_info');
1426 1426
 		$logged_info = Context::get('logged_info');
1427
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1427
+		if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request');
1428 1428
 
1429 1429
 		$args = new stdClass;
1430
-		$args->site_srl= $site_module_info->site_srl;
1430
+		$args->site_srl = $site_module_info->site_srl;
1431 1431
 		$args->member_srl = $logged_info->member_srl;
1432 1432
 		$output = executeQuery('member.deleteMembersGroup', $args);
1433
-		if(!$output->toBool()) return $output;
1433
+		if (!$output->toBool()) return $output;
1434 1434
 		$this->setMessage('success_deleted');
1435 1435
 		$this->_clearMemberCache($args->member_srl, $site_module_info->site_srl);
1436 1436
 	}
@@ -1444,25 +1444,25 @@  discard block
 block discarded – undo
1444 1444
 	 */
1445 1445
 	function setMemberConfig($args)
1446 1446
 	{
1447
-		if(!$args->skin) $args->skin = "default";
1448
-		if(!$args->colorset) $args->colorset = "white";
1449
-		if(!$args->editor_skin) $args->editor_skin= "ckeditor";
1450
-		if(!$args->editor_colorset) $args->editor_colorset = "moono";
1451
-		if($args->enable_join!='Y') $args->enable_join = 'N';
1452
-		$args->enable_openid= 'N';
1453
-		if($args->profile_image !='Y') $args->profile_image = 'N';
1454
-		if($args->image_name!='Y') $args->image_name = 'N';
1455
-		if($args->image_mark!='Y') $args->image_mark = 'N';
1456
-		if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
1457
-		if(!trim(strip_tags($args->agreement))) $args->agreement = null;
1458
-		$args->limit_day = (int)$args->limit_day;
1447
+		if (!$args->skin) $args->skin = "default";
1448
+		if (!$args->colorset) $args->colorset = "white";
1449
+		if (!$args->editor_skin) $args->editor_skin = "ckeditor";
1450
+		if (!$args->editor_colorset) $args->editor_colorset = "moono";
1451
+		if ($args->enable_join != 'Y') $args->enable_join = 'N';
1452
+		$args->enable_openid = 'N';
1453
+		if ($args->profile_image != 'Y') $args->profile_image = 'N';
1454
+		if ($args->image_name != 'Y') $args->image_name = 'N';
1455
+		if ($args->image_mark != 'Y') $args->image_mark = 'N';
1456
+		if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N';
1457
+		if (!trim(strip_tags($args->agreement))) $args->agreement = null;
1458
+		$args->limit_day = (int) $args->limit_day;
1459 1459
 
1460 1460
 		$agreement = trim($args->agreement);
1461 1461
 		unset($args->agreement);
1462 1462
 
1463 1463
 		$oModuleController = getController('module');
1464
-		$output = $oModuleController->insertModuleConfig('member',$args);
1465
-		if(!$output->toBool()) return $output;
1464
+		$output = $oModuleController->insertModuleConfig('member', $args);
1465
+		if (!$output->toBool()) return $output;
1466 1466
 
1467 1467
 		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
1468 1468
 		FileHandler::writeFile($agreement_file, $agreement);
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
 		$signature = trim(removeHackTag($signature));
1484 1484
 		$signature = preg_replace('/<(\/?)(embed|object|param)/is', '&lt;$1$2', $signature);
1485 1485
 
1486
-		$check_signature = trim(str_replace(array('&nbsp;',"\n","\r"), '', strip_tags($signature, '<img><object>')));
1486
+		$check_signature = trim(str_replace(array('&nbsp;', "\n", "\r"), '', strip_tags($signature, '<img><object>')));
1487 1487
 		$path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl));
1488 1488
 		$filename = sprintf('%s%d.signature.php', $path, $member_srl);
1489 1489
 
1490
-		if(!$check_signature) return FileHandler::removeFile($filename);
1490
+		if (!$check_signature) return FileHandler::removeFile($filename);
1491 1491
 
1492 1492
 		$buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
1493 1493
 		FileHandler::makeDir($path);
@@ -1516,15 +1516,15 @@  discard block
 block discarded – undo
1516 1516
 	 *
1517 1517
 	 * @return Object
1518 1518
 	 */
1519
-	function addMemberToGroup($member_srl, $group_srl, $site_srl=0)
1519
+	function addMemberToGroup($member_srl, $group_srl, $site_srl = 0)
1520 1520
 	{
1521 1521
 		$args = new stdClass();
1522 1522
 		$args->member_srl = $member_srl;
1523 1523
 		$args->group_srl = $group_srl;
1524
-		if($site_srl) $args->site_srl = $site_srl;
1524
+		if ($site_srl) $args->site_srl = $site_srl;
1525 1525
 
1526 1526
 		// Add
1527
-		$output = executeQuery('member.addMemberToGroup',$args);
1527
+		$output = executeQuery('member.addMemberToGroup', $args);
1528 1528
 		$output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args);
1529 1529
 
1530 1530
 		$this->_clearMemberCache($member_srl, $site_srl);
@@ -1544,18 +1544,18 @@  discard block
 block discarded – undo
1544 1544
 	{
1545 1545
 		$obj = new stdClass;
1546 1546
 		$obj->site_srl = $args->site_srl;
1547
-		$obj->member_srl = implode(',',$args->member_srl);
1547
+		$obj->member_srl = implode(',', $args->member_srl);
1548 1548
 
1549 1549
 		$output = executeQueryArray('member.getMembersGroup', $obj);
1550
-		if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1550
+		if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1551 1551
 
1552 1552
 		$output = executeQuery('member.deleteMembersGroup', $obj);
1553
-		if(!$output->toBool()) return $output;
1553
+		if (!$output->toBool()) return $output;
1554 1554
 
1555 1555
 		$inserted_members = array();
1556
-		foreach($args->member_srl as $key => $val)
1556
+		foreach ($args->member_srl as $key => $val)
1557 1557
 		{
1558
-			if($inserted_members[$val]) continue;
1558
+			if ($inserted_members[$val]) continue;
1559 1559
 			$inserted_members[$val] = true;
1560 1560
 
1561 1561
 			unset($obj);
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
 			$obj->site_srl = $args->site_srl;
1566 1566
 			$obj->regdate = $date[$obj->member_srl];
1567 1567
 			$output = executeQuery('member.addMemberToGroup', $obj);
1568
-			if(!$output->toBool()) return $output;
1568
+			if (!$output->toBool()) return $output;
1569 1569
 
1570 1570
 			$this->_clearMemberCache($obj->member_srl, $args->site_srl);
1571 1571
 		}
@@ -1587,9 +1587,9 @@  discard block
 block discarded – undo
1587 1587
 		// Get information of the key
1588 1588
 		$output = executeQuery('member.getAutologin', $args);
1589 1589
 		// If no information exists, delete a cookie
1590
-		if(!$output->toBool() || !$output->data)
1590
+		if (!$output->toBool() || !$output->data)
1591 1591
 		{
1592
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365);
1592
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365);
1593 1593
 			return;
1594 1594
 		}
1595 1595
 
@@ -1599,9 +1599,9 @@  discard block
 block discarded – undo
1599 1599
 		$user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address;
1600 1600
 		$password = $output->data->password;
1601 1601
 
1602
-		if(!$user_id || !$password)
1602
+		if (!$user_id || !$password)
1603 1603
 		{
1604
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365);
1604
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365);
1605 1605
 			return;
1606 1606
 		}
1607 1607
 
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 		$check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT'];
1612 1612
 		$check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32);
1613 1613
 
1614
-		if($check_key === substr($args->autologin_key, 32))
1614
+		if ($check_key === substr($args->autologin_key, 32))
1615 1615
 		{
1616 1616
 			// Check change_password_date
1617 1617
 			$oModuleModel = getModel('module');
@@ -1619,12 +1619,12 @@  discard block
 block discarded – undo
1619 1619
 			$limit_date = $member_config->change_password_date;
1620 1620
 
1621 1621
 			// Check if change_password_date is set
1622
-			if($limit_date > 0)
1622
+			if ($limit_date > 0)
1623 1623
 			{
1624 1624
 				$oMemberModel = getModel('member');
1625 1625
 				$columnList = array('member_srl', 'change_password_date');
1626 1626
 
1627
-				if($config->identifier == 'user_id')
1627
+				if ($config->identifier == 'user_id')
1628 1628
 				{
1629 1629
 					$member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList);
1630 1630
 				}
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
 					$member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList);
1634 1634
 				}
1635 1635
 
1636
-				if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){
1636
+				if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) {
1637 1637
 					$do_auto_login = true;
1638 1638
 				}
1639 1639
 
@@ -1644,14 +1644,14 @@  discard block
 block discarded – undo
1644 1644
 			}
1645 1645
 		}
1646 1646
 
1647
-		if($do_auto_login)
1647
+		if ($do_auto_login)
1648 1648
 		{
1649 1649
 			$output = $this->doLogin($user_id);
1650 1650
 		}
1651 1651
 		else
1652 1652
 		{
1653 1653
 			executeQuery('member.deleteAutologin', $args);
1654
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365);
1654
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365);
1655 1655
 		}
1656 1656
 	}
1657 1657
 
@@ -1667,13 +1667,13 @@  discard block
 block discarded – undo
1667 1667
 	function doLogin($user_id, $password = '', $keep_signed = false)
1668 1668
 	{
1669 1669
 		$user_id = strtolower($user_id);
1670
-		if(!$user_id) return new Object(-1, 'null_user_id');
1670
+		if (!$user_id) return new Object(-1, 'null_user_id');
1671 1671
 		// Call a trigger before log-in (before)
1672 1672
 		$trigger_obj = new stdClass();
1673 1673
 		$trigger_obj->user_id = $user_id;
1674 1674
 		$trigger_obj->password = $password;
1675 1675
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj);
1676
-		if(!$trigger_output->toBool()) return $trigger_output;
1676
+		if (!$trigger_output->toBool()) return $trigger_output;
1677 1677
 		// Create a member model object
1678 1678
 		$oMemberModel = getModel('member');
1679 1679
 
@@ -1683,12 +1683,12 @@  discard block
 block discarded – undo
1683 1683
 		$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1684 1684
 
1685 1685
 		// check identifier
1686
-		if($config->identifier == 'email_address')
1686
+		if ($config->identifier == 'email_address')
1687 1687
 		{
1688 1688
 			// Get user_id information
1689 1689
 			$this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id);
1690 1690
 			// Set an invalid user if no value returned
1691
-			if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
1691
+			if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
1692 1692
 
1693 1693
 		}
1694 1694
 		else
@@ -1696,24 +1696,24 @@  discard block
 block discarded – undo
1696 1696
 			// Get user_id information
1697 1697
 			$this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id);
1698 1698
 			// Set an invalid user if no value returned
1699
-			if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
1699
+			if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
1700 1700
 		}
1701 1701
 
1702 1702
 		$output = executeQuery('member.getLoginCountByIp', $args);
1703 1703
 		$errorCount = $output->data->count;
1704
-		if($errorCount >= $config->max_error_count)
1704
+		if ($errorCount >= $config->max_error_count)
1705 1705
 		{
1706 1706
 			$last_update = strtotime($output->data->last_update);
1707
-			$term = intval($_SERVER['REQUEST_TIME']-$last_update);
1708
-			if($term < $config->max_error_count_time)
1707
+			$term = intval($_SERVER['REQUEST_TIME'] - $last_update);
1708
+			if ($term < $config->max_error_count_time)
1709 1709
 			{
1710 1710
 				$term = $config->max_error_count_time - $term;
1711
-				if($term < 60) $term = intval($term).Context::getLang('unit_sec');
1712
-				elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min');
1713
-				elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour');
1714
-				else $term = intval($term/86400).Context::getLang('unit_day');
1711
+				if ($term < 60) $term = intval($term).Context::getLang('unit_sec');
1712
+				elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min');
1713
+				elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour');
1714
+				else $term = intval($term / 86400).Context::getLang('unit_day');
1715 1715
 
1716
-				return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term));
1716
+				return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term));
1717 1717
 			}
1718 1718
 			else
1719 1719
 			{
@@ -1723,13 +1723,13 @@  discard block
 block discarded – undo
1723 1723
 		}
1724 1724
 
1725 1725
 		// Password Check
1726
-		if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl))
1726
+		if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl))
1727 1727
 		{
1728
-			return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo);
1728
+			return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo);
1729 1729
 		}
1730 1730
 
1731 1731
 		// If denied == 'Y', notify
1732
-		if($this->memberInfo->denied == 'Y')
1732
+		if ($this->memberInfo->denied == 'Y')
1733 1733
 		{
1734 1734
 			$args->member_srl = $this->memberInfo->member_srl;
1735 1735
 			$output = executeQuery('member.chkAuthMail', $args);
@@ -1737,12 +1737,12 @@  discard block
 block discarded – undo
1737 1737
 			{
1738 1738
 				$_SESSION['auth_member_srl'] = $this->memberInfo->member_srl;
1739 1739
 				$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
1740
-				return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
1740
+				return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed'));
1741 1741
 			}
1742
-			return new Object(-1,'msg_user_denied');
1742
+			return new Object(-1, 'msg_user_denied');
1743 1743
 		}
1744 1744
 		// Notify if denied_date is less than the current time
1745
-		if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));
1745
+		if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new Object(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d")));
1746 1746
 		// Update the latest login time
1747 1747
 		$args->member_srl = $this->memberInfo->member_srl;
1748 1748
 		$output = executeQuery('member.updateLastLogin', $args);
@@ -1752,36 +1752,36 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
 		// Check if there is recoding table.
1754 1754
 		$oDB = &DB::getInstance();
1755
-		if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N')
1755
+		if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N')
1756 1756
 		{
1757 1757
 			// check if there is login fail records.
1758 1758
 			$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
1759
-			if($output->data && $output->data->content)
1759
+			if ($output->data && $output->data->content)
1760 1760
 			{
1761 1761
 				$title = Context::getLang('login_fail_report');
1762 1762
 				$message = '<ul>';
1763 1763
 				$content = unserialize($output->data->content);
1764
-				if(count($content) > $config->max_error_count)
1764
+				if (count($content) > $config->max_error_count)
1765 1765
 				{
1766
-					foreach($content as $val)
1766
+					foreach ($content as $val)
1767 1767
 					{
1768
-						$message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>';
1768
+						$message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>';
1769 1769
 					}
1770 1770
 					$message .= '</ul>';
1771
-					$content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa'));
1771
+					$content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa'));
1772 1772
 
1773 1773
 					//send message
1774 1774
 					$oCommunicationController = getController('communication');
1775 1775
 					$oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true);
1776 1776
 
1777
-					if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y')
1777
+					if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y')
1778 1778
 					{
1779 1779
 						$view_url = Context::getRequestUri();
1780
-						$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id);
1780
+						$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id);
1781 1781
 						$oMail = new Mail();
1782 1782
 						$oMail->setTitle($title);
1783 1783
 						$oMail->setContent($content);
1784
-						$oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email);
1784
+						$oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email);
1785 1785
 						$oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address);
1786 1786
 						$oMail->send();
1787 1787
 					}
@@ -1791,9 +1791,9 @@  discard block
 block discarded – undo
1791 1791
 		}
1792 1792
 		// Call a trigger after successfully log-in (after)
1793 1793
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo);
1794
-		if(!$trigger_output->toBool()) return $trigger_output;
1794
+		if (!$trigger_output->toBool()) return $trigger_output;
1795 1795
 		// When user checked to use auto-login
1796
-		if($keep_signed)
1796
+		if ($keep_signed)
1797 1797
 		{
1798 1798
 			// Key generate for auto login
1799 1799
 			$oPassword = new Password();
@@ -1805,12 +1805,12 @@  discard block
 block discarded – undo
1805 1805
 			$autologin_args->member_srl = $this->memberInfo->member_srl;
1806 1806
 			executeQuery('member.deleteAutologin', $autologin_args);
1807 1807
 			$autologin_output = executeQuery('member.insertAutologin', $autologin_args);
1808
-			if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000);
1808
+			if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000);
1809 1809
 		}
1810
-		if($this->memberInfo->is_admin == 'Y')
1810
+		if ($this->memberInfo->is_admin == 'Y')
1811 1811
 		{
1812 1812
 			$oMemberAdminModel = getAdminModel('member');
1813
-			if(!$oMemberAdminModel->getMemberAdminIPCheck())
1813
+			if (!$oMemberAdminModel->getMemberAdminIPCheck())
1814 1814
 			{
1815 1815
 				$_SESSION['denied_admin'] = 'Y';
1816 1816
 			}
@@ -1828,18 +1828,18 @@  discard block
 block discarded – undo
1828 1828
 	{
1829 1829
 		$oMemberModel = getModel('member');
1830 1830
 		// If your information came through the current session information to extract information from the users
1831
-		if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() )
1831
+		if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged())
1832 1832
 		{
1833 1833
 			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']);
1834 1834
 			// If you do not destroy the session Profile
1835
-			if($this->memberInfo->member_srl != $_SESSION['member_srl'])
1835
+			if ($this->memberInfo->member_srl != $_SESSION['member_srl'])
1836 1836
 			{
1837 1837
 				$this->destroySessionInfo();
1838 1838
 				return;
1839 1839
 			}
1840 1840
 		}
1841 1841
 		// Stop using the session id is destroyed
1842
-		if($this->memberInfo->denied=='Y')
1842
+		if ($this->memberInfo->denied == 'Y')
1843 1843
 		{
1844 1844
 			$this->destroySessionInfo();
1845 1845
 			return;
@@ -1869,10 +1869,10 @@  discard block
 block discarded – undo
1869 1869
 		Context::set('logged_info', $this->memberInfo);
1870 1870
 
1871 1871
 		// Only the menu configuration of the user (such as an add-on to the menu can be changed)
1872
-		$this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info');
1873
-		$this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document');
1874
-		$this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document');
1875
-		$this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document');
1872
+		$this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info');
1873
+		$this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document');
1874
+		$this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document');
1875
+		$this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document');
1876 1876
 	}
1877 1877
 
1878 1878
 	/**
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 	function addMemberPopupMenu($url, $str, $icon = '', $target = 'self')
1895 1895
 	{
1896 1896
 		$member_popup_menu_list = Context::get('member_popup_menu_list');
1897
-		if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array();
1897
+		if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array();
1898 1898
 
1899 1899
 		$obj = new stdClass;
1900 1900
 		$obj->url = $url;
@@ -1913,33 +1913,33 @@  discard block
 block discarded – undo
1913 1913
 	{
1914 1914
 		// Call a trigger (before)
1915 1915
 		$output = ModuleHandler::triggerCall('member.insertMember', 'before', $args);
1916
-		if(!$output->toBool()) return $output;
1916
+		if (!$output->toBool()) return $output;
1917 1917
 		// Terms and Conditions portion of the information set up by members reaffirmed
1918 1918
 		$oModuleModel = getModel('module');
1919 1919
 		$config = $oModuleModel->getModuleConfig('member');
1920 1920
 
1921 1921
 		$logged_info = Context::get('logged_info');
1922 1922
 		// If the date of the temporary restrictions limit further information on the date of
1923
-		if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24);
1923
+		if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24);
1924 1924
 
1925 1925
 		$args->member_srl = getNextSequence();
1926 1926
 		$args->list_order = -1 * $args->member_srl;
1927 1927
 
1928 1928
 		// Execute insert or update depending on the value of member_srl
1929
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
1929
+		if (!$args->user_id) $args->user_id = 't'.$args->member_srl;
1930 1930
 		// Enter the user's identity changed to lowercase
1931 1931
 		else $args->user_id = strtolower($args->user_id);
1932
-		if(!$args->user_name) $args->user_name = $args->member_srl;
1933
-		if(!$args->nick_name) $args->nick_name = $args->member_srl;
1932
+		if (!$args->user_name) $args->user_name = $args->member_srl;
1933
+		if (!$args->nick_name) $args->nick_name = $args->member_srl;
1934 1934
 
1935 1935
 		// Control of essential parameters
1936
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
1937
-		if($args->denied!='Y') $args->denied = 'N';
1938
-		if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y';
1936
+		if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N';
1937
+		if ($args->denied != 'Y') $args->denied = 'N';
1938
+		if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y';
1939 1939
 
1940
-		if($logged_info->is_admin == 'Y')
1940
+		if ($logged_info->is_admin == 'Y')
1941 1941
 		{
1942
-			if($args->is_admin!='Y') $args->is_admin = 'N';
1942
+			if ($args->is_admin != 'Y') $args->is_admin = 'N';
1943 1943
 		}
1944 1944
 		else
1945 1945
 		{
@@ -1954,88 +1954,88 @@  discard block
 block discarded – undo
1954 1954
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1955 1955
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1956 1956
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1957
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
1958
-		if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog;
1957
+		if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage;
1958
+		if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog;
1959 1959
 
1960 1960
 		// Create a model object
1961 1961
 		$oMemberModel = getModel('member');
1962 1962
 
1963 1963
 		// Check password strength
1964
-		if($args->password && !$password_is_hashed)
1964
+		if ($args->password && !$password_is_hashed)
1965 1965
 		{
1966
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
1966
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
1967 1967
 			{
1968 1968
 				$message = Context::getLang('about_password_strength');
1969 1969
 				return new Object(-1, $message[$config->password_strength]);
1970 1970
 			}
1971 1971
 			$args->password = $oMemberModel->hashPassword($args->password);
1972 1972
 		}
1973
-		elseif(!$args->password)
1973
+		elseif (!$args->password)
1974 1974
 		{
1975 1975
 			unset($args->password);
1976 1976
 		}
1977 1977
 
1978 1978
 		// Check if ID is prohibited
1979
-		if($oMemberModel->isDeniedID($args->user_id))
1979
+		if ($oMemberModel->isDeniedID($args->user_id))
1980 1980
 		{
1981
-			return new Object(-1,'denied_user_id');
1981
+			return new Object(-1, 'denied_user_id');
1982 1982
 		}
1983 1983
 
1984 1984
 		// Check if ID is duplicate
1985 1985
 		$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
1986
-		if($member_srl)
1986
+		if ($member_srl)
1987 1987
 		{
1988
-			return new Object(-1,'msg_exists_user_id');
1988
+			return new Object(-1, 'msg_exists_user_id');
1989 1989
 		}
1990 1990
 
1991 1991
 		// Check if nickname is prohibited
1992
-		if($oMemberModel->isDeniedNickName($args->nick_name))
1992
+		if ($oMemberModel->isDeniedNickName($args->nick_name))
1993 1993
 		{
1994
-			return new Object(-1,'denied_nick_name');
1994
+			return new Object(-1, 'denied_nick_name');
1995 1995
 		}
1996 1996
 
1997 1997
 		// Check if nickname is duplicate
1998 1998
 		$member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
1999
-		if($member_srl)
1999
+		if ($member_srl)
2000 2000
 		{
2001
-			return new Object(-1,'msg_exists_nick_name');
2001
+			return new Object(-1, 'msg_exists_nick_name');
2002 2002
 		}
2003 2003
 
2004 2004
 		// Check if email address is duplicate
2005 2005
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
2006
-		if($member_srl)
2006
+		if ($member_srl)
2007 2007
 		{
2008
-			return new Object(-1,'msg_exists_email_address');
2008
+			return new Object(-1, 'msg_exists_email_address');
2009 2009
 		}
2010 2010
 
2011 2011
 		// Insert data into the DB
2012 2012
 		$args->list_order = -1 * $args->member_srl;
2013 2013
 
2014
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
2015
-		if(!$args->user_name) $args->user_name = $args->member_srl;
2014
+		if (!$args->user_id) $args->user_id = 't'.$args->member_srl;
2015
+		if (!$args->user_name) $args->user_name = $args->member_srl;
2016 2016
 
2017 2017
 		$oDB = &DB::getInstance();
2018 2018
 		$oDB->begin();
2019 2019
 
2020 2020
 		$output = executeQuery('member.insertMember', $args);
2021
-		if(!$output->toBool())
2021
+		if (!$output->toBool())
2022 2022
 		{
2023 2023
 			$oDB->rollback();
2024 2024
 			return $output;
2025 2025
 		}
2026 2026
 
2027
-		if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2027
+		if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2028 2028
 		else $group_srl_list = explode('|@|', $args->group_srl_list);
2029 2029
 		// If no value is entered the default group, the value of group registration
2030
-		if(!$args->group_srl_list)
2030
+		if (!$args->group_srl_list)
2031 2031
 		{
2032 2032
 			$columnList = array('site_srl', 'group_srl');
2033 2033
 			$default_group = $oMemberModel->getDefaultGroup(0, $columnList);
2034
-			if($default_group)
2034
+			if ($default_group)
2035 2035
 			{
2036 2036
 				// Add to the default group
2037
-				$output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl);
2038
-				if(!$output->toBool())
2037
+				$output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl);
2038
+				if (!$output->toBool())
2039 2039
 				{
2040 2040
 					$oDB->rollback();
2041 2041
 					return $output;
@@ -2045,11 +2045,11 @@  discard block
 block discarded – undo
2045 2045
 		}
2046 2046
 		else
2047 2047
 		{
2048
-			for($i=0;$i<count($group_srl_list);$i++)
2048
+			for ($i = 0; $i < count($group_srl_list); $i++)
2049 2049
 			{
2050
-				$output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]);
2050
+				$output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
2051 2051
 
2052
-				if(!$output->toBool())
2052
+				if (!$output->toBool())
2053 2053
 				{
2054 2054
 					$oDB->rollback();
2055 2055
 					return $output;
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 
2060 2060
 		$member_config = $oModuleModel->getModuleConfig('member');
2061 2061
 		// When using email authentication mode (when you subscribed members denied a) certified mail sent
2062
-		if($args->denied == 'Y')
2062
+		if ($args->denied == 'Y')
2063 2063
 		{
2064 2064
 			// Insert data into the authentication DB
2065 2065
 			$oPassword = new Password();
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 			$auth_args->is_register = 'Y';
2072 2072
 
2073 2073
 			$output = executeQuery('member.insertAuthMail', $auth_args);
2074
-			if(!$output->toBool())
2074
+			if (!$output->toBool())
2075 2075
 			{
2076 2076
 				$oDB->rollback();
2077 2077
 				return $output;
@@ -2079,10 +2079,10 @@  discard block
 block discarded – undo
2079 2079
 			$this->_sendAuthMail($auth_args, $args);
2080 2080
 		}
2081 2081
 		// Call a trigger (after)
2082
-		if($output->toBool())
2082
+		if ($output->toBool())
2083 2083
 		{
2084 2084
 			$trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args);
2085
-			if(!$trigger_output->toBool())
2085
+			if (!$trigger_output->toBool())
2086 2086
 			{
2087 2087
 				$oDB->rollback();
2088 2088
 				return $trigger_output;
@@ -2104,41 +2104,41 @@  discard block
 block discarded – undo
2104 2104
 	{
2105 2105
 		// Call a trigger (before)
2106 2106
 		$output = ModuleHandler::triggerCall('member.updateMember', 'before', $args);
2107
-		if(!$output->toBool()) return $output;
2107
+		if (!$output->toBool()) return $output;
2108 2108
 		// Create a model object
2109 2109
 		$oMemberModel = getModel('member');
2110 2110
 
2111 2111
 		$logged_info = Context::get('logged_info');
2112 2112
 		// Get what you want to modify the original information
2113
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2113
+		if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2114 2114
 		// Control of essential parameters
2115
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
2116
-		if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
2115
+		if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N';
2116
+		if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y';
2117 2117
 
2118
-		if($logged_info->is_admin == 'Y')
2118
+		if ($logged_info->is_admin == 'Y')
2119 2119
 		{
2120
-			if($args->denied!='Y') $args->denied = 'N';
2121
-			if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N';
2120
+			if ($args->denied != 'Y') $args->denied = 'N';
2121
+			if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N';
2122 2122
 		}
2123 2123
 		else
2124 2124
 		{
2125 2125
 			unset($args->is_admin);
2126
-			if($is_admin == false)
2126
+			if ($is_admin == false)
2127 2127
 				unset($args->denied);
2128
-			if($logged_info->member_srl != $args->member_srl && $is_admin == false)
2128
+			if ($logged_info->member_srl != $args->member_srl && $is_admin == false)
2129 2129
 			{
2130 2130
 				return $this->stop('msg_invalid_request');
2131 2131
 			}
2132 2132
 		}
2133 2133
 
2134 2134
 		// Sanitize user ID, username, nickname, homepage, blog
2135
-		if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2135
+		if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2136 2136
 		$args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2137 2137
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2138 2138
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2139 2139
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2140
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
2141
-		if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog;
2140
+		if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage;
2141
+		if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog;
2142 2142
 
2143 2143
 		// check member identifier form
2144 2144
 		$config = $oMemberModel->getMemberConfig();
@@ -2147,56 +2147,56 @@  discard block
 block discarded – undo
2147 2147
 		$orgMemberInfo = $output->data;
2148 2148
 
2149 2149
 		// Check if email address or user ID is duplicate
2150
-		if($config->identifier == 'email_address')
2150
+		if ($config->identifier == 'email_address')
2151 2151
 		{
2152 2152
 			$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
2153
-			if($member_srl && $args->member_srl != $member_srl)
2153
+			if ($member_srl && $args->member_srl != $member_srl)
2154 2154
 			{
2155
-				return new Object(-1,'msg_exists_email_address');
2155
+				return new Object(-1, 'msg_exists_email_address');
2156 2156
 			}
2157 2157
 			$args->email_address = $orgMemberInfo->email_address;
2158 2158
 		}
2159 2159
 		else
2160 2160
 		{
2161 2161
 			$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
2162
-			if($member_srl && $args->member_srl != $member_srl)
2162
+			if ($member_srl && $args->member_srl != $member_srl)
2163 2163
 			{
2164
-				return new Object(-1,'msg_exists_user_id');
2164
+				return new Object(-1, 'msg_exists_user_id');
2165 2165
 			}
2166 2166
 
2167 2167
 			$args->user_id = $orgMemberInfo->user_id;
2168 2168
 		}
2169 2169
 
2170
-		if($logged_info->is_admin !== 'Y')
2170
+		if ($logged_info->is_admin !== 'Y')
2171 2171
 		{
2172 2172
 			// Check if ID is prohibited
2173
-			if($args->user_id && $oMemberModel->isDeniedID($args->user_id))
2173
+			if ($args->user_id && $oMemberModel->isDeniedID($args->user_id))
2174 2174
 			{
2175
-				return new Object(-1,'denied_user_id');
2175
+				return new Object(-1, 'denied_user_id');
2176 2176
 			}
2177 2177
 
2178 2178
 			// Check if nickname is prohibited
2179
-			if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name))
2179
+			if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name))
2180 2180
 			{
2181 2181
 				return new Object(-1, 'denied_nick_name');
2182 2182
 			}
2183 2183
 		}
2184 2184
 
2185 2185
 		// Check if ID is duplicate
2186
-		if($args->user_id)
2186
+		if ($args->user_id)
2187 2187
 		{
2188 2188
 			$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
2189
-			if($member_srl && $args->member_srl != $member_srl)
2189
+			if ($member_srl && $args->member_srl != $member_srl)
2190 2190
 			{
2191
-				return new Object(-1,'msg_exists_user_id');
2191
+				return new Object(-1, 'msg_exists_user_id');
2192 2192
 			}
2193 2193
 		}
2194 2194
 
2195 2195
 		// Check if nickname is duplicate
2196 2196
 		$member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
2197
- 		if($member_srl && $args->member_srl != $member_srl)
2197
+ 		if ($member_srl && $args->member_srl != $member_srl)
2198 2198
  		{
2199
- 			return new Object(-1,'msg_exists_nick_name');
2199
+ 			return new Object(-1, 'msg_exists_nick_name');
2200 2200
  		}
2201 2201
 
2202 2202
 		list($args->email_id, $args->email_host) = explode('@', $args->email_address);
@@ -2205,9 +2205,9 @@  discard block
 block discarded – undo
2205 2205
 		$oDB->begin();
2206 2206
 
2207 2207
 		// Check password strength
2208
-		if($args->password)
2208
+		if ($args->password)
2209 2209
 		{
2210
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2210
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2211 2211
 			{
2212 2212
 				$message = Context::getLang('about_password_strength');
2213 2213
 				return new Object(-1, $message[$config->password_strength]);
@@ -2219,40 +2219,40 @@  discard block
 block discarded – undo
2219 2219
 			$args->password = $orgMemberInfo->password;
2220 2220
 		}
2221 2221
 
2222
-		if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name;
2223
-		if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id;
2224
-		if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name;
2225
-		if(!$args->description) $args->description = $orgMemberInfo->description;
2226
-		if(!$args->birthday) $args->birthday = '';
2222
+		if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name;
2223
+		if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id;
2224
+		if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name;
2225
+		if (!$args->description) $args->description = $orgMemberInfo->description;
2226
+		if (!$args->birthday) $args->birthday = '';
2227 2227
 
2228 2228
 		$output = executeQuery('member.updateMember', $args);
2229 2229
 
2230
-		if(!$output->toBool())
2230
+		if (!$output->toBool())
2231 2231
 		{
2232 2232
 			$oDB->rollback();
2233 2233
 			return $output;
2234 2234
 		}
2235 2235
 
2236
-		if($args->group_srl_list)
2236
+		if ($args->group_srl_list)
2237 2237
 		{
2238
-			if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2238
+			if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2239 2239
 			else $group_srl_list = explode('|@|', $args->group_srl_list);
2240 2240
 			// If the group information, group information changes
2241
-			if(count($group_srl_list) > 0)
2241
+			if (count($group_srl_list) > 0)
2242 2242
 			{
2243 2243
 				$args->site_srl = 0;
2244 2244
 				// One of its members to delete all the group
2245 2245
 				$output = executeQuery('member.deleteMemberGroupMember', $args);
2246
-				if(!$output->toBool())
2246
+				if (!$output->toBool())
2247 2247
 				{
2248 2248
 					$oDB->rollback();
2249 2249
 					return $output;
2250 2250
 				}
2251 2251
 				// Enter one of the loop a
2252
-				for($i=0;$i<count($group_srl_list);$i++)
2252
+				for ($i = 0; $i < count($group_srl_list); $i++)
2253 2253
 				{
2254
-					$output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]);
2255
-					if(!$output->toBool())
2254
+					$output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
2255
+					if (!$output->toBool())
2256 2256
 					{
2257 2257
 						$oDB->rollback();
2258 2258
 						return $output;
@@ -2264,9 +2264,9 @@  discard block
 block discarded – undo
2264 2264
 			}
2265 2265
 		}
2266 2266
 		// Call a trigger (after)
2267
-		if($output->toBool()) {
2267
+		if ($output->toBool()) {
2268 2268
 			$trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args);
2269
-			if(!$trigger_output->toBool())
2269
+			if (!$trigger_output->toBool())
2270 2270
 			{
2271 2271
 				$oDB->rollback();
2272 2272
 				return $trigger_output;
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 		$this->_clearMemberCache($args->member_srl, $args->site_srl);
2280 2280
 
2281 2281
 		// Save Session
2282
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2282
+		if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2283 2283
 		$logged_info = Context::get('logged_info');
2284 2284
 
2285 2285
 		$output->add('member_srl', $args->member_srl);
@@ -2291,14 +2291,14 @@  discard block
 block discarded – undo
2291 2291
 	 */
2292 2292
 	function updateMemberPassword($args)
2293 2293
 	{
2294
-		if($args->password)
2294
+		if ($args->password)
2295 2295
 		{
2296 2296
 
2297 2297
 			// check password strength
2298 2298
 			$oMemberModel = getModel('member');
2299 2299
 			$config = $oMemberModel->getMemberConfig();
2300 2300
 
2301
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2301
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2302 2302
 			{
2303 2303
 				$message = Context::getLang('about_password_strength');
2304 2304
 				return new Object(-1, $message[$config->password_strength]);
@@ -2306,13 +2306,13 @@  discard block
 block discarded – undo
2306 2306
 
2307 2307
 			$args->password = $oMemberModel->hashPassword($args->password);
2308 2308
 		}
2309
-		else if($args->hashed_password)
2309
+		else if ($args->hashed_password)
2310 2310
 		{
2311 2311
 			$args->password = $args->hashed_password;
2312 2312
 		}
2313 2313
 
2314 2314
 		$output = executeQuery('member.updateMemberPassword', $args);
2315
-		if($output->toBool())
2315
+		if ($output->toBool())
2316 2316
 		{
2317 2317
 			$result = executeQuery('member.updateChangePasswordDate', $args);
2318 2318
 		}
@@ -2331,18 +2331,18 @@  discard block
 block discarded – undo
2331 2331
 		$trigger_obj = new stdClass();
2332 2332
 		$trigger_obj->member_srl = $member_srl;
2333 2333
 		$output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj);
2334
-		if(!$output->toBool()) return $output;
2334
+		if (!$output->toBool()) return $output;
2335 2335
 		// Create a model object
2336 2336
 		$oMemberModel = getModel('member');
2337 2337
 		// Bringing the user's information
2338
-		if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin))
2338
+		if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin))
2339 2339
 		{
2340 2340
 			$columnList = array('member_srl', 'is_admin');
2341 2341
 			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
2342 2342
 		}
2343
-		if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
2343
+		if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
2344 2344
 		// If managers can not be deleted
2345
-		if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
2345
+		if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
2346 2346
 
2347 2347
 		$oDB = &DB::getInstance();
2348 2348
 		$oDB->begin();
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 		$args->member_srl = $member_srl;
2352 2352
 		// Delete the entries in member_auth_mail
2353 2353
 		$output = executeQuery('member.deleteAuthMail', $args);
2354
-		if(!$output->toBool())
2354
+		if (!$output->toBool())
2355 2355
 		{
2356 2356
 			$oDB->rollback();
2357 2357
 			return $output;
@@ -2366,23 +2366,23 @@  discard block
 block discarded – undo
2366 2366
 		 */
2367 2367
 		// Delete the entries in member_group_member
2368 2368
 		$output = executeQuery('member.deleteMemberGroupMember', $args);
2369
-		if(!$output->toBool())
2369
+		if (!$output->toBool())
2370 2370
 		{
2371 2371
 			$oDB->rollback();
2372 2372
 			return $output;
2373 2373
 		}
2374 2374
 		// member removed from the table
2375 2375
 		$output = executeQuery('member.deleteMember', $args);
2376
-		if(!$output->toBool())
2376
+		if (!$output->toBool())
2377 2377
 		{
2378 2378
 			$oDB->rollback();
2379 2379
 			return $output;
2380 2380
 		}
2381 2381
 		// Call a trigger (after)
2382
-		if($output->toBool())
2382
+		if ($output->toBool())
2383 2383
 		{
2384 2384
 			$trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj);
2385
-			if(!$trigger_output->toBool())
2385
+			if (!$trigger_output->toBool())
2386 2386
 			{
2387 2387
 				$oDB->rollback();
2388 2388
 				return $trigger_output;
@@ -2406,23 +2406,23 @@  discard block
 block discarded – undo
2406 2406
 	 */
2407 2407
 	function destroySessionInfo()
2408 2408
 	{
2409
-		if(!$_SESSION || !is_array($_SESSION)) return;
2409
+		if (!$_SESSION || !is_array($_SESSION)) return;
2410 2410
 
2411 2411
 		$memberInfo = Context::get('logged_info');
2412 2412
 		$memberSrl = $memberInfo->member_srl;
2413 2413
 
2414
-		foreach($_SESSION as $key => $val)
2414
+		foreach ($_SESSION as $key => $val)
2415 2415
 		{
2416 2416
 			$_SESSION[$key] = '';
2417 2417
 		}
2418 2418
 
2419 2419
 		session_destroy();
2420
-		setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000);
2421
-		setcookie('sso','',$_SERVER['REQUEST_TIME']-42000);
2422
-		setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000);
2420
+		setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000);
2421
+		setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000);
2422
+		setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000);
2423 2423
 		setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000);
2424 2424
 
2425
-		if($memberSrl || $_COOKIE['xeak'])
2425
+		if ($memberSrl || $_COOKIE['xeak'])
2426 2426
 		{
2427 2427
 			$args = new stdClass();
2428 2428
 			$args->member_srl = $memberSrl;
@@ -2438,22 +2438,22 @@  discard block
 block discarded – undo
2438 2438
 		$pointGroup = $pointModuleConfig->point_group;
2439 2439
 
2440 2440
 		$levelGroup = array();
2441
-		if(is_array($pointGroup) && count($pointGroup)>0)
2441
+		if (is_array($pointGroup) && count($pointGroup) > 0)
2442 2442
 		{
2443 2443
 			$levelGroup = array_flip($pointGroup);
2444 2444
 			ksort($levelGroup);
2445 2445
 		}
2446 2446
 		$maxLevel = 0;
2447 2447
 		$resultGroup = array_intersect($levelGroup, $groupSrlList);
2448
-		if(count($resultGroup) > 0)
2448
+		if (count($resultGroup) > 0)
2449 2449
 			$maxLevel = max(array_flip($resultGroup));
2450 2450
 
2451
-		if($maxLevel > 0)
2451
+		if ($maxLevel > 0)
2452 2452
 		{
2453 2453
 			$oPointModel = getModel('point');
2454 2454
 			$originPoint = $oPointModel->getPoint($memberSrl);
2455 2455
 
2456
-			if($pointModuleConfig->level_step[$maxLevel] > $originPoint)
2456
+			if ($pointModuleConfig->level_step[$maxLevel] > $originPoint)
2457 2457
 			{
2458 2458
 				$oPointController = getController('point');
2459 2459
 				$oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update');
@@ -2463,18 +2463,18 @@  discard block
 block discarded – undo
2463 2463
 
2464 2464
 	function procMemberModifyEmailAddress()
2465 2465
 	{
2466
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
2466
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
2467 2467
 
2468 2468
 		$member_info = Context::get('logged_info');
2469 2469
 		$newEmail = Context::get('email_address');
2470 2470
 
2471
-		if(!$newEmail) return $this->stop('msg_invalid_request');
2471
+		if (!$newEmail) return $this->stop('msg_invalid_request');
2472 2472
 
2473 2473
 		$oMemberModel = getModel('member');
2474 2474
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
2475
-		if($member_srl) return new Object(-1,'msg_exists_email_address');
2475
+		if ($member_srl) return new Object(-1, 'msg_exists_email_address');
2476 2476
 
2477
-		if($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
2477
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
2478 2478
 		{
2479 2479
 			return $this->stop('msg_invalid_request');
2480 2480
 		}
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
 		$oDB = &DB::getInstance();
2491 2491
 		$oDB->begin();
2492 2492
 		$output = executeQuery('member.insertAuthMail', $auth_args);
2493
-		if(!$output->toBool())
2493
+		if (!$output->toBool())
2494 2494
 		{
2495 2495
 			$oDB->rollback();
2496 2496
 			return $output;
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 		$member_config = $oModuleModel->getModuleConfig('member');
2501 2501
 
2502 2502
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
2503
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2503
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2504 2504
 
2505 2505
 		global $lang;
2506 2506
 
@@ -2512,17 +2512,17 @@  discard block
 block discarded – undo
2512 2512
 
2513 2513
 		Context::set('newEmail', $newEmail);
2514 2514
 
2515
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
2515
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
2516 2516
 		Context::set('auth_url', $auth_url);
2517 2517
 
2518 2518
 		$oTemplate = &TemplateHandler::getInstance();
2519 2519
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
2520 2520
 
2521 2521
 		$oMail = new Mail();
2522
-		$oMail->setTitle( Context::getLang('title_modify_email_address') );
2522
+		$oMail->setTitle(Context::getLang('title_modify_email_address'));
2523 2523
 		$oMail->setContent($content);
2524
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
2525
-		$oMail->setReceiptor( $member_info->nick_name, $newEmail );
2524
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
2525
+		$oMail->setReceiptor($member_info->nick_name, $newEmail);
2526 2526
 		$result = $oMail->send();
2527 2527
 
2528 2528
 		$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail);
@@ -2536,16 +2536,16 @@  discard block
 block discarded – undo
2536 2536
 	{
2537 2537
 		$member_srl = Context::get('member_srl');
2538 2538
 		$auth_key = Context::get('auth_key');
2539
-		if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
2539
+		if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
2540 2540
 
2541 2541
 		// Test logs for finding password by user_id and authkey
2542 2542
 		$args = new stdClass;
2543 2543
 		$args->member_srl = $member_srl;
2544 2544
 		$args->auth_key = $auth_key;
2545 2545
 		$output = executeQuery('member.getAuthMail', $args);
2546
-		if(!$output->toBool() || $output->data->auth_key != $auth_key)
2546
+		if (!$output->toBool() || $output->data->auth_key != $auth_key)
2547 2547
 		{
2548
-			if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args);
2548
+			if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args);
2549 2549
 			return $this->stop('msg_invalid_modify_email_auth_key');
2550 2550
 		}
2551 2551
 
@@ -2554,10 +2554,10 @@  discard block
 block discarded – undo
2554 2554
 		list($args->email_id, $args->email_host) = explode('@', $newEmail);
2555 2555
 
2556 2556
 		$output = executeQuery('member.updateMemberEmailAddress', $args);
2557
-		if(!$output->toBool()) return $this->stop($output->getMessage());
2557
+		if (!$output->toBool()) return $this->stop($output->getMessage());
2558 2558
 
2559 2559
 		// Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table
2560
-		executeQuery('member.deleteAuthChangeEmailAddress',$args);
2560
+		executeQuery('member.deleteAuthChangeEmailAddress', $args);
2561 2561
 
2562 2562
 		$this->_clearMemberCache($args->member_srl);
2563 2563
 
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
 	**/
2576 2576
 	function triggerGetDocumentMenu(&$menu_list)
2577 2577
 	{
2578
-		if(!Context::get('is_logged')) return new Object();
2578
+		if (!Context::get('is_logged')) return new Object();
2579 2579
 
2580 2580
 		$logged_info = Context::get('logged_info');
2581 2581
 		$document_srl = Context::get('target_srl');
@@ -2586,12 +2586,12 @@  discard block
 block discarded – undo
2586 2586
 		$member_srl = $oDocument->get('member_srl');
2587 2587
 		$module_srl = $oDocument->get('module_srl');
2588 2588
 
2589
-		if(!$member_srl) return new Object();
2590
-		if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2589
+		if (!$member_srl) return new Object();
2590
+		if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object();
2591 2591
 
2592 2592
 		$oDocumentController = getController('document');
2593
-		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
2594
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup');
2593
+		$url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl);
2594
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup');
2595 2595
 
2596 2596
 		return new Object();
2597 2597
 	}
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 	**/
2606 2606
 	function triggerGetCommentMenu(&$menu_list)
2607 2607
 	{
2608
-		if(!Context::get('is_logged')) return new Object();
2608
+		if (!Context::get('is_logged')) return new Object();
2609 2609
 
2610 2610
 		$logged_info = Context::get('logged_info');
2611 2611
 		$comment_srl = Context::get('target_srl');
@@ -2616,12 +2616,12 @@  discard block
 block discarded – undo
2616 2616
 		$module_srl = $oComment->get('module_srl');
2617 2617
 		$member_srl = $oComment->get('member_srl');
2618 2618
 
2619
-		if(!$member_srl) return new Object();
2620
-		if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2619
+		if (!$member_srl) return new Object();
2620
+		if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object();
2621 2621
 
2622 2622
 		$oCommentController = getController('comment');
2623
-		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
2624
-		$oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup');
2623
+		$url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl);
2624
+		$oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup');
2625 2625
 
2626 2626
 		return new Object();
2627 2627
 	}
@@ -2633,7 +2633,7 @@  discard block
 block discarded – undo
2633 2633
 	**/
2634 2634
 	function procMemberSpammerManage()
2635 2635
 	{
2636
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2636
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2637 2637
 
2638 2638
 		$logged_info = Context::get('logged_info');
2639 2639
 		$member_srl = Context::get('member_srl');
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
 		$cnt_loop = Context::get('cnt_loop');
2642 2642
 		$proc_type = Context::get('proc_type');
2643 2643
 		$isMoveToTrash = true;
2644
-		if($proc_type == "delete")
2644
+		if ($proc_type == "delete")
2645 2645
 			$isMoveToTrash = false;
2646 2646
 
2647 2647
 		// check grant
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
2651 2651
 		$grant = $oModuleModel->getGrant($module_info, $logged_info);
2652 2652
 
2653
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2653
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
2654 2654
 
2655 2655
 		$proc_msg = "";
2656 2656
 
@@ -2659,10 +2659,10 @@  discard block
 block discarded – undo
2659 2659
 
2660 2660
 		// delete or trash destination
2661 2661
 		// proc member
2662
-		if($cnt_loop == 1)
2662
+		if ($cnt_loop == 1)
2663 2663
 			$this->_spammerMember($member_srl);
2664 2664
 		// proc document and comment
2665
-		elseif($cnt_loop>1)
2665
+		elseif ($cnt_loop > 1)
2666 2666
 			$this->_spammerDocuments($member_srl, $isMoveToTrash);
2667 2667
 
2668 2668
 		// get destination count
@@ -2671,11 +2671,11 @@  discard block
 block discarded – undo
2671 2671
 
2672 2672
 		$total_count = Context::get('total_count');
2673 2673
 		$remain_count = $cnt_document + $cnt_comment;
2674
-		if($cnt_loop == 1) $total_count = $remain_count;
2674
+		if ($cnt_loop == 1) $total_count = $remain_count;
2675 2675
 
2676 2676
 		// get progress percent
2677
-		if($total_count > 0)
2678
-			$progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 );
2677
+		if ($total_count > 0)
2678
+			$progress = intval((($total_count - $remain_count) / $total_count) * 100);
2679 2679
 		else
2680 2680
 			$progress = 100;
2681 2681
 
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
 	**/
2700 2700
 	private function _spammerMember($member_srl) {
2701 2701
 		$logged_info = Context::get('logged_info');
2702
-		$spam_description = trim( Context::get('spam_description') );
2702
+		$spam_description = trim(Context::get('spam_description'));
2703 2703
 
2704 2704
 		$oMemberModel = getModel('member');
2705 2705
 		$columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description');
@@ -2718,10 +2718,10 @@  discard block
 block discarded – undo
2718 2718
 		$args->user_id = $member_info->user_id;
2719 2719
 		$args->nick_name = $member_info->nick_name;
2720 2720
 		$args->denied = "Y";
2721
-		$args->description = trim( $member_info->description );
2722
-		if( $args->description != "" ) $args->description .= "\n";	// add new line
2721
+		$args->description = trim($member_info->description);
2722
+		if ($args->description != "") $args->description .= "\n"; // add new line
2723 2723
 
2724
-		$args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]";
2724
+		$args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]";
2725 2725
 
2726 2726
 		$output = $this->updateMember($args, true);
2727 2727
 
@@ -2750,21 +2750,21 @@  discard block
 block discarded – undo
2750 2750
 		// 1. proc comment, 2. proc document
2751 2751
 		$cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl);
2752 2752
 		$cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl);
2753
-		if($cnt_comment > 0)
2753
+		if ($cnt_comment > 0)
2754 2754
 		{
2755 2755
 			$columnList = array();
2756 2756
 			$commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount);
2757
-			if($commentList) {
2758
-				foreach($commentList as $v) {
2757
+			if ($commentList) {
2758
+				foreach ($commentList as $v) {
2759 2759
 					$oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash);
2760 2760
 				}
2761 2761
 			}
2762
-		} elseif($cnt_document > 0) {
2762
+		} elseif ($cnt_document > 0) {
2763 2763
 			$columnList = array();
2764 2764
 			$documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount);
2765
-			if($documentList) {
2766
-				foreach($documentList as $v) {
2767
-					if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v);
2765
+			if ($documentList) {
2766
+				foreach ($documentList as $v) {
2767
+					if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v);
2768 2768
 					else $oDocumentController->deleteDocument($v->document_srl);
2769 2769
 				}
2770 2770
 			}
@@ -2776,24 +2776,24 @@  discard block
 block discarded – undo
2776 2776
 	function _clearMemberCache($member_srl, $site_srl = 0)
2777 2777
 	{
2778 2778
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
2779
-		if($oCacheHandler->isSupport())
2779
+		if ($oCacheHandler->isSupport())
2780 2780
 		{
2781
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl;
2781
+			$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl;
2782 2782
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2783 2783
 			$oCacheHandler->delete($cache_key);
2784 2784
 
2785
-			if($site_srl !== 0)
2785
+			if ($site_srl !== 0)
2786 2786
 			{
2787
-				$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
2787
+				$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0';
2788 2788
 				$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2789 2789
 				$oCacheHandler->delete($cache_key);
2790 2790
 			}
2791 2791
 		}
2792 2792
 
2793 2793
 		$oCacheHandler = CacheHandler::getInstance('object');
2794
-		if($oCacheHandler->isSupport())
2794
+		if ($oCacheHandler->isSupport())
2795 2795
 		{
2796
-			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
2796
+			$object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl;
2797 2797
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2798 2798
 			$oCacheHandler->delete($cache_key);
2799 2799
 		}
Please login to merge, or discard this patch.
Braces   +590 added lines, -247 removed lines patch added patch discarded remove patch
@@ -41,19 +41,31 @@  discard block
 block discarded – undo
41 41
 		}
42 42
 
43 43
 		// Variables
44
-		if(!$user_id) $user_id = Context::get('user_id');
44
+		if(!$user_id) {
45
+			$user_id = Context::get('user_id');
46
+		}
45 47
 		$user_id = trim($user_id);
46 48
 
47
-		if(!$password) $password = Context::get('password');
49
+		if(!$password) {
50
+			$password = Context::get('password');
51
+		}
48 52
 		$password = trim($password);
49 53
 
50
-		if(!$keep_signed) $keep_signed = Context::get('keep_signed');
54
+		if(!$keep_signed) {
55
+			$keep_signed = Context::get('keep_signed');
56
+		}
51 57
 		// Return an error when id and password doesn't exist
52
-		if(!$user_id) return new Object(-1,'null_user_id');
53
-		if(!$password) return new Object(-1,'null_password');
58
+		if(!$user_id) {
59
+			return new Object(-1,'null_user_id');
60
+		}
61
+		if(!$password) {
62
+			return new Object(-1,'null_password');
63
+		}
54 64
 
55 65
 		$output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false);
56
-		if (!$output->toBool()) return $output;
66
+		if (!$output->toBool()) {
67
+			return $output;
68
+		}
57 69
 
58 70
 		$oModuleModel = getModel('module');
59 71
 		$config = $oModuleModel->getModuleConfig('member');
@@ -80,8 +92,7 @@  discard block
 block discarded – undo
80 92
 		if(!$config->after_login_url)
81 93
 		{
82 94
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
83
-		}
84
-		else
95
+		} else
85 96
 		{
86 97
 			$returnUrl = $config->after_login_url;
87 98
 		}
@@ -98,19 +109,24 @@  discard block
 block discarded – undo
98 109
 		// Call a trigger before log-out (before)
99 110
 		$logged_info = Context::get('logged_info');
100 111
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info);
101
-		if(!$trigger_output->toBool()) return $trigger_output;
112
+		if(!$trigger_output->toBool()) {
113
+			return $trigger_output;
114
+		}
102 115
 		// Destroy session information
103 116
 		$this->destroySessionInfo();
104 117
 		// Call a trigger after log-out (after)
105 118
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info);
106
-		if(!$trigger_output->toBool()) return $trigger_output;
119
+		if(!$trigger_output->toBool()) {
120
+			return $trigger_output;
121
+		}
107 122
 
108 123
 		$output = new Object();
109 124
 
110 125
 		$oModuleModel = getModel('module');
111 126
 		$config = $oModuleModel->getModuleConfig('member');
112
-		if($config->after_logout_url)
113
-			$output->redirect_url = $config->after_logout_url;
127
+		if($config->after_logout_url) {
128
+					$output->redirect_url = $config->after_logout_url;
129
+		}
114 130
 
115 131
 		$this->_clearMemberCache($logged_info->member_srl);
116 132
 
@@ -125,12 +141,18 @@  discard block
 block discarded – undo
125 141
 	function procMemberScrapDocument()
126 142
 	{
127 143
 		// Check login information
128
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
144
+		if(!Context::get('is_logged')) {
145
+			return new Object(-1, 'msg_not_logged');
146
+		}
129 147
 		$logged_info = Context::get('logged_info');
130 148
 
131 149
 		$document_srl = (int)Context::get('document_srl');
132
-		if(!$document_srl) $document_srl = (int)Context::get('target_srl');
133
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
150
+		if(!$document_srl) {
151
+			$document_srl = (int)Context::get('target_srl');
152
+		}
153
+		if(!$document_srl) {
154
+			return new Object(-1,'msg_invalid_request');
155
+		}
134 156
 		// Get document
135 157
 		$oDocumentModel = getModel('document');
136 158
 		$oDocument = $oDocumentModel->getDocument($document_srl);
@@ -145,10 +167,14 @@  discard block
 block discarded – undo
145 167
 		$args->title = $oDocument->get('title');
146 168
 		// Check if already scrapped
147 169
 		$output = executeQuery('member.getScrapDocument', $args);
148
-		if($output->data->count) return new Object(-1, 'msg_alreay_scrapped');
170
+		if($output->data->count) {
171
+			return new Object(-1, 'msg_alreay_scrapped');
172
+		}
149 173
 		// Insert
150 174
 		$output = executeQuery('member.addScrapDocument', $args);
151
-		if(!$output->toBool()) return $output;
175
+		if(!$output->toBool()) {
176
+			return $output;
177
+		}
152 178
 
153 179
 		$this->setError(-1);
154 180
 		$this->setMessage('success_registed');
@@ -162,11 +188,15 @@  discard block
 block discarded – undo
162 188
 	function procMemberDeleteScrap()
163 189
 	{
164 190
 		// Check login information
165
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
191
+		if(!Context::get('is_logged')) {
192
+			return new Object(-1, 'msg_not_logged');
193
+		}
166 194
 		$logged_info = Context::get('logged_info');
167 195
 
168 196
 		$document_srl = (int)Context::get('document_srl');
169
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
197
+		if(!$document_srl) {
198
+			return new Object(-1,'msg_invalid_request');
199
+		}
170 200
 		// Variables
171 201
 		$args = new stdClass;
172 202
 		$args->member_srl = $logged_info->member_srl;
@@ -192,11 +222,15 @@  discard block
 block discarded – undo
192 222
 	function procMemberDeleteSavedDocument()
193 223
 	{
194 224
 		// Check login information
195
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
225
+		if(!Context::get('is_logged')) {
226
+			return new Object(-1, 'msg_not_logged');
227
+		}
196 228
 		$logged_info = Context::get('logged_info');
197 229
 
198 230
 		$document_srl = (int)Context::get('document_srl');
199
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
231
+		if(!$document_srl) {
232
+			return new Object(-1,'msg_invalid_request');
233
+		}
200 234
 
201 235
 		$oDocumentModel = getModel('document');
202 236
 		$oDocument = $oDocumentModel->getDocument($document_srl);
@@ -224,7 +258,9 @@  discard block
 block discarded – undo
224 258
 	{
225 259
 		$name = Context::get('name');
226 260
 		$value = Context::get('value');
227
-		if(!$value) return;
261
+		if(!$value) {
262
+			return;
263
+		}
228 264
 
229 265
 		$oMemberModel = getModel('member');
230 266
 		// Check if logged-in
@@ -235,10 +271,14 @@  discard block
 block discarded – undo
235 271
 		{
236 272
 			case 'user_id' :
237 273
 				// Check denied ID
238
-				if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id');
274
+				if($oMemberModel->isDeniedID($value)) {
275
+					return new Object(0,'denied_user_id');
276
+				}
239 277
 				// Check if duplicated
240 278
 				$member_srl = $oMemberModel->getMemberSrlByUserID($value);
241
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id');
279
+				if($member_srl && $logged_info->member_srl != $member_srl ) {
280
+					return new Object(0,'msg_exists_user_id');
281
+				}
242 282
 				break;
243 283
 			case 'nick_name' :
244 284
 				// Check denied ID
@@ -248,13 +288,17 @@  discard block
 block discarded – undo
248 288
 				}
249 289
 				// Check if duplicated
250 290
 				$member_srl = $oMemberModel->getMemberSrlByNickName($value);
251
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name');
291
+				if($member_srl && $logged_info->member_srl != $member_srl ) {
292
+					return new Object(0,'msg_exists_nick_name');
293
+				}
252 294
 
253 295
 				break;
254 296
 			case 'email_address' :
255 297
 				// Check if duplicated
256 298
 				$member_srl = $oMemberModel->getMemberSrlByEmailAddress($value);
257
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address');
299
+				if($member_srl && $logged_info->member_srl != $member_srl ) {
300
+					return new Object(0,'msg_exists_email_address');
301
+				}
258 302
 				break;
259 303
 		}
260 304
 	}
@@ -266,17 +310,25 @@  discard block
 block discarded – undo
266 310
 	 */
267 311
 	function procMemberInsert()
268 312
 	{
269
-		if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request");
313
+		if (Context::getRequestMethod () == "GET") {
314
+			return new Object (-1, "msg_invalid_request");
315
+		}
270 316
 		$oMemberModel = &getModel ('member');
271 317
 		$config = $oMemberModel->getMemberConfig();
272 318
 
273 319
 		// call a trigger (before)
274 320
 		$trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config);
275
-		if(!$trigger_output->toBool ()) return $trigger_output;
321
+		if(!$trigger_output->toBool ()) {
322
+			return $trigger_output;
323
+		}
276 324
 		// Check if an administrator allows a membership
277
-		if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled');
325
+		if($config->enable_join != 'Y') {
326
+			return $this->stop ('msg_signup_disabled');
327
+		}
278 328
 		// Check if the user accept the license terms (only if terms exist)
279
-		if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement');
329
+		if($config->agreement && Context::get('accept_agreement')!='Y') {
330
+			return $this->stop('msg_accept_agreement');
331
+		}
280 332
 
281 333
 		// Extract the necessary information in advance
282 334
 		$getVars = array();
@@ -295,16 +347,22 @@  discard block
 block discarded – undo
295 347
 		foreach($getVars as $val)
296 348
 		{
297 349
 			$args->{$val} = Context::get($val);
298
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
350
+			if($val == 'birthday') {
351
+				$args->birthday_ui = Context::get('birthday_ui');
352
+			}
299 353
 		}
300 354
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
301
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
355
+		if(!$args->birthday && $args->birthday_ui) {
356
+			$args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
357
+		}
302 358
 
303 359
 		$args->find_account_answer = Context::get('find_account_answer');
304 360
 		$args->allow_mailing = Context::get('allow_mailing');
305 361
 		$args->allow_message = Context::get('allow_message');
306 362
 
307
-		if($args->password1) $args->password = $args->password1;
363
+		if($args->password1) {
364
+			$args->password = $args->password1;
365
+		}
308 366
 
309 367
 		// check password strength
310 368
 		if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
@@ -333,7 +391,9 @@  discard block
 block discarded – undo
333 391
 		unset($all_args->secret_text);
334 392
 
335 393
 		// Set the user state as "denied" when using mail authentication
336
-		if($config->enable_confirm == 'Y') $args->denied = 'Y';
394
+		if($config->enable_confirm == 'Y') {
395
+			$args->denied = 'Y';
396
+		}
337 397
 		// Add extra vars after excluding necessary information from all the requested arguments
338 398
 		$extra_vars = delObjectVars($all_args, $args);
339 399
 		$args->extra_vars = serialize($extra_vars);
@@ -348,7 +408,9 @@  discard block
 block discarded – undo
348 408
 			}
349 409
 		}
350 410
 		$output = $this->insertMember($args);
351
-		if(!$output->toBool()) return $output;
411
+		if(!$output->toBool()) {
412
+			return $output;
413
+		}
352 414
 
353 415
 		// insert ProfileImage, ImageName, ImageMark
354 416
 		$profile_image = $_FILES['profile_image'];
@@ -387,43 +449,46 @@  discard block
 block discarded – undo
387 449
 			if($config->identifier == 'email_address')
388 450
 			{
389 451
 				$output = $this->doLogin($args->email_address);
390
-			}
391
-			else
452
+			} else
392 453
 			{
393 454
 				$output = $this->doLogin($args->user_id);
394 455
 			}
395 456
 			if(!$output->toBool()) {
396
-				if($output->error == -9)
397
-					$output->error = -11;
457
+				if($output->error == -9) {
458
+									$output->error = -11;
459
+				}
398 460
 				return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output);
399 461
 			}
400 462
 		}
401 463
 
402 464
 		// Results
403 465
 		$this->add('member_srl', $args->member_srl);
404
-		if($config->redirect_url) $this->add('redirect_url', $config->redirect_url);
466
+		if($config->redirect_url) {
467
+			$this->add('redirect_url', $config->redirect_url);
468
+		}
405 469
 		if($config->enable_confirm == 'Y')
406 470
 		{
407 471
 			$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address);
408 472
 			$this->setMessage($msg);
409 473
 			return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new Object(-12, $msg));
474
+		} else {
475
+			$this->setMessage('success_registed');
410 476
 		}
411
-		else $this->setMessage('success_registed');
412 477
 		// Call a trigger (after)
413 478
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config);
414
-		if(!$trigger_output->toBool()) return $trigger_output;
479
+		if(!$trigger_output->toBool()) {
480
+			return $trigger_output;
481
+		}
415 482
 
416 483
 		if($config->redirect_url)
417 484
 		{
418 485
 			$returnUrl = $config->redirect_url;
419
-		}
420
-		else
486
+		} else
421 487
 		{
422 488
 			if(Context::get('success_return_url'))
423 489
 			{
424 490
 				$returnUrl = Context::get('success_return_url');
425
-			}
426
-			else if($_COOKIE['XE_REDIRECT_URL'])
491
+			} else if($_COOKIE['XE_REDIRECT_URL'])
427 492
 			{
428 493
 				$returnUrl = $_COOKIE['XE_REDIRECT_URL'];
429 494
 				setcookie("XE_REDIRECT_URL", '', 1);
@@ -477,8 +542,7 @@  discard block
 block discarded – undo
477 542
 		if(Context::get('success_return_url'))
478 543
 		{
479 544
 			$redirectUrl = Context::get('success_return_url');
480
-		}
481
-		else
545
+		} else
482 546
 		{
483 547
 			$redirectUrl = getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo');
484 548
 		}
@@ -522,13 +586,17 @@  discard block
 block discarded – undo
522 586
 		foreach($getVars as $val)
523 587
 		{
524 588
 			$args->{$val} = Context::get($val);
525
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
589
+			if($val == 'birthday') {
590
+				$args->birthday_ui = Context::get('birthday_ui');
591
+			}
526 592
 		}
527 593
 		// Login Information
528 594
 		$logged_info = Context::get('logged_info');
529 595
 		$args->member_srl = $logged_info->member_srl;
530 596
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
531
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
597
+		if(!$args->birthday && $args->birthday_ui) {
598
+			$args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
599
+		}
532 600
 		// Remove some unnecessary variables from all the vars
533 601
 		$all_args = Context::getRequestVars();
534 602
 		unset($all_args->module);
@@ -562,7 +630,9 @@  discard block
 block discarded – undo
562 630
 
563 631
 		// Execute insert or update depending on the value of member_srl
564 632
 		$output = $this->updateMember($args);
565
-		if(!$output->toBool()) return $output;
633
+		if(!$output->toBool()) {
634
+			return $output;
635
+		}
566 636
 
567 637
 		$profile_image = $_FILES['profile_image'];
568 638
 		if(is_uploaded_file($profile_image['tmp_name']))
@@ -592,7 +662,9 @@  discard block
 block discarded – undo
592 662
 
593 663
 		// Call a trigger after successfully log-in (after)
594 664
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo);
595
-		if(!$trigger_output->toBool()) return $trigger_output;
665
+		if(!$trigger_output->toBool()) {
666
+			return $trigger_output;
667
+		}
596 668
 
597 669
 		$this->setSessionInfo();
598 670
 		// Return result
@@ -613,7 +685,9 @@  discard block
 block discarded – undo
613 685
 	 */
614 686
 	function procMemberModifyPassword()
615 687
 	{
616
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
688
+		if(!Context::get('is_logged')) {
689
+			return $this->stop('msg_not_logged');
690
+		}
617 691
 		// Extract the necessary information in advance
618 692
 		$current_password = trim(Context::get('current_password'));
619 693
 		$password = trim(Context::get('password1'));
@@ -627,17 +701,23 @@  discard block
 block discarded – undo
627 701
 
628 702
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
629 703
 		// Verify the cuttent password
630
-		if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password');
704
+		if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) {
705
+			return new Object(-1, 'invalid_password');
706
+		}
631 707
 
632 708
 		// Check if a new password is as same as the previous password
633
-		if($current_password == $password) return new Object(-1, 'invalid_new_password');
709
+		if($current_password == $password) {
710
+			return new Object(-1, 'invalid_new_password');
711
+		}
634 712
 
635 713
 		// Execute insert or update depending on the value of member_srl
636 714
 		$args = new stdClass;
637 715
 		$args->member_srl = $member_srl;
638 716
 		$args->password = $password;
639 717
 		$output = $this->updateMemberPassword($args);
640
-		if(!$output->toBool()) return $output;
718
+		if(!$output->toBool()) {
719
+			return $output;
720
+		}
641 721
 
642 722
 		$this->add('member_srl', $args->member_srl);
643 723
 		$this->setMessage('success_updated');
@@ -653,7 +733,9 @@  discard block
 block discarded – undo
653 733
 	 */
654 734
 	function procMemberLeave()
655 735
 	{
656
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
736
+		if(!Context::get('is_logged')) {
737
+			return $this->stop('msg_not_logged');
738
+		}
657 739
 		// Extract the necessary information in advance
658 740
 		$password = trim(Context::get('password'));
659 741
 		// Get information of logged-in user
@@ -669,10 +751,14 @@  discard block
 block discarded – undo
669 751
 			$this->memberInfo->password = $memberInfo->password;
670 752
 		}
671 753
 		// Verify the cuttent password
672
-		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
754
+		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) {
755
+			return new Object(-1, 'invalid_password');
756
+		}
673 757
 
674 758
 		$output = $this->deleteMember($member_srl);
675
-		if(!$output->toBool()) return $output;
759
+		if(!$output->toBool()) {
760
+			return $output;
761
+		}
676 762
 		// Destroy all session information
677 763
 		$this->destroySessionInfo();
678 764
 		// Return success message
@@ -691,17 +777,25 @@  discard block
 block discarded – undo
691 777
 	{
692 778
 		// Check if the file is successfully uploaded
693 779
 		$file = $_FILES['profile_image'];
694
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image');
780
+		if(!is_uploaded_file($file['tmp_name'])) {
781
+			return $this->stop('msg_not_uploaded_profile_image');
782
+		}
695 783
 		// Ignore if member_srl is invalid or doesn't exist.
696 784
 		$member_srl = Context::get('member_srl');
697
-		if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image');
785
+		if(!$member_srl) {
786
+			return $this->stop('msg_not_uploaded_profile_image');
787
+		}
698 788
 
699 789
 		$logged_info = Context::get('logged_info');
700
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image');
790
+		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) {
791
+			return $this->stop('msg_not_uploaded_profile_image');
792
+		}
701 793
 		// Return if member module is set not to use an image name or the user is not an administrator ;
702 794
 		$oModuleModel = getModel('module');
703 795
 		$config = $oModuleModel->getModuleConfig('member');
704
-		if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image');
796
+		if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') {
797
+			return $this->stop('msg_not_uploaded_profile_image');
798
+		}
705 799
 
706 800
 		$this->insertProfileImage($member_srl, $file['tmp_name']);
707 801
 		// Page refresh
@@ -723,26 +817,35 @@  discard block
 block discarded – undo
723 817
 	{
724 818
 
725 819
 		// Check uploaded file
726
-		if(!checkUploadedFile($target_file)) return;
820
+		if(!checkUploadedFile($target_file)) {
821
+			return;
822
+		}
727 823
 
728 824
 		$oMemberModel = getModel('member');
729 825
 		$config = $oMemberModel->getMemberConfig();
730 826
 
731 827
 		// Get an image size
732 828
 		$max_width = $config->profile_image_max_width;
733
-		if(!$max_width) $max_width = "90";
829
+		if(!$max_width) {
830
+			$max_width = "90";
831
+		}
734 832
 		$max_height = $config->profile_image_max_height;
735
-		if(!$max_height) $max_height = "90";
833
+		if(!$max_height) {
834
+			$max_height = "90";
835
+		}
736 836
 		// Get a target path to save
737 837
 		$target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl));
738 838
 		FileHandler::makeDir($target_path);
739 839
 
740 840
 		// Get file information
741 841
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
742
-		if(IMAGETYPE_PNG == $type) $ext = 'png';
743
-		elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg';
744
-		elseif(IMAGETYPE_GIF == $type) $ext = 'gif';
745
-		else
842
+		if(IMAGETYPE_PNG == $type) {
843
+			$ext = 'png';
844
+		} elseif(IMAGETYPE_JPEG == $type) {
845
+			$ext = 'jpg';
846
+		} elseif(IMAGETYPE_GIF == $type) {
847
+			$ext = 'gif';
848
+		} else
746 849
 		{
747 850
 			return;
748 851
 		}
@@ -754,8 +857,7 @@  discard block
 block discarded – undo
754 857
 		if(($width > $max_width || $height > $max_height ) && $type != 1)
755 858
 		{
756 859
 			FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext);
757
-		}
758
-		else
860
+		} else
759 861
 		{
760 862
 			@copy($target_file, $target_filename);
761 863
 		}
@@ -770,17 +872,25 @@  discard block
 block discarded – undo
770 872
 	{
771 873
 		// Check if the file is successfully uploaded
772 874
 		$file = $_FILES['image_name'];
773
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name');
875
+		if(!is_uploaded_file($file['tmp_name'])) {
876
+			return $this->stop('msg_not_uploaded_image_name');
877
+		}
774 878
 		// Ignore if member_srl is invalid or doesn't exist.
775 879
 		$member_srl = Context::get('member_srl');
776
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_name');
880
+		if(!$member_srl) {
881
+			return $this->stop('msg_not_uploaded_image_name');
882
+		}
777 883
 
778 884
 		$logged_info = Context::get('logged_info');
779
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name');
885
+		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) {
886
+			return $this->stop('msg_not_uploaded_image_name');
887
+		}
780 888
 		// Return if member module is set not to use an image name or the user is not an administrator ;
781 889
 		$oModuleModel = getModel('module');
782 890
 		$config = $oModuleModel->getModuleConfig('member');
783
-		if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name');
891
+		if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') {
892
+			return $this->stop('msg_not_uploaded_image_name');
893
+		}
784 894
 
785 895
 		$this->insertImageName($member_srl, $file['tmp_name']);
786 896
 		// Page refresh
@@ -801,15 +911,21 @@  discard block
 block discarded – undo
801 911
 	function insertImageName($member_srl, $target_file)
802 912
 	{
803 913
 		// Check uploaded file
804
-		if(!checkUploadedFile($target_file)) return;
914
+		if(!checkUploadedFile($target_file)) {
915
+			return;
916
+		}
805 917
 
806 918
 		$oModuleModel = getModel('module');
807 919
 		$config = $oModuleModel->getModuleConfig('member');
808 920
 		// Get an image size
809 921
 		$max_width = $config->image_name_max_width;
810
-		if(!$max_width) $max_width = "90";
922
+		if(!$max_width) {
923
+			$max_width = "90";
924
+		}
811 925
 		$max_height = $config->image_name_max_height;
812
-		if(!$max_height) $max_height = "20";
926
+		if(!$max_height) {
927
+			$max_height = "20";
928
+		}
813 929
 		// Get a target path to save
814 930
 		$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl));
815 931
 		FileHandler::makeDir($target_path);
@@ -818,8 +934,11 @@  discard block
 block discarded – undo
818 934
 		// Get file information
819 935
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
820 936
 		// Convert if the image size is larger than a given size or if the format is not a gif
821
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
822
-		else @copy($target_file, $target_filename);
937
+		if($width > $max_width || $height > $max_height || $type!=1) {
938
+			FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
939
+		} else {
940
+			@copy($target_file, $target_filename);
941
+		}
823 942
 	}
824 943
 
825 944
 	/**
@@ -879,17 +998,25 @@  discard block
 block discarded – undo
879 998
 	{
880 999
 		// Check if the file is successfully uploaded
881 1000
 		$file = $_FILES['image_mark'];
882
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark');
1001
+		if(!is_uploaded_file($file['tmp_name'])) {
1002
+			return $this->stop('msg_not_uploaded_image_mark');
1003
+		}
883 1004
 		// Ignore if member_srl is invalid or doesn't exist.
884 1005
 		$member_srl = Context::get('member_srl');
885
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark');
1006
+		if(!$member_srl) {
1007
+			return $this->stop('msg_not_uploaded_image_mark');
1008
+		}
886 1009
 
887 1010
 		$logged_info = Context::get('logged_info');
888
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark');
1011
+		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) {
1012
+			return $this->stop('msg_not_uploaded_image_mark');
1013
+		}
889 1014
 		// Membership in the images mark the module using the ban was set by an administrator or return;
890 1015
 		$oModuleModel = getModel('module');
891 1016
 		$config = $oModuleModel->getModuleConfig('member');
892
-		if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark');
1017
+		if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') {
1018
+			return $this->stop('msg_not_uploaded_image_mark');
1019
+		}
893 1020
 
894 1021
 		$this->insertImageMark($member_srl, $file['tmp_name']);
895 1022
 		// Page refresh
@@ -910,15 +1037,21 @@  discard block
 block discarded – undo
910 1037
 	function insertImageMark($member_srl, $target_file)
911 1038
 	{
912 1039
 		// Check uploaded file
913
-		if(!checkUploadedFile($target_file)) return;
1040
+		if(!checkUploadedFile($target_file)) {
1041
+			return;
1042
+		}
914 1043
 
915 1044
 		$oModuleModel = getModel('module');
916 1045
 		$config = $oModuleModel->getModuleConfig('member');
917 1046
 		// Get an image size
918 1047
 		$max_width = $config->image_mark_max_width;
919
-		if(!$max_width) $max_width = "20";
1048
+		if(!$max_width) {
1049
+			$max_width = "20";
1050
+		}
920 1051
 		$max_height = $config->image_mark_max_height;
921
-		if(!$max_height) $max_height = "20";
1052
+		if(!$max_height) {
1053
+			$max_height = "20";
1054
+		}
922 1055
 
923 1056
 		$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl));
924 1057
 		FileHandler::makeDir($target_path);
@@ -927,8 +1060,11 @@  discard block
 block discarded – undo
927 1060
 		// Get file information
928 1061
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
929 1062
 
930
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
931
-		else @copy($target_file, $target_filename);
1063
+		if($width > $max_width || $height > $max_height || $type!=1) {
1064
+			FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
1065
+		} else {
1066
+			@copy($target_file, $target_filename);
1067
+		}
932 1068
 	}
933 1069
 
934 1070
 	/**
@@ -963,14 +1099,18 @@  discard block
 block discarded – undo
963 1099
 	function procMemberFindAccount()
964 1100
 	{
965 1101
 		$email_address = Context::get('email_address');
966
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
1102
+		if(!$email_address) {
1103
+			return new Object(-1, 'msg_invalid_request');
1104
+		}
967 1105
 
968 1106
 		$oMemberModel = getModel('member');
969 1107
 		$oModuleModel = getModel('module');
970 1108
 
971 1109
 		// Check if a member having the same email address exists
972 1110
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
973
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
1111
+		if(!$member_srl) {
1112
+			return new Object(-1, 'msg_email_not_exists');
1113
+		}
974 1114
 
975 1115
 		// Get information of the member
976 1116
 		$columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name');
@@ -982,7 +1122,9 @@  discard block
 block discarded – undo
982 1122
 			$chk_args = new stdClass;
983 1123
 			$chk_args->member_srl = $member_info->member_srl;
984 1124
 			$output = executeQuery('member.chkAuthMail', $chk_args);
985
-			if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed');
1125
+			if($output->toBool() && $output->data->count != '0') {
1126
+				return new Object(-1, 'msg_user_not_confirmed');
1127
+			}
986 1128
 		}
987 1129
 
988 1130
 		// Insert data into the authentication DB
@@ -995,7 +1137,9 @@  discard block
 block discarded – undo
995 1137
 		$args->is_register = 'N';
996 1138
 
997 1139
 		$output = executeQuery('member.insertAuthMail', $args);
998
-		if(!$output->toBool()) return $output;
1140
+		if(!$output->toBool()) {
1141
+			return $output;
1142
+		}
999 1143
 		// Get content of the email to send a member
1000 1144
 		Context::set('auth_args', $args);
1001 1145
 
@@ -1012,8 +1156,7 @@  discard block
 block discarded – undo
1012 1156
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1013 1157
 				}
1014 1158
 			}
1015
-		}
1016
-		else
1159
+		} else
1017 1160
 		{
1018 1161
 			$memberInfo[$lang->user_id] = $args->user_id;
1019 1162
 			$memberInfo[$lang->user_name] = $args->user_name;
@@ -1022,13 +1165,19 @@  discard block
 block discarded – undo
1022 1165
 		}
1023 1166
 		Context::set('memberInfo', $memberInfo);
1024 1167
 
1025
-		if(!$member_config->skin) $member_config->skin = "default";
1026
-		if(!$member_config->colorset) $member_config->colorset = "white";
1168
+		if(!$member_config->skin) {
1169
+			$member_config->skin = "default";
1170
+		}
1171
+		if(!$member_config->colorset) {
1172
+			$member_config->colorset = "white";
1173
+		}
1027 1174
 
1028 1175
 		Context::set('member_config', $member_config);
1029 1176
 
1030 1177
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1031
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1178
+		if(!is_dir($tpl_path)) {
1179
+			$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1180
+		}
1032 1181
 
1033 1182
 		$find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key);
1034 1183
 		Context::set('find_url', $find_url);
@@ -1070,20 +1219,28 @@  discard block
 block discarded – undo
1070 1219
 		$find_account_question = trim(Context::get('find_account_question'));
1071 1220
 		$find_account_answer = trim(Context::get('find_account_answer'));
1072 1221
 
1073
-		if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request');
1222
+		if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) {
1223
+			return new Object(-1, 'msg_invalid_request');
1224
+		}
1074 1225
 
1075 1226
 		$oModuleModel = getModel('module');
1076 1227
 		// Check if a member having the same email address exists
1077 1228
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1078
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
1229
+		if(!$member_srl) {
1230
+			return new Object(-1, 'msg_email_not_exists');
1231
+		}
1079 1232
 		// Get information of the member
1080 1233
 		$columnList = array('member_srl', 'find_account_question', 'find_account_answer');
1081 1234
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
1082 1235
 
1083 1236
 		// Display a message if no answer is entered
1084
-		if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists');
1237
+		if(!$member_info->find_account_question || !$member_info->find_account_answer) {
1238
+			return new Object(-1, 'msg_question_not_exists');
1239
+		}
1085 1240
 
1086
-		if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches');
1241
+		if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) {
1242
+			return new Object(-1, 'msg_answer_not_matches');
1243
+		}
1087 1244
 
1088 1245
 		if($config->identifier == 'email_address')
1089 1246
 		{
@@ -1099,7 +1256,9 @@  discard block
 block discarded – undo
1099 1256
 		$args->password = $temp_password;
1100 1257
 		$args->change_password_date = '1';
1101 1258
 		$output = $this->updateMemberPassword($args);
1102
-		if(!$output->toBool()) return $output;
1259
+		if(!$output->toBool()) {
1260
+			return $output;
1261
+		}
1103 1262
 
1104 1263
 		$_SESSION['xe_temp_password_' . $user_id] = $temp_password;
1105 1264
 
@@ -1156,8 +1315,7 @@  discard block
 block discarded – undo
1156 1315
 		if($output->data->is_register == 'Y')
1157 1316
 		{
1158 1317
 			$args->denied = 'N';
1159
-		}
1160
-		else
1318
+		} else
1161 1319
 		{
1162 1320
 			$args->password = $oMemberModel->hashPassword($args->password);
1163 1321
 		}
@@ -1191,33 +1349,45 @@  discard block
 block discarded – undo
1191 1349
 	{
1192 1350
 		// Get an email_address
1193 1351
 		$email_address = Context::get('email_address');
1194
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
1352
+		if(!$email_address) {
1353
+			return new Object(-1, 'msg_invalid_request');
1354
+		}
1195 1355
 		// Log test by using email_address
1196 1356
 		$oMemberModel = getModel('member');
1197 1357
 
1198 1358
 		$args = new stdClass;
1199 1359
 		$args->email_address = $email_address;
1200 1360
 		$memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1201
-		if(!$memberSrl) return new Object(-1, 'msg_not_exists_member');
1361
+		if(!$memberSrl) {
1362
+			return new Object(-1, 'msg_not_exists_member');
1363
+		}
1202 1364
 
1203 1365
 		$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address');
1204 1366
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList);
1205 1367
 
1206 1368
 		$oModuleModel = getModel('module');
1207 1369
 		$member_config = $oModuleModel->getModuleConfig('member');
1208
-		if(!$member_config->skin) $member_config->skin = "default";
1209
-		if(!$member_config->colorset) $member_config->colorset = "white";
1370
+		if(!$member_config->skin) {
1371
+			$member_config->skin = "default";
1372
+		}
1373
+		if(!$member_config->colorset) {
1374
+			$member_config->colorset = "white";
1375
+		}
1210 1376
 
1211 1377
 		// Check if a authentication mail has been sent previously
1212 1378
 		$chk_args = new stdClass;
1213 1379
 		$chk_args->member_srl = $member_info->member_srl;
1214 1380
 		$output = executeQuery('member.chkAuthMail', $chk_args);
1215
-		if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request');
1381
+		if($output->toBool() && $output->data->count == '0') {
1382
+			return new Object(-1, 'msg_invalid_request');
1383
+		}
1216 1384
 
1217 1385
 		$auth_args = new stdClass;
1218 1386
 		$auth_args->member_srl = $member_info->member_srl;
1219 1387
 		$output = executeQueryArray('member.getAuthMailInfo', $auth_args);
1220
-		if(!$output->data || !$output->data[0]->auth_key)  return new Object(-1, 'msg_invalid_request');
1388
+		if(!$output->data || !$output->data[0]->auth_key) {
1389
+			return new Object(-1, 'msg_invalid_request');
1390
+		}
1221 1391
 		$auth_info = $output->data[0];
1222 1392
 
1223 1393
 		// Update the regdate of authmail entry
@@ -1238,8 +1408,7 @@  discard block
 block discarded – undo
1238 1408
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1239 1409
 				}
1240 1410
 			}
1241
-		}
1242
-		else
1411
+		} else
1243 1412
 		{
1244 1413
 			$memberInfo[$lang->user_id] = $member_info->user_id;
1245 1414
 			$memberInfo[$lang->user_name] = $member_info->user_name;
@@ -1252,7 +1421,9 @@  discard block
 block discarded – undo
1252 1421
 		Context::set('member_config', $member_config);
1253 1422
 
1254 1423
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1255
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1424
+		if(!is_dir($tpl_path)) {
1425
+			$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1426
+		}
1256 1427
 
1257 1428
 		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key);
1258 1429
 		Context::set('auth_url', $auth_url);
@@ -1330,7 +1501,9 @@  discard block
 block discarded – undo
1330 1501
 		$auth_args->is_register = 'Y';
1331 1502
 
1332 1503
 		$output = executeQuery('member.insertAuthMail', $auth_args);
1333
-		if(!$output->toBool()) return $output;
1504
+		if(!$output->toBool()) {
1505
+			return $output;
1506
+		}
1334 1507
 
1335 1508
 		$memberInfo->email_address = $newEmail;
1336 1509
 
@@ -1364,8 +1537,7 @@  discard block
 block discarded – undo
1364 1537
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1365 1538
 				}
1366 1539
 			}
1367
-		}
1368
-		else
1540
+		} else
1369 1541
 		{
1370 1542
 			$memberInfo[$lang->user_id] = $member_info->user_id;
1371 1543
 			$memberInfo[$lang->user_name] = $member_info->user_name;
@@ -1374,13 +1546,19 @@  discard block
 block discarded – undo
1374 1546
 		}
1375 1547
 		Context::set('memberInfo', $memberInfo);
1376 1548
 
1377
-		if(!$member_config->skin) $member_config->skin = "default";
1378
-		if(!$member_config->colorset) $member_config->colorset = "white";
1549
+		if(!$member_config->skin) {
1550
+			$member_config->skin = "default";
1551
+		}
1552
+		if(!$member_config->colorset) {
1553
+			$member_config->colorset = "white";
1554
+		}
1379 1555
 
1380 1556
 		Context::set('member_config', $member_config);
1381 1557
 
1382 1558
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1383
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1559
+		if(!is_dir($tpl_path)) {
1560
+			$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1561
+		}
1384 1562
 
1385 1563
 		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
1386 1564
 		Context::set('auth_url', $auth_url);
@@ -1405,7 +1583,9 @@  discard block
 block discarded – undo
1405 1583
 	{
1406 1584
 		$site_module_info = Context::get('site_module_info');
1407 1585
 		$logged_info = Context::get('logged_info');
1408
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1586
+		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) {
1587
+			return new Object(-1,'msg_invalid_request');
1588
+		}
1409 1589
 
1410 1590
 		$oMemberModel = getModel('member');
1411 1591
 		$columnList = array('site_srl', 'group_srl', 'title');
@@ -1424,13 +1604,17 @@  discard block
 block discarded – undo
1424 1604
 	{
1425 1605
 		$site_module_info = Context::get('site_module_info');
1426 1606
 		$logged_info = Context::get('logged_info');
1427
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1607
+		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) {
1608
+			return new Object(-1,'msg_invalid_request');
1609
+		}
1428 1610
 
1429 1611
 		$args = new stdClass;
1430 1612
 		$args->site_srl= $site_module_info->site_srl;
1431 1613
 		$args->member_srl = $logged_info->member_srl;
1432 1614
 		$output = executeQuery('member.deleteMembersGroup', $args);
1433
-		if(!$output->toBool()) return $output;
1615
+		if(!$output->toBool()) {
1616
+			return $output;
1617
+		}
1434 1618
 		$this->setMessage('success_deleted');
1435 1619
 		$this->_clearMemberCache($args->member_srl, $site_module_info->site_srl);
1436 1620
 	}
@@ -1444,17 +1628,37 @@  discard block
 block discarded – undo
1444 1628
 	 */
1445 1629
 	function setMemberConfig($args)
1446 1630
 	{
1447
-		if(!$args->skin) $args->skin = "default";
1448
-		if(!$args->colorset) $args->colorset = "white";
1449
-		if(!$args->editor_skin) $args->editor_skin= "ckeditor";
1450
-		if(!$args->editor_colorset) $args->editor_colorset = "moono";
1451
-		if($args->enable_join!='Y') $args->enable_join = 'N';
1631
+		if(!$args->skin) {
1632
+			$args->skin = "default";
1633
+		}
1634
+		if(!$args->colorset) {
1635
+			$args->colorset = "white";
1636
+		}
1637
+		if(!$args->editor_skin) {
1638
+			$args->editor_skin= "ckeditor";
1639
+		}
1640
+		if(!$args->editor_colorset) {
1641
+			$args->editor_colorset = "moono";
1642
+		}
1643
+		if($args->enable_join!='Y') {
1644
+			$args->enable_join = 'N';
1645
+		}
1452 1646
 		$args->enable_openid= 'N';
1453
-		if($args->profile_image !='Y') $args->profile_image = 'N';
1454
-		if($args->image_name!='Y') $args->image_name = 'N';
1455
-		if($args->image_mark!='Y') $args->image_mark = 'N';
1456
-		if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
1457
-		if(!trim(strip_tags($args->agreement))) $args->agreement = null;
1647
+		if($args->profile_image !='Y') {
1648
+			$args->profile_image = 'N';
1649
+		}
1650
+		if($args->image_name!='Y') {
1651
+			$args->image_name = 'N';
1652
+		}
1653
+		if($args->image_mark!='Y') {
1654
+			$args->image_mark = 'N';
1655
+		}
1656
+		if($args->group_image_mark!='Y') {
1657
+			$args->group_image_mark = 'N';
1658
+		}
1659
+		if(!trim(strip_tags($args->agreement))) {
1660
+			$args->agreement = null;
1661
+		}
1458 1662
 		$args->limit_day = (int)$args->limit_day;
1459 1663
 
1460 1664
 		$agreement = trim($args->agreement);
@@ -1462,7 +1666,9 @@  discard block
 block discarded – undo
1462 1666
 
1463 1667
 		$oModuleController = getController('module');
1464 1668
 		$output = $oModuleController->insertModuleConfig('member',$args);
1465
-		if(!$output->toBool()) return $output;
1669
+		if(!$output->toBool()) {
1670
+			return $output;
1671
+		}
1466 1672
 
1467 1673
 		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
1468 1674
 		FileHandler::writeFile($agreement_file, $agreement);
@@ -1487,7 +1693,9 @@  discard block
 block discarded – undo
1487 1693
 		$path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl));
1488 1694
 		$filename = sprintf('%s%d.signature.php', $path, $member_srl);
1489 1695
 
1490
-		if(!$check_signature) return FileHandler::removeFile($filename);
1696
+		if(!$check_signature) {
1697
+			return FileHandler::removeFile($filename);
1698
+		}
1491 1699
 
1492 1700
 		$buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
1493 1701
 		FileHandler::makeDir($path);
@@ -1521,7 +1729,9 @@  discard block
 block discarded – undo
1521 1729
 		$args = new stdClass();
1522 1730
 		$args->member_srl = $member_srl;
1523 1731
 		$args->group_srl = $group_srl;
1524
-		if($site_srl) $args->site_srl = $site_srl;
1732
+		if($site_srl) {
1733
+			$args->site_srl = $site_srl;
1734
+		}
1525 1735
 
1526 1736
 		// Add
1527 1737
 		$output = executeQuery('member.addMemberToGroup',$args);
@@ -1547,15 +1757,21 @@  discard block
 block discarded – undo
1547 1757
 		$obj->member_srl = implode(',',$args->member_srl);
1548 1758
 
1549 1759
 		$output = executeQueryArray('member.getMembersGroup', $obj);
1550
-		if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1760
+		if($output->data) {
1761
+			foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1762
+		}
1551 1763
 
1552 1764
 		$output = executeQuery('member.deleteMembersGroup', $obj);
1553
-		if(!$output->toBool()) return $output;
1765
+		if(!$output->toBool()) {
1766
+			return $output;
1767
+		}
1554 1768
 
1555 1769
 		$inserted_members = array();
1556 1770
 		foreach($args->member_srl as $key => $val)
1557 1771
 		{
1558
-			if($inserted_members[$val]) continue;
1772
+			if($inserted_members[$val]) {
1773
+				continue;
1774
+			}
1559 1775
 			$inserted_members[$val] = true;
1560 1776
 
1561 1777
 			unset($obj);
@@ -1565,7 +1781,9 @@  discard block
 block discarded – undo
1565 1781
 			$obj->site_srl = $args->site_srl;
1566 1782
 			$obj->regdate = $date[$obj->member_srl];
1567 1783
 			$output = executeQuery('member.addMemberToGroup', $obj);
1568
-			if(!$output->toBool()) return $output;
1784
+			if(!$output->toBool()) {
1785
+				return $output;
1786
+			}
1569 1787
 
1570 1788
 			$this->_clearMemberCache($obj->member_srl, $args->site_srl);
1571 1789
 		}
@@ -1627,8 +1845,7 @@  discard block
 block discarded – undo
1627 1845
 				if($config->identifier == 'user_id')
1628 1846
 				{
1629 1847
 					$member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList);
1630
-				}
1631
-				else
1848
+				} else
1632 1849
 				{
1633 1850
 					$member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList);
1634 1851
 				}
@@ -1637,8 +1854,7 @@  discard block
 block discarded – undo
1637 1854
 					$do_auto_login = true;
1638 1855
 				}
1639 1856
 
1640
-			}
1641
-			else
1857
+			} else
1642 1858
 			{
1643 1859
 				$do_auto_login = true;
1644 1860
 			}
@@ -1647,8 +1863,7 @@  discard block
 block discarded – undo
1647 1863
 		if($do_auto_login)
1648 1864
 		{
1649 1865
 			$output = $this->doLogin($user_id);
1650
-		}
1651
-		else
1866
+		} else
1652 1867
 		{
1653 1868
 			executeQuery('member.deleteAutologin', $args);
1654 1869
 			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365);
@@ -1667,13 +1882,17 @@  discard block
 block discarded – undo
1667 1882
 	function doLogin($user_id, $password = '', $keep_signed = false)
1668 1883
 	{
1669 1884
 		$user_id = strtolower($user_id);
1670
-		if(!$user_id) return new Object(-1, 'null_user_id');
1885
+		if(!$user_id) {
1886
+			return new Object(-1, 'null_user_id');
1887
+		}
1671 1888
 		// Call a trigger before log-in (before)
1672 1889
 		$trigger_obj = new stdClass();
1673 1890
 		$trigger_obj->user_id = $user_id;
1674 1891
 		$trigger_obj->password = $password;
1675 1892
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj);
1676
-		if(!$trigger_output->toBool()) return $trigger_output;
1893
+		if(!$trigger_output->toBool()) {
1894
+			return $trigger_output;
1895
+		}
1677 1896
 		// Create a member model object
1678 1897
 		$oMemberModel = getModel('member');
1679 1898
 
@@ -1688,15 +1907,18 @@  discard block
 block discarded – undo
1688 1907
 			// Get user_id information
1689 1908
 			$this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id);
1690 1909
 			// Set an invalid user if no value returned
1691
-			if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
1910
+			if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) {
1911
+				return $this->recordLoginError(-1, 'invalid_email_address');
1912
+			}
1692 1913
 
1693
-		}
1694
-		else
1914
+		} else
1695 1915
 		{
1696 1916
 			// Get user_id information
1697 1917
 			$this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id);
1698 1918
 			// Set an invalid user if no value returned
1699
-			if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
1919
+			if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) {
1920
+				return $this->recordLoginError(-1, 'invalid_user_id');
1921
+			}
1700 1922
 		}
1701 1923
 
1702 1924
 		$output = executeQuery('member.getLoginCountByIp', $args);
@@ -1708,14 +1930,18 @@  discard block
 block discarded – undo
1708 1930
 			if($term < $config->max_error_count_time)
1709 1931
 			{
1710 1932
 				$term = $config->max_error_count_time - $term;
1711
-				if($term < 60) $term = intval($term).Context::getLang('unit_sec');
1712
-				elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min');
1713
-				elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour');
1714
-				else $term = intval($term/86400).Context::getLang('unit_day');
1933
+				if($term < 60) {
1934
+					$term = intval($term).Context::getLang('unit_sec');
1935
+				} elseif(60 <= $term && $term < 3600) {
1936
+					$term = intval($term/60).Context::getLang('unit_min');
1937
+				} elseif(3600 <= $term && $term < 86400) {
1938
+					$term = intval($term/3600).Context::getLang('unit_hour');
1939
+				} else {
1940
+					$term = intval($term/86400).Context::getLang('unit_day');
1941
+				}
1715 1942
 
1716 1943
 				return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term));
1717
-			}
1718
-			else
1944
+			} else
1719 1945
 			{
1720 1946
 				$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1721 1947
 				$output = executeQuery('member.deleteLoginCountByIp', $args);
@@ -1742,7 +1968,9 @@  discard block
 block discarded – undo
1742 1968
 			return new Object(-1,'msg_user_denied');
1743 1969
 		}
1744 1970
 		// Notify if denied_date is less than the current time
1745
-		if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));
1971
+		if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) {
1972
+			return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));
1973
+		}
1746 1974
 		// Update the latest login time
1747 1975
 		$args->member_srl = $this->memberInfo->member_srl;
1748 1976
 		$output = executeQuery('member.updateLastLogin', $args);
@@ -1791,7 +2019,9 @@  discard block
 block discarded – undo
1791 2019
 		}
1792 2020
 		// Call a trigger after successfully log-in (after)
1793 2021
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo);
1794
-		if(!$trigger_output->toBool()) return $trigger_output;
2022
+		if(!$trigger_output->toBool()) {
2023
+			return $trigger_output;
2024
+		}
1795 2025
 		// When user checked to use auto-login
1796 2026
 		if($keep_signed)
1797 2027
 		{
@@ -1805,7 +2035,9 @@  discard block
 block discarded – undo
1805 2035
 			$autologin_args->member_srl = $this->memberInfo->member_srl;
1806 2036
 			executeQuery('member.deleteAutologin', $autologin_args);
1807 2037
 			$autologin_output = executeQuery('member.insertAutologin', $autologin_args);
1808
-			if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000);
2038
+			if($autologin_output->toBool()) {
2039
+				setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000);
2040
+			}
1809 2041
 		}
1810 2042
 		if($this->memberInfo->is_admin == 'Y')
1811 2043
 		{
@@ -1894,7 +2126,9 @@  discard block
 block discarded – undo
1894 2126
 	function addMemberPopupMenu($url, $str, $icon = '', $target = 'self')
1895 2127
 	{
1896 2128
 		$member_popup_menu_list = Context::get('member_popup_menu_list');
1897
-		if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array();
2129
+		if(!is_array($member_popup_menu_list)) {
2130
+			$member_popup_menu_list = array();
2131
+		}
1898 2132
 
1899 2133
 		$obj = new stdClass;
1900 2134
 		$obj->url = $url;
@@ -1913,35 +2147,54 @@  discard block
 block discarded – undo
1913 2147
 	{
1914 2148
 		// Call a trigger (before)
1915 2149
 		$output = ModuleHandler::triggerCall('member.insertMember', 'before', $args);
1916
-		if(!$output->toBool()) return $output;
2150
+		if(!$output->toBool()) {
2151
+			return $output;
2152
+		}
1917 2153
 		// Terms and Conditions portion of the information set up by members reaffirmed
1918 2154
 		$oModuleModel = getModel('module');
1919 2155
 		$config = $oModuleModel->getModuleConfig('member');
1920 2156
 
1921 2157
 		$logged_info = Context::get('logged_info');
1922 2158
 		// If the date of the temporary restrictions limit further information on the date of
1923
-		if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24);
2159
+		if($config->limit_day) {
2160
+			$args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24);
2161
+		}
1924 2162
 
1925 2163
 		$args->member_srl = getNextSequence();
1926 2164
 		$args->list_order = -1 * $args->member_srl;
1927 2165
 
1928 2166
 		// Execute insert or update depending on the value of member_srl
1929
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
2167
+		if(!$args->user_id) {
2168
+			$args->user_id = 't'.$args->member_srl;
2169
+		}
1930 2170
 		// Enter the user's identity changed to lowercase
1931
-		else $args->user_id = strtolower($args->user_id);
1932
-		if(!$args->user_name) $args->user_name = $args->member_srl;
1933
-		if(!$args->nick_name) $args->nick_name = $args->member_srl;
2171
+		else {
2172
+			$args->user_id = strtolower($args->user_id);
2173
+		}
2174
+		if(!$args->user_name) {
2175
+			$args->user_name = $args->member_srl;
2176
+		}
2177
+		if(!$args->nick_name) {
2178
+			$args->nick_name = $args->member_srl;
2179
+		}
1934 2180
 
1935 2181
 		// Control of essential parameters
1936
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
1937
-		if($args->denied!='Y') $args->denied = 'N';
1938
-		if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y';
2182
+		if($args->allow_mailing!='Y') {
2183
+			$args->allow_mailing = 'N';
2184
+		}
2185
+		if($args->denied!='Y') {
2186
+			$args->denied = 'N';
2187
+		}
2188
+		if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) {
2189
+			$args->allow_message = 'Y';
2190
+		}
1939 2191
 
1940 2192
 		if($logged_info->is_admin == 'Y')
1941 2193
 		{
1942
-			if($args->is_admin!='Y') $args->is_admin = 'N';
1943
-		}
1944
-		else
2194
+			if($args->is_admin!='Y') {
2195
+				$args->is_admin = 'N';
2196
+			}
2197
+		} else
1945 2198
 		{
1946 2199
 			unset($args->is_admin);
1947 2200
 		}
@@ -1954,8 +2207,12 @@  discard block
 block discarded – undo
1954 2207
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1955 2208
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1956 2209
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1957
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
1958
-		if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog;
2210
+		if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) {
2211
+			$args->homepage = 'http://'.$args->homepage;
2212
+		}
2213
+		if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) {
2214
+			$args->blog = 'http://'.$args->blog;
2215
+		}
1959 2216
 
1960 2217
 		// Create a model object
1961 2218
 		$oMemberModel = getModel('member');
@@ -1969,8 +2226,7 @@  discard block
 block discarded – undo
1969 2226
 				return new Object(-1, $message[$config->password_strength]);
1970 2227
 			}
1971 2228
 			$args->password = $oMemberModel->hashPassword($args->password);
1972
-		}
1973
-		elseif(!$args->password)
2229
+		} elseif(!$args->password)
1974 2230
 		{
1975 2231
 			unset($args->password);
1976 2232
 		}
@@ -2011,8 +2267,12 @@  discard block
 block discarded – undo
2011 2267
 		// Insert data into the DB
2012 2268
 		$args->list_order = -1 * $args->member_srl;
2013 2269
 
2014
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
2015
-		if(!$args->user_name) $args->user_name = $args->member_srl;
2270
+		if(!$args->user_id) {
2271
+			$args->user_id = 't'.$args->member_srl;
2272
+		}
2273
+		if(!$args->user_name) {
2274
+			$args->user_name = $args->member_srl;
2275
+		}
2016 2276
 
2017 2277
 		$oDB = &DB::getInstance();
2018 2278
 		$oDB->begin();
@@ -2024,8 +2284,11 @@  discard block
 block discarded – undo
2024 2284
 			return $output;
2025 2285
 		}
2026 2286
 
2027
-		if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2028
-		else $group_srl_list = explode('|@|', $args->group_srl_list);
2287
+		if(is_array($args->group_srl_list)) {
2288
+			$group_srl_list = $args->group_srl_list;
2289
+		} else {
2290
+			$group_srl_list = explode('|@|', $args->group_srl_list);
2291
+		}
2029 2292
 		// If no value is entered the default group, the value of group registration
2030 2293
 		if(!$args->group_srl_list)
2031 2294
 		{
@@ -2042,8 +2305,7 @@  discard block
 block discarded – undo
2042 2305
 				}
2043 2306
 			}
2044 2307
 			// If the value is the value of the group entered the group registration
2045
-		}
2046
-		else
2308
+		} else
2047 2309
 		{
2048 2310
 			for($i=0;$i<count($group_srl_list);$i++)
2049 2311
 			{
@@ -2104,27 +2366,39 @@  discard block
 block discarded – undo
2104 2366
 	{
2105 2367
 		// Call a trigger (before)
2106 2368
 		$output = ModuleHandler::triggerCall('member.updateMember', 'before', $args);
2107
-		if(!$output->toBool()) return $output;
2369
+		if(!$output->toBool()) {
2370
+			return $output;
2371
+		}
2108 2372
 		// Create a model object
2109 2373
 		$oMemberModel = getModel('member');
2110 2374
 
2111 2375
 		$logged_info = Context::get('logged_info');
2112 2376
 		// Get what you want to modify the original information
2113
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2377
+		if(!$this->memberInfo) {
2378
+			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2379
+		}
2114 2380
 		// Control of essential parameters
2115
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
2116
-		if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
2381
+		if($args->allow_mailing!='Y') {
2382
+			$args->allow_mailing = 'N';
2383
+		}
2384
+		if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) {
2385
+			$args->allow_message = 'Y';
2386
+		}
2117 2387
 
2118 2388
 		if($logged_info->is_admin == 'Y')
2119 2389
 		{
2120
-			if($args->denied!='Y') $args->denied = 'N';
2121
-			if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N';
2122
-		}
2123
-		else
2390
+			if($args->denied!='Y') {
2391
+				$args->denied = 'N';
2392
+			}
2393
+			if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) {
2394
+				$args->is_admin = 'N';
2395
+			}
2396
+		} else
2124 2397
 		{
2125 2398
 			unset($args->is_admin);
2126
-			if($is_admin == false)
2127
-				unset($args->denied);
2399
+			if($is_admin == false) {
2400
+							unset($args->denied);
2401
+			}
2128 2402
 			if($logged_info->member_srl != $args->member_srl && $is_admin == false)
2129 2403
 			{
2130 2404
 				return $this->stop('msg_invalid_request');
@@ -2132,13 +2406,19 @@  discard block
 block discarded – undo
2132 2406
 		}
2133 2407
 
2134 2408
 		// Sanitize user ID, username, nickname, homepage, blog
2135
-		if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2409
+		if($args->user_id) {
2410
+			$args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2411
+		}
2136 2412
 		$args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2137 2413
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2138 2414
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2139 2415
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2140
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
2141
-		if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog;
2416
+		if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) {
2417
+			$args->homepage = 'http://'.$args->homepage;
2418
+		}
2419
+		if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) {
2420
+			$args->blog = 'http://'.$args->blog;
2421
+		}
2142 2422
 
2143 2423
 		// check member identifier form
2144 2424
 		$config = $oMemberModel->getMemberConfig();
@@ -2155,8 +2435,7 @@  discard block
 block discarded – undo
2155 2435
 				return new Object(-1,'msg_exists_email_address');
2156 2436
 			}
2157 2437
 			$args->email_address = $orgMemberInfo->email_address;
2158
-		}
2159
-		else
2438
+		} else
2160 2439
 		{
2161 2440
 			$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
2162 2441
 			if($member_srl && $args->member_srl != $member_srl)
@@ -2213,17 +2492,26 @@  discard block
 block discarded – undo
2213 2492
 				return new Object(-1, $message[$config->password_strength]);
2214 2493
 			}
2215 2494
 			$args->password = $oMemberModel->hashPassword($args->password);
2216
-		}
2217
-		else
2495
+		} else
2218 2496
 		{
2219 2497
 			$args->password = $orgMemberInfo->password;
2220 2498
 		}
2221 2499
 
2222
-		if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name;
2223
-		if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id;
2224
-		if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name;
2225
-		if(!$args->description) $args->description = $orgMemberInfo->description;
2226
-		if(!$args->birthday) $args->birthday = '';
2500
+		if(!$args->user_name) {
2501
+			$args->user_name = $orgMemberInfo->user_name;
2502
+		}
2503
+		if(!$args->user_id) {
2504
+			$args->user_id = $orgMemberInfo->user_id;
2505
+		}
2506
+		if(!$args->nick_name) {
2507
+			$args->nick_name = $orgMemberInfo->nick_name;
2508
+		}
2509
+		if(!$args->description) {
2510
+			$args->description = $orgMemberInfo->description;
2511
+		}
2512
+		if(!$args->birthday) {
2513
+			$args->birthday = '';
2514
+		}
2227 2515
 
2228 2516
 		$output = executeQuery('member.updateMember', $args);
2229 2517
 
@@ -2235,8 +2523,11 @@  discard block
 block discarded – undo
2235 2523
 
2236 2524
 		if($args->group_srl_list)
2237 2525
 		{
2238
-			if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2239
-			else $group_srl_list = explode('|@|', $args->group_srl_list);
2526
+			if(is_array($args->group_srl_list)) {
2527
+				$group_srl_list = $args->group_srl_list;
2528
+			} else {
2529
+				$group_srl_list = explode('|@|', $args->group_srl_list);
2530
+			}
2240 2531
 			// If the group information, group information changes
2241 2532
 			if(count($group_srl_list) > 0)
2242 2533
 			{
@@ -2279,7 +2570,9 @@  discard block
 block discarded – undo
2279 2570
 		$this->_clearMemberCache($args->member_srl, $args->site_srl);
2280 2571
 
2281 2572
 		// Save Session
2282
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2573
+		if(!$this->memberInfo) {
2574
+			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2575
+		}
2283 2576
 		$logged_info = Context::get('logged_info');
2284 2577
 
2285 2578
 		$output->add('member_srl', $args->member_srl);
@@ -2305,8 +2598,7 @@  discard block
 block discarded – undo
2305 2598
 			}
2306 2599
 
2307 2600
 			$args->password = $oMemberModel->hashPassword($args->password);
2308
-		}
2309
-		else if($args->hashed_password)
2601
+		} else if($args->hashed_password)
2310 2602
 		{
2311 2603
 			$args->password = $args->hashed_password;
2312 2604
 		}
@@ -2331,7 +2623,9 @@  discard block
 block discarded – undo
2331 2623
 		$trigger_obj = new stdClass();
2332 2624
 		$trigger_obj->member_srl = $member_srl;
2333 2625
 		$output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj);
2334
-		if(!$output->toBool()) return $output;
2626
+		if(!$output->toBool()) {
2627
+			return $output;
2628
+		}
2335 2629
 		// Create a model object
2336 2630
 		$oMemberModel = getModel('member');
2337 2631
 		// Bringing the user's information
@@ -2340,9 +2634,13 @@  discard block
 block discarded – undo
2340 2634
 			$columnList = array('member_srl', 'is_admin');
2341 2635
 			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
2342 2636
 		}
2343
-		if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
2637
+		if(!$this->memberInfo) {
2638
+			return new Object(-1, 'msg_not_exists_member');
2639
+		}
2344 2640
 		// If managers can not be deleted
2345
-		if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
2641
+		if($this->memberInfo->is_admin == 'Y') {
2642
+			return new Object(-1, 'msg_cannot_delete_admin');
2643
+		}
2346 2644
 
2347 2645
 		$oDB = &DB::getInstance();
2348 2646
 		$oDB->begin();
@@ -2406,7 +2704,9 @@  discard block
 block discarded – undo
2406 2704
 	 */
2407 2705
 	function destroySessionInfo()
2408 2706
 	{
2409
-		if(!$_SESSION || !is_array($_SESSION)) return;
2707
+		if(!$_SESSION || !is_array($_SESSION)) {
2708
+			return;
2709
+		}
2410 2710
 
2411 2711
 		$memberInfo = Context::get('logged_info');
2412 2712
 		$memberSrl = $memberInfo->member_srl;
@@ -2445,8 +2745,9 @@  discard block
 block discarded – undo
2445 2745
 		}
2446 2746
 		$maxLevel = 0;
2447 2747
 		$resultGroup = array_intersect($levelGroup, $groupSrlList);
2448
-		if(count($resultGroup) > 0)
2449
-			$maxLevel = max(array_flip($resultGroup));
2748
+		if(count($resultGroup) > 0) {
2749
+					$maxLevel = max(array_flip($resultGroup));
2750
+		}
2450 2751
 
2451 2752
 		if($maxLevel > 0)
2452 2753
 		{
@@ -2463,16 +2764,22 @@  discard block
 block discarded – undo
2463 2764
 
2464 2765
 	function procMemberModifyEmailAddress()
2465 2766
 	{
2466
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
2767
+		if(!Context::get('is_logged')) {
2768
+			return $this->stop('msg_not_logged');
2769
+		}
2467 2770
 
2468 2771
 		$member_info = Context::get('logged_info');
2469 2772
 		$newEmail = Context::get('email_address');
2470 2773
 
2471
-		if(!$newEmail) return $this->stop('msg_invalid_request');
2774
+		if(!$newEmail) {
2775
+			return $this->stop('msg_invalid_request');
2776
+		}
2472 2777
 
2473 2778
 		$oMemberModel = getModel('member');
2474 2779
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
2475
-		if($member_srl) return new Object(-1,'msg_exists_email_address');
2780
+		if($member_srl) {
2781
+			return new Object(-1,'msg_exists_email_address');
2782
+		}
2476 2783
 
2477 2784
 		if($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
2478 2785
 		{
@@ -2500,7 +2807,9 @@  discard block
 block discarded – undo
2500 2807
 		$member_config = $oModuleModel->getModuleConfig('member');
2501 2808
 
2502 2809
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
2503
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2810
+		if(!is_dir($tpl_path)) {
2811
+			$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2812
+		}
2504 2813
 
2505 2814
 		global $lang;
2506 2815
 
@@ -2536,7 +2845,9 @@  discard block
 block discarded – undo
2536 2845
 	{
2537 2846
 		$member_srl = Context::get('member_srl');
2538 2847
 		$auth_key = Context::get('auth_key');
2539
-		if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
2848
+		if(!$member_srl || !$auth_key) {
2849
+			return $this->stop('msg_invalid_request');
2850
+		}
2540 2851
 
2541 2852
 		// Test logs for finding password by user_id and authkey
2542 2853
 		$args = new stdClass;
@@ -2545,7 +2856,9 @@  discard block
 block discarded – undo
2545 2856
 		$output = executeQuery('member.getAuthMail', $args);
2546 2857
 		if(!$output->toBool() || $output->data->auth_key != $auth_key)
2547 2858
 		{
2548
-			if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args);
2859
+			if(strlen($output->data->auth_key) !== strlen($auth_key)) {
2860
+				executeQuery('member.deleteAuthChangeEmailAddress', $args);
2861
+			}
2549 2862
 			return $this->stop('msg_invalid_modify_email_auth_key');
2550 2863
 		}
2551 2864
 
@@ -2554,7 +2867,9 @@  discard block
 block discarded – undo
2554 2867
 		list($args->email_id, $args->email_host) = explode('@', $newEmail);
2555 2868
 
2556 2869
 		$output = executeQuery('member.updateMemberEmailAddress', $args);
2557
-		if(!$output->toBool()) return $this->stop($output->getMessage());
2870
+		if(!$output->toBool()) {
2871
+			return $this->stop($output->getMessage());
2872
+		}
2558 2873
 
2559 2874
 		// Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table
2560 2875
 		executeQuery('member.deleteAuthChangeEmailAddress',$args);
@@ -2575,7 +2890,9 @@  discard block
 block discarded – undo
2575 2890
 	**/
2576 2891
 	function triggerGetDocumentMenu(&$menu_list)
2577 2892
 	{
2578
-		if(!Context::get('is_logged')) return new Object();
2893
+		if(!Context::get('is_logged')) {
2894
+			return new Object();
2895
+		}
2579 2896
 
2580 2897
 		$logged_info = Context::get('logged_info');
2581 2898
 		$document_srl = Context::get('target_srl');
@@ -2586,8 +2903,12 @@  discard block
 block discarded – undo
2586 2903
 		$member_srl = $oDocument->get('member_srl');
2587 2904
 		$module_srl = $oDocument->get('module_srl');
2588 2905
 
2589
-		if(!$member_srl) return new Object();
2590
-		if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2906
+		if(!$member_srl) {
2907
+			return new Object();
2908
+		}
2909
+		if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) {
2910
+			return new Object();
2911
+		}
2591 2912
 
2592 2913
 		$oDocumentController = getController('document');
2593 2914
 		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
@@ -2605,7 +2926,9 @@  discard block
 block discarded – undo
2605 2926
 	**/
2606 2927
 	function triggerGetCommentMenu(&$menu_list)
2607 2928
 	{
2608
-		if(!Context::get('is_logged')) return new Object();
2929
+		if(!Context::get('is_logged')) {
2930
+			return new Object();
2931
+		}
2609 2932
 
2610 2933
 		$logged_info = Context::get('logged_info');
2611 2934
 		$comment_srl = Context::get('target_srl');
@@ -2616,8 +2939,12 @@  discard block
 block discarded – undo
2616 2939
 		$module_srl = $oComment->get('module_srl');
2617 2940
 		$member_srl = $oComment->get('member_srl');
2618 2941
 
2619
-		if(!$member_srl) return new Object();
2620
-		if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2942
+		if(!$member_srl) {
2943
+			return new Object();
2944
+		}
2945
+		if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) {
2946
+			return new Object();
2947
+		}
2621 2948
 
2622 2949
 		$oCommentController = getController('comment');
2623 2950
 		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
@@ -2633,7 +2960,9 @@  discard block
 block discarded – undo
2633 2960
 	**/
2634 2961
 	function procMemberSpammerManage()
2635 2962
 	{
2636
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2963
+		if(!Context::get('is_logged')) {
2964
+			return new Object(-1,'msg_not_permitted');
2965
+		}
2637 2966
 
2638 2967
 		$logged_info = Context::get('logged_info');
2639 2968
 		$member_srl = Context::get('member_srl');
@@ -2641,8 +2970,9 @@  discard block
 block discarded – undo
2641 2970
 		$cnt_loop = Context::get('cnt_loop');
2642 2971
 		$proc_type = Context::get('proc_type');
2643 2972
 		$isMoveToTrash = true;
2644
-		if($proc_type == "delete")
2645
-			$isMoveToTrash = false;
2973
+		if($proc_type == "delete") {
2974
+					$isMoveToTrash = false;
2975
+		}
2646 2976
 
2647 2977
 		// check grant
2648 2978
 		$oModuleModel = getModel('module');
@@ -2650,7 +2980,9 @@  discard block
 block discarded – undo
2650 2980
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
2651 2981
 		$grant = $oModuleModel->getGrant($module_info, $logged_info);
2652 2982
 
2653
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2983
+		if(!$grant->manager) {
2984
+			return new Object(-1,'msg_not_permitted');
2985
+		}
2654 2986
 
2655 2987
 		$proc_msg = "";
2656 2988
 
@@ -2659,11 +2991,13 @@  discard block
 block discarded – undo
2659 2991
 
2660 2992
 		// delete or trash destination
2661 2993
 		// proc member
2662
-		if($cnt_loop == 1)
2663
-			$this->_spammerMember($member_srl);
2994
+		if($cnt_loop == 1) {
2995
+					$this->_spammerMember($member_srl);
2996
+		}
2664 2997
 		// proc document and comment
2665
-		elseif($cnt_loop>1)
2666
-			$this->_spammerDocuments($member_srl, $isMoveToTrash);
2998
+		elseif($cnt_loop>1) {
2999
+					$this->_spammerDocuments($member_srl, $isMoveToTrash);
3000
+		}
2667 3001
 
2668 3002
 		// get destination count
2669 3003
 		$cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl);
@@ -2671,13 +3005,16 @@  discard block
 block discarded – undo
2671 3005
 
2672 3006
 		$total_count = Context::get('total_count');
2673 3007
 		$remain_count = $cnt_document + $cnt_comment;
2674
-		if($cnt_loop == 1) $total_count = $remain_count;
3008
+		if($cnt_loop == 1) {
3009
+			$total_count = $remain_count;
3010
+		}
2675 3011
 
2676 3012
 		// get progress percent
2677
-		if($total_count > 0)
2678
-			$progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 );
2679
-		else
2680
-			$progress = 100;
3013
+		if($total_count > 0) {
3014
+					$progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 );
3015
+		} else {
3016
+					$progress = 100;
3017
+		}
2681 3018
 
2682 3019
 		$this->add('total_count', $total_count);
2683 3020
 		$this->add('remain_count', $remain_count);
@@ -2719,7 +3056,10 @@  discard block
 block discarded – undo
2719 3056
 		$args->nick_name = $member_info->nick_name;
2720 3057
 		$args->denied = "Y";
2721 3058
 		$args->description = trim( $member_info->description );
2722
-		if( $args->description != "" ) $args->description .= "\n";	// add new line
3059
+		if( $args->description != "" ) {
3060
+			$args->description .= "\n";
3061
+		}
3062
+		// add new line
2723 3063
 
2724 3064
 		$args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]";
2725 3065
 
@@ -2764,8 +3104,11 @@  discard block
 block discarded – undo
2764 3104
 			$documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount);
2765 3105
 			if($documentList) {
2766 3106
 				foreach($documentList as $v) {
2767
-					if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v);
2768
-					else $oDocumentController->deleteDocument($v->document_srl);
3107
+					if($isMoveToTrash) {
3108
+						$oDocumentController->moveDocumentToTrash($v);
3109
+					} else {
3110
+						$oDocumentController->deleteDocument($v->document_srl);
3111
+					}
2769 3112
 				}
2770 3113
 			}
2771 3114
 		}
Please login to merge, or discard this patch.