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
Pull Request — develop (#1814)
by
unknown
13:41
created
modules/member/member.model.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -297,6 +297,7 @@
 block discarded – undo
297 297
 
298 298
 	/**
299 299
 	 * @brief Return member information with member_srl
300
+	 * @param string $member_srl
300 301
 	 */
301 302
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
302 303
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  memberModel
5
- * @author NAVER ([email protected])
6
- * @brief Model class of the member module
7
- */
4
+	 * @class  memberModel
5
+	 * @author NAVER ([email protected])
6
+	 * @brief Model class of the member module
7
+	 */
8 8
 class memberModel extends member
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 		static $member_config;
28 28
 
29
-		if($member_config)
29
+		if ($member_config)
30 30
 		{
31 31
 			return $member_config;
32 32
 		}
@@ -35,42 +35,42 @@  discard block
 block discarded – undo
35 35
 		$oModuleModel = getModel('module');
36 36
 		$config = $oModuleModel->getModuleConfig('member');
37 37
 
38
-		if(!$config->signupForm || !is_array($config->signupForm))
38
+		if (!$config->signupForm || !is_array($config->signupForm))
39 39
 		{
40 40
 			$oMemberAdminController = getAdminController('member');
41 41
 			$identifier = ($config->identifier) ? $config->identifier : 'email_address';
42 42
 			$config->signupForm = $oMemberAdminController->createSignupForm($identifier);
43 43
 		}
44 44
 		//for multi language
45
-		foreach($config->signupForm AS $key=>$value)
45
+		foreach ($config->signupForm AS $key=>$value)
46 46
 		{
47 47
 			$config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title;
48
-			if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
-			if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
48
+			if ($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
+			if ($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
50 50
 		}
51 51
 
52 52
 		// Get terms of user
53 53
 		$config->agreement = memberModel::_getAgreement();
54 54
 
55
-		if(!$config->webmaster_name) $config->webmaster_name = 'webmaster';
56
-		if(!$config->image_name_max_width) $config->image_name_max_width = 90;
57
-		if(!$config->image_name_max_height) $config->image_name_max_height = 20;
58
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = 20;
59
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = 20;
60
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = 90;
61
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = 90;
62
-		if(!$config->skin) $config->skin = 'default';
63
-		if(!$config->colorset) $config->colorset = 'white';
64
-		if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
65
-		if(!$config->group_image_mark) $config->group_image_mark = "N";
55
+		if (!$config->webmaster_name) $config->webmaster_name = 'webmaster';
56
+		if (!$config->image_name_max_width) $config->image_name_max_width = 90;
57
+		if (!$config->image_name_max_height) $config->image_name_max_height = 20;
58
+		if (!$config->image_mark_max_width) $config->image_mark_max_width = 20;
59
+		if (!$config->image_mark_max_height) $config->image_mark_max_height = 20;
60
+		if (!$config->profile_image_max_width) $config->profile_image_max_width = 90;
61
+		if (!$config->profile_image_max_height) $config->profile_image_max_height = 90;
62
+		if (!$config->skin) $config->skin = 'default';
63
+		if (!$config->colorset) $config->colorset = 'white';
64
+		if (!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
65
+		if (!$config->group_image_mark) $config->group_image_mark = "N";
66 66
 
67
-		if(!$config->identifier) $config->identifier = 'user_id';
67
+		if (!$config->identifier) $config->identifier = 'user_id';
68 68
 
69
-		if(!$config->max_error_count) $config->max_error_count = 10;
70
-		if(!$config->max_error_count_time) $config->max_error_count_time = 300;
69
+		if (!$config->max_error_count) $config->max_error_count = 10;
70
+		if (!$config->max_error_count_time) $config->max_error_count_time = 300;
71 71
 
72
-		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
73
-		if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
72
+		if (!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
73
+		if (!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
74 74
 
75 75
 		$member_config = $config;
76 76
 
@@ -79,24 +79,24 @@  discard block
 block discarded – undo
79 79
 
80 80
 	function _getAgreement()
81 81
 	{
82
-		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
83
-		if(is_readable($agreement_file))
82
+		$agreement_file = _XE_PATH_ . 'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
83
+		if (is_readable($agreement_file))
84 84
 		{
85 85
 			return FileHandler::readFile($agreement_file);
86 86
 		}
87 87
 
88 88
 		$db_info = Context::getDBInfo();
89
-		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt';
90
-		if(is_readable($agreement_file))
89
+		$agreement_file = _XE_PATH_ . 'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt';
90
+		if (is_readable($agreement_file))
91 91
 		{
92 92
 			return FileHandler::readFile($agreement_file);
93 93
 		}
94 94
 
95 95
 		$lang_selected = Context::loadLangSelected();
96
-		foreach($lang_selected as $key => $val)
96
+		foreach ($lang_selected as $key => $val)
97 97
 		{
98
-			$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $key . '.txt';
99
-			if(is_readable($agreement_file))
98
+			$agreement_file = _XE_PATH_ . 'files/member_extra_info/agreement_' . $key . '.txt';
99
+			if (is_readable($agreement_file))
100 100
 			{
101 101
 				return FileHandler::readFile($agreement_file);
102 102
 			}
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 		$logged_info = Context::get('logged_info');
117 117
 		$act = Context::get('cur_act');
118 118
 		// When click user's own nickname
119
-		if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
119
+		if ($member_srl == $logged_info->member_srl) $member_info = $logged_info;
120 120
 		// When click other's nickname
121 121
 		else $member_info = $this->getMemberInfoByMemberSrl($member_srl);
122 122
 
123 123
 		$member_srl = $member_info->member_srl;
124
-		if(!$member_srl) return;
124
+		if (!$member_srl) return;
125 125
 		// List variables
126 126
 		$user_id = $member_info->user_id;
127 127
 		$user_name = $member_info->user_name;
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$oMemberController = getController('member');
132 132
 		// Display member information (Don't display to non-logged user)
133
-		if($logged_info->member_srl)
133
+		if ($logged_info->member_srl)
134 134
 		{
135
-			$url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl);
136
-			$oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self');
135
+			$url = getUrl('', 'mid', $mid, 'act', 'dispMemberInfo', 'member_srl', $member_srl);
136
+			$oMemberController->addMemberPopupMenu($url, 'cmd_view_member_info', $icon_path, 'self');
137 137
 		}
138 138
 		// When click other's nickname
139
-		if($member_srl != $logged_info->member_srl && $logged_info->member_srl)
139
+		if ($member_srl != $logged_info->member_srl && $logged_info->member_srl)
140 140
 		{
141 141
 			// Get email config
142
-			foreach($this->module_config->signupForm as $field)
142
+			foreach ($this->module_config->signupForm as $field)
143 143
 			{
144
-				if($field->name == 'email_address')
144
+				if ($field->name == 'email_address')
145 145
 				{
146 146
 					$email_config = $field;
147 147
 					break;
@@ -149,36 +149,36 @@  discard block
 block discarded – undo
149 149
 			}
150 150
 
151 151
 			// Send an email only if email address is public
152
-			if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address)
152
+			if (($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address)
153 153
 			{
154
-				$url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
155
-				$oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path);
154
+				$url = 'mailto:' . htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
155
+				$oMemberController->addMemberPopupMenu($url, 'cmd_send_email', $icon_path);
156 156
 			}
157 157
 		}
158 158
 		// View homepage info
159
-		if($member_info->homepage)
159
+		if ($member_info->homepage)
160 160
 			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
161 161
 		// View blog info
162
-		if($member_info->blog)
162
+		if ($member_info->blog)
163 163
 			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
164 164
 		// Call a trigger (after)
165 165
 		ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null);
166 166
 		// Display a menu for editting member info to a top administrator
167
-		if($logged_info->is_admin == 'Y')
167
+		if ($logged_info->is_admin == 'Y')
168 168
 		{
169
-			$url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl);
170
-			$oMemberController->addMemberPopupMenu($url,'cmd_manage_member_info',$icon_path,'MemberModifyInfo');
169
+			$url = getUrl('', 'module', 'admin', 'act', 'dispMemberAdminInsert', 'member_srl', $member_srl);
170
+			$oMemberController->addMemberPopupMenu($url, 'cmd_manage_member_info', $icon_path, 'MemberModifyInfo');
171 171
 
172
-			$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl);
173
-			$oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument');
172
+			$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl);
173
+			$oMemberController->addMemberPopupMenu($url, 'cmd_trace_document', $icon_path, 'TraceMemberDocument');
174 174
 
175
-			$url = getUrl('','module','admin','act','dispCommentAdminList','search_target','member_srl','search_keyword',$member_srl);
176
-			$oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment');
175
+			$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl);
176
+			$oMemberController->addMemberPopupMenu($url, 'cmd_trace_comment', $icon_path, 'TraceMemberComment');
177 177
 		}
178 178
 		// Change a language of pop-up menu
179 179
 		$menus = Context::get('member_popup_menu_list');
180 180
 		$menus_count = count($menus);
181
-		for($i=0;$i<$menus_count;$i++)
181
+		for ($i = 0; $i < $menus_count; $i++)
182 182
 		{
183 183
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
184 184
 		}
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 	 * @brief Check if logged-in
191 191
 	 */
192 192
 	function isLogged() {
193
-		if($_SESSION['is_logged'])
193
+		if ($_SESSION['is_logged'])
194 194
 		{
195
-			if(Mobile::isFromMobilePhone())
195
+			if (Mobile::isFromMobilePhone())
196 196
 			{
197 197
 				return true;
198 198
 			}
199 199
 			else
200 200
 			{
201
-				if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
201
+				if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
202 202
 				{
203 203
 					return true;
204 204
 				}
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 	function getLoggedInfo()
216 216
 	{
217 217
 		// Return session info if session info is requested and the user is logged-in
218
-		if($this->isLogged())
218
+		if ($this->isLogged())
219 219
 		{
220 220
 			$logged_info = Context::get('logged_info');
221 221
 			// Admin/Group list defined depending on site_module_info
222 222
 			$site_module_info = Context::get('site_module_info');
223
-			if($site_module_info->site_srl)
223
+			if ($site_module_info->site_srl)
224 224
 			{
225 225
 				$logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl);
226 226
 				// Add is_site_admin bool variable into logged_info if site_administrator is
227 227
 				$oModuleModel = getModel('module');
228
-				if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
228
+				if ($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
229 229
 				else $logged_info->is_site_admin = false;
230 230
 			}
231 231
 			else
232 232
 			{
233 233
 				// Register a default group if the site doesn't have a member group
234
-				if(count($logged_info->group_list) === 0)
234
+				if (count($logged_info->group_list) === 0)
235 235
 				{
236 236
 					$default_group = $this->getDefaultGroup(0);
237 237
 					$oMemberController = getController('member');
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	function getMemberInfoByUserID($user_id, $columnList = array())
256 256
 	{
257
-		if(!$user_id) return;
257
+		if (!$user_id) return;
258 258
 
259 259
 		$args = new stdClass;
260 260
 		$args->user_id = $user_id;
261 261
 		$output = executeQuery('member.getMemberInfo', $args);
262
-		if(!$output->toBool()) return $output;
263
-		if(!$output->data) return;
262
+		if (!$output->toBool()) return $output;
263
+		if (!$output->data) return;
264 264
 
265 265
 		$member_info = $this->arrangeMemberInfo($output->data);
266 266
 
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	function getMemberInfoByEmailAddress($email_address)
274 274
 	{
275
-		if(!$email_address) return;
275
+		if (!$email_address) return;
276 276
 
277 277
 		$args = new stdClass();
278 278
 		
279
-		$db_info = Context::getDBInfo ();
280
-		if($db_info->master_db['db_type'] == "cubrid")
279
+		$db_info = Context::getDBInfo();
280
+		if ($db_info->master_db['db_type'] == "cubrid")
281 281
 		{
282 282
 			$args->email_address = strtolower($email_address);
283 283
 			$output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args);
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 			$output = executeQuery('member.getMemberInfoByEmailAddress', $args);
289 289
 		}
290 290
 		
291
-		if(!$output->toBool()) return $output;
292
-		if(!$output->data) return;
291
+		if (!$output->toBool()) return $output;
292
+		if (!$output->data) return;
293 293
 
294 294
 		$member_info = $this->arrangeMemberInfo($output->data);
295 295
 		return $member_info;
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
302 302
 	{
303
-		if(!$member_srl) return;
303
+		if (!$member_srl) return;
304 304
 
305 305
 		//columnList size zero... get full member info
306
-		if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
306
+		if (!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
307 307
 		{
308 308
 			$GLOBALS['__member_info__'][$member_srl] = false;
309 309
 
310 310
 			$oCacheHandler = CacheHandler::getInstance('object');
311
-			if($oCacheHandler->isSupport())
311
+			if ($oCacheHandler->isSupport())
312 312
 			{
313 313
 				$columnList = array();
314 314
 				$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 				$GLOBALS['__member_info__'][$member_srl] = $oCacheHandler->get($cache_key);
317 317
 			}
318 318
 
319
-			if($GLOBALS['__member_info__'][$member_srl] === false)
319
+			if ($GLOBALS['__member_info__'][$member_srl] === false)
320 320
 			{
321 321
 				$args = new stdClass();
322 322
 				$args->member_srl = $member_srl;
323 323
 				$output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList);
324
-				if(!$output->data) 
324
+				if (!$output->data) 
325 325
 				{
326
-					if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
326
+					if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
327 327
 					return;
328 328
 				}
329 329
 				$this->arrangeMemberInfo($output->data, $site_srl);
330 330
 
331 331
 				//insert in cache
332
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
332
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
333 333
 			}
334 334
 		}
335 335
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	function arrangeMemberInfo($info, $site_srl = 0)
343 343
 	{
344
-		if(!$GLOBALS['__member_info__'][$info->member_srl])
344
+		if (!$GLOBALS['__member_info__'][$info->member_srl])
345 345
 		{
346 346
 			$oModuleModel = getModel('module');
347 347
 			$config = $oModuleModel->getModuleConfig('member');
@@ -350,25 +350,25 @@  discard block
 block discarded – undo
350 350
 			$info->profile_image = $this->getProfileImage($info->member_srl);
351 351
 			$info->image_name = $this->getImageName($info->member_srl);
352 352
 			$info->image_mark = $this->getImageMark($info->member_srl);
353
-			if($config->group_image_mark=='Y')
353
+			if ($config->group_image_mark == 'Y')
354 354
 			{
355
-				$info->group_mark = $this->getGroupImageMark($info->member_srl,$site_srl);
355
+				$info->group_mark = $this->getGroupImageMark($info->member_srl, $site_srl);
356 356
 			}
357 357
 			$info->signature = $this->getSignature($info->member_srl);
358 358
 			$info->group_list = $this->getMemberGroups($info->member_srl, $site_srl);
359 359
 
360 360
 			$extra_vars = unserialize($info->extra_vars);
361 361
 			unset($info->extra_vars);
362
-			if($extra_vars)
362
+			if ($extra_vars)
363 363
 			{
364
-				foreach($extra_vars as $key => $val)
364
+				foreach ($extra_vars as $key => $val)
365 365
 				{
366
-					if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
367
-					if(!$info->{$key}) $info->{$key} = $val;
366
+					if (!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
367
+					if (!$info->{$key}) $info->{$key} = $val;
368 368
 				}
369 369
 			}
370 370
 
371
-			if(strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer))
371
+			if (strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer))
372 372
 			{
373 373
 				$info->find_account_answer = null;
374 374
 			}
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
 			$info->homepage = strip_tags($info->homepage);
381 381
 			$info->blog = strip_tags($info->blog);
382 382
 
383
-			if($extra_vars)
383
+			if ($extra_vars)
384 384
 			{
385
-				foreach($extra_vars as $key => $val)
385
+				foreach ($extra_vars as $key => $val)
386 386
 				{
387
-					if(is_array($val))
387
+					if (is_array($val))
388 388
 					{
389 389
 						$oSecurity->encodeHTML($key . '.');
390 390
 					}
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 
398 398
 			// Check format.
399 399
 			$oValidator = new Validator();
400
-			if(!$oValidator->applyRule('url', $info->homepage))
400
+			if (!$oValidator->applyRule('url', $info->homepage))
401 401
 			{
402 402
 				$info->homepage = '';
403 403
 			}
404 404
 
405
-			if(!$oValidator->applyRule('url', $info->blog))
405
+			if (!$oValidator->applyRule('url', $info->blog))
406 406
 			{
407 407
 				$info->blog = '';
408 408
 			}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getLoggedMemberSrl()
453 453
 	{
454
-		if(!$this->isLogged()) return;
454
+		if (!$this->isLogged()) return;
455 455
 		return $_SESSION['member_srl'];
456 456
 	}
457 457
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	function getLoggedUserID()
462 462
 	{
463
-		if(!$this->isLogged()) return;
463
+		if (!$this->isLogged()) return;
464 464
 		$logged_info = Context::get('logged_info');
465 465
 		return $logged_info->user_id;
466 466
 	}
@@ -475,16 +475,16 @@  discard block
 block discarded – undo
475 475
 		// cache controll
476 476
 		$group_list = false;
477 477
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
478
-		if($oCacheHandler->isSupport())
478
+		if ($oCacheHandler->isSupport())
479 479
 		{
480
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_'.$site_srl;
480
+			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl;
481 481
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
482 482
 			$group_list = $oCacheHandler->get($cache_key);
483 483
 		}
484 484
 
485
-		if(!$member_groups[$member_srl][$site_srl] || $force_reload)
485
+		if (!$member_groups[$member_srl][$site_srl] || $force_reload)
486 486
 		{
487
-			if($group_list === false)
487
+			if ($group_list === false)
488 488
 			{
489 489
 				$args = new stdClass();
490 490
 				$args->member_srl = $member_srl;
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 				$output = executeQueryArray('member.getMemberGroups', $args);
493 493
 				$group_list = $output->data;
494 494
 				//insert in cache
495
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
495
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
496 496
 			}
497
-			if(!$group_list) return array();
497
+			if (!$group_list) return array();
498 498
 
499
-			foreach($group_list as $group)
499
+			foreach ($group_list as $group)
500 500
 			{
501 501
 				$result[$group->group_srl] = $group->title;
502 502
 			}
@@ -510,14 +510,14 @@  discard block
 block discarded – undo
510 510
 	 */
511 511
 	function getMembersGroups($member_srls, $site_srl = 0)
512 512
 	{
513
-		$args->member_srls = implode(',',$member_srls);
513
+		$args->member_srls = implode(',', $member_srls);
514 514
 		$args->site_srl = $site_srl;
515 515
 		$args->sort_index = 'list_order';
516 516
 		$output = executeQueryArray('member.getMembersGroups', $args);
517
-		if(!$output->data) return array();
517
+		if (!$output->data) return array();
518 518
 
519 519
 		$result = array();
520
-		foreach($output->data as $key=>$val)
520
+		foreach ($output->data as $key=>$val)
521 521
 		{
522 522
 			$result[$val->member_srl][] = $val->title;
523 523
 		}
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	{
532 532
 		$default_group = false;
533 533
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
534
-		if($oCacheHandler->isSupport())
534
+		if ($oCacheHandler->isSupport())
535 535
 		{
536 536
 			$columnList = array();
537 537
 			$object_key = 'default_group_' . $site_srl;
@@ -539,13 +539,13 @@  discard block
 block discarded – undo
539 539
 			$default_group = $oCacheHandler->get($cache_key);
540 540
 		}
541 541
 
542
-		if($default_group === false)
542
+		if ($default_group === false)
543 543
 		{
544 544
 			$args = new stdClass();
545 545
 			$args->site_srl = $site_srl;
546 546
 			$output = executeQuery('member.getDefaultGroup', $args, $columnList);
547 547
 			$default_group = $output->data;
548
-			if($oCacheHandler->isSupport())
548
+			if ($oCacheHandler->isSupport())
549 549
 			{
550 550
 				$oCacheHandler->put($cache_key, $default_group);
551 551
 			}
@@ -579,25 +579,25 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	function getGroups($site_srl = 0)
581 581
 	{
582
-		if(!$GLOBALS['__group_info__'][$site_srl])
582
+		if (!$GLOBALS['__group_info__'][$site_srl])
583 583
 		{
584 584
 			$result = array();
585 585
 
586
-			if(!isset($site_srl))
586
+			if (!isset($site_srl))
587 587
 			{
588 588
 				$site_srl = 0;
589 589
 			}
590 590
 
591 591
 			$group_list = false;
592 592
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
593
-			if($oCacheHandler->isSupport())
593
+			if ($oCacheHandler->isSupport())
594 594
 			{
595
-				$object_key = 'member_groups:site_'.$site_srl;
595
+				$object_key = 'member_groups:site_' . $site_srl;
596 596
 				$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
597 597
 				$group_list = $oCacheHandler->get($cache_key);
598 598
 			}
599 599
 
600
-			if($group_list === false)
600
+			if ($group_list === false)
601 601
 			{
602 602
 				$args = new stdClass();
603 603
 				$args->site_srl = $site_srl;
@@ -606,16 +606,16 @@  discard block
 block discarded – undo
606 606
 				$output = executeQueryArray('member.getGroups', $args);
607 607
 				$group_list = $output->data;
608 608
 				//insert in cache
609
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
609
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
610 610
 			}
611 611
 
612
-			if(!$group_list)
612
+			if (!$group_list)
613 613
 			{
614 614
 				return array();
615 615
 			}
616 616
 
617 617
 
618
-			foreach($group_list as $val)
618
+			foreach ($group_list as $val)
619 619
 			{
620 620
 				$result[$val->group_srl] = $val;
621 621
 			}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		// Set to ignore if a super administrator.
647 647
 		$logged_info = Context::get('logged_info');
648 648
 
649
-		if(!$this->join_form_list)
649
+		if (!$this->join_form_list)
650 650
 		{
651 651
 			// Argument setting to sort list_order column
652 652
 			$args = new stdClass();
@@ -654,11 +654,11 @@  discard block
 block discarded – undo
654 654
 			$output = executeQuery('member.getJoinFormList', $args);
655 655
 			// NULL if output data deosn't exist
656 656
 			$join_form_list = $output->data;
657
-			if(!$join_form_list) return NULL;
657
+			if (!$join_form_list) return NULL;
658 658
 			// Need to unserialize because serialized array is inserted into DB in case of default_value
659
-			if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
659
+			if (!is_array($join_form_list)) $join_form_list = array($join_form_list);
660 660
 			$join_form_count = count($join_form_list);
661
-			for($i=0;$i<$join_form_count;$i++)
661
+			for ($i = 0; $i < $join_form_count; $i++)
662 662
 			{
663 663
 				$join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name);
664 664
 
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 				// Add language variable
671 671
 				$lang->extend_vars[$column_name] = $column_title;
672 672
 				// unserialize if the data type if checkbox, select and so on
673
-				if(in_array($column_type, array('checkbox','select','radio')))
673
+				if (in_array($column_type, array('checkbox', 'select', 'radio')))
674 674
 				{
675 675
 					$join_form_list[$i]->default_value = unserialize($default_value);
676
-					if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
676
+					if (!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
677 677
 				}
678 678
 				else
679 679
 				{
@@ -685,21 +685,21 @@  discard block
 block discarded – undo
685 685
 			$this->join_form_list = $list;
686 686
 		}
687 687
 		// Get object style if the filter_response is true
688
-		if($filter_response && count($this->join_form_list))
688
+		if ($filter_response && count($this->join_form_list))
689 689
 		{
690
-			foreach($this->join_form_list as $key => $val)
690
+			foreach ($this->join_form_list as $key => $val)
691 691
 			{
692
-				if($val->is_active != 'Y') continue;
692
+				if ($val->is_active != 'Y') continue;
693 693
 				unset($obj);
694 694
 				$obj->type = $val->column_type;
695 695
 				$obj->name = $val->column_name;
696 696
 				$obj->lang = $val->column_title;
697
-				if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false;
697
+				if ($logged_info->is_admin != 'Y') $obj->required = $val->required == 'Y' ? true : false;
698 698
 				else $obj->required = false;
699 699
 				$filter_output[] = $obj;
700 700
 
701 701
 				unset($open_obj);
702
-				$open_obj->name = 'open_'.$val->column_name;
702
+				$open_obj->name = 'open_' . $val->column_name;
703 703
 				$open_obj->required = false;
704 704
 				$filter_output[] = $open_obj;
705 705
 
@@ -721,15 +721,15 @@  discard block
 block discarded – undo
721 721
 		$args->sort_index = "list_order";
722 722
 		$output = executeQueryArray('member.getJoinFormList', $args);
723 723
 
724
-		if(!$output->toBool())
724
+		if (!$output->toBool())
725 725
 		{
726 726
 			return array();
727 727
 		}
728 728
 
729 729
 		$joinFormList = array();
730
-		foreach($output->data as $val)
730
+		foreach ($output->data as $val)
731 731
 		{
732
-			if($val->is_active != 'Y')
732
+			if ($val->is_active != 'Y')
733 733
 			{
734 734
 				continue;
735 735
 			}
@@ -746,20 +746,20 @@  discard block
 block discarded – undo
746 746
 	function getCombineJoinForm($member_info)
747 747
 	{
748 748
 		$extend_form_list = $this->getJoinFormlist();
749
-		if(!$extend_form_list) return;
749
+		if (!$extend_form_list) return;
750 750
 		// Member info is open only to an administrator and him/herself when is_private is true.
751 751
 		$logged_info = Context::get('logged_info');
752 752
 
753
-		foreach($extend_form_list as $srl => $item)
753
+		foreach ($extend_form_list as $srl => $item)
754 754
 		{
755 755
 			$column_name = $item->column_name;
756 756
 			$value = $member_info->{$column_name};
757 757
 
758 758
 			// Change values depening on the type of extend form
759
-			switch($item->column_type)
759
+			switch ($item->column_type)
760 760
 			{
761 761
 				case 'checkbox' :
762
-					if($value && !is_array($value)) $value = array($value);
762
+					if ($value && !is_array($value)) $value = array($value);
763 763
 					break;
764 764
 				case 'text' :
765 765
 				case 'homepage' :
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 
774 774
 			$extend_form_list[$srl]->value = $value;
775 775
 
776
-			if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true;
776
+			if ($member_info->{'open_' . $column_name} == 'Y') $extend_form_list[$srl]->is_opened = true;
777 777
 			else $extend_form_list[$srl]->is_opened = false;
778 778
 		}
779 779
 		return $extend_form_list;
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
 		$args->member_join_form_srl = $member_join_form_srl;
788 788
 		$output = executeQuery('member.getJoinForm', $args);
789 789
 		$join_form = $output->data;
790
-		if(!$join_form) return NULL;
790
+		if (!$join_form) return NULL;
791 791
 
792 792
 		$column_type = $join_form->column_type;
793 793
 		$default_value = $join_form->default_value;
794 794
 
795
-		if(in_array($column_type, array('checkbox','select','radio')))
795
+		if (in_array($column_type, array('checkbox', 'select', 'radio')))
796 796
 		{
797 797
 			$join_form->default_value = unserialize($default_value);
798 798
 		}
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 */
810 810
 	function getDeniedIDList()
811 811
 	{
812
-		if(!$this->denied_id_list)
812
+		if (!$this->denied_id_list)
813 813
 		{
814 814
 			$args->sort_index = "list_order";
815 815
 			$args->page = Context::get('page');
@@ -825,14 +825,14 @@  discard block
 block discarded – undo
825 825
 	function getDeniedIDs()
826 826
 	{
827 827
 		$output = executeQueryArray('member.getDeniedIDs');
828
-		if(!$output->toBool()) return array();
828
+		if (!$output->toBool()) return array();
829 829
 		return $output->data;
830 830
 	}
831 831
 
832 832
 	function getDeniedNickNames()
833 833
 	{
834 834
 		$output = executeQueryArray('member.getDeniedNickNames');
835
-		if(!$output->toBool())
835
+		if (!$output->toBool())
836 836
 		{
837 837
 			return array();
838 838
 		}
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 		$args = new stdClass();
849 849
 		$args->user_id = $user_id;
850 850
 		$output = executeQuery('member.chkDeniedID', $args);
851
-		if($output->data->count) return true;
851
+		if ($output->data->count) return true;
852 852
 		return false;
853 853
 	}
854 854
 
@@ -860,8 +860,8 @@  discard block
 block discarded – undo
860 860
 		$args = new stdClass();
861 861
 		$args->nick_name = $nickName;
862 862
 		$output = executeQuery('member.chkDeniedNickName', $args);
863
-		if($output->data->count) return true;
864
-		if(!$output->toBool())
863
+		if ($output->data->count) return true;
864
+		if (!$output->toBool())
865 865
 		{
866 866
 			return true;
867 867
 		}
@@ -872,21 +872,21 @@  discard block
 block discarded – undo
872 872
 	 */
873 873
 	function getProfileImage($member_srl)
874 874
 	{
875
-		if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl]))
875
+		if (!isset($GLOBALS['__member_info__']['profile_image'][$member_srl]))
876 876
 		{
877 877
 			$GLOBALS['__member_info__']['profile_image'][$member_srl] = null;
878
-			$exts = array('gif','jpg','png');
879
-			for($i=0;$i<3;$i++)
878
+			$exts = array('gif', 'jpg', 'png');
879
+			for ($i = 0; $i < 3; $i++)
880 880
 			{
881 881
 				$image_name_file = sprintf('files/member_extra_info/profile_image/%s%d.%s', getNumberingPath($member_srl), $member_srl, $exts[$i]);
882
-				if(file_exists($image_name_file))
882
+				if (file_exists($image_name_file))
883 883
 				{
884 884
 					list($width, $height, $type, $attrs) = getimagesize($image_name_file);
885 885
 					$info = new stdClass();
886 886
 					$info->width = $width;
887 887
 					$info->height = $height;
888
-					$info->src = Context::getRequestUri().$image_name_file;
889
-					$info->file = './'.$image_name_file;
888
+					$info->src = Context::getRequestUri() . $image_name_file;
889
+					$info->file = './' . $image_name_file;
890 890
 					$GLOBALS['__member_info__']['profile_image'][$member_srl] = $info;
891 891
 					break;
892 892
 				}
@@ -901,17 +901,17 @@  discard block
 block discarded – undo
901 901
 	 */
902 902
 	function getImageName($member_srl)
903 903
 	{
904
-		if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl]))
904
+		if (!isset($GLOBALS['__member_info__']['image_name'][$member_srl]))
905 905
 		{
906 906
 			$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
907
-			if(file_exists($image_name_file))
907
+			if (file_exists($image_name_file))
908 908
 			{
909 909
 				list($width, $height, $type, $attrs) = getimagesize($image_name_file);
910 910
 				$info = new stdClass;
911 911
 				$info->width = $width;
912 912
 				$info->height = $height;
913
-				$info->src = Context::getRequestUri().$image_name_file;
914
-				$info->file = './'.$image_name_file;
913
+				$info->src = Context::getRequestUri() . $image_name_file;
914
+				$info->file = './' . $image_name_file;
915 915
 				$GLOBALS['__member_info__']['image_name'][$member_srl] = $info;
916 916
 			}
917 917
 			else $GLOBALS['__member_info__']['image_name'][$member_srl] = null;
@@ -924,16 +924,16 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function getImageMark($member_srl)
926 926
 	{
927
-		if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl]))
927
+		if (!isset($GLOBALS['__member_info__']['image_mark'][$member_srl]))
928 928
 		{
929 929
 			$image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
930
-			if(file_exists($image_mark_file))
930
+			if (file_exists($image_mark_file))
931 931
 			{
932 932
 				list($width, $height, $type, $attrs) = getimagesize($image_mark_file);
933 933
 				$info->width = $width;
934 934
 				$info->height = $height;
935
-				$info->src = Context::getRequestUri().$image_mark_file;
936
-				$info->file = './'.$image_mark_file;
935
+				$info->src = Context::getRequestUri() . $image_mark_file;
936
+				$info->file = './' . $image_mark_file;
937 937
 				$GLOBALS['__member_info__']['image_mark'][$member_srl] = $info;
938 938
 			}
939 939
 			else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null;
@@ -946,27 +946,27 @@  discard block
 block discarded – undo
946 946
 	/**
947 947
 	 * @brief Get the image mark of the group
948 948
 	 */
949
-	function getGroupImageMark($member_srl,$site_srl=0)
949
+	function getGroupImageMark($member_srl, $site_srl = 0)
950 950
 	{
951
-		if(!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl]))
951
+		if (!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl]))
952 952
 		{
953 953
 			$oModuleModel = getModel('module');
954 954
 			$config = $oModuleModel->getModuleConfig('member');
955
-			if($config->group_image_mark!='Y')
955
+			if ($config->group_image_mark != 'Y')
956 956
 			{
957 957
 				return null;
958 958
 			}
959
-			$member_group = $this->getMemberGroups($member_srl,$site_srl);
959
+			$member_group = $this->getMemberGroups($member_srl, $site_srl);
960 960
 			$groups_info = $this->getGroups($site_srl);
961
-			if(count($member_group) > 0 && is_array($member_group))
961
+			if (count($member_group) > 0 && is_array($member_group))
962 962
 			{
963 963
 				$memberGroups = array_keys($member_group);
964 964
 
965
-				foreach($groups_info as $group_srl=>$group_info)
965
+				foreach ($groups_info as $group_srl=>$group_info)
966 966
 				{
967
-					if(in_array($group_srl, $memberGroups))
967
+					if (in_array($group_srl, $memberGroups))
968 968
 					{
969
-						if($group_info->image_mark)
969
+						if ($group_info->image_mark)
970 970
 						{
971 971
 							$info = new stdClass();
972 972
 							$info->title = $group_info->title;
@@ -990,10 +990,10 @@  discard block
 block discarded – undo
990 990
 	 */
991 991
 	function getSignature($member_srl)
992 992
 	{
993
-		if(!isset($GLOBALS['__member_info__']['signature'][$member_srl]))
993
+		if (!isset($GLOBALS['__member_info__']['signature'][$member_srl]))
994 994
 		{
995 995
 			$filename = sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl);
996
-			if(file_exists($filename))
996
+			if (file_exists($filename))
997 997
 			{
998 998
 				$buff = FileHandler::readFile($filename);
999 999
 				$signature = preg_replace('/<\?.*\?>/', '', $buff);
@@ -1011,10 +1011,10 @@  discard block
 block discarded – undo
1011 1011
 	 * @param int $member_srl Set this to member_srl when comparing a member's password (optional)
1012 1012
 	 * @return bool
1013 1013
 	 */
1014
-	function isValidPassword($hashed_password, $password_text, $member_srl=null)
1014
+	function isValidPassword($hashed_password, $password_text, $member_srl = null)
1015 1015
 	{
1016 1016
 		// False if no password in entered
1017
-		if(!$password_text)
1017
+		if (!$password_text)
1018 1018
 		{
1019 1019
 			return false;
1020 1020
 		}
@@ -1023,31 +1023,31 @@  discard block
 block discarded – undo
1023 1023
 		$oPassword = new Password();
1024 1024
 		$current_algorithm = $oPassword->checkAlgorithm($hashed_password);
1025 1025
 		$match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm);
1026
-		if(!$match)
1026
+		if (!$match)
1027 1027
 		{
1028 1028
 			return false;
1029 1029
 		}
1030 1030
 		
1031 1031
 		// Update the encryption method if necessary
1032 1032
 		$config = $this->getMemberConfig();
1033
-		if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N')
1033
+		if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N')
1034 1034
 		{
1035 1035
 			$need_upgrade = false;
1036 1036
 			
1037
-			if(!$need_upgrade)
1037
+			if (!$need_upgrade)
1038 1038
 			{
1039 1039
 				$required_algorithm = $oPassword->getCurrentlySelectedAlgorithm();
1040
-				if($required_algorithm !== $current_algorithm) $need_upgrade = true;
1040
+				if ($required_algorithm !== $current_algorithm) $need_upgrade = true;
1041 1041
 			}
1042 1042
 			
1043
-			if(!$need_upgrade)
1043
+			if (!$need_upgrade)
1044 1044
 			{
1045 1045
 				$required_work_factor = $oPassword->getWorkFactor();
1046 1046
 				$current_work_factor = $oPassword->checkWorkFactor($hashed_password);
1047
-				if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1047
+				if ($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1048 1048
 			}
1049 1049
 			
1050
-			if($need_upgrade === true)
1050
+			if ($need_upgrade === true)
1051 1051
 			{
1052 1052
 				$args = new stdClass();
1053 1053
 				$args->member_srl = $member_srl;
@@ -1075,27 +1075,27 @@  discard block
 block discarded – undo
1075 1075
 	function checkPasswordStrength($password, $strength)
1076 1076
 	{
1077 1077
 		$logged_info = Context::get('logged_info');
1078
-		if($logged_info->is_admin == 'Y') return true;
1078
+		if ($logged_info->is_admin == 'Y') return true;
1079 1079
 		
1080
-		if($strength == NULL)
1080
+		if ($strength == NULL)
1081 1081
 		{
1082 1082
 			$config = $this->getMemberConfig();
1083
-			$strength = $config->password_strength?$config->password_strength:'normal';
1083
+			$strength = $config->password_strength ? $config->password_strength : 'normal';
1084 1084
 		}
1085 1085
 		
1086 1086
 		$length = strlen($password);
1087 1087
 		
1088 1088
 		switch ($strength) {
1089 1089
 			case 'high':
1090
-				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1090
+				if ($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1091 1091
 				/* no break */
1092 1092
 				
1093 1093
 			case 'normal':
1094
-				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1094
+				if ($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1095 1095
 				break;
1096 1096
 				
1097 1097
 			case 'low':
1098
-				if($length < 4) return false;
1098
+				if ($length < 4) return false;
1099 1099
 				break; 
1100 1100
 		}
1101 1101
 		
@@ -1106,11 +1106,11 @@  discard block
 block discarded – undo
1106 1106
 	{
1107 1107
 		$groupSrl = 0;
1108 1108
 		$output = $this->getGroups($site_srl);
1109
-		if(is_array($output))
1109
+		if (is_array($output))
1110 1110
 		{
1111
-			foreach($output AS $key=>$value)
1111
+			foreach ($output AS $key=>$value)
1112 1112
 			{
1113
-				if($value->is_admin == 'Y')
1113
+				if ($value->is_admin == 'Y')
1114 1114
 				{
1115 1115
 					$groupSrl = $value->group_srl;
1116 1116
 					break;
Please login to merge, or discard this patch.
Braces   +201 added lines, -81 removed lines patch added patch discarded remove patch
@@ -45,32 +45,68 @@  discard block
 block discarded – undo
45 45
 		foreach($config->signupForm AS $key=>$value)
46 46
 		{
47 47
 			$config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title;
48
-			if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
-			if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
48
+			if($config->signupForm[$key]->isPublic != 'N') {
49
+				$config->signupForm[$key]->isPublic = 'Y';
50
+			}
51
+			if($value->name == 'find_account_question') {
52
+				$config->signupForm[$key]->isPublic = 'N';
53
+			}
50 54
 		}
51 55
 
52 56
 		// Get terms of user
53 57
 		$config->agreement = memberModel::_getAgreement();
54 58
 
55
-		if(!$config->webmaster_name) $config->webmaster_name = 'webmaster';
56
-		if(!$config->image_name_max_width) $config->image_name_max_width = 90;
57
-		if(!$config->image_name_max_height) $config->image_name_max_height = 20;
58
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = 20;
59
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = 20;
60
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = 90;
61
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = 90;
62
-		if(!$config->skin) $config->skin = 'default';
63
-		if(!$config->colorset) $config->colorset = 'white';
64
-		if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
65
-		if(!$config->group_image_mark) $config->group_image_mark = "N";
59
+		if(!$config->webmaster_name) {
60
+			$config->webmaster_name = 'webmaster';
61
+		}
62
+		if(!$config->image_name_max_width) {
63
+			$config->image_name_max_width = 90;
64
+		}
65
+		if(!$config->image_name_max_height) {
66
+			$config->image_name_max_height = 20;
67
+		}
68
+		if(!$config->image_mark_max_width) {
69
+			$config->image_mark_max_width = 20;
70
+		}
71
+		if(!$config->image_mark_max_height) {
72
+			$config->image_mark_max_height = 20;
73
+		}
74
+		if(!$config->profile_image_max_width) {
75
+			$config->profile_image_max_width = 90;
76
+		}
77
+		if(!$config->profile_image_max_height) {
78
+			$config->profile_image_max_height = 90;
79
+		}
80
+		if(!$config->skin) {
81
+			$config->skin = 'default';
82
+		}
83
+		if(!$config->colorset) {
84
+			$config->colorset = 'white';
85
+		}
86
+		if(!$config->editor_skin || $config->editor_skin == 'default') {
87
+			$config->editor_skin = 'ckeditor';
88
+		}
89
+		if(!$config->group_image_mark) {
90
+			$config->group_image_mark = "N";
91
+		}
66 92
 
67
-		if(!$config->identifier) $config->identifier = 'user_id';
93
+		if(!$config->identifier) {
94
+			$config->identifier = 'user_id';
95
+		}
68 96
 
69
-		if(!$config->max_error_count) $config->max_error_count = 10;
70
-		if(!$config->max_error_count_time) $config->max_error_count_time = 300;
97
+		if(!$config->max_error_count) {
98
+			$config->max_error_count = 10;
99
+		}
100
+		if(!$config->max_error_count_time) {
101
+			$config->max_error_count_time = 300;
102
+		}
71 103
 
72
-		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
73
-		if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
104
+		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') {
105
+			$config->signature_editor_skin = 'ckeditor';
106
+		}
107
+		if(!$config->sel_editor_colorset) {
108
+			$config->sel_editor_colorset = 'moono';
109
+		}
74 110
 
75 111
 		$member_config = $config;
76 112
 
@@ -116,12 +152,18 @@  discard block
 block discarded – undo
116 152
 		$logged_info = Context::get('logged_info');
117 153
 		$act = Context::get('cur_act');
118 154
 		// When click user's own nickname
119
-		if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
155
+		if($member_srl == $logged_info->member_srl) {
156
+			$member_info = $logged_info;
157
+		}
120 158
 		// When click other's nickname
121
-		else $member_info = $this->getMemberInfoByMemberSrl($member_srl);
159
+		else {
160
+			$member_info = $this->getMemberInfoByMemberSrl($member_srl);
161
+		}
122 162
 
123 163
 		$member_srl = $member_info->member_srl;
124
-		if(!$member_srl) return;
164
+		if(!$member_srl) {
165
+			return;
166
+		}
125 167
 		// List variables
126 168
 		$user_id = $member_info->user_id;
127 169
 		$user_name = $member_info->user_name;
@@ -156,11 +198,13 @@  discard block
 block discarded – undo
156 198
 			}
157 199
 		}
158 200
 		// View homepage info
159
-		if($member_info->homepage)
160
-			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
201
+		if($member_info->homepage) {
202
+					$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
203
+		}
161 204
 		// View blog info
162
-		if($member_info->blog)
163
-			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
205
+		if($member_info->blog) {
206
+					$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
207
+		}
164 208
 		// Call a trigger (after)
165 209
 		ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null);
166 210
 		// Display a menu for editting member info to a top administrator
@@ -195,8 +239,7 @@  discard block
 block discarded – undo
195 239
 			if(Mobile::isFromMobilePhone())
196 240
 			{
197 241
 				return true;
198
-			}
199
-			else
242
+			} else
200 243
 			{
201 244
 				if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
202 245
 				{
@@ -225,10 +268,12 @@  discard block
 block discarded – undo
225 268
 				$logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl);
226 269
 				// Add is_site_admin bool variable into logged_info if site_administrator is
227 270
 				$oModuleModel = getModel('module');
228
-				if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
229
-				else $logged_info->is_site_admin = false;
230
-			}
231
-			else
271
+				if($oModuleModel->isSiteAdmin($logged_info)) {
272
+					$logged_info->is_site_admin = true;
273
+				} else {
274
+					$logged_info->is_site_admin = false;
275
+				}
276
+			} else
232 277
 			{
233 278
 				// Register a default group if the site doesn't have a member group
234 279
 				if(count($logged_info->group_list) === 0)
@@ -254,13 +299,19 @@  discard block
 block discarded – undo
254 299
 	 */
255 300
 	function getMemberInfoByUserID($user_id, $columnList = array())
256 301
 	{
257
-		if(!$user_id) return;
302
+		if(!$user_id) {
303
+			return;
304
+		}
258 305
 
259 306
 		$args = new stdClass;
260 307
 		$args->user_id = $user_id;
261 308
 		$output = executeQuery('member.getMemberInfo', $args);
262
-		if(!$output->toBool()) return $output;
263
-		if(!$output->data) return;
309
+		if(!$output->toBool()) {
310
+			return $output;
311
+		}
312
+		if(!$output->data) {
313
+			return;
314
+		}
264 315
 
265 316
 		$member_info = $this->arrangeMemberInfo($output->data);
266 317
 
@@ -272,7 +323,9 @@  discard block
 block discarded – undo
272 323
 	 */
273 324
 	function getMemberInfoByEmailAddress($email_address)
274 325
 	{
275
-		if(!$email_address) return;
326
+		if(!$email_address) {
327
+			return;
328
+		}
276 329
 
277 330
 		$args = new stdClass();
278 331
 		
@@ -281,15 +334,18 @@  discard block
 block discarded – undo
281 334
 		{
282 335
 			$args->email_address = strtolower($email_address);
283 336
 			$output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args);
284
-		}
285
-		else
337
+		} else
286 338
 		{
287 339
 			$args->email_address = $email_address;
288 340
 			$output = executeQuery('member.getMemberInfoByEmailAddress', $args);
289 341
 		}
290 342
 		
291
-		if(!$output->toBool()) return $output;
292
-		if(!$output->data) return;
343
+		if(!$output->toBool()) {
344
+			return $output;
345
+		}
346
+		if(!$output->data) {
347
+			return;
348
+		}
293 349
 
294 350
 		$member_info = $this->arrangeMemberInfo($output->data);
295 351
 		return $member_info;
@@ -300,7 +356,9 @@  discard block
 block discarded – undo
300 356
 	 */
301 357
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
302 358
 	{
303
-		if(!$member_srl) return;
359
+		if(!$member_srl) {
360
+			return;
361
+		}
304 362
 
305 363
 		//columnList size zero... get full member info
306 364
 		if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
@@ -323,13 +381,17 @@  discard block
 block discarded – undo
323 381
 				$output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList);
324 382
 				if(!$output->data) 
325 383
 				{
326
-					if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
384
+					if($oCacheHandler->isSupport()) {
385
+						$oCacheHandler->put($cache_key, new stdClass);
386
+					}
327 387
 					return;
328 388
 				}
329 389
 				$this->arrangeMemberInfo($output->data, $site_srl);
330 390
 
331 391
 				//insert in cache
332
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
392
+				if($oCacheHandler->isSupport()) {
393
+					$oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
394
+				}
333 395
 			}
334 396
 		}
335 397
 
@@ -363,8 +425,12 @@  discard block
 block discarded – undo
363 425
 			{
364 426
 				foreach($extra_vars as $key => $val)
365 427
 				{
366
-					if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
367
-					if(!$info->{$key}) $info->{$key} = $val;
428
+					if(!is_array($val) && strpos($val, '|@|') !== FALSE) {
429
+						$val = explode('|@|', $val);
430
+					}
431
+					if(!$info->{$key}) {
432
+						$info->{$key} = $val;
433
+					}
368 434
 				}
369 435
 			}
370 436
 
@@ -387,8 +453,7 @@  discard block
 block discarded – undo
387 453
 					if(is_array($val))
388 454
 					{
389 455
 						$oSecurity->encodeHTML($key . '.');
390
-					}
391
-					else
456
+					} else
392 457
 					{
393 458
 						$oSecurity->encodeHTML($key);
394 459
 					}
@@ -451,7 +516,9 @@  discard block
 block discarded – undo
451 516
 	 */
452 517
 	function getLoggedMemberSrl()
453 518
 	{
454
-		if(!$this->isLogged()) return;
519
+		if(!$this->isLogged()) {
520
+			return;
521
+		}
455 522
 		return $_SESSION['member_srl'];
456 523
 	}
457 524
 
@@ -460,7 +527,9 @@  discard block
 block discarded – undo
460 527
 	 */
461 528
 	function getLoggedUserID()
462 529
 	{
463
-		if(!$this->isLogged()) return;
530
+		if(!$this->isLogged()) {
531
+			return;
532
+		}
464 533
 		$logged_info = Context::get('logged_info');
465 534
 		return $logged_info->user_id;
466 535
 	}
@@ -492,9 +561,13 @@  discard block
 block discarded – undo
492 561
 				$output = executeQueryArray('member.getMemberGroups', $args);
493 562
 				$group_list = $output->data;
494 563
 				//insert in cache
495
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
564
+				if($oCacheHandler->isSupport()) {
565
+					$oCacheHandler->put($cache_key, $group_list);
566
+				}
567
+			}
568
+			if(!$group_list) {
569
+				return array();
496 570
 			}
497
-			if(!$group_list) return array();
498 571
 
499 572
 			foreach($group_list as $group)
500 573
 			{
@@ -514,7 +587,9 @@  discard block
 block discarded – undo
514 587
 		$args->site_srl = $site_srl;
515 588
 		$args->sort_index = 'list_order';
516 589
 		$output = executeQueryArray('member.getMembersGroups', $args);
517
-		if(!$output->data) return array();
590
+		if(!$output->data) {
591
+			return array();
592
+		}
518 593
 
519 594
 		$result = array();
520 595
 		foreach($output->data as $key=>$val)
@@ -606,7 +681,9 @@  discard block
 block discarded – undo
606 681
 				$output = executeQueryArray('member.getGroups', $args);
607 682
 				$group_list = $output->data;
608 683
 				//insert in cache
609
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
684
+				if($oCacheHandler->isSupport()) {
685
+					$oCacheHandler->put($cache_key, $group_list);
686
+				}
610 687
 			}
611 688
 
612 689
 			if(!$group_list)
@@ -654,9 +731,13 @@  discard block
 block discarded – undo
654 731
 			$output = executeQuery('member.getJoinFormList', $args);
655 732
 			// NULL if output data deosn't exist
656 733
 			$join_form_list = $output->data;
657
-			if(!$join_form_list) return NULL;
734
+			if(!$join_form_list) {
735
+				return NULL;
736
+			}
658 737
 			// Need to unserialize because serialized array is inserted into DB in case of default_value
659
-			if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
738
+			if(!is_array($join_form_list)) {
739
+				$join_form_list = array($join_form_list);
740
+			}
660 741
 			$join_form_count = count($join_form_list);
661 742
 			for($i=0;$i<$join_form_count;$i++)
662 743
 			{
@@ -673,9 +754,10 @@  discard block
 block discarded – undo
673 754
 				if(in_array($column_type, array('checkbox','select','radio')))
674 755
 				{
675 756
 					$join_form_list[$i]->default_value = unserialize($default_value);
676
-					if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
677
-				}
678
-				else
757
+					if(!$join_form_list[$i]->default_value[0]) {
758
+						$join_form_list[$i]->default_value = '';
759
+					}
760
+				} else
679 761
 				{
680 762
 					$join_form_list[$i]->default_value = '';
681 763
 				}
@@ -689,13 +771,18 @@  discard block
 block discarded – undo
689 771
 		{
690 772
 			foreach($this->join_form_list as $key => $val)
691 773
 			{
692
-				if($val->is_active != 'Y') continue;
774
+				if($val->is_active != 'Y') {
775
+					continue;
776
+				}
693 777
 				unset($obj);
694 778
 				$obj->type = $val->column_type;
695 779
 				$obj->name = $val->column_name;
696 780
 				$obj->lang = $val->column_title;
697
-				if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false;
698
-				else $obj->required = false;
781
+				if($logged_info->is_admin != 'Y') {
782
+					$obj->required = $val->required=='Y'?true:false;
783
+				} else {
784
+					$obj->required = false;
785
+				}
699 786
 				$filter_output[] = $obj;
700 787
 
701 788
 				unset($open_obj);
@@ -746,7 +833,9 @@  discard block
 block discarded – undo
746 833
 	function getCombineJoinForm($member_info)
747 834
 	{
748 835
 		$extend_form_list = $this->getJoinFormlist();
749
-		if(!$extend_form_list) return;
836
+		if(!$extend_form_list) {
837
+			return;
838
+		}
750 839
 		// Member info is open only to an administrator and him/herself when is_private is true.
751 840
 		$logged_info = Context::get('logged_info');
752 841
 
@@ -759,7 +848,9 @@  discard block
 block discarded – undo
759 848
 			switch($item->column_type)
760 849
 			{
761 850
 				case 'checkbox' :
762
-					if($value && !is_array($value)) $value = array($value);
851
+					if($value && !is_array($value)) {
852
+						$value = array($value);
853
+					}
763 854
 					break;
764 855
 				case 'text' :
765 856
 				case 'homepage' :
@@ -773,8 +864,11 @@  discard block
 block discarded – undo
773 864
 
774 865
 			$extend_form_list[$srl]->value = $value;
775 866
 
776
-			if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true;
777
-			else $extend_form_list[$srl]->is_opened = false;
867
+			if($member_info->{'open_'.$column_name}=='Y') {
868
+				$extend_form_list[$srl]->is_opened = true;
869
+			} else {
870
+				$extend_form_list[$srl]->is_opened = false;
871
+			}
778 872
 		}
779 873
 		return $extend_form_list;
780 874
 	}
@@ -787,7 +881,9 @@  discard block
 block discarded – undo
787 881
 		$args->member_join_form_srl = $member_join_form_srl;
788 882
 		$output = executeQuery('member.getJoinForm', $args);
789 883
 		$join_form = $output->data;
790
-		if(!$join_form) return NULL;
884
+		if(!$join_form) {
885
+			return NULL;
886
+		}
791 887
 
792 888
 		$column_type = $join_form->column_type;
793 889
 		$default_value = $join_form->default_value;
@@ -795,8 +891,7 @@  discard block
 block discarded – undo
795 891
 		if(in_array($column_type, array('checkbox','select','radio')))
796 892
 		{
797 893
 			$join_form->default_value = unserialize($default_value);
798
-		}
799
-		else
894
+		} else
800 895
 		{
801 896
 			$join_form->default_value = '';
802 897
 		}
@@ -825,7 +920,9 @@  discard block
 block discarded – undo
825 920
 	function getDeniedIDs()
826 921
 	{
827 922
 		$output = executeQueryArray('member.getDeniedIDs');
828
-		if(!$output->toBool()) return array();
923
+		if(!$output->toBool()) {
924
+			return array();
925
+		}
829 926
 		return $output->data;
830 927
 	}
831 928
 
@@ -848,7 +945,9 @@  discard block
 block discarded – undo
848 945
 		$args = new stdClass();
849 946
 		$args->user_id = $user_id;
850 947
 		$output = executeQuery('member.chkDeniedID', $args);
851
-		if($output->data->count) return true;
948
+		if($output->data->count) {
949
+			return true;
950
+		}
852 951
 		return false;
853 952
 	}
854 953
 
@@ -860,7 +959,9 @@  discard block
 block discarded – undo
860 959
 		$args = new stdClass();
861 960
 		$args->nick_name = $nickName;
862 961
 		$output = executeQuery('member.chkDeniedNickName', $args);
863
-		if($output->data->count) return true;
962
+		if($output->data->count) {
963
+			return true;
964
+		}
864 965
 		if(!$output->toBool())
865 966
 		{
866 967
 			return true;
@@ -913,8 +1014,9 @@  discard block
 block discarded – undo
913 1014
 				$info->src = Context::getRequestUri().$image_name_file;
914 1015
 				$info->file = './'.$image_name_file;
915 1016
 				$GLOBALS['__member_info__']['image_name'][$member_srl] = $info;
1017
+			} else {
1018
+				$GLOBALS['__member_info__']['image_name'][$member_srl] = null;
916 1019
 			}
917
-			else $GLOBALS['__member_info__']['image_name'][$member_srl] = null;
918 1020
 		}
919 1021
 		return $GLOBALS['__member_info__']['image_name'][$member_srl];
920 1022
 	}
@@ -935,8 +1037,9 @@  discard block
 block discarded – undo
935 1037
 				$info->src = Context::getRequestUri().$image_mark_file;
936 1038
 				$info->file = './'.$image_mark_file;
937 1039
 				$GLOBALS['__member_info__']['image_mark'][$member_srl] = $info;
1040
+			} else {
1041
+				$GLOBALS['__member_info__']['image_mark'][$member_srl] = null;
938 1042
 			}
939
-			else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null;
940 1043
 		}
941 1044
 
942 1045
 		return $GLOBALS['__member_info__']['image_mark'][$member_srl];
@@ -978,9 +1081,13 @@  discard block
 block discarded – undo
978 1081
 					}
979 1082
 				}
980 1083
 			}
981
-			if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N';
1084
+			if (!$info) {
1085
+				$GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N';
1086
+			}
1087
+		}
1088
+		if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') {
1089
+			return null;
982 1090
 		}
983
-		if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null;
984 1091
 
985 1092
 		return $GLOBALS['__member_info__']['group_image_mark'][$member_srl];
986 1093
 	}
@@ -998,8 +1105,9 @@  discard block
 block discarded – undo
998 1105
 				$buff = FileHandler::readFile($filename);
999 1106
 				$signature = preg_replace('/<\?.*\?>/', '', $buff);
1000 1107
 				$GLOBALS['__member_info__']['signature'][$member_srl] = $signature;
1108
+			} else {
1109
+				$GLOBALS['__member_info__']['signature'][$member_srl] = null;
1001 1110
 			}
1002
-			else $GLOBALS['__member_info__']['signature'][$member_srl] = null;
1003 1111
 		}
1004 1112
 		return $GLOBALS['__member_info__']['signature'][$member_srl];
1005 1113
 	}
@@ -1037,14 +1145,18 @@  discard block
 block discarded – undo
1037 1145
 			if(!$need_upgrade)
1038 1146
 			{
1039 1147
 				$required_algorithm = $oPassword->getCurrentlySelectedAlgorithm();
1040
-				if($required_algorithm !== $current_algorithm) $need_upgrade = true;
1148
+				if($required_algorithm !== $current_algorithm) {
1149
+					$need_upgrade = true;
1150
+				}
1041 1151
 			}
1042 1152
 			
1043 1153
 			if(!$need_upgrade)
1044 1154
 			{
1045 1155
 				$required_work_factor = $oPassword->getWorkFactor();
1046 1156
 				$current_work_factor = $oPassword->checkWorkFactor($hashed_password);
1047
-				if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1157
+				if($current_work_factor !== false && $required_work_factor > $current_work_factor) {
1158
+					$need_upgrade = true;
1159
+				}
1048 1160
 			}
1049 1161
 			
1050 1162
 			if($need_upgrade === true)
@@ -1075,7 +1187,9 @@  discard block
 block discarded – undo
1075 1187
 	function checkPasswordStrength($password, $strength)
1076 1188
 	{
1077 1189
 		$logged_info = Context::get('logged_info');
1078
-		if($logged_info->is_admin == 'Y') return true;
1190
+		if($logged_info->is_admin == 'Y') {
1191
+			return true;
1192
+		}
1079 1193
 		
1080 1194
 		if($strength == NULL)
1081 1195
 		{
@@ -1087,15 +1201,21 @@  discard block
 block discarded – undo
1087 1201
 		
1088 1202
 		switch ($strength) {
1089 1203
 			case 'high':
1090
-				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1204
+				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) {
1205
+					return false;
1206
+				}
1091 1207
 				/* no break */
1092 1208
 				
1093 1209
 			case 'normal':
1094
-				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1210
+				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) {
1211
+					return false;
1212
+				}
1095 1213
 				break;
1096 1214
 				
1097 1215
 			case 'low':
1098
-				if($length < 4) return false;
1216
+				if($length < 4) {
1217
+					return false;
1218
+				}
1099 1219
 				break; 
1100 1220
 		}
1101 1221
 		
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 4 patches
Doc Comments   +23 added lines, -3 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 	/**
247 247
 	 * Delete menu process method
248
-	 * @return void|Object
248
+	 * @return Object|null
249 249
 	 */
250 250
 	function procMenuAdminDelete()
251 251
 	{
@@ -304,6 +304,7 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * Delete menu
306 306
 	 * Delete menu_item and xml cache files
307
+	 * @param string $menu_srl
307 308
 	 * @return Object
308 309
 	 */
309 310
 	function deleteMenu($menu_srl)
@@ -380,6 +381,7 @@  discard block
 block discarded – undo
380 381
 
381 382
 	/**
382 383
 	 * Add an item to the menu, simple version
384
+	 * @param stdClass $request
383 385
 	 * @return void
384 386
 	 */
385 387
 	public function procMenuAdminInsertItem($request = NULL)
@@ -519,6 +521,9 @@  discard block
 block discarded – undo
519 521
 		$this->setMessage('success_registed', 'info');
520 522
 	}
521 523
 
524
+	/**
525
+	 * @param boolean $isProc
526
+	 */
522 527
 	private function _insertMenu(&$request, $isProc)
523 528
 	{
524 529
 		$oDB = DB::getInstance();
@@ -584,6 +589,7 @@  discard block
 block discarded – undo
584 589
 	 * insert module by men create value
585 590
 	 * @request value of client request
586 591
 	 * @args value for menu create
592
+	 * @param stdClass $args
587 593
 	 * @return bool result of create module
588 594
 	 */
589 595
 	private function _insertModule(&$request, &$args)
@@ -641,7 +647,7 @@  discard block
 block discarded – undo
641 647
 
642 648
 	/**
643 649
 	 * Update an item to the menu, simple version
644
-	 * @return void
650
+	 * @return Object|null
645 651
 	 */
646 652
 	public function procMenuAdminUpdateItem()
647 653
 	{
@@ -842,6 +848,7 @@  discard block
 block discarded – undo
842 848
 	/**
843 849
 	 * Delete menu item ( Only include BO )
844 850
 	 * @args menu_srl, menu_item_srl, is_force
851
+	 * @param stdClass $args
845 852
 	 * @return void|Object
846 853
 	 */
847 854
 	public function deleteItem($args)
@@ -990,6 +997,9 @@  discard block
 block discarded – undo
990 997
 		return new Object(0, 'success');
991 998
 	}
992 999
 
1000
+	/**
1001
+	 * @param DB $oDB
1002
+	 */
993 1003
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 1004
 	{
995 1005
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
@@ -1009,7 +1019,7 @@  discard block
 block discarded – undo
1009 1019
 
1010 1020
 	/**
1011 1021
 	 * Move menu items
1012
-	 * @return void
1022
+	 * @return Object|null
1013 1023
 	 */
1014 1024
 	function procMenuAdminMoveItem()
1015 1025
 	{
@@ -1174,6 +1184,9 @@  discard block
 block discarded – undo
1174 1184
 		}
1175 1185
 	}
1176 1186
 
1187
+	/**
1188
+	 * @param string $parentSrl
1189
+	 */
1177 1190
 	private function _copyMenu($menuSrl, $parentSrl, &$originMenu)
1178 1191
 	{
1179 1192
 		$oMenuAdminModel = getAdminModel('menu');
@@ -2182,6 +2195,7 @@  discard block
 block discarded – undo
2182 2195
 	/**
2183 2196
 	 * When copy a menu, button copied also.
2184 2197
 	 * @param $args menuItemInfo with button values
2198
+	 * @param string $insertedMenuItemSrl
2185 2199
 	 */
2186 2200
 	private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo)
2187 2201
 	{
@@ -2222,6 +2236,9 @@  discard block
 block discarded – undo
2222 2236
 		return $copied_info;
2223 2237
 	}
2224 2238
 
2239
+	/**
2240
+	 * @param string $mode
2241
+	 */
2225 2242
 	private function _changeMenuItemSrlInButtonPath($buttonPath, $menuSrl, $menuItemSrl, $mode)
2226 2243
 	{
2227 2244
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
@@ -2231,6 +2248,9 @@  discard block
 block discarded – undo
2231 2248
 		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2232 2249
 	}
2233 2250
 
2251
+	/**
2252
+	 * @param integer $menuSrl
2253
+	 */
2234 2254
 	public function makeHomemenuCacheFile($menuSrl)
2235 2255
 	{
2236 2256
 		$cacheBuff .= sprintf('<?php if(!defined("__XE__")) exit();');
Please login to merge, or discard this patch.
Spacing   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	function init()
54 54
 	{
55
-		$this->setTemplatePath($this->module_path.'tpl');
55
+		$this->setTemplatePath($this->module_path . 'tpl');
56 56
 	}
57 57
 
58 58
 	function __construct() {
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new Object(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new Object(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new Object(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new Object(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368
-				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
368
+				$pos = strpos($cache_file, $menu_srl . '.');
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new Object(0,'success_deleted');
378
+		return new Object(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new Object(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new Object(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new Object($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -465,27 +465,27 @@  discard block
 block discarded – undo
465 465
 			$args->is_shortcut = $request->is_shortcut;
466 466
 			$args->url = $request->shortcut_target;
467 467
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
468
+			if (!$args->open_window) $args->open_window = 'N';
469
+			if (!$args->expand) $args->expand = 'N';
470
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
471 471
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
473 473
 			else $args->name = $request->menu_name;
474 474
 		}
475 475
 		// type is module short cut
476
-		else if(is_numeric($request->shortcut_target))
476
+		else if (is_numeric($request->shortcut_target))
477 477
 		{
478 478
 			// Get original information
479 479
 			$oMenuAdminModel = getAdminModel('menu');
480 480
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
481
-			if(!$itemInfo->menu_item_srl)
481
+			if (!$itemInfo->menu_item_srl)
482 482
 			{
483 483
 				return new Object(-1, 'msg_invalid_request');
484 484
 			}
485 485
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
486 486
 
487 487
 			$args = $itemInfo;
488
-			if(count($args->group_srls) == 0)
488
+			if (count($args->group_srls) == 0)
489 489
 			{
490 490
 				unset($args->group_srls);
491 491
 			}
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 			$args->url = '#';
506 506
 		}
507 507
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
509 509
 		else $args->desc = '';
510 510
 
511 511
 		$args->menu_item_srl = getNextSequence();
512
-		$args->listorder = -1*$args->menu_item_srl;
512
+		$args->listorder = -1 * $args->menu_item_srl;
513 513
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
514
+		if (!$output->toBool()) return $output;
515 515
 
516 516
 		$oDB->commit();
517 517
 
@@ -533,46 +533,46 @@  discard block
 block discarded – undo
533 533
 		$args->expand = $request->menu_expand;
534 534
 		$args->is_shortcut = $request->is_shortcut;
535 535
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
536
+		if (!$args->open_window) $args->open_window = 'N';
537
+		if (!$args->expand) $args->expand = 'N';
538
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
539 539
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
541 541
 		else $args->name = $request->menu_name;
542 542
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
544 544
 		else $args->desc = '';
545 545
 
546
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 547
 		{
548 548
 			return new Object(-1, 'msg_invalid_request');
549 549
 		}
550 550
 
551 551
 		// when menu copy, module already copied
552
-		if($isProc)
552
+		if ($isProc)
553 553
 		{
554 554
 			$result = $this->_insertModule($request, $args);
555
-			if(!$result->toBool())
555
+			if (!$result->toBool())
556 556
 			{
557 557
 				return new Object(-1, $result->message);
558 558
 			}
559 559
 		}
560 560
 
561 561
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
562
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
565 565
 
566
-		if(!$request->module_id)
566
+		if (!$request->module_id)
567 567
 		{
568 568
 			return new Object(-1, 'msg_invalid_request');
569 569
 		}
570 570
 
571 571
 		$args->url = $request->module_id;
572 572
 		$args->menu_item_srl = getNextSequence();
573
-		$args->listorder = -1*$args->menu_item_srl;
573
+		$args->listorder = -1 * $args->menu_item_srl;
574 574
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
575
+		if (!$output->toBool()) return $output;
576 576
 
577 577
 		$oDB->commit();
578 578
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		//module create
606 606
 		$site_module_info = Context::get('site_module_info');
607
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
607
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
608 608
 		$cmArgs->browser_title = $args->name;
609 609
 		$cmArgs->menu_srl = $request->menu_srl;
610 610
 		$cmArgs->layout_srl = -1;
@@ -612,23 +612,23 @@  discard block
 block discarded – undo
612 612
 		$cmArgs->is_skin_fix = 'N';
613 613
 		$cmArgs->is_mskin_fix = 'N';
614 614
 
615
-		if(Mobile::isMobileEnabled() === true)
615
+		if (Mobile::isMobileEnabled() === true)
616 616
 		{
617 617
 			$cmArgs->use_mobile = 'Y';
618 618
 		}
619 619
 
620 620
 		// if mid is empty, auto create mid
621
-		if(!$request->module_id)
621
+		if (!$request->module_id)
622 622
 		{
623 623
 			$randomMid = $this->_makeRandomMid();
624
-			$request->module_id = $cmArgs->module.'_'.$randomMid;
624
+			$request->module_id = $cmArgs->module . '_' . $randomMid;
625 625
 		}
626 626
 		$cmArgs->mid = $request->module_id;
627 627
 
628 628
 		// check already created module instance
629 629
 		$oModuleModel = getModel('module');
630 630
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
631
-		if($output->module_srl)
631
+		if ($output->module_srl)
632 632
 		{
633 633
 			return new Object(-1, 'msg_module_name_exists');
634 634
 		}
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 	{
648 648
 		$request = Context::getRequestVars();
649 649
 
650
-		if(!$request->menu_item_srl || !$request->menu_name)
650
+		if (!$request->menu_item_srl || !$request->menu_name)
651 651
 		{
652 652
 			return new Object(-1, 'msg_invalid_request');
653 653
 		}
654 654
 
655 655
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
656
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
658 658
 
659 659
 		// Get original information
660 660
 		$oMenuAdminModel = getAdminModel('menu');
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		$args = $itemInfo;
663 663
 
664 664
 		// if menu type is module, check exists module and update
665
-		if($itemInfo->is_shortcut == 'Y')
665
+		if ($itemInfo->is_shortcut == 'Y')
666 666
 		{
667 667
 			// type is url
668
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
669 669
 			{
670 670
 				$args->url = $request->shortcut_target;
671 671
 			}
672 672
 			// type is module short cut
673
-			else if(is_numeric($request->shortcut_target))
673
+			else if (is_numeric($request->shortcut_target))
674 674
 			{
675 675
 				// Get new original information
676 676
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
677
-				if(!$newItemInfo->menu_item_srl)
677
+				if (!$newItemInfo->menu_item_srl)
678 678
 				{
679 679
 					return new Object(-1, 'msg_invalid_request');
680 680
 				}
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
 		{
692 692
 			// check already created module instance
693 693
 			$oModuleModel = getModel('module');
694
-			if($request->module_id != $itemInfo->url)
694
+			if ($request->module_id != $itemInfo->url)
695 695
 			{
696 696
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
697
-				if($output->module_srl)
697
+				if ($output->module_srl)
698 698
 				{
699 699
 					return new Object(-1, 'msg_module_name_exists');
700 700
 				}
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
 
703 703
 			// if not exist module, return error
704 704
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
705
-			if(!$moduleInfo)
705
+			if (!$moduleInfo)
706 706
 			{
707 707
 				return new Object(-1, 'msg_invalid_request');
708 708
 			}
709 709
 
710 710
 			$moduleInfo->mid = $request->module_id;
711
-			if($request->browser_title)
711
+			if ($request->browser_title)
712 712
 			{
713 713
 				$moduleInfo->browser_title = $request->browser_title;
714 714
 			}
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			$args->url = $request->module_id;
718 718
 		}
719 719
 
720
-		if($request->menu_name_key)
720
+		if ($request->menu_name_key)
721 721
 		{
722 722
 			$args->name = $request->menu_name_key;
723 723
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			$args->name = $request->menu_name;
727 727
 		}
728 728
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
730 730
 		else $args->desc = '';
731 731
 
732 732
 		unset($args->group_srls);
@@ -754,38 +754,38 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$btnOutput = $this->_uploadButton($args);
756 756
 
757
-		if($btnOutput['normal_btn'])
757
+		if ($btnOutput['normal_btn'])
758 758
 		{
759 759
 			$this->add('normal_btn', $btnOutput['normal_btn']);
760 760
 			$item_info->normal_btn = $btnOutput['normal_btn'];
761 761
 		}
762
-		if($btnOutput['hover_btn'])
762
+		if ($btnOutput['hover_btn'])
763 763
 		{
764 764
 			$this->add('hover_btn', $btnOutput['hover_btn']);
765 765
 			$item_info->hover_btn = $btnOutput['hover_btn'];
766 766
 		}
767
-		if($btnOutput['active_btn'])
767
+		if ($btnOutput['active_btn'])
768 768
 		{
769 769
 			$this->add('active_btn', $btnOutput['active_btn']);
770 770
 			$item_info->active_btn = $btnOutput['active_btn'];
771 771
 		}
772 772
 
773 773
 		// group_srls check
774
-		if(count($item_info->group_srls) == 0)
774
+		if (count($item_info->group_srls) == 0)
775 775
 		{
776 776
 			unset($item_info->group_srls);
777 777
 		}
778 778
 
779 779
 		// Button delete check
780
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
781 781
 		{
782 782
 			$item_info->normal_btn = '';
783 783
 		}
784
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
785 785
 		{
786 786
 			$item_info->hover_btn = '';
787 787
 		}
788
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
789 789
 		{
790 790
 			$item_info->active_btn = '';
791 791
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$args->is_force = Context::get('is_force');
826 826
 
827 827
 		$returnObj = $this->deleteItem($args);
828
-		if(is_object($returnObj))
828
+		if (is_object($returnObj))
829 829
 		{
830 830
 			$this->setError($returnObj->error);
831 831
 			$this->setMessage($returnObj->message);
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
 		$args->menu_srl = $itemInfo->menu_srl;
855 855
 
856 856
 		// Display an error that the category cannot be deleted if it has a child node	603
857
-		if($args->is_force != 'Y')
857
+		if ($args->is_force != 'Y')
858 858
 		{
859 859
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
861
-			if($output->data->count > 0)
860
+			if (!$output->toBool()) return $output;
861
+			if ($output->data->count > 0)
862 862
 			{
863 863
 				return new Object(-1001, 'msg_cannot_delete_for_child');
864 864
 			}
@@ -870,22 +870,22 @@  discard block
 block discarded – undo
870 870
 
871 871
 		// check admin menu delete
872 872
 		$oAdmin = getClass('admin');
873
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
874 874
 		{
875 875
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 876
 		}
877 877
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
879 879
 
880 880
 		// get menu properies with child menu
881 881
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
882 882
 		$originMenu = NULL;
883 883
 
884
-		if(is_readable(FileHandler::getRealPath($phpFile)))
884
+		if (is_readable(FileHandler::getRealPath($phpFile)))
885 885
 		{
886 886
 			include(FileHandler::getRealPath($phpFile));
887 887
 
888
-			if(is_array($menu->list))
888
+			if (is_array($menu->list))
889 889
 			{
890 890
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
891 891
 			}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
896 896
 		$isStartmenuInclude = false;
897 897
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
898
-		if($isStartmenuInclude)
898
+		if ($isStartmenuInclude)
899 899
 		{
900 900
 			return new Object(-1, 'msg_cannot_delete_homemenu');
901 901
 		}
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 
920 920
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
921 921
 	{
922
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
923 923
 		{
924 924
 			$isStartmenuInclude = true;
925 925
 		}
926 926
 
927
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
927
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
928 928
 		{
929
-			foreach($originMenu['list'] AS $key=>$value)
929
+			foreach ($originMenu['list'] AS $key=>$value)
930 930
 			{
931 931
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
932 932
 			}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		$args->menu_srl = $menuSrl;
941 941
 		$args->menu_item_srl = $node['node_srl'];
942 942
 		$output = executeQuery("menu.deleteMenuItem", $args);
943
-		if(!$output->toBool())
943
+		if (!$output->toBool())
944 944
 		{
945 945
 			$oDB->rollback();
946 946
 			return $output;
@@ -949,12 +949,12 @@  discard block
 block discarded – undo
949 949
 		// Update the xml file and get its location
950 950
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 951
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
952
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
955 955
 
956 956
 		// Delete module
957
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
958 958
 		{
959 959
 			$oModuleController = getController('module');
960 960
 			$oModuleModel = getModel('module');
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 			$args->site_srl = $menuInfo->site_srl;
965 965
 			$args->is_shortcut = 'Y';
966 966
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
967
-			if($output->data->menu_item_srl)
967
+			if ($output->data->menu_item_srl)
968 968
 			{
969 969
 				$output->data->url = '';
970 970
 				$referenceItem = $output->data;
971 971
 				$output = $this->_updateMenuItem($referenceItem);
972
-				if(!$output->toBool())
972
+				if (!$output->toBool())
973 973
 				{
974 974
 					$oDB->rollback();
975 975
 					return $output;
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 			}
978 978
 
979 979
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
980
-			if($moduleInfo->module_srl)
980
+			if ($moduleInfo->module_srl)
981 981
 			{
982 982
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
983
-				if(!$output->toBool())
983
+				if (!$output->toBool())
984 984
 				{
985 985
 					$oDB->rollback();
986 986
 					return $output;
@@ -993,14 +993,14 @@  discard block
 block discarded – undo
993 993
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 994
 	{
995 995
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
996
-		if(!$output->toBool())
996
+		if (!$output->toBool())
997 997
 		{
998 998
 			return new Object(-1, $output->message);
999 999
 		}
1000 1000
 
1001
-		if(is_array($node['list']))
1001
+		if (is_array($node['list']))
1002 1002
 		{
1003
-			foreach($node['list'] AS $key=>$value)
1003
+			foreach ($node['list'] AS $key=>$value)
1004 1004
 			{
1005 1005
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1006 1006
 			}
@@ -1013,18 +1013,18 @@  discard block
 block discarded – undo
1013 1013
 	 */
1014 1014
 	function procMenuAdminMoveItem()
1015 1015
 	{
1016
-		$mode = Context::get('mode');	//move
1017
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1018
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1016
+		$mode = Context::get('mode'); //move
1017
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1018
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1019
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1020 1020
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1021
+		if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request');
1022 1022
 
1023 1023
 		$oMenuAdminModel = getAdminModel('menu');
1024 1024
 
1025 1025
 		// get original menu item info for cache file recreate
1026 1026
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1027
-		if(!$originalItemInfo->menu_item_srl)
1027
+		if (!$originalItemInfo->menu_item_srl)
1028 1028
 		{
1029 1029
 			return new Object(-1, 'msg_empty_menu_item');
1030 1030
 		}
@@ -1033,11 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1034 1034
 		$originMenu = NULL;
1035 1035
 
1036
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1036
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1037 1037
 		{
1038 1038
 			include(FileHandler::getRealPath($phpFile));
1039 1039
 
1040
-			if(is_array($menu->list))
1040
+			if (is_array($menu->list))
1041 1041
 			{
1042 1042
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1043 1043
 			}
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 		// get target menu info for move
1047 1047
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1048 1048
 		// if move in same sitemap
1049
-		if($targetMenuItemInfo->menu_item_srl)
1049
+		if ($targetMenuItemInfo->menu_item_srl)
1050 1050
 		{
1051 1051
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1052 1052
 		}
@@ -1058,20 +1058,20 @@  discard block
 block discarded – undo
1058 1058
 			$parent_srl = 0;
1059 1059
 		}
1060 1060
 
1061
-		if(!$this->homeModuleMid)
1061
+		if (!$this->homeModuleMid)
1062 1062
 		{
1063 1063
 			$oModuleModel = getModel('module');
1064 1064
 			$oMenuAdminController = getAdminController('menu');
1065 1065
 			$columnList = array('modules.mid',);
1066 1066
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1067
-			if($output->mid)
1067
+			if ($output->mid)
1068 1068
 			{
1069 1069
 				$this->homeModuleMid = $output->mid;
1070 1070
 			}
1071 1071
 		}
1072 1072
 
1073 1073
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1074
-		if(count($originMenu['list']) > 0)
1074
+		if (count($originMenu['list']) > 0)
1075 1075
 		{
1076 1076
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1077 1077
 		}
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1087 1087
 	{
1088
-		if(is_array($node))
1088
+		if (is_array($node))
1089 1089
 		{
1090
-			foreach($node AS $key=>$node)
1090
+			foreach ($node AS $key=>$node)
1091 1091
 			{
1092 1092
 				$args = new stdClass();
1093 1093
 				$args->menu_srl = $menu_srl;
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 				$output = $this->_updateMenuItem($args);
1096 1096
 
1097 1097
 				//module's menu_srl move also
1098
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1098
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1099 1099
 				{
1100 1100
 					$oModuleModel = getModel('module');
1101 1101
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1102
-					if($menu_srl != $moduleInfo->menu_srl)
1102
+					if ($menu_srl != $moduleInfo->menu_srl)
1103 1103
 					{
1104 1104
 						$moduleInfo->menu_srl = $menu_srl;
1105 1105
 						$oModuleController = getController('module');
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 					}
1108 1108
 				}
1109 1109
 
1110
-				if(count($node['list']) > 0)
1110
+				if (count($node['list']) > 0)
1111 1111
 				{
1112 1112
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1113 1113
 				}
@@ -1132,18 +1132,18 @@  discard block
 block discarded – undo
1132 1132
 		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1133 1133
 		$originMenu = NULL;
1134 1134
 
1135
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1135
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1136 1136
 		{
1137 1137
 			include(FileHandler::getRealPath($phpFile));
1138 1138
 
1139
-			if(is_array($menu->list))
1139
+			if (is_array($menu->list))
1140 1140
 			{
1141 1141
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		// copy the menu item with recursively
1146
-		if(is_array($originMenu))
1146
+		if (is_array($originMenu))
1147 1147
 		{
1148 1148
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1149 1149
 		}
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1161 1161
 	{
1162
-		if(array_key_exists($menuItemSrl, $menuList))
1162
+		if (array_key_exists($menuItemSrl, $menuList))
1163 1163
 		{
1164 1164
 			$originMenu = $menuList[$menuItemSrl];
1165 1165
 			return;
1166 1166
 		}
1167 1167
 
1168
-		foreach($menuList AS $key=>$value)
1168
+		foreach ($menuList AS $key=>$value)
1169 1169
 		{
1170
-			if(count($value['list']) > 0)
1170
+			if (count($value['list']) > 0)
1171 1171
 			{
1172 1172
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1173 1173
 			}
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		// default argument setting
1183 1183
 		$args = new stdClass();
1184 1184
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1186 1186
 		else $args->parent_srl = $parentSrl;
1187 1187
 		$args->menu_name_key = $originMenu['text'];
1188 1188
 		$args->menu_name = $originMenu['text'];
@@ -1195,14 +1195,14 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$isModuleCopySuccess = false;
1197 1197
 		// if menu have a reference of module instance
1198
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1198
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1199 1199
 		{
1200 1200
 			$oModuleModel = getModel('module');
1201 1201
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
1202 1202
 
1203 1203
 			$args->module_type = $moduleInfo->module;
1204 1204
 			$randomMid = $this->_makeRandomMid();
1205
-			$args->module_id = $moduleInfo->module.'_'.$randomMid;
1205
+			$args->module_id = $moduleInfo->module . '_' . $randomMid;
1206 1206
 			$args->layout_srl = $moduleInfo->layout_srl;
1207 1207
 
1208 1208
 			$oModuleAdminController = getAdminController('module');
@@ -1215,22 +1215,22 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 			$args->module_srl = $copiedModuleSrl;
1217 1217
 
1218
-			if($copiedModuleSrl)
1218
+			if ($copiedModuleSrl)
1219 1219
 			{
1220 1220
 				$isModuleCopySuccess = true;
1221 1221
 			}
1222 1222
 		}
1223 1223
 		// if menu type is shortcut
1224
-		else if($menuItemInfo->is_shortcut == 'Y')
1224
+		else if ($menuItemInfo->is_shortcut == 'Y')
1225 1225
 		{
1226 1226
 			$args->shortcut_target = $originMenu['url'];
1227 1227
 			$isModuleCopySuccess = true;
1228 1228
 		}
1229 1229
 
1230
-		if($isModuleCopySuccess)
1230
+		if ($isModuleCopySuccess)
1231 1231
 		{
1232 1232
 			// if have a group permission
1233
-			if($menuItemInfo->group_srls)
1233
+			if ($menuItemInfo->group_srls)
1234 1234
 			{
1235 1235
 				$args->group_srls = $menuItemInfo->group_srls;
1236 1236
 			}
@@ -1244,12 +1244,12 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 			// if have a button, copy a button image also
1246 1246
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1247
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1248 1248
 			{
1249 1249
 				// copy & upate
1250 1250
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1251
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1252
-				if(count($update_item_info->group_srls) == 0)
1251
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1252
+				if (count($update_item_info->group_srls) == 0)
1253 1253
 				{
1254 1254
 					unset($update_item_info->group_srls);
1255 1255
 				}
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 		// if have a child menu, copy child menu also
1265 1265
 		$childMenu = array_shift($originMenu['list']);
1266
-		if(count($childMenu) > 0)
1266
+		if (count($childMenu) > 0)
1267 1267
 		{
1268 1268
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1269 1269
 		}
@@ -1273,16 +1273,16 @@  discard block
 block discarded – undo
1273 1273
 	{
1274 1274
 		$time = $_SERVER['REQUEST_TIME'];
1275 1275
 		$randomString = "";
1276
-		for($i=0;$i<4;$i++)
1276
+		for ($i = 0; $i < 4; $i++)
1277 1277
 		{
1278 1278
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1279
+			if ($case) $doc = rand(65, 90);
1280 1280
 			else $doc = rand(97, 122);
1281 1281
 
1282 1282
 			$randomString .= chr($doc);
1283 1283
 		}
1284 1284
 
1285
-		return $randomString.substr($time, -2);
1285
+		return $randomString . substr($time, -2);
1286 1286
 	}
1287 1287
 
1288 1288
 	/**
@@ -1300,32 +1300,32 @@  discard block
 block discarded – undo
1300 1300
 		// menu name update
1301 1301
 		$args->menu_srl = $this->menuSrl;
1302 1302
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1303
+		if (!$output->toBool()) return $output;
1304 1304
 
1305 1305
 		$this->map = array();
1306
-		if(is_array($parentKeyList))
1306
+		if (is_array($parentKeyList))
1307 1307
 		{
1308
-			foreach($parentKeyList as $no=>$srl)
1308
+			foreach ($parentKeyList as $no=>$srl)
1309 1309
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1310
+				if ($srl === 0) continue;
1311
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1312 1312
 				$this->map[$srl][] = $no;
1313 1313
 			}
1314 1314
 		}
1315 1315
 
1316 1316
 		$result = array();
1317
-		if(is_array($this->itemKeyList))
1317
+		if (is_array($this->itemKeyList))
1318 1318
 		{
1319
-			foreach($this->itemKeyList as $srl)
1319
+			foreach ($this->itemKeyList as $srl)
1320 1320
 			{
1321
-				if(!$this->checked[$srl])
1321
+				if (!$this->checked[$srl])
1322 1322
 				{
1323 1323
 					$target = new stdClass();
1324 1324
 					$this->checked[$srl] = 1;
1325 1325
 					$target->node = $srl;
1326
-					$target->child= array();
1326
+					$target->child = array();
1327 1327
 
1328
-					while(count($this->map[$srl]))
1328
+					while (count($this->map[$srl]))
1329 1329
 					{
1330 1330
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1331 1331
 					}
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
 			}
1335 1335
 		}
1336 1336
 
1337
-		if(is_array($result))
1337
+		if (is_array($result))
1338 1338
 		{
1339 1339
 			$i = 0;
1340
-			foreach($result AS $key=>$node)
1340
+			foreach ($result AS $key=>$node)
1341 1341
 			{
1342
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1343
-				$this->_recursiveMoveMenuItem($node);	//move child node
1342
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1343
+				$this->_recursiveMoveMenuItem($node); //move child node
1344 1344
 				$i = $node->node;
1345 1345
 			}
1346 1346
 		}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 		$child_node->child = array();
1370 1370
 		$target->child[] = $child_node;
1371 1371
 
1372
-		while(count($this->map[$child_srl]))
1372
+		while (count($this->map[$child_srl]))
1373 1373
 		{
1374 1374
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1375 1375
 		}
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 	function _recursiveMoveMenuItem($result)
1385 1385
 	{
1386 1386
 		$i = 0;
1387
-		while(count($result->child))
1387
+		while (count($result->child))
1388 1388
 		{
1389 1389
 			unset($node);
1390 1390
 			$node = array_shift($result->child);
@@ -1404,48 +1404,48 @@  discard block
 block discarded – undo
1404 1404
 	 * @param string $mode 'move' or 'insert'
1405 1405
 	 * @return void
1406 1406
 	 */
1407
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1407
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1408 1408
 	{
1409 1409
 		// Get the original menus
1410 1410
 		$oMenuAdminModel = getAdminModel('menu');
1411 1411
 
1412 1412
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1413
+		if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request');
1414 1414
 		// Move the menu location(change the order menu appears)
1415
-		if($mode == 'move')
1415
+		if ($mode == 'move')
1416 1416
 		{
1417 1417
 			$args = new stdClass();
1418 1418
 			$args->parent_srl = $parent_srl;
1419 1419
 			$args->menu_srl = $menu_srl;
1420 1420
 
1421
-			if($source_srl)
1421
+			if ($source_srl)
1422 1422
 			{
1423 1423
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1425
-				$args->listorder = $source_item->listorder-1;
1424
+				if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request');
1425
+				$args->listorder = $source_item->listorder - 1;
1426 1426
 			}
1427 1427
 			else
1428 1428
 			{
1429 1429
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1431
-				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1430
+				if (!$output->toBool()) return $output;
1431
+				$args->listorder = (int) $output->data->listorder;
1432
+				if (!$args->listorder) $args->listorder = 0;
1433 1433
 			}
1434 1434
 			$args->parent_srl = $parent_srl;
1435 1435
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1436
+			if (!$output->toBool()) return $output;
1437 1437
 
1438 1438
 			$args->parent_srl = $parent_srl;
1439 1439
 			$args->menu_item_srl = $target_srl;
1440 1440
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1441
+			if (!$output->toBool()) return $output;
1442 1442
 
1443 1443
 			//module's menu_srl move also
1444
-			if($isShortcut == 'N' && !empty($url))
1444
+			if ($isShortcut == 'N' && !empty($url))
1445 1445
 			{
1446 1446
 				$oModuleModel = getModel('module');
1447 1447
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1448
-				if($menu_srl != $moduleInfo->menu_srl)
1448
+				if ($menu_srl != $moduleInfo->menu_srl)
1449 1449
 				{
1450 1450
 					$moduleInfo->menu_srl = $menu_srl;
1451 1451
 					$oModuleController = getController('module');
@@ -1453,13 +1453,13 @@  discard block
 block discarded – undo
1453 1453
 				}
1454 1454
 
1455 1455
 				// change home menu cache file
1456
-				if($url == $this->homeModuleMid)
1456
+				if ($url == $this->homeModuleMid)
1457 1457
 				{
1458
-					if(file_exists($this->homeMenuCacheFile))
1458
+					if (file_exists($this->homeMenuCacheFile))
1459 1459
 					{
1460 1460
 						include($this->homeMenuCacheFile);
1461 1461
 					}
1462
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1463 1463
 					{
1464 1464
 						$this->makeHomemenuCacheFile($menu_srl);
1465 1465
 					}
@@ -1467,13 +1467,13 @@  discard block
 block discarded – undo
1467 1467
 			}
1468 1468
 			// Add a child
1469 1469
 		}
1470
-		elseif($mode == 'insert')
1470
+		elseif ($mode == 'insert')
1471 1471
 		{
1472 1472
 			$args->menu_item_srl = $target_srl;
1473 1473
 			$args->parent_srl = $parent_srl;
1474
-			$args->listorder = -1*getNextSequence();
1474
+			$args->listorder = -1 * getNextSequence();
1475 1475
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1476
+			if (!$output->toBool()) return $output;
1477 1477
 		}
1478 1478
 
1479 1479
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
 		// Re-generate the xml file
1499 1499
 		$xml_file = $this->makeXmlFile($menu_srl);
1500 1500
 		// Set return value
1501
-		$this->add('menu_title',$menu_title);
1502
-		$this->add('xml_file',$xml_file);
1501
+		$this->add('menu_title', $menu_title);
1502
+		$this->add('xml_file', $xml_file);
1503 1503
 	}
1504 1504
 
1505 1505
 	/**
@@ -1513,12 +1513,12 @@  discard block
 block discarded – undo
1513 1513
 		$target = Context::get('target');
1514 1514
 		$target_file = Context::get($target);
1515 1515
 		// Error occurs when the target is neither a uploaded file nor a valid file
1516
-		if(!$menu_srl || !$menu_item_srl)
1516
+		if (!$menu_srl || !$menu_item_srl)
1517 1517
 		{
1518 1518
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1519
 
1520 1520
 		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1522 1522
 		{
1523 1523
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1524
 		}
@@ -1526,19 +1526,19 @@  discard block
 block discarded – undo
1526 1526
 		// Move the file to a specific director if the uploaded file meets requirement
1527 1527
 		else
1528 1528
 		{
1529
-			$tmp_arr = explode('.',$target_file['name']);
1530
-			$ext = $tmp_arr[count($tmp_arr)-1];
1529
+			$tmp_arr = explode('.', $target_file['name']);
1530
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1531 1531
 
1532 1532
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1533
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1534
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1535
+			if (!is_dir($path)) FileHandler::makeDir($path);
1536 1536
 
1537 1537
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1538
 			Context::set('filename', $filename);
1539 1539
 		}
1540 1540
 
1541
-		$this->setTemplatePath($this->module_path.'tpl');
1541
+		$this->setTemplatePath($this->module_path . 'tpl');
1542 1542
 		$this->setTemplateFile('menu_file_uploaded');
1543 1543
 	}
1544 1544
 
@@ -1565,14 +1565,14 @@  discard block
 block discarded – undo
1565 1565
 	{
1566 1566
 		$oModuleModel = getModel('module');
1567 1567
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1568
-		if(is_array($installed_module_list))
1568
+		if (is_array($installed_module_list))
1569 1569
 		{
1570 1570
 			$currentLang = Context::getLangType();
1571 1571
 			$menuList = array();
1572
-			foreach($installed_module_list AS $key=>$value)
1572
+			foreach ($installed_module_list AS $key=>$value)
1573 1573
 			{
1574 1574
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1575
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1576 1576
 				unset($info->menu);
1577 1577
 			}
1578 1578
 		}
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1605
 
1606 1606
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1609 1609
 		$dbInfo = Context::getDBInfo();
1610 1610
 
1611 1611
 		$args = new stdClass();
@@ -1614,9 +1614,9 @@  discard block
 block discarded – undo
1614 1614
 		$args->menu_srl = $requestArgs->menu_srl;
1615 1615
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1616 1616
 		//if now page is https...
1617
-		if(strpos($url, 'https') !== false)
1617
+		if (strpos($url, 'https') !== false)
1618 1618
 		{
1619
-			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619
+			$args->url = str_replace('https' . substr($dbInfo->default_url, 4), '', $url);
1620 1620
 		}
1621 1621
 		else
1622 1622
 		{
@@ -1628,23 +1628,23 @@  discard block
 block discarded – undo
1628 1628
 		$args->hover_btn = '';
1629 1629
 		$args->active_btn = '';
1630 1630
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1631
-		$args->listorder = -1*$args->menu_item_srl;
1631
+		$args->listorder = -1 * $args->menu_item_srl;
1632 1632
 
1633 1633
 		// Check if already exists
1634 1634
 		$oMenuModel = getAdminModel('menu');
1635 1635
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1636 1636
 		// Update if exists
1637
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1637
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1638 1638
 		{
1639 1639
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1640
+			if (!$output->toBool()) return $output;
1641 1641
 		}
1642 1642
 		// Insert if not exist
1643 1643
 		else
1644 1644
 		{
1645
-			$args->listorder = -1*$args->menu_item_srl;
1645
+			$args->listorder = -1 * $args->menu_item_srl;
1646 1646
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1647
+			if (!$output->toBool()) return $output;
1648 1648
 		}
1649 1649
 		// Get information of the menu
1650 1650
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1672,23 +1672,23 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 		// Menu Exposure update
1674 1674
 		// if exposure target is only login user...
1675
-		if(!$exposure)
1675
+		if (!$exposure)
1676 1676
 		{
1677 1677
 			$args->group_srls = '';
1678 1678
 		}
1679 1679
 		else
1680 1680
 		{
1681 1681
 			$exposure = explode(',', $exposure);
1682
-			if(in_array($exposure, array('-1','-3')))
1682
+			if (in_array($exposure, array('-1', '-3')))
1683 1683
 			{
1684 1684
 				$args->group_srls = $exposure;
1685 1685
 			}
1686 1686
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1687
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1688 1688
 		}
1689 1689
 
1690 1690
 		$output = $this->_updateMenuItem($args);
1691
-		if(!$output->toBool())
1691
+		if (!$output->toBool())
1692 1692
 		{
1693 1693
 			return $output;
1694 1694
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1705
 
1706 1706
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1707
+		if (!$grantList) $grantList = new stdClass;
1708 1708
 
1709 1709
 		$grantList->access = new stdClass();
1710 1710
 		$grantList->access->default = 'guest';
@@ -1712,9 +1712,9 @@  discard block
 block discarded – undo
1712 1712
 		$grantList->manager->default = 'manager';
1713 1713
 
1714 1714
 		$grant = new stdClass;
1715
-		foreach($grantList AS $grantName=>$grantInfo)
1715
+		foreach ($grantList AS $grantName=>$grantInfo)
1716 1716
 		{
1717
-			if(!$htPerm[$grantName])
1717
+			if (!$htPerm[$grantName])
1718 1718
 			{
1719 1719
 				continue;
1720 1720
 			}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 			$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1723 1723
 
1724 1724
 			// users in a particular group
1725
-			if(is_array($htPerm[$grantName]))
1725
+			if (is_array($htPerm[$grantName]))
1726 1726
 			{
1727 1727
 				$grant->{$grantName} = $htPerm[$grantName];
1728 1728
 				continue;
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 			$grant->{$group_srls} = array();
1737 1737
 		}
1738 1738
 
1739
-		if(count($grant))
1739
+		if (count($grant))
1740 1740
 		{
1741 1741
 			$oModuleController = getController('module');
1742 1742
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
 	function makeXmlFile($menu_srl)
1755 1755
 	{
1756 1756
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1757
+		if (!$menu_srl) return;
1758 1758
 		// Get menu informaton
1759 1759
 		$args = new stdClass();
1760 1760
 		$args->menu_srl = $menu_srl;
1761 1761
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1763
-		$site_srl = (int)$output->data->site_srl;
1762
+		if (!$output->toBool() || !$output->data) return $output;
1763
+		$site_srl = (int) $output->data->site_srl;
1764 1764
 
1765
-		if($site_srl)
1765
+		if ($site_srl)
1766 1766
 		{
1767 1767
 			$oModuleModel = getModel('module');
1768 1768
 			$columnList = array('sites.domain');
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 		$args->menu_srl = $menu_srl;
1774 1774
 		$args->sort_index = 'listorder';
1775 1775
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1776
+		if (!$output->toBool()) return;
1777 1777
 		// Specify the name of the cache file
1778 1778
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779 1779
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1780 1780
 		// If no data found, generate an XML file without node data
1781 1781
 		$list = $output->data;
1782
-		if(!$list)
1782
+		if (!$list)
1783 1783
 		{
1784 1784
 			$xml_buff = "<root />";
1785 1785
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1787,10 +1787,10 @@  discard block
 block discarded – undo
1787 1787
 			return $xml_file;
1788 1788
 		}
1789 1789
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1790
+		if (!is_array($list)) $list = array($list);
1791 1791
 		// Create a tree for loop
1792 1792
 		$list_count = count($list);
1793
-		for($i=0;$i<$list_count;$i++)
1793
+		for ($i = 0; $i < $list_count; $i++)
1794 1794
 		{
1795 1795
 			$node = $list[$i];
1796 1796
 			$menu_item_srl = $node->menu_item_srl;
@@ -1800,43 +1800,43 @@  discard block
 block discarded – undo
1800 1800
 		}
1801 1801
 		// A common header to set permissions of the cache file and groups
1802 1802
 		$header_script =
1803
-			'$lang_type = Context::getLangType(); '.
1804
-			'$is_logged = Context::get(\'is_logged\'); '.
1805
-			'$logged_info = Context::get(\'logged_info\'); '.
1806
-			'$site_srl = '.$site_srl.';'.
1807
-			'$site_admin = false;'.
1808
-			'if($site_srl) { '.
1809
-			'$oModuleModel = getModel(\'module\');'.
1810
-			'$site_module_info = $oModuleModel->getSiteInfo($site_srl); '.
1811
-			'if($site_module_info) Context::set(\'site_module_info\',$site_module_info);'.
1812
-			'else $site_module_info = Context::get(\'site_module_info\');'.
1813
-			'$grant = $oModuleModel->getGrant($site_module_info, $logged_info); '.
1814
-			'if($grant->manager ==1) $site_admin = true;'.
1815
-			'}'.
1816
-			'if($is_logged) {'.
1817
-			'if($logged_info->is_admin=="Y") $is_admin = true; '.
1818
-			'else $is_admin = false; '.
1819
-			'$group_srls = array_keys($logged_info->group_list); '.
1820
-			'} else { '.
1821
-			'$is_admin = false; '.
1822
-			'$group_srls = array(); '.
1803
+			'$lang_type = Context::getLangType(); ' .
1804
+			'$is_logged = Context::get(\'is_logged\'); ' .
1805
+			'$logged_info = Context::get(\'logged_info\'); ' .
1806
+			'$site_srl = ' . $site_srl . ';' .
1807
+			'$site_admin = false;' .
1808
+			'if($site_srl) { ' .
1809
+			'$oModuleModel = getModel(\'module\');' .
1810
+			'$site_module_info = $oModuleModel->getSiteInfo($site_srl); ' .
1811
+			'if($site_module_info) Context::set(\'site_module_info\',$site_module_info);' .
1812
+			'else $site_module_info = Context::get(\'site_module_info\');' .
1813
+			'$grant = $oModuleModel->getGrant($site_module_info, $logged_info); ' .
1814
+			'if($grant->manager ==1) $site_admin = true;' .
1815
+			'}' .
1816
+			'if($is_logged) {' .
1817
+			'if($logged_info->is_admin=="Y") $is_admin = true; ' .
1818
+			'else $is_admin = false; ' .
1819
+			'$group_srls = array_keys($logged_info->group_list); ' .
1820
+			'} else { ' .
1821
+			'$is_admin = false; ' .
1822
+			'$group_srls = array(); ' .
1823 1823
 			'}';
1824 1824
 		// Create the xml cache file (a separate session is needed for xml cache)
1825 1825
 		$xml_buff = sprintf(
1826
-			'<?php '.
1827
-			'define(\'__XE__\', true); '.
1828
-			'require_once(\''.FileHandler::getRealPath('./config/config.inc.php').'\'); '.
1829
-			'$oContext = Context::getInstance(); '.
1830
-			'$oContext->init(); '.
1831
-			'header("Content-Type: text/xml; charset=UTF-8"); '.
1832
-			'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); '.
1833
-			'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); '.
1834
-			'header("Cache-Control: no-store, no-cache, must-revalidate"); '.
1835
-			'header("Cache-Control: post-check=0, pre-check=0", false); '.
1836
-			'header("Pragma: no-cache"); '.
1837
-			'%s '.
1838
-			'$oContext->close(); '.
1839
-			'?>'.
1826
+			'<?php ' .
1827
+			'define(\'__XE__\', true); ' .
1828
+			'require_once(\'' . FileHandler::getRealPath('./config/config.inc.php') . '\'); ' .
1829
+			'$oContext = Context::getInstance(); ' .
1830
+			'$oContext->init(); ' .
1831
+			'header("Content-Type: text/xml; charset=UTF-8"); ' .
1832
+			'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); ' .
1833
+			'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ' .
1834
+			'header("Cache-Control: no-store, no-cache, must-revalidate"); ' .
1835
+			'header("Cache-Control: post-check=0, pre-check=0", false); ' .
1836
+			'header("Pragma: no-cache"); ' .
1837
+			'%s ' .
1838
+			'$oContext->close(); ' .
1839
+			'?>' .
1840 1840
 			'<root>%s</root>',
1841 1841
 			$header_script,
1842 1842
 			$this->getXmlTree($tree[0], $tree, $site_srl, $domain)
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
 		// Create php cache file
1845 1845
 		$php_output = $this->getPhpCacheCode($tree[0], $tree, $site_srl, $domain);
1846 1846
 		$php_buff = sprintf(
1847
-			'<?php '.
1848
-			'if(!defined("__XE__")) exit(); '.
1847
+			'<?php ' .
1848
+			'if(!defined("__XE__")) exit(); ' .
1849 1849
 			'$menu = new stdClass();' .
1850
-			'%s; '.
1851
-			'%s; '.
1852
-			'$menu->list = array(%s); '.
1853
-			'if(!$is_admin) { recurciveExposureCheck($menu->list); }'.
1854
-			'Context::set("included_menu", $menu); '.
1850
+			'%s; ' .
1851
+			'%s; ' .
1852
+			'$menu->list = array(%s); ' .
1853
+			'if(!$is_admin) { recurciveExposureCheck($menu->list); }' .
1854
+			'Context::set("included_menu", $menu); ' .
1855 1855
 			'?>',
1856 1856
 			$header_script,
1857 1857
 			$php_output['name'],
@@ -1875,26 +1875,26 @@  discard block
 block discarded – undo
1875 1875
 	 */
1876 1876
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1877
 	{
1878
-		if(!$source_node) return;
1878
+		if (!$source_node) return;
1879 1879
 
1880 1880
 		$oMenuAdminModel = getAdminModel('menu');
1881 1881
 
1882
-		foreach($source_node as $menu_item_srl => $node)
1882
+		foreach ($source_node as $menu_item_srl => $node)
1883 1883
 		{
1884 1884
 			$child_buff = "";
1885 1885
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1886
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1887 1887
 			// List variables
1888 1888
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889
-			foreach($names as $key => $val)
1889
+			foreach ($names as $key => $val)
1890 1890
 			{
1891
-				$name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1891
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1892 1892
 			}
1893 1893
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1894 1894
 
1895
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1896
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1897
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1895
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1896
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1897
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 1898
 			{
1899 1899
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1900 1900
 			}
@@ -1904,21 +1904,21 @@  discard block
 block discarded – undo
1904 1904
 			$expand = $node->expand;
1905 1905
 
1906 1906
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1907
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1908 1908
 			else $normal_btn = '';
1909 1909
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1910
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1911 1911
 			else $hover_btn = '';
1912 1912
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1913
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1914 1914
 			else $active_btn = '';
1915 1915
 
1916 1916
 			$group_srls = $node->group_srls;
1917 1917
 
1918
-			if($normal_btn)
1918
+			if ($normal_btn)
1919 1919
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1920
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1922 1922
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923 1923
 			}
1924 1924
 			else
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 1927
 			}
1928 1928
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1929
+			if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1930 1930
 			else $group_check_code = "true";
1931 1931
 			$attribute = sprintf(
1932 1932
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 				$link
1951 1951
 			);
1952 1952
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
1953
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
+			else $buff .= sprintf('<node %s />', $attribute);
1955 1955
 		}
1956 1956
 		return $buff;
1957 1957
 	}
@@ -1970,74 +1970,74 @@  discard block
 block discarded – undo
1970 1970
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 1971
 	{
1972 1972
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
1973
+		if (!$source_node) return $output;
1974 1974
 
1975 1975
 		$oMenuAdminModel = getAdminModel('menu');
1976 1976
 
1977
-		foreach($source_node as $menu_item_srl => $node)
1977
+		foreach ($source_node as $menu_item_srl => $node)
1978 1978
 		{
1979 1979
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1980
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981 1981
 			else $child_output = array("buff"=>"", "url_list"=>array());
1982 1982
 			// List variables
1983 1983
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1984 1984
 			unset($name_arr_str);
1985
-			foreach($names as $key => $val)
1985
+			foreach ($names as $key => $val)
1986 1986
 			{
1987
-				$name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace(array('\\','"'),array('\\\\','&quot;'),$val));
1987
+				$name_arr_str .= sprintf('"%s"=>"%s",', $key, str_replace(array('\\', '"'), array('\\\\', '&quot;'), $val));
1988 1988
 			}
1989 1989
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1990 1990
 			// If url value is not empty in the current node, put the value into an array url_list
1991
-			if($node->url) $child_output['url_list'][] = $node->url;
1991
+			if ($node->url) $child_output['url_list'][] = $node->url;
1992 1992
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
1993 1993
 			// If node->group_srls value exists
1994
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
1994
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
1995 1995
 			else $group_check_code = "true";
1996 1996
 			// List variables
1997
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
1998
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1999
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2000
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
1997
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
1998
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1999
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2000
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2001 2001
 			{
2002 2002
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2003 2003
 			}
2004 2004
 			else $href = sprintf('"%s"', $url);
2005 2005
 			$is_shortcut = $node->is_shortcut;
2006 2006
 			$open_window = $node->open_window;
2007
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2008
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2009
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2007
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2008
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2009
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2010 2010
 
2011
-			foreach($child_output['url_list'] as $key =>$val)
2011
+			foreach ($child_output['url_list'] as $key =>$val)
2012 2012
 			{
2013 2013
 				$child_output['url_list'][$key] = addslashes($val);
2014 2014
 			}
2015 2015
 
2016
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2016
+			$selected = '"' . implode('","', $child_output['url_list']) . '"';
2017 2017
 			$child_buff = $child_output['buff'];
2018 2018
 			$expand = $node->expand;
2019 2019
 
2020 2020
 			$normal_btn = $node->normal_btn;
2021
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2021
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2022 2022
 			else $normal_btn = '';
2023 2023
 
2024 2024
 			$hover_btn = $node->hover_btn;
2025
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2025
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2026 2026
 			else $hover_btn = '';
2027 2027
 
2028 2028
 			$active_btn = $node->active_btn;
2029
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2029
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2030 2030
 			else $active_btn = '';
2031 2031
 
2032 2032
 
2033 2033
 			$group_srls = $node->group_srls;
2034 2034
 
2035
-			if($normal_btn)
2035
+			if ($normal_btn)
2036 2036
 			{
2037
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2038
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2037
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2038
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2039 2039
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2040
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2040
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2041 2041
 				else $link_active = $link;
2042 2042
 			}
2043 2043
 			else
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 			);
2076 2076
 
2077 2077
 			// Generate buff data
2078
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2078
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2079 2079
 			$output['name'] .= $name_str;
2080 2080
 		}
2081 2081
 		return $output;
@@ -2089,19 +2089,19 @@  discard block
 block discarded – undo
2089 2089
 	 */
2090 2090
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2091 2091
 	{
2092
-		if(!count($menu_srl_list)) return;
2092
+		if (!count($menu_srl_list)) return;
2093 2093
 		// Delete the value of menu_srls
2094
-		$args->menu_srls = implode(',',$menu_srl_list);
2094
+		$args->menu_srls = implode(',', $menu_srl_list);
2095 2095
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2096
-		if(!$output->toBool()) return $output;
2096
+		if (!$output->toBool()) return $output;
2097 2097
 
2098 2098
 		$args->layout_srl = $layout_srl;
2099 2099
 		// Mapping menu_srls, layout_srl
2100
-		for($i=0;$i<count($menu_srl_list);$i++)
2100
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2101 2101
 		{
2102 2102
 			$args->menu_srl = $menu_srl_list[$i];
2103 2103
 			$output = executeQuery('menu.insertMenuLayout', $args);
2104
-			if(!$output->toBool()) return $output;
2104
+			if (!$output->toBool()) return $output;
2105 2105
 		}
2106 2106
 	}
2107 2107
 
@@ -2114,47 +2114,47 @@  discard block
 block discarded – undo
2114 2114
 	{
2115 2115
 		// path setting
2116 2116
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2117
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2117
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2118 2118
 		{
2119 2119
 			FileHandler::makeDir($path);
2120 2120
 		}
2121 2121
 
2122
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2122
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2123 2123
 		{
2124 2124
 			$oMenuModel = getAdminModel('menu');
2125 2125
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2126 2126
 
2127
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2128
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2129
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2127
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2128
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2129
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2130 2130
 		}
2131 2131
 
2132 2132
 		$returnArray = array();
2133 2133
 		$date = date('YmdHis');
2134 2134
 		// normal button
2135
-		if($args->menu_normal_btn)
2135
+		if ($args->menu_normal_btn)
2136 2136
 		{
2137
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2138
-			$ext = $tmp_arr[count($tmp_arr)-1];
2137
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2138
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2139 2139
 
2140 2140
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2141 2141
 
2142
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2142
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2143 2143
 			{
2144
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2144
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2145 2145
 				$returnArray ['normal_btn'] = $filename;
2146 2146
 			}
2147 2147
 		}
2148 2148
 
2149 2149
 		// hover button
2150
-		if($args->menu_hover_btn)
2150
+		if ($args->menu_hover_btn)
2151 2151
 		{
2152
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2153
-			$ext = $tmp_arr[count($tmp_arr)-1];
2152
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2153
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2154 2154
 
2155 2155
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2156 2156
 
2157
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2157
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2158 2158
 			{
2159 2159
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2160 2160
 				$returnArray['hover_btn'] = $filename;
@@ -2162,14 +2162,14 @@  discard block
 block discarded – undo
2162 2162
 		}
2163 2163
 
2164 2164
 		// active button
2165
-		if($args->menu_active_btn)
2165
+		if ($args->menu_active_btn)
2166 2166
 		{
2167
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2168
-			$ext = $tmp_arr[count($tmp_arr)-1];
2167
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2168
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2169 2169
 
2170 2170
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2171 2171
 
2172
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2172
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2173 2173
 			{
2174 2174
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2175 2175
 				$returnArray['active_btn'] = $filename;
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
 			"active_btn"=>"",
2192 2192
 		);
2193 2193
 		//normal_btn
2194
-		if($menuItemInfo->normal_btn)
2194
+		if ($menuItemInfo->normal_btn)
2195 2195
 		{
2196 2196
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2197 2197
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 		}
2202 2202
 
2203 2203
 		//hover_btn
2204
-		if($menuItemInfo->hover_btn)
2204
+		if ($menuItemInfo->hover_btn)
2205 2205
 		{
2206 2206
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2207 2207
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 		}
2212 2212
 
2213 2213
 		//active_btn
2214
-		if($menuItemInfo->active_btn)
2214
+		if ($menuItemInfo->active_btn)
2215 2215
 		{
2216 2216
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2217 2217
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2226,9 +2226,9 @@  discard block
 block discarded – undo
2226 2226
 	{
2227 2227
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2228 2228
 		$tmp_arr = explode('.', $buttonPath);
2229
-		$ext = $tmp_arr[count($tmp_arr)-1];
2229
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2230 2230
 		$date = date("YmdHis");
2231
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2231
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_' . $mode . '_btn', $ext);
2232 2232
 	}
2233 2233
 
2234 2234
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +296 added lines, -128 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new Object(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new Object(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -465,12 +470,21 @@  discard block
 block discarded – undo
465 470
 			$args->is_shortcut = $request->is_shortcut;
466 471
 			$args->url = $request->shortcut_target;
467 472
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
473
+			if(!$args->open_window) {
474
+				$args->open_window = 'N';
475
+			}
476
+			if(!$args->expand) {
477
+				$args->expand = 'N';
478
+			}
479
+			if(!$args->is_shortcut) {
480
+				$args->is_shortcut = 'Y';
481
+			}
471 482
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
473
-			else $args->name = $request->menu_name;
483
+			if($request->menu_name_key) {
484
+				$args->name = $request->menu_name_key;
485
+			} else {
486
+				$args->name = $request->menu_name;
487
+			}
474 488
 		}
475 489
 		// type is module short cut
476 490
 		else if(is_numeric($request->shortcut_target))
@@ -505,13 +519,18 @@  discard block
 block discarded – undo
505 519
 			$args->url = '#';
506 520
 		}
507 521
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
509
-		else $args->desc = '';
522
+		if($request->menu_desc) {
523
+			$args->desc = $request->menu_desc;
524
+		} else {
525
+			$args->desc = '';
526
+		}
510 527
 
511 528
 		$args->menu_item_srl = getNextSequence();
512 529
 		$args->listorder = -1*$args->menu_item_srl;
513 530
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
531
+		if(!$output->toBool()) {
532
+			return $output;
533
+		}
515 534
 
516 535
 		$oDB->commit();
517 536
 
@@ -533,15 +552,27 @@  discard block
 block discarded – undo
533 552
 		$args->expand = $request->menu_expand;
534 553
 		$args->is_shortcut = $request->is_shortcut;
535 554
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
555
+		if(!$args->open_window) {
556
+			$args->open_window = 'N';
557
+		}
558
+		if(!$args->expand) {
559
+			$args->expand = 'N';
560
+		}
561
+		if(!$args->is_shortcut) {
562
+			$args->is_shortcut = 'N';
563
+		}
539 564
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
541
-		else $args->name = $request->menu_name;
565
+		if($request->menu_name_key) {
566
+			$args->name = $request->menu_name_key;
567
+		} else {
568
+			$args->name = $request->menu_name;
569
+		}
542 570
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
544
-		else $args->desc = '';
571
+		if($request->menu_desc) {
572
+			$args->desc = $request->menu_desc;
573
+		} else {
574
+			$args->desc = '';
575
+		}
545 576
 
546 577
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 578
 		{
@@ -559,9 +590,15 @@  discard block
 block discarded – undo
559 590
 		}
560 591
 
561 592
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
593
+		if($request->normal_btn) {
594
+			$args->normal_btn = $request->normal_btn;
595
+		}
596
+		if($request->hover_btn) {
597
+			$args->hover_btn = $request->hover_btn;
598
+		}
599
+		if($request->active_btn) {
600
+			$args->active_btn = $request->active_btn;
601
+		}
565 602
 
566 603
 		if(!$request->module_id)
567 604
 		{
@@ -572,7 +609,9 @@  discard block
 block discarded – undo
572 609
 		$args->menu_item_srl = getNextSequence();
573 610
 		$args->listorder = -1*$args->menu_item_srl;
574 611
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
612
+		if(!$output->toBool()) {
613
+			return $output;
614
+		}
576 615
 
577 616
 		$oDB->commit();
578 617
 
@@ -653,8 +692,12 @@  discard block
 block discarded – undo
653 692
 		}
654 693
 
655 694
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
695
+		if($request->menu_open_window != "Y") {
696
+			$request->menu_open_window = "N";
697
+		}
698
+		if($request->menu_expand != "Y") {
699
+			$request->menu_expand = "N";
700
+		}
658 701
 
659 702
 		// Get original information
660 703
 		$oMenuAdminModel = getAdminModel('menu');
@@ -681,13 +724,11 @@  discard block
 block discarded – undo
681 724
 
682 725
 				$args->url = $newItemInfo->url;
683 726
 				$args->is_shortcut = 'Y';
684
-			}
685
-			else
727
+			} else
686 728
 			{
687 729
 				$args->url = '#';
688 730
 			}
689
-		}
690
-		else
731
+		} else
691 732
 		{
692 733
 			// check already created module instance
693 734
 			$oModuleModel = getModel('module');
@@ -720,14 +761,16 @@  discard block
 block discarded – undo
720 761
 		if($request->menu_name_key)
721 762
 		{
722 763
 			$args->name = $request->menu_name_key;
723
-		}
724
-		else
764
+		} else
725 765
 		{
726 766
 			$args->name = $request->menu_name;
727 767
 		}
728 768
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
730
-		else $args->desc = '';
769
+		if($request->menu_desc) {
770
+			$args->desc = $request->menu_desc;
771
+		} else {
772
+			$args->desc = '';
773
+		}
731 774
 
732 775
 		unset($args->group_srls);
733 776
 		$args->open_window = $request->menu_open_window;
@@ -829,8 +872,7 @@  discard block
 block discarded – undo
829 872
 		{
830 873
 			$this->setError($returnObj->error);
831 874
 			$this->setMessage($returnObj->message);
832
-		}
833
-		else
875
+		} else
834 876
 		{
835 877
 			$this->setMessage('success_deleted');
836 878
 		}
@@ -857,7 +899,9 @@  discard block
 block discarded – undo
857 899
 		if($args->is_force != 'Y')
858 900
 		{
859 901
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
902
+			if(!$output->toBool()) {
903
+				return $output;
904
+			}
861 905
 			if($output->data->count > 0)
862 906
 			{
863 907
 				return new Object(-1001, 'msg_cannot_delete_for_child');
@@ -875,7 +919,9 @@  discard block
 block discarded – undo
875 919
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 920
 		}
877 921
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
922
+		if($itemInfo->parent_srl) {
923
+			$parent_srl = $itemInfo->parent_srl;
924
+		}
879 925
 
880 926
 		// get menu properies with child menu
881 927
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -949,9 +995,15 @@  discard block
 block discarded – undo
949 995
 		// Update the xml file and get its location
950 996
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 997
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
998
+		if($node['normal_btn']) {
999
+			FileHandler::removeFile($node['normal_btn']);
1000
+		}
1001
+		if($node['hover_btn']) {
1002
+			FileHandler::removeFile($node['hover_btn']);
1003
+		}
1004
+		if($node['active_btn']) {
1005
+			FileHandler::removeFile($node['active_btn']);
1006
+		}
955 1007
 
956 1008
 		// Delete module
957 1009
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1018,7 +1070,9 @@  discard block
 block discarded – undo
1018 1070
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019 1071
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1020 1072
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1073
+		if(!$mode || !$parent_srl || !$target_srl) {
1074
+			return new Object(-1,'msg_invalid_request');
1075
+		}
1022 1076
 
1023 1077
 		$oMenuAdminModel = getAdminModel('menu');
1024 1078
 
@@ -1182,8 +1236,11 @@  discard block
 block discarded – undo
1182 1236
 		// default argument setting
1183 1237
 		$args = new stdClass();
1184 1238
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1186
-		else $args->parent_srl = $parentSrl;
1239
+		if($parentSrl == 0) {
1240
+			$args->parent_srl = $menuSrl;
1241
+		} else {
1242
+			$args->parent_srl = $parentSrl;
1243
+		}
1187 1244
 		$args->menu_name_key = $originMenu['text'];
1188 1245
 		$args->menu_name = $originMenu['text'];
1189 1246
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1276,8 +1333,11 @@  discard block
 block discarded – undo
1276 1333
 		for($i=0;$i<4;$i++)
1277 1334
 		{
1278 1335
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1280
-			else $doc = rand(97, 122);
1336
+			if($case) {
1337
+				$doc = rand(65, 90);
1338
+			} else {
1339
+				$doc = rand(97, 122);
1340
+			}
1281 1341
 
1282 1342
 			$randomString .= chr($doc);
1283 1343
 		}
@@ -1300,15 +1360,21 @@  discard block
 block discarded – undo
1300 1360
 		// menu name update
1301 1361
 		$args->menu_srl = $this->menuSrl;
1302 1362
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1363
+		if(!$output->toBool()) {
1364
+			return $output;
1365
+		}
1304 1366
 
1305 1367
 		$this->map = array();
1306 1368
 		if(is_array($parentKeyList))
1307 1369
 		{
1308 1370
 			foreach($parentKeyList as $no=>$srl)
1309 1371
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1372
+				if($srl === 0) {
1373
+					continue;
1374
+				}
1375
+				if(!is_array($this->map[$srl])) {
1376
+					$this->map[$srl] = array();
1377
+				}
1312 1378
 				$this->map[$srl][] = $no;
1313 1379
 			}
1314 1380
 		}
@@ -1410,7 +1476,9 @@  discard block
 block discarded – undo
1410 1476
 		$oMenuAdminModel = getAdminModel('menu');
1411 1477
 
1412 1478
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1479
+		if($target_item->menu_item_srl != $target_srl) {
1480
+			return new Object(-1,'msg_invalid_request');
1481
+		}
1414 1482
 		// Move the menu location(change the order menu appears)
1415 1483
 		if($mode == 'move')
1416 1484
 		{
@@ -1421,24 +1489,33 @@  discard block
 block discarded – undo
1421 1489
 			if($source_srl)
1422 1490
 			{
1423 1491
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1492
+				if($source_item->menu_item_srl != $source_srl) {
1493
+					return new Object(-1,'msg_invalid_request');
1494
+				}
1425 1495
 				$args->listorder = $source_item->listorder-1;
1426
-			}
1427
-			else
1496
+			} else
1428 1497
 			{
1429 1498
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1499
+				if(!$output->toBool()) {
1500
+					return $output;
1501
+				}
1431 1502
 				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1503
+				if(!$args->listorder) {
1504
+					$args->listorder= 0;
1505
+				}
1433 1506
 			}
1434 1507
 			$args->parent_srl = $parent_srl;
1435 1508
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1509
+			if(!$output->toBool()) {
1510
+				return $output;
1511
+			}
1437 1512
 
1438 1513
 			$args->parent_srl = $parent_srl;
1439 1514
 			$args->menu_item_srl = $target_srl;
1440 1515
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1516
+			if(!$output->toBool()) {
1517
+				return $output;
1518
+			}
1442 1519
 
1443 1520
 			//module's menu_srl move also
1444 1521
 			if($isShortcut == 'N' && !empty($url))
@@ -1466,14 +1543,15 @@  discard block
 block discarded – undo
1466 1543
 				}
1467 1544
 			}
1468 1545
 			// Add a child
1469
-		}
1470
-		elseif($mode == 'insert')
1546
+		} elseif($mode == 'insert')
1471 1547
 		{
1472 1548
 			$args->menu_item_srl = $target_srl;
1473 1549
 			$args->parent_srl = $parent_srl;
1474 1550
 			$args->listorder = -1*getNextSequence();
1475 1551
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1552
+			if(!$output->toBool()) {
1553
+				return $output;
1554
+			}
1477 1555
 		}
1478 1556
 
1479 1557
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1517,8 +1595,7 @@  discard block
 block discarded – undo
1517 1595
 		{
1518 1596
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1597
 
1520
-		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1598
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1522 1599
 		{
1523 1600
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1601
 		}
@@ -1532,7 +1609,9 @@  discard block
 block discarded – undo
1532 1609
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1610
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1611
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1612
+			if(!is_dir($path)) {
1613
+				FileHandler::makeDir($path);
1614
+			}
1536 1615
 
1537 1616
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1617
 			Context::set('filename', $filename);
@@ -1572,7 +1651,9 @@  discard block
 block discarded – undo
1572 1651
 			foreach($installed_module_list AS $key=>$value)
1573 1652
 			{
1574 1653
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1654
+				if($info->menu) {
1655
+					$menuList[$value->module] = $info->menu;
1656
+				}
1576 1657
 				unset($info->menu);
1577 1658
 			}
1578 1659
 		}
@@ -1604,8 +1685,12 @@  discard block
 block discarded – undo
1604 1685
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1686
 
1606 1687
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1688
+		if(empty($url)) {
1689
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1690
+		}
1691
+		if(empty($url)) {
1692
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1693
+		}
1609 1694
 		$dbInfo = Context::getDBInfo();
1610 1695
 
1611 1696
 		$args = new stdClass();
@@ -1617,8 +1702,7 @@  discard block
 block discarded – undo
1617 1702
 		if(strpos($url, 'https') !== false)
1618 1703
 		{
1619 1704
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620
-		}
1621
-		else
1705
+		} else
1622 1706
 		{
1623 1707
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1624 1708
 		}
@@ -1637,14 +1721,18 @@  discard block
 block discarded – undo
1637 1721
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1638 1722
 		{
1639 1723
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1724
+			if(!$output->toBool()) {
1725
+				return $output;
1726
+			}
1641 1727
 		}
1642 1728
 		// Insert if not exist
1643 1729
 		else
1644 1730
 		{
1645 1731
 			$args->listorder = -1*$args->menu_item_srl;
1646 1732
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1733
+			if(!$output->toBool()) {
1734
+				return $output;
1735
+			}
1648 1736
 		}
1649 1737
 		// Get information of the menu
1650 1738
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1675,8 +1763,7 @@  discard block
 block discarded – undo
1675 1763
 		if(!$exposure)
1676 1764
 		{
1677 1765
 			$args->group_srls = '';
1678
-		}
1679
-		else
1766
+		} else
1680 1767
 		{
1681 1768
 			$exposure = explode(',', $exposure);
1682 1769
 			if(in_array($exposure, array('-1','-3')))
@@ -1684,7 +1771,9 @@  discard block
 block discarded – undo
1684 1771
 				$args->group_srls = $exposure;
1685 1772
 			}
1686 1773
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1774
+			if($exposure) {
1775
+				$args->group_srls = implode(',', $exposure);
1776
+			}
1688 1777
 		}
1689 1778
 
1690 1779
 		$output = $this->_updateMenuItem($args);
@@ -1704,7 +1793,9 @@  discard block
 block discarded – undo
1704 1793
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1794
 
1706 1795
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1796
+		if(!$grantList) {
1797
+			$grantList = new stdClass;
1798
+		}
1708 1799
 
1709 1800
 		$grantList->access = new stdClass();
1710 1801
 		$grantList->access->default = 'guest';
@@ -1754,12 +1845,16 @@  discard block
 block discarded – undo
1754 1845
 	function makeXmlFile($menu_srl)
1755 1846
 	{
1756 1847
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1848
+		if(!$menu_srl) {
1849
+			return;
1850
+		}
1758 1851
 		// Get menu informaton
1759 1852
 		$args = new stdClass();
1760 1853
 		$args->menu_srl = $menu_srl;
1761 1854
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1855
+		if(!$output->toBool() || !$output->data) {
1856
+			return $output;
1857
+		}
1763 1858
 		$site_srl = (int)$output->data->site_srl;
1764 1859
 
1765 1860
 		if($site_srl)
@@ -1773,7 +1868,9 @@  discard block
 block discarded – undo
1773 1868
 		$args->menu_srl = $menu_srl;
1774 1869
 		$args->sort_index = 'listorder';
1775 1870
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1871
+		if(!$output->toBool()) {
1872
+			return;
1873
+		}
1777 1874
 		// Specify the name of the cache file
1778 1875
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779 1876
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1787,7 +1884,9 @@  discard block
 block discarded – undo
1787 1884
 			return $xml_file;
1788 1885
 		}
1789 1886
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1887
+		if(!is_array($list)) {
1888
+			$list = array($list);
1889
+		}
1791 1890
 		// Create a tree for loop
1792 1891
 		$list_count = count($list);
1793 1892
 		for($i=0;$i<$list_count;$i++)
@@ -1875,7 +1974,9 @@  discard block
 block discarded – undo
1875 1974
 	 */
1876 1975
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1976
 	{
1878
-		if(!$source_node) return;
1977
+		if(!$source_node) {
1978
+			return;
1979
+		}
1879 1980
 
1880 1981
 		$oMenuAdminModel = getAdminModel('menu');
1881 1982
 
@@ -1883,7 +1984,9 @@  discard block
 block discarded – undo
1883 1984
 		{
1884 1985
 			$child_buff = "";
1885 1986
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1987
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
1988
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1989
+			}
1887 1990
 			// List variables
1888 1991
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889 1992
 			foreach($names as $key => $val)
@@ -1897,37 +2000,57 @@  discard block
 block discarded – undo
1897 2000
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 2001
 			{
1899 2002
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2003
+			} else {
2004
+				$href = sprintf('"%s"', $url);
1900 2005
 			}
1901
-			else $href = sprintf('"%s"', $url);
1902 2006
 			$is_shortcut = $node->is_shortcut;
1903 2007
 			$open_window = $node->open_window;
1904 2008
 			$expand = $node->expand;
1905 2009
 
1906 2010
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1908
-			else $normal_btn = '';
2011
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2012
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2013
+			} else {
2014
+				$normal_btn = '';
2015
+			}
1909 2016
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1911
-			else $hover_btn = '';
2017
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2018
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2019
+			} else {
2020
+				$hover_btn = '';
2021
+			}
1912 2022
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1914
-			else $active_btn = '';
2023
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2024
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2025
+			} else {
2026
+				$active_btn = '';
2027
+			}
1915 2028
 
1916 2029
 			$group_srls = $node->group_srls;
1917 2030
 
1918 2031
 			if($normal_btn)
1919 2032
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2033
+				if($hover_btn) {
2034
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2035
+				} else {
2036
+					$hover_str = '';
2037
+				}
2038
+				if($active_btn) {
2039
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2040
+				} else {
2041
+					$active_str = '';
2042
+				}
1922 2043
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923
-			}
1924
-			else
2044
+			} else
1925 2045
 			{
1926 2046
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 2047
 			}
1928 2048
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1930
-			else $group_check_code = "true";
2049
+			if($group_srls) {
2050
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
2051
+			} else {
2052
+				$group_check_code = "true";
2053
+			}
1931 2054
 			$attribute = sprintf(
1932 2055
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
1933 2056
 				$menu_item_srl,
@@ -1950,8 +2073,11 @@  discard block
 block discarded – undo
1950 2073
 				$link
1951 2074
 			);
1952 2075
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
2076
+			if($child_buff) {
2077
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2078
+			} else {
2079
+				$buff .=  sprintf('<node %s />', $attribute);
2080
+			}
1955 2081
 		}
1956 2082
 		return $buff;
1957 2083
 	}
@@ -1970,15 +2096,20 @@  discard block
 block discarded – undo
1970 2096
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 2097
 	{
1972 2098
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
2099
+		if(!$source_node) {
2100
+			return $output;
2101
+		}
1974 2102
 
1975 2103
 		$oMenuAdminModel = getAdminModel('menu');
1976 2104
 
1977 2105
 		foreach($source_node as $menu_item_srl => $node)
1978 2106
 		{
1979 2107
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981
-			else $child_output = array("buff"=>"", "url_list"=>array());
2108
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2109
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2110
+			} else {
2111
+				$child_output = array("buff"=>"", "url_list"=>array());
2112
+			}
1982 2113
 			// List variables
1983 2114
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1984 2115
 			unset($name_arr_str);
@@ -1988,11 +2119,16 @@  discard block
 block discarded – undo
1988 2119
 			}
1989 2120
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1990 2121
 			// If url value is not empty in the current node, put the value into an array url_list
1991
-			if($node->url) $child_output['url_list'][] = $node->url;
2122
+			if($node->url) {
2123
+				$child_output['url_list'][] = $node->url;
2124
+			}
1992 2125
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
1993 2126
 			// If node->group_srls value exists
1994
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
1995
-			else $group_check_code = "true";
2127
+			if($node->group_srls) {
2128
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2129
+			} else {
2130
+				$group_check_code = "true";
2131
+			}
1996 2132
 			// List variables
1997 2133
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
1998 2134
 			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
@@ -2000,8 +2136,9 @@  discard block
 block discarded – undo
2000 2136
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2001 2137
 			{
2002 2138
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2139
+			} else {
2140
+				$href = sprintf('"%s"', $url);
2003 2141
 			}
2004
-			else $href = sprintf('"%s"', $url);
2005 2142
 			$is_shortcut = $node->is_shortcut;
2006 2143
 			$open_window = $node->open_window;
2007 2144
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2018,29 +2155,48 @@  discard block
 block discarded – undo
2018 2155
 			$expand = $node->expand;
2019 2156
 
2020 2157
 			$normal_btn = $node->normal_btn;
2021
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2022
-			else $normal_btn = '';
2158
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2159
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2160
+			} else {
2161
+				$normal_btn = '';
2162
+			}
2023 2163
 
2024 2164
 			$hover_btn = $node->hover_btn;
2025
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2026
-			else $hover_btn = '';
2165
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2166
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2167
+			} else {
2168
+				$hover_btn = '';
2169
+			}
2027 2170
 
2028 2171
 			$active_btn = $node->active_btn;
2029
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2030
-			else $active_btn = '';
2172
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2173
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2174
+			} else {
2175
+				$active_btn = '';
2176
+			}
2031 2177
 
2032 2178
 
2033 2179
 			$group_srls = $node->group_srls;
2034 2180
 
2035 2181
 			if($normal_btn)
2036 2182
 			{
2037
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2038
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2183
+				if($hover_btn) {
2184
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2185
+				} else {
2186
+					$hover_str = '';
2187
+				}
2188
+				if($active_btn) {
2189
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2190
+				} else {
2191
+					$active_str = '';
2192
+				}
2039 2193
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2040
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2041
-				else $link_active = $link;
2042
-			}
2043
-			else
2194
+				if($active_btn) {
2195
+					$link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2196
+				} else {
2197
+					$link_active = $link;
2198
+				}
2199
+			} else
2044 2200
 			{
2045 2201
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2046 2202
 			}
@@ -2089,11 +2245,15 @@  discard block
 block discarded – undo
2089 2245
 	 */
2090 2246
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2091 2247
 	{
2092
-		if(!count($menu_srl_list)) return;
2248
+		if(!count($menu_srl_list)) {
2249
+			return;
2250
+		}
2093 2251
 		// Delete the value of menu_srls
2094 2252
 		$args->menu_srls = implode(',',$menu_srl_list);
2095 2253
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2096
-		if(!$output->toBool()) return $output;
2254
+		if(!$output->toBool()) {
2255
+			return $output;
2256
+		}
2097 2257
 
2098 2258
 		$args->layout_srl = $layout_srl;
2099 2259
 		// Mapping menu_srls, layout_srl
@@ -2101,7 +2261,9 @@  discard block
 block discarded – undo
2101 2261
 		{
2102 2262
 			$args->menu_srl = $menu_srl_list[$i];
2103 2263
 			$output = executeQuery('menu.insertMenuLayout', $args);
2104
-			if(!$output->toBool()) return $output;
2264
+			if(!$output->toBool()) {
2265
+				return $output;
2266
+			}
2105 2267
 		}
2106 2268
 	}
2107 2269
 
@@ -2124,9 +2286,15 @@  discard block
 block discarded – undo
2124 2286
 			$oMenuModel = getAdminModel('menu');
2125 2287
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2126 2288
 
2127
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2128
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2129
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2289
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2290
+				FileHandler::removeFile($itemInfo->normal_btn);
2291
+			}
2292
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2293
+				FileHandler::removeFile($itemInfo->hover_btn);
2294
+			}
2295
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2296
+				FileHandler::removeFile($itemInfo->active_btn);
2297
+			}
2130 2298
 		}
2131 2299
 
2132 2300
 		$returnArray = array();
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * menuAdminController class
5
- * admin controller class of the menu module
6
- *
7
- * @author NAVER ([email protected])
8
- * @package /modules/menu
9
- * @version 0.1
10
- */
4
+	 * menuAdminController class
5
+	 * admin controller class of the menu module
6
+	 *
7
+	 * @author NAVER ([email protected])
8
+	 * @package /modules/menu
9
+	 * @version 0.1
10
+	 */
11 11
 class menuAdminController extends menu
12 12
 {
13 13
 	/**
Please login to merge, or discard this patch.
modules/menu/menu.mobile.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@
 block discarded – undo
18 18
 
19 19
 	/**
20 20
 	 * Menu depth arrange
21
+	 * @param integer $depth
21 22
 	 * @return void
22 23
 	 */
23 24
 	function straightenMenu($menu_item, $depth)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if (!$menu_item['link']) return;
26 26
 		$obj = new stdClass;
27 27
 		$obj->href = $menu_item['href'];
28 28
 		$obj->depth = $depth;
29 29
 		$obj->text = $menu_item['text'];
30 30
 		$obj->open_window = $menu_item['open_window'];
31 31
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
33
-		foreach($menu_item['list'] as $item)
32
+		if (!$menu_item['list']) return;
33
+		foreach ($menu_item['list'] as $item)
34 34
 		{
35
-			$this->straightenMenu($item, $depth+1);
35
+			$this->straightenMenu($item, $depth + 1);
36 36
 		}
37 37
 	}
38 38
 
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 	function dispMenuMenu()
44 44
 	{
45 45
 		$menu_srl = Context::get('menu_srl');
46
-		$oAdminModel =& getAdminModel('menu');
46
+		$oAdminModel = & getAdminModel('menu');
47 47
 		$menu_info = $oAdminModel->getMenu($menu_srl);
48 48
 
49
-		if(!$menu_srl)
49
+		if (!$menu_srl)
50 50
 		{
51 51
 			$oMenuAdminController = getAdminController('menu');
52 52
 			$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
53 53
 
54
-			if(file_exists($homeMenuCacheFile))
54
+			if (file_exists($homeMenuCacheFile))
55 55
 			{
56 56
 				@include($homeMenuCacheFile);
57 57
 			}
58
-			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
58
+			$menu_info->php_file = './files/cache/menu/' . $homeMenuSrl . '.php';
59 59
 		}
60 60
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
-		if(is_array($menu->list))
61
+		if (file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
+		if (is_array($menu->list))
63 63
 		{
64
-			foreach($menu->list as $menu_item)
64
+			foreach ($menu->list as $menu_item)
65 65
 			{
66 66
 				$this->straightenMenu($menu_item, 0);
67 67
 			}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 		Context::set('menu', $this->result);	
71 71
 
72
-		$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
72
+		$this->setTemplatePath(sprintf("%stpl/", $this->module_path));
73 73
 		$this->setTemplateFile('menu.html');
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,14 +22,18 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if(!$menu_item['link']) {
26
+			return;
27
+		}
26 28
 		$obj = new stdClass;
27 29
 		$obj->href = $menu_item['href'];
28 30
 		$obj->depth = $depth;
29 31
 		$obj->text = $menu_item['text'];
30 32
 		$obj->open_window = $menu_item['open_window'];
31 33
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
34
+		if(!$menu_item['list']) {
35
+			return;
36
+		}
33 37
 		foreach($menu_item['list'] as $item)
34 38
 		{
35 39
 			$this->straightenMenu($item, $depth+1);
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
59 63
 		}
60 64
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
65
+		if(file_exists($menu_info->php_file)) {
66
+			@include($menu_info->php_file);
67
+		}
62 68
 		if(is_array($menu->list))
63 69
 		{
64 70
 			foreach($menu->list as $menu_item)
Please login to merge, or discard this patch.
modules/module/module.admin.controller.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -260,6 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
+	/**
264
+	 * @param boolean $isProc
265
+	 */
263 266
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 267
 	{
265 268
 		if(!$isProc)
@@ -938,6 +941,9 @@  discard block
 block discarded – undo
938 941
 
939 942
 	}
940 943
 
944
+	/**
945
+	 * @param string $skinVars
946
+	 */
941 947
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
942 948
 	{
943 949
 		if(!$moduleSrl && !$mid)
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleAdminController
5
- * @author NAVER ([email protected])
6
- * @brief admin controller class of the module module
7
- */
4
+	 * @class  moduleAdminController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief admin controller class of the module module
7
+	 */
8 8
 class moduleAdminController extends module
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if (!$output->toBool()) return $output;
26 26
 
27 27
 		$this->setMessage("success_registed");
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	function procModuleAdminUpdateCategory()
37 37
 	{
38 38
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
39
+		if (!$output->toBool()) return $output;
40 40
 
41 41
 		$this->setMessage('success_updated');
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function procModuleAdminDeleteCategory()
51 51
 	{
52 52
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
53
+		if (!$output->toBool()) return $output;
54 54
 
55 55
 		$this->setMessage('success_deleted');
56 56
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	function procModuleAdminCopyModule($args = NULL)
86 86
 	{
87 87
 		$isProc = false;
88
-		if(!$args)
88
+		if (!$args)
89 89
 		{
90 90
 			$isProc = true;
91 91
 			// Get information of the target module to copy
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 			$module_srl = $args->module_srl;
98 98
 		}
99 99
 
100
-		if(!$module_srl)
100
+		if (!$module_srl)
101 101
 		{
102 102
 			return $this->_returnByProc($isProc);
103 103
 		}
104 104
 
105 105
 		// Get module name to create and browser title
106 106
 		$clones = array();
107
-		for($i=1;$i<=10;$i++)
107
+		for ($i = 1; $i <= 10; $i++)
108 108
 		{
109
-			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
112
-			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
109
+			$mid = trim($args->{"mid_" . $i});
110
+			if (!$mid) continue;
111
+			if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
112
+			$browser_title = $args->{"browser_title_" . $i};
113
+			if (!$mid) continue;
114
+			if ($mid && !$browser_title) $browser_title = $mid;
115 115
 			$clones[$mid] = $browser_title;
116 116
 		}
117
-		if(count($clones) < 1)
117
+		if (count($clones) < 1)
118 118
 		{
119 119
 			return $this->_returnByProc($isProc);
120 120
 		}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$module_args->module_srl = $module_srl;
130 130
 		$output = executeQueryArray('module.getModuleGrants', $module_args);
131 131
 		$grant = array();
132
-		if($output->data)
132
+		if ($output->data)
133 133
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
134
+			foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl;
135 135
 		}
136 136
 
137 137
 		// get Extra Vars
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		$extra_args->module_srl = $module_srl;
140 140
 		$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
141 141
 		$extra_vars = new stdClass();
142
-		if($extra_output->toBool() && is_array($extra_output->data))
142
+		if ($extra_output->toBool() && is_array($extra_output->data))
143 143
 		{
144
-			foreach($extra_output->data as $info)
144
+			foreach ($extra_output->data as $info)
145 145
 			{
146 146
 				$extra_vars->{$info->name} = $info->value;
147 147
 			}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		$tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl);
151 151
 		$tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl);
152 152
 
153
-		if($tmpModuleSkinVars)
153
+		if ($tmpModuleSkinVars)
154 154
 		{
155
-			foreach($tmpModuleSkinVars as $key=>$value)
155
+			foreach ($tmpModuleSkinVars as $key=>$value)
156 156
 			{
157 157
 				$moduleSkinVars->{$key} = $value->value;
158 158
 			}
159 159
 		}
160 160
 
161
-		if($tmpModuleMobileSkinVars)
161
+		if ($tmpModuleMobileSkinVars)
162 162
 		{
163
-			foreach($tmpModuleMobileSkinVars as $key=>$value)
163
+			foreach ($tmpModuleMobileSkinVars as $key=>$value)
164 164
 			{
165 165
 				$moduleMobileSkinVars->{$key} = $value->value;
166 166
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$triggerObj->moduleSrlList = array();
175 175
 
176 176
 		$errorLog = array();
177
-		foreach($clones as $mid => $browser_title)
177
+		foreach ($clones as $mid => $browser_title)
178 178
 		{
179 179
 			$clone_args = new stdClass;
180 180
 			$clone_args = clone $module_info;
@@ -188,29 +188,29 @@  discard block
 block discarded – undo
188 188
 			// Create a module
189 189
 			$output = $oModuleController->insertModule($clone_args);
190 190
 
191
-			if(!$output->toBool())
191
+			if (!$output->toBool())
192 192
 			{
193
-				$errorLog[] = $mid . ' : '. $output->message;
193
+				$errorLog[] = $mid . ' : ' . $output->message;
194 194
 				continue;
195 195
 			}
196 196
 			$module_srl = $output->get('module_srl');
197 197
 
198
-			if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
198
+			if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
199 199
 			{
200 200
 				// copy document
201 201
 				$oDocumentAdminController = getAdminController('document');
202 202
 				$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl);
203 203
 				$document_srls = $copyOutput->get('copied_srls');
204
-				if($document_srls && count($document_srls) > 0)
204
+				if ($document_srls && count($document_srls) > 0)
205 205
 				{
206 206
 					$extra_vars->document_srl = array_pop($document_srls);
207 207
 				}
208 208
 
209
-				if($extra_vars->mdocument_srl)
209
+				if ($extra_vars->mdocument_srl)
210 210
 				{
211 211
 					$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl);
212 212
 					$copiedSrls = $copyOutput->get('copied_srls');
213
-					if($copiedSrls && count($copiedSrls) > 0)
213
+					if ($copiedSrls && count($copiedSrls) > 0)
214 214
 					{
215 215
 						$extra_vars->mdocument_srl = array_pop($copiedSrls);
216 216
 					}
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 			}
219 219
 
220 220
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
221
+			if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
+			if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
223 223
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
224
+			if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
+			if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
226 226
 
227 227
 			$triggerObj->moduleSrlList[] = $module_srl;
228 228
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$oDB->commit();
233 233
 
234
-		if(count($errorLog) > 0)
234
+		if (count($errorLog) > 0)
235 235
 		{
236 236
 			$message = implode('\n', $errorLog);
237 237
 			$this->setMessage($message);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 			$this->setMessage('success_registed');
243 243
 		}
244 244
 
245
-		if($isProc)
245
+		if ($isProc)
246 246
 		{
247
-			if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
247
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
248 248
 			{
249 249
 				global $lang;
250 250
 				htmlHeader();
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
-	private function _returnByProc($isProc, $msg='msg_invalid_request')
263
+	private function _returnByProc($isProc, $msg = 'msg_invalid_request')
264 264
 	{
265
-		if(!$isProc)
265
+		if (!$isProc)
266 266
 			return;
267 267
 		else
268 268
 		{
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
 		// Get information of the module
283 283
 		$columnList = array('module_srl', 'module');
284 284
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new Object(-1,'msg_invalid_request');
285
+		if (!$module_info) return new Object(-1, 'msg_invalid_request');
286 286
 		// Register Admin ID
287 287
 		$oModuleController->deleteAdminId($module_srl);
288 288
 		$admin_member = Context::get('admin_member');
289
-		if($admin_member)
289
+		if ($admin_member)
290 290
 		{
291
-			$admin_members = explode(',',$admin_member);
292
-			foreach($admin_members as $admin_id)
291
+			$admin_members = explode(',', $admin_member);
292
+			foreach ($admin_members as $admin_id)
293 293
 			{
294 294
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
295
+				if (!$admin_id) continue;
296 296
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 297
 			}
298 298
 		}
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		$grant_list->manager->default = 'manager';
308 308
 
309 309
 		$grant = new stdClass();
310
-		foreach($grant_list as $grant_name => $grant_info)
310
+		foreach ($grant_list as $grant_name => $grant_info)
311 311
 		{
312 312
 			// Get the default value
313
-			$default = Context::get($grant_name.'_default');
313
+			$default = Context::get($grant_name . '_default');
314 314
 			// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
315 315
 			$grant->{$grant_name} = array();
316
-			if(strlen($default))
316
+			if (strlen($default))
317 317
 			{
318 318
 				$grant->{$grant_name}[] = $default;
319 319
 				continue;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 			else
323 323
 			{
324 324
 				$group_srls = Context::get($grant_name);
325
-				if($group_srls)
325
+				if ($group_srls)
326 326
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
327
+					if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
328
+					elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
329 329
 					else $group_srls = array($group_srls);
330 330
 					$grant->{$grant_name} = $group_srls;
331 331
 				}
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		$args = new stdClass();
339 339
 		$args->module_srl = $module_srl;
340 340
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
341
+		if (!$output->toBool()) return $output;
342 342
 		// Permissions stored in the DB
343
-		foreach($grant as $grant_name => $group_srls)
343
+		foreach ($grant as $grant_name => $group_srls)
344 344
 		{
345
-			foreach($group_srls as $val)
345
+			foreach ($group_srls as $val)
346 346
 			{
347 347
 				$args = new stdClass();
348 348
 				$args->module_srl = $module_srl;
349 349
 				$args->name = $grant_name;
350 350
 				$args->group_srl = $val;
351 351
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
352
+				if (!$output->toBool()) return $output;
353 353
 			}
354 354
 		}
355 355
 		$this->setMessage('success_registed');
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 		$oModuleModel = getModel('module');
369 369
 		$columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix');
370 370
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
371
-		if($module_info->module_srl)
371
+		if ($module_info->module_srl)
372 372
 		{
373
-			if($mode === 'M')
373
+			if ($mode === 'M')
374 374
 			{
375
-				if($module_info->is_mskin_fix == 'Y')
375
+				if ($module_info->is_mskin_fix == 'Y')
376 376
 				{
377 377
 					$skin = $module_info->mskin;
378 378
 				}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 			else
385 385
 			{
386
-				if($module_info->is_skin_fix == 'Y')
386
+				if ($module_info->is_skin_fix == 'Y')
387 387
 				{
388 388
 					$skin = $module_info->skin;
389 389
 				}
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 			}
395 395
 
396 396
 			// Get skin information (to check extra_vars)
397
-			$module_path = _XE_PATH_ . 'modules/'.$module_info->module;
397
+			$module_path = _XE_PATH_ . 'modules/' . $module_info->module;
398 398
 
399
-			if($mode === 'M')
399
+			if ($mode === 'M')
400 400
 			{
401 401
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 402
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -417,35 +417,35 @@  discard block
 block discarded – undo
417 417
 			unset($obj->module);
418 418
 			unset($obj->_mode);
419 419
 			// Separately handle if a type of extra_vars is an image in the original skin_info
420
-			if($skin_info->extra_vars)
420
+			if ($skin_info->extra_vars)
421 421
 			{
422
-				foreach($skin_info->extra_vars as $vars)
422
+				foreach ($skin_info->extra_vars as $vars)
423 423
 				{
424
-					if($vars->type!='image') continue;
424
+					if ($vars->type != 'image') continue;
425 425
 
426 426
 					$image_obj = $obj->{$vars->name};
427 427
 					// Get a variable to delete
428
-					$del_var = $obj->{"del_".$vars->name};
429
-					unset($obj->{"del_".$vars->name});
430
-					if($del_var == 'Y')
428
+					$del_var = $obj->{"del_" . $vars->name};
429
+					unset($obj->{"del_" . $vars->name});
430
+					if ($del_var == 'Y')
431 431
 					{
432 432
 						FileHandler::removeFile($skin_vars[$vars->name]->value);
433 433
 						continue;
434 434
 					}
435 435
 					// Use the previous data if not uploaded
436
-					if(!$image_obj['tmp_name'])
436
+					if (!$image_obj['tmp_name'])
437 437
 					{
438 438
 						$obj->{$vars->name} = $skin_vars[$vars->name]->value;
439 439
 						continue;
440 440
 					}
441 441
 					// Ignore if the file is not successfully uploaded
442
-					if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
442
+					if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
443 443
 					{
444 444
 						unset($obj->{$vars->name});
445 445
 						continue;
446 446
 					}
447 447
 					// Ignore if the file is not an image
448
-					if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
448
+					if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
449 449
 					{
450 450
 						unset($obj->{$vars->name});
451 451
 						continue;
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 					// Upload the file to a path
454 454
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 455
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
456
+					if (!FileHandler::makeDir($path)) return false;
457 457
 
458
-					$filename = $path.$image_obj['name'];
458
+					$filename = $path . $image_obj['name'];
459 459
 					// Move the file
460
-					if(!move_uploaded_file($image_obj['tmp_name'], $filename))
460
+					if (!move_uploaded_file($image_obj['tmp_name'], $filename))
461 461
 					{
462 462
 						unset($obj->{$vars->name});
463 463
 						continue;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			*/
482 482
 			$oModuleController = getController('module');
483 483
 
484
-			if($mode === 'M')
484
+			if ($mode === 'M')
485 485
 			{
486 486
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487 487
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			{
490 490
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 491
 			}
492
-			if(!$output->toBool())
492
+			if (!$output->toBool())
493 493
 			{
494 494
 				return $output;
495 495
 			}
@@ -506,29 +506,29 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$vars = Context::getRequestVars();
508 508
 
509
-		if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
509
+		if (!$vars->module_srls) return new Object(-1, 'msg_invalid_request');
510 510
 
511
-		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request');
511
+		$module_srls = explode(',', $vars->module_srls);
512
+		if (count($module_srls) < 1) return new Object(-1, 'msg_invalid_request');
513 513
 
514 514
 		$oModuleModel = getModel('module');
515
-		$oModuleController= getController('module');
515
+		$oModuleController = getController('module');
516 516
 		$columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate');
517
-		$updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile');
518
-		foreach($updateList as $key=>$val)
517
+		$updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile');
518
+		foreach ($updateList as $key=>$val)
519 519
 		{
520
-			if(!strlen($vars->{$val}))
520
+			if (!strlen($vars->{$val}))
521 521
 			{
522 522
 				unset($updateList[$key]);
523 523
 				$columnList[] = $val;
524 524
 			}
525 525
 		}
526 526
 
527
-		foreach($module_srls as $module_srl)
527
+		foreach ($module_srls as $module_srl)
528 528
 		{
529 529
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
530 530
 
531
-			foreach($updateList as $val)
531
+			foreach ($updateList as $val)
532 532
 			{
533 533
 				$module_info->{$val} = $vars->{$val};
534 534
 			}
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->setMessage('success_registed');
539
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
539
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
540 540
 		{
541
-			if(Context::get('success_return_url'))
541
+			if (Context::get('success_return_url'))
542 542
 			{
543 543
 				$this->setRedirectUrl(Context::get('success_return_url'));
544 544
 			}
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
 	function procModuleAdminModuleGrantSetup()
562 562
 	{
563 563
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new Object(-1,'msg_invalid_request');
564
+		if (!$module_srls) return new Object(-1, 'msg_invalid_request');
565 565
 
566
-		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new Object(-1,'msg_invalid_request');
566
+		$modules = explode(',', $module_srls);
567
+		if (count($modules) < 1) return new Object(-1, 'msg_invalid_request');
568 568
 
569 569
 		$oModuleController = getController('module');
570 570
 		$oModuleModel = getModel('module');
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$grant = new stdClass;
583 583
 
584
-		foreach($grant_list as $grant_name => $grant_info)
584
+		foreach ($grant_list as $grant_name => $grant_info)
585 585
 		{
586 586
 			// Get the default value
587
-			$default = Context::get($grant_name.'_default');
587
+			$default = Context::get($grant_name . '_default');
588 588
 			// -1 = Sign only, 0 = all users
589 589
 			$grant->{$grant_name} = array();
590
-			if(strlen($default))
590
+			if (strlen($default))
591 591
 			{
592 592
 				$grant->{$grant_name}[] = $default;
593 593
 				continue;
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 			else
597 597
 			{
598 598
 				$group_srls = Context::get($grant_name);
599
-				if($group_srls)
599
+				if ($group_srls)
600 600
 				{
601
-					if(!is_array($group_srls))
601
+					if (!is_array($group_srls))
602 602
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
603
+						if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
604
+						elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
605 605
 						else $group_srls = array($group_srls);
606 606
 					}
607 607
 					$grant->{$grant_name} = $group_srls;
@@ -612,30 +612,30 @@  discard block
 block discarded – undo
612 612
 		}
613 613
 
614 614
 		// Stored in the DB
615
-		foreach($modules as $module_srl)
615
+		foreach ($modules as $module_srl)
616 616
 		{
617 617
 			$args = new stdClass();
618 618
 			$args->module_srl = $module_srl;
619 619
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
620
+			if (!$output->toBool()) continue;
621 621
 			// Permissions stored in the DB
622
-			foreach($grant as $grant_name => $group_srls)
622
+			foreach ($grant as $grant_name => $group_srls)
623 623
 			{
624
-				foreach($group_srls as $val)
624
+				foreach ($group_srls as $val)
625 625
 				{
626 626
 					$args = new stdClass();
627 627
 					$args->module_srl = $module_srl;
628 628
 					$args->name = $grant_name;
629 629
 					$args->group_srl = $val;
630 630
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
631
+					if (!$output->toBool()) return $output;
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 		$this->setMessage('success_registed');
636
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
636
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
637 637
 		{
638
-			if(Context::get('success_return_url'))
638
+			if (Context::get('success_return_url'))
639 639
 			{
640 640
 				$this->setRedirectUrl(Context::get('success_return_url'));
641 641
 			}
@@ -662,38 +662,38 @@  discard block
 block discarded – undo
662 662
 		$target = Context::get('target');
663 663
 		$module = Context::get('module');
664 664
 		$args = new stdClass();
665
-		$args->site_srl = (int)$site_module_info->site_srl;
666
-		$args->name = str_replace(' ','_',Context::get('lang_code'));
667
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
665
+		$args->site_srl = (int) $site_module_info->site_srl;
666
+		$args->name = str_replace(' ', '_', Context::get('lang_code'));
667
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
668
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
669 669
 
670 670
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
671
+		if (empty($args->name)) $args->name = 'userLang' . date('YmdHis') . '' . sprintf('%03d', mt_rand(0, 100));
672 672
 
673
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
673
+		if (!$args->name) return new Object(-1, 'msg_invalid_request');
674 674
 		// Check whether a language code exists
675 675
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
676
+		if (!$output->toBool()) return $output;
677 677
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
678
+		if ($output->data) $output = executeQuery('module.deleteLang', $args);
679
+		if (!$output->toBool()) return $output;
680 680
 		// Enter
681 681
 		$lang_supported = Context::get('lang_supported');
682
-		foreach($lang_supported as $key => $val)
682
+		foreach ($lang_supported as $key => $val)
683 683
 		{
684 684
 			$args->lang_code = $key;
685 685
 			$args->value = trim(Context::get($key));
686 686
 
687 687
 			// if request method is json, strip slashes
688
-			if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
688
+			if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
689 689
 			{
690 690
 				$args->value = stripslashes($args->value);
691 691
 			}
692 692
 
693
-			if($args->value)
693
+			if ($args->value)
694 694
 			{
695 695
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
696
+				if (!$output->toBool()) return $output;
697 697
 			}
698 698
 		}
699 699
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 		// Get language code
714 714
 		$site_module_info = Context::get('site_module_info');
715 715
 		$args = new stdClass();
716
-		$args->site_srl = (int)$site_module_info->site_srl;
717
-		$args->name = str_replace(' ','_',Context::get('name'));
718
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
716
+		$args->site_srl = (int) $site_module_info->site_srl;
717
+		$args->name = str_replace(' ', '_', Context::get('name'));
718
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
719
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
720
+		if (!$args->name) return new Object(-1, 'msg_invalid_request');
721 721
 
722 722
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
723
+		if (!$output->toBool()) return $output;
724 724
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 725
 
726 726
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
 	function procModuleAdminGetList()
733 733
 	{
734
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
734
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
735 735
 
736 736
 		$oModuleController = getController('module');
737 737
 		$oModuleModel = getModel('module');
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 		$args = new stdClass;
745 745
 		$logged_info = Context::get('logged_info');
746 746
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
747
+		if ($site_keyword) $args->site_keyword = $site_keyword;
748 748
 
749
-		if(!$site_srl)
749
+		if (!$site_srl)
750 750
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
751
+			if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
+			else $args->site_srl = (int) $site_module_info->site_srl;
753 753
 		}
754 754
 		else $args->site_srl = $site_srl;
755 755
 
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 		// Get a list of modules at the site
760 760
 		$output = executeQueryArray('module.getSiteModules', $args);
761 761
 		$mid_list = array();
762
-		if(count($output->data) > 0)
762
+		if (count($output->data) > 0)
763 763
 		{
764
-			foreach($output->data as $val)
764
+			foreach ($output->data as $val)
765 765
 			{
766 766
 				$module = trim($val->module);
767
-				if(!$module) continue;
767
+				if (!$module) continue;
768 768
 
769 769
 				// replace user defined lang.
770 770
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 				$obj->browser_title = $val->browser_title;
776 776
 				$obj->mid = $val->mid;
777 777
 				$obj->module_category_srl = $val->module_category_srl;
778
-				if($val->module_category_srl > 0)
778
+				if ($val->module_category_srl > 0)
779 779
 				{
780 780
 					$moduleCategorySrl[] = $val->module_category_srl;
781 781
 				}
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		$moduleCategorySrl = array_unique($moduleCategorySrl);
788 788
 		$output = $oModuleModel->getModuleCategories($moduleCategorySrl);
789 789
 		$categoryNameList = array();
790
-		if(is_array($output))
790
+		if (is_array($output))
791 791
 		{
792
-			foreach($output as $value)
792
+			foreach ($output as $value)
793 793
 			{
794 794
 				$categoryNameList[$value->module_category_srl] = $value->title;
795 795
 			}
796 796
 		}
797 797
 
798 798
 		$selected_module = Context::get('selected_module');
799
-		if(count($mid_list) > 0)
799
+		if (count($mid_list) > 0)
800 800
 		{
801
-			foreach($mid_list as $module => $val)
801
+			foreach ($mid_list as $module => $val)
802 802
 			{
803
-				if(!$selected_module) $selected_module = $module;
803
+				if (!$selected_module) $selected_module = $module;
804 804
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 805
 
806
-				if(!$xml_info)
806
+				if (!$xml_info)
807 807
 				{
808 808
 					unset($mid_list[$module]);
809 809
 					continue;
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
 				$mid_list[$module]->title = $xml_info->title;
813 813
 
814 814
 				// change module category srl to title
815
-				if(is_array($val->list))
815
+				if (is_array($val->list))
816 816
 				{
817
-					foreach($val->list as $key=>$value)
817
+					foreach ($val->list as $key=>$value)
818 818
 					{
819
-						if($value->module_category_srl > 0)
819
+						if ($value->module_category_srl > 0)
820 820
 						{
821 821
 							$categorySrl = $mid_list[$module]->list[$key]->module_category_srl;
822
-							if(isset($categoryNameList[$categorySrl]))
822
+							if (isset($categoryNameList[$categorySrl]))
823 823
 							{
824 824
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 825
 							}
@@ -847,23 +847,23 @@  discard block
 block discarded – undo
847 847
 		$args = new stdClass();
848 848
 
849 849
 		// Get the language file of the current site
850
-		if(!$site_srl)
850
+		if (!$site_srl)
851 851
 		{
852 852
 			$site_module_info = Context::get('site_module_info');
853
-			$args->site_srl = (int)$site_module_info->site_srl;
853
+			$args->site_srl = (int) $site_module_info->site_srl;
854 854
 		}
855 855
 		else
856 856
 		{
857 857
 			$args->site_srl = $site_srl;
858 858
 		}
859 859
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
860
+		if (!$output->toBool() || !$output->data) return;
861 861
 		// Set the cache directory
862
-		$cache_path = _XE_PATH_.'files/cache/lang_defined/';
862
+		$cache_path = _XE_PATH_ . 'files/cache/lang_defined/';
863 863
 		FileHandler::makeDir($cache_path);
864 864
 
865 865
 		$langMap = array();
866
-		foreach($output->data as $val)
866
+		foreach ($output->data as $val)
867 867
 		{
868 868
 			$langMap[$val->lang_code][$val->name] = $val->value;
869 869
 		}
@@ -872,27 +872,27 @@  discard block
 block discarded – undo
872 872
 		$dbInfo = Context::getDBInfo();
873 873
 		$defaultLang = $dbInfo->lang_type;
874 874
 
875
-		if(!is_array($langMap[$defaultLang]))
875
+		if (!is_array($langMap[$defaultLang]))
876 876
 		{
877 877
 			$langMap[$defaultLang] = array();
878 878
 		}
879 879
 
880
-		foreach($lang_supported as $langCode => $langName)
880
+		foreach ($lang_supported as $langCode => $langName)
881 881
 		{
882
-			if(!is_array($langMap[$langCode]))
882
+			if (!is_array($langMap[$langCode]))
883 883
 			{
884 884
 				$langMap[$langCode] = array();
885 885
 			}
886 886
 
887 887
 			$langMap[$langCode] += $langMap[$defaultLang];
888
-			foreach($lang_supported as $targetLangCode => $targetLangName)
888
+			foreach ($lang_supported as $targetLangCode => $targetLangName)
889 889
 			{
890
-				if($langCode == $targetLangCode || $langCode == $defaultLang)
890
+				if ($langCode == $targetLangCode || $langCode == $defaultLang)
891 891
 				{
892 892
 					continue;
893 893
 				}
894 894
 
895
-				if(!is_array($langMap[$targetLangCode]))
895
+				if (!is_array($langMap[$targetLangCode]))
896 896
 				{
897 897
 					$langMap[$targetLangCode] = array();
898 898
 				}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 			}
902 902
 
903 903
 			$buff = array("<?php if(!defined('__XE__')) exit();");
904
-			foreach($langMap[$langCode] as $code => $value)
904
+			foreach ($langMap[$langCode] as $code => $value)
905 905
 			{
906 906
 				$buff[] = sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes($value, "'"));
907 907
 			}
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 
925 925
 		$isSkinFix = Context::get('is_skin_fix');
926 926
 
927
-		if($isSkinFix)
927
+		if ($isSkinFix)
928 928
 		{
929 929
 			$isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y';
930 930
 		}
@@ -940,14 +940,14 @@  discard block
 block discarded – undo
940 940
 
941 941
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
942 942
 	{
943
-		if(!$moduleSrl && !$mid)
943
+		if (!$moduleSrl && !$mid)
944 944
 		{
945 945
 			return $this->stop(-1, 'msg_invalid_request');
946 946
 		}
947 947
 
948 948
 		$oModuleModel = getModel('module');
949 949
 
950
-		if($mid)
950
+		if ($mid)
951 951
 		{
952 952
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
953 953
 		}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
957 957
 		}
958 958
 
959
-		if(!$moduleInfo)
959
+		if (!$moduleInfo)
960 960
 		{
961 961
 			return $this->stop(-1, 'msg_module_not_exists');
962 962
 		}
@@ -965,26 +965,26 @@  discard block
 block discarded – undo
965 965
 		$layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl';
966 966
 		$skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix';
967 967
 
968
-		if(strlen($layoutSrl))
968
+		if (strlen($layoutSrl))
969 969
 		{
970 970
 			$moduleInfo->{$layoutTargetValue} = $layoutSrl;
971 971
 		}
972 972
 
973
-		if(strlen($isSkinFix))
973
+		if (strlen($isSkinFix))
974 974
 		{
975 975
 			$moduleInfo->{$skinFixTargetValue} = $isSkinFix;
976 976
 		}
977 977
 
978
-		if($isSkinFix == 'Y')
978
+		if ($isSkinFix == 'Y')
979 979
 		{
980 980
 			$moduleInfo->{$skinTargetValue} = $skinName;
981 981
 			$skinVars = json_decode($skinVars);
982 982
 
983
-			if(is_array($skinVars))
983
+			if (is_array($skinVars))
984 984
 			{
985
-				foreach($skinVars as $key => $val)
985
+				foreach ($skinVars as $key => $val)
986 986
 				{
987
-					if(empty($val))
987
+					if (empty($val))
988 988
 					{
989 989
 						continue;
990 990
 					}
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 		$menuItemSrl = Context::get('menu_item_srl');
1006 1006
 		$useMobile = Context::get('use_mobile');
1007 1007
 
1008
-		if(!$menuItemSrl)
1008
+		if (!$menuItemSrl)
1009 1009
 		{
1010 1010
 			return $this->stop(-1, 'msg_invalid_request');
1011 1011
 		}
Please login to merge, or discard this patch.
Braces   +155 added lines, -79 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if(!$output->toBool()) {
26
+			return $output;
27
+		}
26 28
 
27 29
 		$this->setMessage("success_registed");
28 30
 
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 	function procModuleAdminUpdateCategory()
37 39
 	{
38 40
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
41
+		if(!$output->toBool()) {
42
+			return $output;
43
+		}
40 44
 
41 45
 		$this->setMessage('success_updated');
42 46
 
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
 	function procModuleAdminDeleteCategory()
51 55
 	{
52 56
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
57
+		if(!$output->toBool()) {
58
+			return $output;
59
+		}
54 60
 
55 61
 		$this->setMessage('success_deleted');
56 62
 
@@ -91,8 +97,7 @@  discard block
 block discarded – undo
91 97
 			// Get information of the target module to copy
92 98
 			$module_srl = Context::get('module_srl');
93 99
 			$args = Context::getRequestVars();
94
-		}
95
-		else
100
+		} else
96 101
 		{
97 102
 			$module_srl = $args->module_srl;
98 103
 		}
@@ -107,11 +112,19 @@  discard block
 block discarded – undo
107 112
 		for($i=1;$i<=10;$i++)
108 113
 		{
109 114
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
115
+			if(!$mid) {
116
+				continue;
117
+			}
118
+			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) {
119
+				return new Object(-1, 'msg_limit_mid');
120
+			}
112 121
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
122
+			if(!$mid) {
123
+				continue;
124
+			}
125
+			if($mid && !$browser_title) {
126
+				$browser_title = $mid;
127
+			}
115 128
 			$clones[$mid] = $browser_title;
116 129
 		}
117 130
 		if(count($clones) < 1)
@@ -131,7 +144,9 @@  discard block
 block discarded – undo
131 144
 		$grant = array();
132 145
 		if($output->data)
133 146
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
147
+			foreach($output->data as $val) {
148
+				$grant[$val->name][] = $val->group_srl;
149
+			}
135 150
 		}
136 151
 
137 152
 		// get Extra Vars
@@ -218,11 +233,19 @@  discard block
 block discarded – undo
218 233
 			}
219 234
 
220 235
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
236
+			if(count($grant) > 0) {
237
+				$oModuleController->insertModuleGrants($module_srl, $grant);
238
+			}
239
+			if($extra_vars) {
240
+				$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
241
+			}
223 242
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
243
+			if($moduleSkinVars) {
244
+				$oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
245
+			}
246
+			if($moduleMobileSkinVars) {
247
+				$oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
248
+			}
226 249
 
227 250
 			$triggerObj->moduleSrlList[] = $module_srl;
228 251
 		}
@@ -235,8 +258,7 @@  discard block
 block discarded – undo
235 258
 		{
236 259
 			$message = implode('\n', $errorLog);
237 260
 			$this->setMessage($message);
238
-		}
239
-		else
261
+		} else
240 262
 		{
241 263
 			$message = $lang->success_registed;
242 264
 			$this->setMessage('success_registed');
@@ -262,9 +284,9 @@  discard block
 block discarded – undo
262 284
 
263 285
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 286
 	{
265
-		if(!$isProc)
266
-			return;
267
-		else
287
+		if(!$isProc) {
288
+					return;
289
+		} else
268 290
 		{
269 291
 			return new Object(-1, $msg);
270 292
 		}
@@ -282,7 +304,9 @@  discard block
 block discarded – undo
282 304
 		// Get information of the module
283 305
 		$columnList = array('module_srl', 'module');
284 306
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new Object(-1,'msg_invalid_request');
307
+		if(!$module_info) {
308
+			return new Object(-1,'msg_invalid_request');
309
+		}
286 310
 		// Register Admin ID
287 311
 		$oModuleController->deleteAdminId($module_srl);
288 312
 		$admin_member = Context::get('admin_member');
@@ -292,7 +316,9 @@  discard block
 block discarded – undo
292 316
 			foreach($admin_members as $admin_id)
293 317
 			{
294 318
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
319
+				if(!$admin_id) {
320
+					continue;
321
+				}
296 322
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 323
 			}
298 324
 		}
@@ -318,15 +344,18 @@  discard block
 block discarded – undo
318 344
 				$grant->{$grant_name}[] = $default;
319 345
 				continue;
320 346
 				// users in a particular group
321
-			}
322
-			else
347
+			} else
323 348
 			{
324 349
 				$group_srls = Context::get($grant_name);
325 350
 				if($group_srls)
326 351
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
329
-					else $group_srls = array($group_srls);
352
+					if(strpos($group_srls,'|@|')!==false) {
353
+						$group_srls = explode('|@|',$group_srls);
354
+					} elseif(strpos($group_srls,',')!==false) {
355
+						$group_srls = explode(',',$group_srls);
356
+					} else {
357
+						$group_srls = array($group_srls);
358
+					}
330 359
 					$grant->{$grant_name} = $group_srls;
331 360
 				}
332 361
 				continue;
@@ -338,7 +367,9 @@  discard block
 block discarded – undo
338 367
 		$args = new stdClass();
339 368
 		$args->module_srl = $module_srl;
340 369
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
370
+		if(!$output->toBool()) {
371
+			return $output;
372
+		}
342 373
 		// Permissions stored in the DB
343 374
 		foreach($grant as $grant_name => $group_srls)
344 375
 		{
@@ -349,7 +380,9 @@  discard block
 block discarded – undo
349 380
 				$args->name = $grant_name;
350 381
 				$args->group_srl = $val;
351 382
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
383
+				if(!$output->toBool()) {
384
+					return $output;
385
+				}
353 386
 			}
354 387
 		}
355 388
 		$this->setMessage('success_registed');
@@ -375,19 +408,16 @@  discard block
 block discarded – undo
375 408
 				if($module_info->is_mskin_fix == 'Y')
376 409
 				{
377 410
 					$skin = $module_info->mskin;
378
-				}
379
-				else
411
+				} else
380 412
 				{
381 413
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M');
382 414
 				}
383
-			}
384
-			else
415
+			} else
385 416
 			{
386 417
 				if($module_info->is_skin_fix == 'Y')
387 418
 				{
388 419
 					$skin = $module_info->skin;
389
-				}
390
-				else
420
+				} else
391 421
 				{
392 422
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P');
393 423
 				}
@@ -400,8 +430,7 @@  discard block
 block discarded – undo
400 430
 			{
401 431
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 432
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
403
-			}
404
-			else
433
+			} else
405 434
 			{
406 435
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
407 436
 				$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -421,7 +450,9 @@  discard block
 block discarded – undo
421 450
 			{
422 451
 				foreach($skin_info->extra_vars as $vars)
423 452
 				{
424
-					if($vars->type!='image') continue;
453
+					if($vars->type!='image') {
454
+						continue;
455
+					}
425 456
 
426 457
 					$image_obj = $obj->{$vars->name};
427 458
 					// Get a variable to delete
@@ -453,7 +484,9 @@  discard block
 block discarded – undo
453 484
 					// Upload the file to a path
454 485
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 486
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
487
+					if(!FileHandler::makeDir($path)) {
488
+						return false;
489
+					}
457 490
 
458 491
 					$filename = $path.$image_obj['name'];
459 492
 					// Move the file
@@ -484,8 +517,7 @@  discard block
 block discarded – undo
484 517
 			if($mode === 'M')
485 518
 			{
486 519
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487
-			}
488
-			else
520
+			} else
489 521
 			{
490 522
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 523
 			}
@@ -506,10 +538,14 @@  discard block
 block discarded – undo
506 538
 	{
507 539
 		$vars = Context::getRequestVars();
508 540
 
509
-		if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
541
+		if(!$vars->module_srls) {
542
+			return new Object(-1,'msg_invalid_request');
543
+		}
510 544
 
511 545
 		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request');
546
+		if(count($module_srls) < 1) {
547
+			return new Object(-1,'msg_invalid_request');
548
+		}
513 549
 
514 550
 		$oModuleModel = getModel('module');
515 551
 		$oModuleController= getController('module');
@@ -541,8 +577,7 @@  discard block
 block discarded – undo
541 577
 			if(Context::get('success_return_url'))
542 578
 			{
543 579
 				$this->setRedirectUrl(Context::get('success_return_url'));
544
-			}
545
-			else
580
+			} else
546 581
 			{
547 582
 				global $lang;
548 583
 				htmlHeader();
@@ -561,10 +596,14 @@  discard block
 block discarded – undo
561 596
 	function procModuleAdminModuleGrantSetup()
562 597
 	{
563 598
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new Object(-1,'msg_invalid_request');
599
+		if(!$module_srls) {
600
+			return new Object(-1,'msg_invalid_request');
601
+		}
565 602
 
566 603
 		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new Object(-1,'msg_invalid_request');
604
+		if(count($modules) < 1) {
605
+			return new Object(-1,'msg_invalid_request');
606
+		}
568 607
 
569 608
 		$oModuleController = getController('module');
570 609
 		$oModuleModel = getModel('module');
@@ -592,17 +631,20 @@  discard block
 block discarded – undo
592 631
 				$grant->{$grant_name}[] = $default;
593 632
 				continue;
594 633
 				// Users in a particular group
595
-			}
596
-			else
634
+			} else
597 635
 			{
598 636
 				$group_srls = Context::get($grant_name);
599 637
 				if($group_srls)
600 638
 				{
601 639
 					if(!is_array($group_srls))
602 640
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
605
-						else $group_srls = array($group_srls);
641
+						if(strpos($group_srls,'|@|')!==false) {
642
+							$group_srls = explode('|@|',$group_srls);
643
+						} elseif(strpos($group_srls,',')!==false) {
644
+							$group_srls = explode(',',$group_srls);
645
+						} else {
646
+							$group_srls = array($group_srls);
647
+						}
606 648
 					}
607 649
 					$grant->{$grant_name} = $group_srls;
608 650
 				}
@@ -617,7 +659,9 @@  discard block
 block discarded – undo
617 659
 			$args = new stdClass();
618 660
 			$args->module_srl = $module_srl;
619 661
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
662
+			if(!$output->toBool()) {
663
+				continue;
664
+			}
621 665
 			// Permissions stored in the DB
622 666
 			foreach($grant as $grant_name => $group_srls)
623 667
 			{
@@ -628,7 +672,9 @@  discard block
 block discarded – undo
628 672
 					$args->name = $grant_name;
629 673
 					$args->group_srl = $val;
630 674
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
675
+					if(!$output->toBool()) {
676
+						return $output;
677
+					}
632 678
 				}
633 679
 			}
634 680
 		}
@@ -638,8 +684,7 @@  discard block
 block discarded – undo
638 684
 			if(Context::get('success_return_url'))
639 685
 			{
640 686
 				$this->setRedirectUrl(Context::get('success_return_url'));
641
-			}
642
-			else
687
+			} else
643 688
 			{
644 689
 				global $lang;
645 690
 				htmlHeader();
@@ -665,18 +710,30 @@  discard block
 block discarded – undo
665 710
 		$args->site_srl = (int)$site_module_info->site_srl;
666 711
 		$args->name = str_replace(' ','_',Context::get('lang_code'));
667 712
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
713
+		if(!empty($args->lang_name)) {
714
+			$args->name = $args->lang_name;
715
+		}
669 716
 
670 717
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
718
+		if(empty($args->name)) {
719
+			$args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
720
+		}
672 721
 
673
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
722
+		if(!$args->name) {
723
+			return new Object(-1,'msg_invalid_request');
724
+		}
674 725
 		// Check whether a language code exists
675 726
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
727
+		if(!$output->toBool()) {
728
+			return $output;
729
+		}
677 730
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
731
+		if($output->data) {
732
+			$output = executeQuery('module.deleteLang', $args);
733
+		}
734
+		if(!$output->toBool()) {
735
+			return $output;
736
+		}
680 737
 		// Enter
681 738
 		$lang_supported = Context::get('lang_supported');
682 739
 		foreach($lang_supported as $key => $val)
@@ -693,7 +750,9 @@  discard block
 block discarded – undo
693 750
 			if($args->value)
694 751
 			{
695 752
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
753
+				if(!$output->toBool()) {
754
+					return $output;
755
+				}
697 756
 			}
698 757
 		}
699 758
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -716,11 +775,17 @@  discard block
 block discarded – undo
716 775
 		$args->site_srl = (int)$site_module_info->site_srl;
717 776
 		$args->name = str_replace(' ','_',Context::get('name'));
718 777
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
778
+		if(!empty($args->lang_name)) {
779
+			$args->name = $args->lang_name;
780
+		}
781
+		if(!$args->name) {
782
+			return new Object(-1,'msg_invalid_request');
783
+		}
721 784
 
722 785
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
786
+		if(!$output->toBool()) {
787
+			return $output;
788
+		}
724 789
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 790
 
726 791
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +796,9 @@  discard block
 block discarded – undo
731 796
 
732 797
 	function procModuleAdminGetList()
733 798
 	{
734
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
799
+		if(!Context::get('is_logged')) {
800
+			return new Object(-1, 'msg_not_permitted');
801
+		}
735 802
 
736 803
 		$oModuleController = getController('module');
737 804
 		$oModuleModel = getModel('module');
@@ -744,14 +811,20 @@  discard block
 block discarded – undo
744 811
 		$args = new stdClass;
745 812
 		$logged_info = Context::get('logged_info');
746 813
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
814
+		if($site_keyword) {
815
+			$args->site_keyword = $site_keyword;
816
+		}
748 817
 
749 818
 		if(!$site_srl)
750 819
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
820
+			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) {
821
+				$args->site_srl = 0;
822
+			} else {
823
+				$args->site_srl = (int)$site_module_info->site_srl;
824
+			}
825
+		} else {
826
+			$args->site_srl = $site_srl;
753 827
 		}
754
-		else $args->site_srl = $site_srl;
755 828
 
756 829
 		$args->sort_index1 = 'sites.domain';
757 830
 
@@ -764,7 +837,9 @@  discard block
 block discarded – undo
764 837
 			foreach($output->data as $val)
765 838
 			{
766 839
 				$module = trim($val->module);
767
-				if(!$module) continue;
840
+				if(!$module) {
841
+					continue;
842
+				}
768 843
 
769 844
 				// replace user defined lang.
770 845
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -800,7 +875,9 @@  discard block
 block discarded – undo
800 875
 		{
801 876
 			foreach($mid_list as $module => $val)
802 877
 			{
803
-				if(!$selected_module) $selected_module = $module;
878
+				if(!$selected_module) {
879
+					$selected_module = $module;
880
+				}
804 881
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 882
 
806 883
 				if(!$xml_info)
@@ -823,8 +900,7 @@  discard block
 block discarded – undo
823 900
 							{
824 901
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 902
 							}
826
-						}
827
-						else
903
+						} else
828 904
 						{
829 905
 							$mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category');
830 906
 						}
@@ -851,13 +927,14 @@  discard block
 block discarded – undo
851 927
 		{
852 928
 			$site_module_info = Context::get('site_module_info');
853 929
 			$args->site_srl = (int)$site_module_info->site_srl;
854
-		}
855
-		else
930
+		} else
856 931
 		{
857 932
 			$args->site_srl = $site_srl;
858 933
 		}
859 934
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
935
+		if(!$output->toBool() || !$output->data) {
936
+			return;
937
+		}
861 938
 		// Set the cache directory
862 939
 		$cache_path = _XE_PATH_.'files/cache/lang_defined/';
863 940
 		FileHandler::makeDir($cache_path);
@@ -950,8 +1027,7 @@  discard block
 block discarded – undo
950 1027
 		if($mid)
951 1028
 		{
952 1029
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
953
-		}
954
-		else
1030
+		} else
955 1031
 		{
956 1032
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
957 1033
 		}
Please login to merge, or discard this patch.
modules/module/module.admin.model.php 4 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 		return $output;
57 57
 	}
58 58
 
59
+	/**
60
+	 * @param string $modulePath
61
+	 */
59 62
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 63
 	{
61 64
 		if($modulePath)
@@ -306,7 +309,7 @@  discard block
 block discarded – undo
306 309
 	 * Skin setting page for the module
307 310
 	 *
308 311
 	 * @param $module_srl sequence of module
309
-	 * @param $mode P or M
312
+	 * @param string $mode P or M
310 313
 	 * @return string The HTML code
311 314
 	 */
312 315
 	function _getModuleSkinHTML($module_srl, $mode)
@@ -395,6 +398,7 @@  discard block
 block discarded – undo
395 398
 	/**
396 399
 	 * @brief Get values for a particular language code
397 400
 	 * Return its corresponding value if lang_code is specified. Otherwise return $name.
401
+	 * @param string $name
398 402
 	 */
399 403
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 404
 	{
@@ -513,6 +517,7 @@  discard block
 block discarded – undo
513 517
 
514 518
 	/**
515 519
 	 * @brief Return current lang list
520
+	 * @param stdClass $args
516 521
 	 */
517 522
 	function getLangListByLangcode($args)
518 523
 	{
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleAdminModel
5
- * @author NAVER ([email protected])
6
- * @version 0.1
7
- * @brief AdminModel class of the "module" module
8
- */
4
+	 * @class  moduleAdminModel
5
+	 * @author NAVER ([email protected])
6
+	 * @version 0.1
7
+	 * @brief AdminModel class of the "module" module
8
+	 */
9 9
 class moduleAdminModel extends module
10 10
 {
11 11
 	/**
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new Object();
29
+		if (!$output->toBool() || !$output->data) return new Object();
30 30
 
31
-		foreach($output->data as $key => $val)
31
+		foreach ($output->data as $key => $val)
32 32
 		{
33 33
 			$info_xml = $oModuleModel->getModuleInfoXml($val->module);
34 34
 			$oModuleController->replaceDefinedLangCode($val->browser_title);
35
-			$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
35
+			$list[$val->module_srl] = array('module_srl'=>$val->module_srl, 'mid'=>$val->mid, 'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
36 36
 		}
37
-		$modules = explode(',',$args->module_srls);
38
-		for($i=0;$i<count($modules);$i++)
37
+		$modules = explode(',', $args->module_srls);
38
+		for ($i = 0; $i < count($modules); $i++)
39 39
 		{
40 40
 			$module_list[$modules[$i]] = $list[$modules[$i]];
41 41
 		}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$args->list_count = 20;
50 50
 		$args->page_count = 10;
51 51
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
52
+		if (!$output->toBool()) return $output;
53 53
 
54 54
 		ModuleModel::syncModuleToSite($output->data);
55 55
 
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 60
 	{
61
-		if($modulePath)
61
+		if ($modulePath)
62 62
 		{
63 63
 			// get the skins path
64 64
 			$oModuleModel = getModel('module');
65 65
 			$skin_list = $oModuleModel->getSkins($modulePath);
66
-			Context::set('skin_list',$skin_list);
66
+			Context::set('skin_list', $skin_list);
67 67
 
68 68
 			$mskin_list = $oModuleModel->getSkins($modulePath, "m.skins");
69 69
 			Context::set('mskin_list', $mskin_list);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$layout_list = $oLayoutModel->getLayoutList();
75 75
 		Context::set('layout_list', $layout_list);
76 76
 
77
-		$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
77
+		$mobile_layout_list = $oLayoutModel->getLayoutList(0, "M");
78 78
 		Context::set('mlayout_list', $mobile_layout_list);
79 79
 
80 80
 		$security = new Security();
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 		$security->encodeHTML('skin_list..title');
84 84
 		$security->encodeHTML('mskin_list..title');
85 85
 
86
-		$grant_list =new stdClass();
86
+		$grant_list = new stdClass();
87 87
 		// Grant virtual permission for access and manager
88
-		if(!$grantList)
88
+		if (!$grantList)
89 89
 		{
90
-			$grantList =new stdClass();
90
+			$grantList = new stdClass();
91 91
 		}
92 92
 		$grantList->access = new stdClass();
93 93
 		$grantList->access->title = Context::getLang('grant_access');
94 94
 		$grantList->access->default = 'guest';
95
-		if(count($grantList))
95
+		if (count($grantList))
96 96
 		{
97
-			foreach($grantList as $key => $val)
97
+			foreach ($grantList as $key => $val)
98 98
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
99
+				if (!$val->default) $val->default = 'guest';
100
+				if ($val->default == 'root') $val->default = 'manager';
101 101
 				$grant_list->{$key} = $val;
102 102
 			}
103 103
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
120 120
 		Context::set('setup_content', $content);
121 121
 
122
-		if(count($tabChoice) == 0)
122
+		if (count($tabChoice) == 0)
123 123
 		{
124 124
 			$tabChoice = array('tab1'=>1, 'tab2'=>1, 'tab3'=>1);
125 125
 		}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 		// Get information of module_grants
129 129
 		$oTemplate = &TemplateHandler::getInstance();
130
-		return $oTemplate->compile($this->module_path.'tpl', 'include.manage_selected.html');
130
+		return $oTemplate->compile($this->module_path . 'tpl', 'include.manage_selected.html');
131 131
 	}
132 132
 
133 133
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	function getModuleGrantHTML($module_srl, $source_grant_list)
138 138
 	{
139
-		if(!$module_srl)
139
+		if (!$module_srl)
140 140
 		{
141 141
 			return;
142 142
 		}
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		$grant_list->access = new stdClass();
155 155
 		$grant_list->access->title = Context::getLang('grant_access');
156 156
 		$grant_list->access->default = 'guest';
157
-		if(count($source_grant_list))
157
+		if (count($source_grant_list))
158 158
 		{
159
-			foreach($source_grant_list as $key => $val)
159
+			foreach ($source_grant_list as $key => $val)
160 160
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
161
+				if (!$val->default) $val->default = 'guest';
162
+				if ($val->default == 'root') $val->default = 'manager';
163 163
 				$grant_list->{$key} = $val;
164 164
 			}
165 165
 		}
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 		$args = new stdClass();
173 173
 		$args->module_srl = $module_srl;
174 174
 		$output = executeQueryArray('module.getModuleGrants', $args);
175
-		if($output->data)
175
+		if ($output->data)
176 176
 		{
177
-			foreach($output->data as $val)
177
+			foreach ($output->data as $val)
178 178
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
179
+				if ($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
+				else if ($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
+				else if ($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
+				else if ($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183 183
 				else
184 184
 				{
185 185
 					$selected_group[$val->name][] = $val->group_srl;
@@ -206,19 +206,19 @@  discard block
 block discarded – undo
206 206
 
207 207
 		// Get information of module_grants
208 208
 		$oTemplate = &TemplateHandler::getInstance();
209
-		return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
209
+		return $oTemplate->compile($this->module_path . 'tpl', 'module_grants');
210 210
 	}
211 211
 
212 212
 	public function getModuleAdminGrant()
213 213
 	{
214 214
 		$targetModule = Context::get('target_module');
215 215
 		$moduleSrl = Context::get('module_srl');
216
-		if(!$targetModule || !$moduleSrl)
216
+		if (!$targetModule || !$moduleSrl)
217 217
 		{
218 218
 			return new Object(-1, 'msg_invalid_request');
219 219
 		}
220 220
 
221
-		if($targetModule == '_SHORTCUT')
221
+		if ($targetModule == '_SHORTCUT')
222 222
 		{
223 223
 			return new Object(0);
224 224
 		}
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		$grantList->access = new stdClass();
232 232
 		$grantList->access->title = Context::getLang('grant_access');
233 233
 		$grantList->access->default = 'guest';
234
-		if(count($xmlInfo->grant))
234
+		if (count($xmlInfo->grant))
235 235
 		{
236
-			foreach($xmlInfo->grant as $key => $val)
236
+			foreach ($xmlInfo->grant as $key => $val)
237 237
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
238
+				if (!$val->default) $val->default = 'guest';
239
+				if ($val->default == 'root') $val->default = 'manager';
240 240
 				$grantList->{$key} = $val;
241 241
 			}
242 242
 		}
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 		$args = new stdClass();
250 250
 		$args->module_srl = $moduleSrl;
251 251
 		$output = executeQueryArray('module.getModuleGrants', $args);
252
-		if($output->data)
252
+		if ($output->data)
253 253
 		{
254
-			foreach($output->data as $val)
254
+			foreach ($output->data as $val)
255 255
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
256
+				if ($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
+				else if ($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
+				else if ($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
+				else if ($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260 260
 				else
261 261
 				{
262 262
 					$selectedGroup->{$val->name}[] = $val->group_srl;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 		}
267 267
 
268
-		if(is_object($grantList))
268
+		if (is_object($grantList))
269 269
 		{
270
-			foreach($grantList AS $key=>$value)
270
+			foreach ($grantList AS $key=>$value)
271 271
 			{
272
-				if(isset($defaultGrant->{$key}))
272
+				if (isset($defaultGrant->{$key}))
273 273
 				{
274 274
 					$grantList->{$key}->grant = $defaultGrant->{$key};
275 275
 				}
276
-				if(isset($selectedGroup->{$key}))
276
+				if (isset($selectedGroup->{$key}))
277 277
 				{
278 278
 					$grantList->{$key}->group_srls = $selectedGroup->{$key};
279 279
 				}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
 		$oModuleModel = getModel('module');
317 317
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
318
+		if (!$module_info) return;
319 319
 
320
-		if($mode === 'P')
320
+		if ($mode === 'P')
321 321
 		{
322
-			if($module_info->is_skin_fix == 'N')
322
+			if ($module_info->is_skin_fix == 'N')
323 323
 			{
324 324
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325 325
 			}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		}
331 331
 		else
332 332
 		{
333
-			if($module_info->is_mskin_fix == 'N')
333
+			if ($module_info->is_mskin_fix == 'N')
334 334
 			{
335 335
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336 336
 			}
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 			}
341 341
 		}
342 342
 
343
-		$module_path = './modules/'.$module_info->module;
343
+		$module_path = './modules/' . $module_info->module;
344 344
 
345 345
 		// Get XML information of the skin and skin sinformation set in DB
346
-		if($mode === 'P')
346
+		if ($mode === 'P')
347 347
 		{
348 348
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 349
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -354,25 +354,25 @@  discard block
 block discarded – undo
354 354
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
355 355
 		}
356 356
 
357
-		if(count($skin_info->extra_vars)) 
357
+		if (count($skin_info->extra_vars)) 
358 358
 		{
359
-			foreach($skin_info->extra_vars as $key => $val) 
359
+			foreach ($skin_info->extra_vars as $key => $val) 
360 360
 			{
361 361
 				$group = $val->group;
362 362
 				$name = $val->name;
363 363
 				$type = $val->type;
364
-				if($skin_vars[$name]) 
364
+				if ($skin_vars[$name]) 
365 365
 				{
366 366
 					$value = $skin_vars[$name]->value;
367 367
 				}
368 368
 				else $value = '';
369
-				if($type=="checkbox")
369
+				if ($type == "checkbox")
370 370
 				{
371
-					$value = $value?unserialize($value):array();
371
+					$value = $value ? unserialize($value) : array();
372 372
 				}
373 373
 
374 374
 				$value = empty($value) ? $val->default : $value;
375
-				$skin_info->extra_vars[$key]->value= $value;
375
+				$skin_info->extra_vars[$key]->value = $value;
376 376
 			}
377 377
 		}
378 378
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		$security->encodeHTML('skin_info...');
390 390
 
391 391
 		$oTemplate = &TemplateHandler::getInstance();
392
-		return $oTemplate->compile($this->module_path.'tpl', 'skin_config');
392
+		return $oTemplate->compile($this->module_path . 'tpl', 'skin_config');
393 393
 	}
394 394
 
395 395
 	/**
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 400
 	{
401
-		if($isFullLanguage)
401
+		if ($isFullLanguage)
402 402
 		{
403 403
 			$lang_supported = Context::loadLangSupported();
404 404
 		}
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
 			$lang_supported = Context::get('lang_supported');
408 408
 		}
409 409
 
410
-		if(substr($name,0,12)=='$user_lang->')
410
+		if (substr($name, 0, 12) == '$user_lang->')
411 411
 		{
412 412
 			$args = new stdClass();
413
-			$args->site_srl = (int)$site_srl;
414
-			$args->name = substr($name,12);
413
+			$args->site_srl = (int) $site_srl;
414
+			$args->name = substr($name, 12);
415 415
 			$output = executeQueryArray('module.getLang', $args);
416
-			if($output->data)
416
+			if ($output->data)
417 417
 			{
418
-				foreach($output->data as $key => $val)
418
+				foreach ($output->data as $key => $val)
419 419
 				{
420 420
 					$selected_lang[$val->lang_code] = $val->value;
421 421
 				}
@@ -424,24 +424,24 @@  discard block
 block discarded – undo
424 424
 		else
425 425
 		{
426 426
 			$tmp = unserialize($name);
427
-			if($tmp)
427
+			if ($tmp)
428 428
 			{
429 429
 				$selected_lang = array();
430 430
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
432
-				if(is_array($lang_supported))
431
+				if (!$rand_name) $rand_name = array_shift($tmp);
432
+				if (is_array($lang_supported))
433 433
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
434
+					foreach ($lang_supported as $key => $val)
435
+						$selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name;
436 436
 				}
437 437
 			}
438 438
 		}
439 439
 
440 440
 		$output = array();
441
-		if(is_array($lang_supported))
441
+		if (is_array($lang_supported))
442 442
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
443
+			foreach ($lang_supported as $key => $val)
444
+				$output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name;
445 445
 		}
446 446
 		return $output;
447 447
 	}
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
 	function getModuleAdminLangCode()
453 453
 	{
454 454
 		$name = Context::get('name');
455
-		if(!$name) return new Object(-1,'msg_invalid_request');
455
+		if (!$name) return new Object(-1, 'msg_invalid_request');
456 456
 		$site_module_info = Context::get('site_module_info');
457 457
 		$this->add('name', $name);
458
-		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
458
+		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->' . $name);
459 459
 		$this->add('langs', $output);
460 460
 	}
461 461
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	function getModuleAdminLangListByName()
466 466
 	{
467 467
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
468
+		if (!$args->site_srl) $args->site_srl = 0;
469 469
 
470 470
 		$columnList = array('lang_code', 'name', 'value');
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 475
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
476
+		if ($output->toBool()) $langList = $output->data;
477 477
 
478 478
 		$this->add('lang_list', $langList);
479 479
 		$this->add('lang_name', $args->langName);
@@ -485,23 +485,23 @@  discard block
 block discarded – undo
485 485
 	function getModuleAdminLangListByValue()
486 486
 	{
487 487
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
488
+		if (!$args->site_srl) $args->site_srl = 0;
489 489
 
490 490
 		$langList = array();
491 491
 
492 492
 		// search value
493 493
 		$output = executeQueryArray('module.getLangNameByValue', $args);
494
-		if($output->toBool() && is_array($output->data))
494
+		if ($output->toBool() && is_array($output->data))
495 495
 		{
496 496
 			unset($args->value);
497 497
 
498
-			foreach($output->data as $data)
498
+			foreach ($output->data as $data)
499 499
 			{
500 500
 				$args->langName = $data->name;
501 501
 				$columnList = array('lang_code', 'name', 'value');
502 502
 				$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
503 503
 
504
-				if($outputByName->toBool())
504
+				if ($outputByName->toBool())
505 505
 				{
506 506
 					$langList = array_merge($langList, $outputByName->data);
507 507
 				}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	function getLangListByLangcode($args)
518 518
 	{
519 519
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
520
+		if (!$output->toBool()) return array();
521 521
 
522 522
 		return $output;
523 523
 	}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	{
541 541
 		$site_module_info = Context::get('site_module_info');
542 542
 		$args = new stdClass();
543
-		$args->site_srl = (int)$site_module_info->site_srl;
543
+		$args->site_srl = (int) $site_module_info->site_srl;
544 544
 		$args->langCode = Context::get('lang_code');
545 545
 		$args->page = Context::get('page');
546 546
 		$args->sort_index = 'name';
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$args->list_count = Context::get('list_count');
551 551
 		$args->page_count = 5;
552 552
 
553
-		if(!$args->langCode)
553
+		if (!$args->langCode)
554 554
 		{
555 555
 			$args->langCode = Context::get('lang_type');
556 556
 		}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	function getModuleAdminModuleInfo()
591 591
 	{
592
-		if(Context::get('search_module_srl'))
592
+		if (Context::get('search_module_srl'))
593 593
 		{
594 594
 			$module_srl = Context::get('search_module_srl');
595 595
 		}
Please login to merge, or discard this patch.
Braces   +78 added lines, -44 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new Object();
29
+		if(!$output->toBool() || !$output->data) {
30
+			return new Object();
31
+		}
30 32
 
31 33
 		foreach($output->data as $key => $val)
32 34
 		{
@@ -49,7 +51,9 @@  discard block
 block discarded – undo
49 51
 		$args->list_count = 20;
50 52
 		$args->page_count = 10;
51 53
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
54
+		if(!$output->toBool()) {
55
+			return $output;
56
+		}
53 57
 
54 58
 		ModuleModel::syncModuleToSite($output->data);
55 59
 
@@ -96,8 +100,12 @@  discard block
 block discarded – undo
96 100
 		{
97 101
 			foreach($grantList as $key => $val)
98 102
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
103
+				if(!$val->default) {
104
+					$val->default = 'guest';
105
+				}
106
+				if($val->default == 'root') {
107
+					$val->default = 'manager';
108
+				}
101 109
 				$grant_list->{$key} = $val;
102 110
 			}
103 111
 		}
@@ -158,8 +166,12 @@  discard block
 block discarded – undo
158 166
 		{
159 167
 			foreach($source_grant_list as $key => $val)
160 168
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
169
+				if(!$val->default) {
170
+					$val->default = 'guest';
171
+				}
172
+				if($val->default == 'root') {
173
+					$val->default = 'manager';
174
+				}
163 175
 				$grant_list->{$key} = $val;
164 176
 			}
165 177
 		}
@@ -176,11 +188,15 @@  discard block
 block discarded – undo
176 188
 		{
177 189
 			foreach($output->data as $val)
178 190
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183
-				else
191
+				if($val->group_srl == 0) {
192
+					$default_grant[$val->name] = 'all';
193
+				} else if($val->group_srl == -1) {
194
+					$default_grant[$val->name] = 'member';
195
+				} else if($val->group_srl == -2) {
196
+					$default_grant[$val->name] = 'site';
197
+				} else if($val->group_srl == -3) {
198
+					$default_grant[$val->name] = 'manager';
199
+				} else
184 200
 				{
185 201
 					$selected_group[$val->name][] = $val->group_srl;
186 202
 					$default_grant[$val->name] = 'group';
@@ -235,8 +251,12 @@  discard block
 block discarded – undo
235 251
 		{
236 252
 			foreach($xmlInfo->grant as $key => $val)
237 253
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
254
+				if(!$val->default) {
255
+					$val->default = 'guest';
256
+				}
257
+				if($val->default == 'root') {
258
+					$val->default = 'manager';
259
+				}
240 260
 				$grantList->{$key} = $val;
241 261
 			}
242 262
 		}
@@ -253,11 +273,15 @@  discard block
 block discarded – undo
253 273
 		{
254 274
 			foreach($output->data as $val)
255 275
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260
-				else
276
+				if($val->group_srl == 0) {
277
+					$defaultGrant->{$val->name} = 'all';
278
+				} else if($val->group_srl == -1) {
279
+					$defaultGrant->{$val->name} = 'member';
280
+				} else if($val->group_srl == -2) {
281
+					$defaultGrant->{$val->name} = 'site';
282
+				} else if($val->group_srl == -3) {
283
+					$defaultGrant->{$val->name} = 'manager';
284
+				} else
261 285
 				{
262 286
 					$selectedGroup->{$val->name}[] = $val->group_srl;
263 287
 					$defaultGrant->{$val->name} = 'group';
@@ -315,26 +339,25 @@  discard block
 block discarded – undo
315 339
 
316 340
 		$oModuleModel = getModel('module');
317 341
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
342
+		if(!$module_info) {
343
+			return;
344
+		}
319 345
 
320 346
 		if($mode === 'P')
321 347
 		{
322 348
 			if($module_info->is_skin_fix == 'N')
323 349
 			{
324 350
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325
-			}
326
-			else
351
+			} else
327 352
 			{
328 353
 				$skin = $module_info->skin;
329 354
 			}
330
-		}
331
-		else
355
+		} else
332 356
 		{
333 357
 			if($module_info->is_mskin_fix == 'N')
334 358
 			{
335 359
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336
-			}
337
-			else
360
+			} else
338 361
 			{
339 362
 				$skin = $module_info->mskin;
340 363
 			}
@@ -347,8 +370,7 @@  discard block
 block discarded – undo
347 370
 		{
348 371
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 372
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
350
-		}
351
-		else
373
+		} else
352 374
 		{
353 375
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
354 376
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -364,8 +386,9 @@  discard block
 block discarded – undo
364 386
 				if($skin_vars[$name]) 
365 387
 				{
366 388
 					$value = $skin_vars[$name]->value;
389
+				} else {
390
+					$value = '';
367 391
 				}
368
-				else $value = '';
369 392
 				if($type=="checkbox")
370 393
 				{
371 394
 					$value = $value?unserialize($value):array();
@@ -401,8 +424,7 @@  discard block
 block discarded – undo
401 424
 		if($isFullLanguage)
402 425
 		{
403 426
 			$lang_supported = Context::loadLangSupported();
404
-		}
405
-		else
427
+		} else
406 428
 		{
407 429
 			$lang_supported = Context::get('lang_supported');
408 430
 		}
@@ -420,19 +442,21 @@  discard block
 block discarded – undo
420 442
 					$selected_lang[$val->lang_code] = $val->value;
421 443
 				}
422 444
 			}
423
-		}
424
-		else
445
+		} else
425 446
 		{
426 447
 			$tmp = unserialize($name);
427 448
 			if($tmp)
428 449
 			{
429 450
 				$selected_lang = array();
430 451
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
452
+				if(!$rand_name) {
453
+					$rand_name = array_shift($tmp);
454
+				}
432 455
 				if(is_array($lang_supported))
433 456
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
457
+					foreach($lang_supported as $key => $val) {
458
+											$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
459
+					}
436 460
 				}
437 461
 			}
438 462
 		}
@@ -440,8 +464,9 @@  discard block
 block discarded – undo
440 464
 		$output = array();
441 465
 		if(is_array($lang_supported))
442 466
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
467
+			foreach($lang_supported as $key => $val) {
468
+							$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
469
+			}
445 470
 		}
446 471
 		return $output;
447 472
 	}
@@ -452,7 +477,9 @@  discard block
 block discarded – undo
452 477
 	function getModuleAdminLangCode()
453 478
 	{
454 479
 		$name = Context::get('name');
455
-		if(!$name) return new Object(-1,'msg_invalid_request');
480
+		if(!$name) {
481
+			return new Object(-1,'msg_invalid_request');
482
+		}
456 483
 		$site_module_info = Context::get('site_module_info');
457 484
 		$this->add('name', $name);
458 485
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -465,7 +492,9 @@  discard block
 block discarded – undo
465 492
 	function getModuleAdminLangListByName()
466 493
 	{
467 494
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
495
+		if(!$args->site_srl) {
496
+			$args->site_srl = 0;
497
+		}
469 498
 
470 499
 		$columnList = array('lang_code', 'name', 'value');
471 500
 
@@ -473,7 +502,9 @@  discard block
 block discarded – undo
473 502
 
474 503
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 504
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
505
+		if($output->toBool()) {
506
+			$langList = $output->data;
507
+		}
477 508
 
478 509
 		$this->add('lang_list', $langList);
479 510
 		$this->add('lang_name', $args->langName);
@@ -485,7 +516,9 @@  discard block
 block discarded – undo
485 516
 	function getModuleAdminLangListByValue()
486 517
 	{
487 518
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
519
+		if(!$args->site_srl) {
520
+			$args->site_srl = 0;
521
+		}
489 522
 
490 523
 		$langList = array();
491 524
 
@@ -517,7 +550,9 @@  discard block
 block discarded – undo
517 550
 	function getLangListByLangcode($args)
518 551
 	{
519 552
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
553
+		if(!$output->toBool()) {
554
+			return array();
555
+		}
521 556
 
522 557
 		return $output;
523 558
 	}
@@ -592,8 +627,7 @@  discard block
 block discarded – undo
592 627
 		if(Context::get('search_module_srl'))
593 628
 		{
594 629
 			$module_srl = Context::get('search_module_srl');
595
-		}
596
-		else
630
+		} else
597 631
 		{
598 632
 			$module_srl = Context::get('module_srl');
599 633
 		}
Please login to merge, or discard this patch.
modules/module/module.controller.php 4 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -933,6 +933,7 @@  discard block
 block discarded – undo
933 933
 
934 934
 	/**
935 935
 	 * @brief Insert skin vars to a module
936
+	 * @param string $mode
936 937
 	 */
937 938
 	function _insertModuleSkinVars($module_srl, $obj, $mode)
938 939
 	{
@@ -1006,6 +1007,7 @@  discard block
 block discarded – undo
1006 1007
 
1007 1008
 	/**
1008 1009
 	 * @brief Remove skin vars of a module
1010
+	 * @param string $mode
1009 1011
 	 */
1010 1012
 	function _deleteModuleSkinVars($module_srl, $mode)
1011 1013
 	{
@@ -1242,6 +1244,7 @@  discard block
 block discarded – undo
1242 1244
 
1243 1245
 	/**
1244 1246
 	 * @brief Update a file into the file box
1247
+	 * @param stdClass $vars
1245 1248
 	 */
1246 1249
 	function updateModuleFileBox($vars)
1247 1250
 	{
@@ -1283,6 +1286,7 @@  discard block
 block discarded – undo
1283 1286
 
1284 1287
 	/**
1285 1288
 	 * @brief Add a file into the file box
1289
+	 * @param stdClass $vars
1286 1290
 	 */
1287 1291
 	function insertModuleFileBox($vars)
1288 1292
 	{
@@ -1336,6 +1340,9 @@  discard block
 block discarded – undo
1336 1340
 		if(!$output->toBool()) return $output;
1337 1341
 	}
1338 1342
 
1343
+	/**
1344
+	 * @param stdClass $vars
1345
+	 */
1339 1346
 	function deleteModuleFileBox($vars)
1340 1347
 	{
1341 1348
 		// delete real file
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleController
5
- * @author NAVER ([email protected])
6
- * @brief controller class of the module module
7
- */
4
+	 * @class  moduleController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief controller class of the module module
7
+	 */
8 8
 class moduleController extends module
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$output = executeQuery('module.insertActionForward', $args);
30 30
 
31 31
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
32
-		if($oCacheHandler->isSupport())
32
+		if ($oCacheHandler->isSupport())
33 33
 		{
34 34
 			$cache_key = 'action_forward';
35 35
 			$oCacheHandler->delete($cache_key);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$output = executeQuery('module.deleteActionForward', $args);
52 52
 
53 53
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
54
-		if($oCacheHandler->isSupport())
54
+		if ($oCacheHandler->isSupport())
55 55
 		{
56 56
 			$cache_key = 'action_forward';
57 57
 			$oCacheHandler->delete($cache_key);
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$args->called_position = $called_position;
76 76
 
77 77
 		$output = executeQuery('module.insertTrigger', $args);
78
-		if($output->toBool())
78
+		if ($output->toBool())
79 79
 		{
80 80
 			//remove from cache
81 81
 			$GLOBALS['__triggers__'] = NULL;
82 82
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
83
-			if($oCacheHandler->isSupport())
83
+			if ($oCacheHandler->isSupport())
84 84
 			{
85 85
 				$cache_key = 'triggers';
86 86
 				$oCacheHandler->delete($cache_key);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 		$args->called_position = $called_position;
105 105
 
106 106
 		$output = executeQuery('module.deleteTrigger', $args);
107
-		if($output->toBool())
107
+		if ($output->toBool())
108 108
 		{
109 109
 			//remove from cache
110 110
 			$GLOBALS['__triggers__'] = NULL;
111 111
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
112
-			if($oCacheHandler->isSupport())
112
+			if ($oCacheHandler->isSupport())
113 113
 			{
114 114
 				$cache_key = 'triggers';
115 115
 				$oCacheHandler->delete($cache_key);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 		$args->module = $module;
130 130
 
131 131
 		$output = executeQuery('module.deleteModuleTriggers', $args);
132
-		if($output->toBool())
132
+		if ($output->toBool())
133 133
 		{
134 134
 			//remove from cache
135 135
 			$GLOBALS['__triggers__'] = NULL;
136 136
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
137
-			if($oCacheHandler->isSupport())
137
+			if ($oCacheHandler->isSupport())
138 138
 			{
139 139
 				$cache_key = 'triggers';
140 140
 				$oCacheHandler->delete($cache_key);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 * @brief Add module extend
149 149
 	 *
150 150
 	 */
151
-	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
151
+	function insertModuleExtend($parent_module, $extend_module, $type, $kind = '')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if ($kind != 'admin') $kind = '';
154
+		if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false;
155
+		if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false;
156 156
 
157 157
 		$cache_file = './files/config/module_extend.php';
158 158
 		FileHandler::removeFile($cache_file);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$args->kind = $kind;
165 165
 
166 166
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
167
+		if ($output->data->count > 0) return false;
168 168
 
169 169
 		$output = executeQuery('module.insertModuleExtend', $args);
170 170
 		return $output;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @brief Delete module extend
175 175
 	 *
176 176
 	 */
177
-	function deleteModuleExtend($parent_module, $extend_module, $type, $kind='')
177
+	function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '')
178 178
 	{
179 179
 		$cache_file = './files/config/module_extend.php';
180 180
 		FileHandler::removeFile($cache_file);
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		$oModuleModel = getModel('module');
200 200
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 201
 
202
-		if(!$origin_config) $origin_config = new stdClass;
202
+		if (!$origin_config) $origin_config = new stdClass;
203 203
 
204
-		foreach($config as $key => $val)
204
+		foreach ($config as $key => $val)
205 205
 		{
206 206
 			$origin_config->{$key} = $val;
207 207
 		}
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	function insertModuleConfig($module, $config, $site_srl = 0)
217 217
 	{
218
-		$args =new stdClass();
218
+		$args = new stdClass();
219 219
 		$args->module = $module;
220 220
 		$args->config = serialize($config);
221 221
 		$args->site_srl = $site_srl;
222 222
 
223 223
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
224
+		if (!$output->toBool()) return $output;
225 225
 
226 226
 		$output = executeQuery('module.insertModuleConfig', $args);
227 227
 
228 228
 		//remove from cache
229 229
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
230
-		if($oCacheHandler->isSupport())
230
+		if ($oCacheHandler->isSupport())
231 231
 		{
232 232
 			$oCacheHandler->invalidateGroupKey('site_and_module');
233 233
 		}
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 		$args->config = serialize($config);
247 247
 
248 248
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
249
+		if (!$output->toBool()) return $output;
250 250
 
251 251
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 252
 
253 253
 		//remove from cache
254 254
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
255
-		if($oCacheHandler->isSupport())
255
+		if ($oCacheHandler->isSupport())
256 256
 		{
257 257
 			$oCacheHandler->invalidateGroupKey('site_and_module');
258 258
 		}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	function insertSite($domain, $index_module_srl)
267 267
 	{
268
-		if(isSiteID($domain))
268
+		if (isSiteID($domain))
269 269
 		{
270 270
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
271
+			if ($oModuleModel->isIDExists($domain, 0)) return new Object(-1, 'msg_already_registed_vid');
272 272
 		}
273 273
 		else
274 274
 		{
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 		$columnList = array('modules.site_srl');
285 285
 		$oModuleModel = getModel('module');
286 286
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new Object(-1,'msg_already_registed_vid');
287
+		if ($output) return new Object(-1, 'msg_already_registed_vid');
288 288
 
289 289
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
290
+		if (!$output->toBool()) return $output;
291 291
 
292 292
 		$output->add('site_srl', $args->site_srl);
293 293
 		return $output;
@@ -302,32 +302,32 @@  discard block
 block discarded – undo
302 302
 		$columnList = array('sites.site_srl', 'sites.domain');
303 303
 		$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
304 304
 
305
-		if(!$args->domain && $site_info->site_srl == $args->site_srl)
305
+		if (!$args->domain && $site_info->site_srl == $args->site_srl)
306 306
 		{
307 307
 			$args->domain = $site_info->domain;
308 308
 		}
309 309
 
310
-		if($site_info->domain != $args->domain)
310
+		if ($site_info->domain != $args->domain)
311 311
 		{
312 312
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
313
+			if ($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1, 'msg_already_registed_domain');
314
+			if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1, 'msg_already_registed_vid');
315 315
 
316
-			if($args->domain && !isSiteID($args->domain))
316
+			if ($args->domain && !isSiteID($args->domain))
317 317
 			{
318 318
 				$args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain;
319 319
 			}
320 320
 		}
321 321
 		$output = executeQuery('module.updateSite', $args);
322 322
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
323
+		if ($args->site_srl == 0) $vid = '';
324
+		else $vid = $args->domain;
325 325
 
326 326
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 327
 		$mid = $module_info->mid;
328 328
 
329 329
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
330
-		if($oCacheHandler->isSupport())
330
+		if ($oCacheHandler->isSupport())
331 331
 		{
332 332
 			$oCacheHandler->invalidateGroupKey('site_and_module');
333 333
 		}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		unset($args->act);
346 346
 		unset($args->page);
347 347
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
348
+		if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
349 349
 		// Test variables (separate basic vars and other vars in modules)
350 350
 		$extra_vars = clone($args);
351 351
 		unset($extra_vars->module_srl);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function insertModule($args)
381 381
 	{
382
-		if(isset($args->isMenuCreate))
382
+		if (isset($args->isMenuCreate))
383 383
 		{
384 384
 			$isMenuCreate = $args->isMenuCreate;
385 385
 		}
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 		}
390 390
 
391 391
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
392
+		if (!$output->toBool()) return $output;
393 393
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
394
+		if (!$args->site_srl) $args->site_srl = 0;
395 395
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
396
+		if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
397 397
 
398 398
 		// begin transaction
399 399
 		$oDB = &DB::getInstance();
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		$skin_vars = new stdClass();
405 405
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 406
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
407
+		if (!$args->module_srl) $args->module_srl = getNextSequence();
408 408
 
409 409
 		// default value
410
-		if($args->skin == '/USE_DEFAULT/')
410
+		if ($args->skin == '/USE_DEFAULT/')
411 411
 		{
412 412
 			$args->is_skin_fix = 'N';
413 413
 		}
414 414
 		else
415 415
 		{
416
-			if(isset($args->is_skin_fix))
416
+			if (isset($args->is_skin_fix))
417 417
 			{
418 418
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419 419
 			}
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			}
424 424
 		}
425 425
 
426
-		if($args->mskin == '/USE_DEFAULT/')
426
+		if ($args->mskin == '/USE_DEFAULT/')
427 427
 		{
428 428
 			$args->is_mskin_fix = 'N';
429 429
 		}
430 430
 		else
431 431
 		{
432
-			if(isset($args->is_mskin_fix))
432
+			if (isset($args->is_mskin_fix))
433 433
 			{
434 434
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435 435
 			}
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 
444 444
 		$args->browser_title = strip_tags($args->browser_title);
445 445
 
446
-		if($isMenuCreate == TRUE)
446
+		if ($isMenuCreate == TRUE)
447 447
 		{
448 448
 			$menuArgs = new stdClass;
449 449
 			$menuArgs->menu_srl = $args->menu_srl;
450 450
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
451 451
 
452 452
 			// if menu is not created, create menu also. and does not supported that in virtual site.
453
-			if(!$menuOutput->data && !$args->site_srl)
453
+			if (!$menuOutput->data && !$args->site_srl)
454 454
 			{
455 455
 				$oMenuAdminModel = getAdminModel('menu');
456 456
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				$menuArgs->listorder = $args->menu_item_srl * -1;
469 469
 
470 470
 				$menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs);
471
-				if(!$menuItemOutput->toBool())
471
+				if (!$menuItemOutput->toBool())
472 472
 				{
473 473
 					$oDB->rollback();
474 474
 					return $menuItemOutput;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		// Insert a module
482 482
 		$args->menu_srl = $menuArgs->menu_srl;
483 483
 		$output = executeQuery('module.insertModule', $args);
484
-		if(!$output->toBool())
484
+		if (!$output->toBool())
485 485
 		{
486 486
 			$oDB->rollback();
487 487
 			return $output;
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 		$oDB->commit();
494 494
 
495 495
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
496
-		if($oCacheHandler->isSupport())
496
+		if ($oCacheHandler->isSupport())
497 497
 		{
498 498
 			$oCacheHandler->invalidateGroupKey('site_and_module');
499 499
 		}
500 500
 
501
-		$output->add('module_srl',$args->module_srl);
501
+		$output->add('module_srl', $args->module_srl);
502 502
 		return $output;
503 503
 	}
504 504
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	function updateModule($args)
509 509
 	{
510 510
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
511
-		if(!$output->toBool()) return $output;
511
+		if (!$output->toBool()) return $output;
512 512
 		// begin transaction
513 513
 		$oDB = &DB::getInstance();
514 514
 		$oDB->begin();
@@ -517,29 +517,29 @@  discard block
 block discarded – undo
517 517
 		$columnList = array('module_srl', 'site_srl', 'browser_title', 'mid');
518 518
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
519 519
 
520
-		if(!$args->site_srl || !$args->browser_title)
520
+		if (!$args->site_srl || !$args->browser_title)
521 521
 		{
522
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
523
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
522
+			if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl;
523
+			if (!$args->browser_title) $args->browser_title = $module_info->browser_title;
524 524
 		}
525 525
 
526 526
 		$args->browser_title = strip_tags($args->browser_title);
527 527
 
528 528
 		$output = executeQuery('module.isExistsModuleName', $args);
529
-		if(!$output->toBool() || $output->data->count)
529
+		if (!$output->toBool() || $output->data->count)
530 530
 		{
531 531
 			$oDB->rollback();
532 532
 			return new Object(-1, 'msg_module_name_exists');
533 533
 		}
534 534
 
535 535
 		// default value
536
-		if($args->skin == '/USE_DEFAULT/')
536
+		if ($args->skin == '/USE_DEFAULT/')
537 537
 		{
538 538
 			$args->is_skin_fix = 'N';
539 539
 		}
540 540
 		else
541 541
 		{
542
-			if(isset($args->is_skin_fix))
542
+			if (isset($args->is_skin_fix))
543 543
 			{
544 544
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
545 545
 			}
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 			}
550 550
 		}
551 551
 
552
-		if($args->mskin == '/USE_DEFAULT/')
552
+		if ($args->mskin == '/USE_DEFAULT/')
553 553
 		{
554 554
 			$args->is_mskin_fix = 'N';
555 555
 		}
556 556
 		else
557 557
 		{
558
-			if(isset($args->is_mskin_fix))
558
+			if (isset($args->is_mskin_fix))
559 559
 			{
560 560
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
561 561
 			}
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			}
566 566
 		}
567 567
 		$output = executeQuery('module.updateModule', $args);
568
-		if(!$output->toBool())
568
+		if (!$output->toBool())
569 569
 		{
570 570
 			$oDB->rollback();
571 571
 			return $output;
@@ -575,15 +575,15 @@  discard block
 block discarded – undo
575 575
 		$menuArgs->url = $module_info->mid;
576 576
 		$menuArgs->site_srl = $module_info->site_srl;
577 577
 		$menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs);
578
-		if($menuOutput->data && count($menuOutput->data))
578
+		if ($menuOutput->data && count($menuOutput->data))
579 579
 		{
580 580
 			$oMenuAdminController = getAdminController('menu');
581
-			foreach($menuOutput->data as $itemInfo)
581
+			foreach ($menuOutput->data as $itemInfo)
582 582
 			{
583 583
 				$itemInfo->url = $args->mid;
584 584
 
585 585
 				$updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo);
586
-				if(!$updateMenuItemOutput->toBool())
586
+				if (!$updateMenuItemOutput->toBool())
587 587
 				{
588 588
 					$oDB->rollback();
589 589
 					return $updateMenuItemOutput;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		}
593 593
 
594 594
 		// if mid changed, change mid of success_return_url to new mid
595
-		if($module_info->mid != $args->mid && Context::get('success_return_url'))
595
+		if ($module_info->mid != $args->mid && Context::get('success_return_url'))
596 596
 		{
597 597
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
598 598
 		}
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 
603 603
 		$oDB->commit();
604 604
 
605
-		$output->add('module_srl',$args->module_srl);
605
+		$output->add('module_srl', $args->module_srl);
606 606
 
607 607
 		//remove from cache
608 608
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
609
-		if($oCacheHandler->isSupport())
609
+		if ($oCacheHandler->isSupport())
610 610
 		{
611 611
 			$oCacheHandler->invalidateGroupKey('site_and_module');
612 612
 		}
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 		$args->site_srl = $site_srl;
625 625
 		$args->layout_srl = $layout_srl;
626 626
 		$output = executeQuery('module.updateModuleSite', $args);
627
-		if(!$output->toBool()) return $output;
627
+		if (!$output->toBool()) return $output;
628 628
 
629 629
 		//remove from cache
630 630
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
631
-		if($oCacheHandler->isSupport())
631
+		if ($oCacheHandler->isSupport())
632 632
 		{
633 633
 			$oCacheHandler->invalidateGroupKey('site_and_module');
634 634
 		}
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 */
644 644
 	function deleteModule($module_srl, $site_srl = 0)
645 645
 	{
646
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
646
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
647 647
 
648 648
 		$site_module_info = Context::get('site_module_info');
649 649
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$args = new stdClass();
654 654
 		$args->url = $output->mid;
655 655
 		$args->is_shortcut = 'N';
656
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
656
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
657 657
 		else $args->site_srl = $site_srl;
658 658
 
659 659
 		unset($output);
@@ -662,9 +662,9 @@  discard block
 block discarded – undo
662 662
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
663 663
 
664 664
 		// get menu_srl by site_srl
665
-		if(is_array($menuOutput->data))
665
+		if (is_array($menuOutput->data))
666 666
 		{
667
-			foreach($menuOutput->data AS $key=>$value)
667
+			foreach ($menuOutput->data AS $key=>$value)
668 668
 			{
669 669
 				$args->menu_srl = $value->menu_srl;
670 670
 				break;
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 
674 674
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
675 675
 		// menu delete
676
-		if($output->data)
676
+		if ($output->data)
677 677
 		{
678 678
 			unset($args);
679 679
 			$args = new stdClass;
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			$oMenuAdminController = getAdminController('menu');
685 685
 			$output = $oMenuAdminController->deleteItem($args);
686 686
 
687
-			if($output->isSuccess)
687
+			if ($output->isSuccess)
688 688
 			{
689 689
 				return new Object(0, 'success_deleted');
690 690
 			}
@@ -706,19 +706,19 @@  discard block
 block discarded – undo
706 706
 	 */
707 707
 	public function onlyDeleteModule($module_srl)
708 708
 	{
709
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
709
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
710 710
 
711 711
 		// check start module
712 712
 		$oModuleModel = getModel('module');
713 713
 		$columnList = array('sites.index_module_srl');
714 714
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
715
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
715
+		if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
716 716
 
717 717
 		// Call a trigger (before)
718 718
 		$trigger_obj = new stdClass();
719 719
 		$trigger_obj->module_srl = $module_srl;
720 720
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
721
-		if(!$output->toBool()) return $output;
721
+		if (!$output->toBool()) return $output;
722 722
 
723 723
 		// begin transaction
724 724
 		$oDB = &DB::getInstance();
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		$args->module_srl = $module_srl;
729 729
 		// Delete module information from the DB
730 730
 		$output = executeQuery('module.deleteModule', $args);
731
-		if(!$output->toBool())
731
+		if (!$output->toBool())
732 732
 		{
733 733
 			$oDB->rollback();
734 734
 			return $output;
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
 		// Remove the module manager
743 743
 		$this->deleteAdminId($module_srl);
744 744
 		// Call a trigger (after)
745
-		if($output->toBool())
745
+		if ($output->toBool())
746 746
 		{
747 747
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
748
-			if(!$trigger_output->toBool())
748
+			if (!$trigger_output->toBool())
749 749
 			{
750 750
 				$oDB->rollback();
751 751
 				return $trigger_output;
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 
758 758
 		//remove from cache
759 759
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
760
-		if($oCacheHandler->isSupport())
760
+		if ($oCacheHandler->isSupport())
761 761
 		{
762 762
 			$oCacheHandler->invalidateGroupKey('site_and_module');
763 763
 		}
@@ -779,10 +779,10 @@  discard block
 block discarded – undo
779 779
 	function clearDefaultModule()
780 780
 	{
781 781
 		$output = executeQuery('module.clearDefaultModule');
782
-		if(!$output->toBool()) return $output;
782
+		if (!$output->toBool()) return $output;
783 783
 
784 784
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
785
-		if($oCacheHandler->isSupport())
785
+		if ($oCacheHandler->isSupport())
786 786
 		{
787 787
 			$oCacheHandler->invalidateGroupKey('site_and_module');
788 788
 		}
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		$output = executeQuery('module.updateModuleMenu', $args);
799 799
 
800 800
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
801
-		if($oCacheHandler->isSupport())
801
+		if ($oCacheHandler->isSupport())
802 802
 		{
803 803
 			$oCacheHandler->invalidateGroupKey('site_and_module');
804 804
 		}
@@ -811,15 +811,15 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	function updateModuleLayout($layout_srl, $menu_srl_list)
813 813
 	{
814
-		if(!count($menu_srl_list)) return;
814
+		if (!count($menu_srl_list)) return;
815 815
 
816 816
 		$args = new stdClass;
817 817
 		$args->layout_srl = $layout_srl;
818
-		$args->menu_srls = implode(',',$menu_srl_list);
818
+		$args->menu_srls = implode(',', $menu_srl_list);
819 819
 		$output = executeQuery('module.updateModuleLayout', $args);
820 820
 
821 821
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
822
-		if($oCacheHandler->isSupport())
822
+		if ($oCacheHandler->isSupport())
823 823
 		{
824 824
 			$oCacheHandler->invalidateGroupKey('site_and_module');
825 825
 		}
@@ -838,37 +838,37 @@  discard block
 block discarded – undo
838 838
 
839 839
 		$output = executeQuery('module.deleteSiteAdmin', $args);
840 840
 
841
-		if(!$output->toBool()) return $output;
841
+		if (!$output->toBool()) return $output;
842 842
 		// Get user id of an administrator
843
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
844
-		foreach($arr_admins as $key => $user_id)
843
+		if (!is_array($arr_admins) || !count($arr_admins)) return new Object();
844
+		foreach ($arr_admins as $key => $user_id)
845 845
 		{
846
-			if(!trim($user_id)) continue;
846
+			if (!trim($user_id)) continue;
847 847
 			$admins[] = trim($user_id);
848 848
 		}
849
-		if(!count($admins)) return new Object();
849
+		if (!count($admins)) return new Object();
850 850
 
851 851
 		$oMemberModel = getModel('member');
852 852
 		$member_config = $oMemberModel->getMemberConfig();
853
-		if($member_config->identifier == 'email_address')
853
+		if ($member_config->identifier == 'email_address')
854 854
 		{
855
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
855
+			$args->email_address = '\'' . implode('\',\'', $admins) . '\'';
856 856
 		}
857 857
 		else
858 858
 		{
859
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
859
+			$args->user_ids = '\'' . implode('\',\'', $admins) . '\'';
860 860
 		}
861 861
 		$output = executeQueryArray('module.getAdminSrls', $args);
862
-		if(!$output->toBool()||!$output->data) return $output;
862
+		if (!$output->toBool() || !$output->data) return $output;
863 863
 
864
-		foreach($output->data as $key => $val)
864
+		foreach ($output->data as $key => $val)
865 865
 		{
866 866
 			unset($args);
867 867
 			$args = new stdClass;
868 868
 			$args->site_srl = $site_srl;
869 869
 			$args->member_srl = $val->member_srl;
870 870
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
871
-			if(!$output->toBool()) return $output;
871
+			if (!$output->toBool()) return $output;
872 872
 		}
873 873
 		return new Object();
874 874
 	}
@@ -881,12 +881,12 @@  discard block
 block discarded – undo
881 881
 		$oMemberModel = getModel('member');
882 882
 		$member_config = $oMemberModel->getMemberConfig();
883 883
 
884
-		if($member_config->identifier == 'email_address')
884
+		if ($member_config->identifier == 'email_address')
885 885
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
886 886
 		else
887 887
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
888 888
 
889
-		if(!$member_info->member_srl) return;
889
+		if (!$member_info->member_srl) return;
890 890
 		$args = new stdClass();
891 891
 		$args->module_srl = $module_srl;
892 892
 		$args->member_srl = $member_info->member_srl;
@@ -901,11 +901,11 @@  discard block
 block discarded – undo
901 901
 		$args = new stdClass();
902 902
 		$args->module_srl = $module_srl;
903 903
 
904
-		if($admin_id)
904
+		if ($admin_id)
905 905
 		{
906 906
 			$oMemberModel = getModel('member');
907 907
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
908
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
908
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
909 909
 		}
910 910
 		return executeQuery('module.deleteAdminId', $args);
911 911
 	}
@@ -942,18 +942,18 @@  discard block
 block discarded – undo
942 942
 		$oDB->begin();
943 943
 
944 944
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
945
-		if(!$output->toBool())
945
+		if (!$output->toBool())
946 946
 		{
947 947
 			$oDB->rollback();
948 948
 			return $output;
949 949
 		}
950 950
 
951 951
 		getDestroyXeVars($obj);
952
-		if(!$obj || !count($obj)) return new Object();
952
+		if (!$obj || !count($obj)) return new Object();
953 953
 
954 954
 		$args = new stdClass;
955 955
 		$args->module_srl = $module_srl;
956
-		foreach($obj as $key => $val)
956
+		foreach ($obj as $key => $val)
957 957
 		{
958 958
 			// #17927989 For an old board which used the old blog module
959 959
 			// it often saved menu item(stdClass) on the skin info column
@@ -964,9 +964,9 @@  discard block
 block discarded – undo
964 964
 
965 965
 			$args->name = trim($key);
966 966
 			$args->value = trim($val);
967
-			if(!$args->name || !$args->value) continue;
967
+			if (!$args->name || !$args->value) continue;
968 968
 
969
-			if($mode === 'P')
969
+			if ($mode === 'P')
970 970
 			{
971 971
 				$output = executeQuery('module.insertModuleSkinVars', $args);
972 972
 			}
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 			{
975 975
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
976 976
 			}
977
-			if(!$output->toBool())
977
+			if (!$output->toBool())
978 978
 			{
979 979
 				return $output;
980 980
 				$oDB->rollback();
@@ -1013,21 +1013,21 @@  discard block
 block discarded – undo
1013 1013
 		$args->module_srl = $module_srl;
1014 1014
 		$mode = $mode === 'P' ? 'P' : 'M';
1015 1015
 
1016
-		if($mode === 'P')
1016
+		if ($mode === 'P')
1017 1017
 		{
1018
-			$object_key = 'module_skin_vars:'.$module_srl;
1018
+			$object_key = 'module_skin_vars:' . $module_srl;
1019 1019
 			$query = 'module.deleteModuleSkinVars';
1020 1020
 		}
1021 1021
 		else
1022 1022
 		{
1023
-			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1023
+			$object_key = 'module_mobile_skin_vars:' . $module_srl;
1024 1024
 			$query = 'module.deleteModuleMobileSkinVars';
1025 1025
 		}
1026 1026
 
1027 1027
 		//remove from cache
1028 1028
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1029 1029
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1030
-		if($oCacheHandler->isSupport())
1030
+		if ($oCacheHandler->isSupport())
1031 1031
 		{
1032 1032
 			$oCacheHandler->delete($cache_key);
1033 1033
 		}
@@ -1042,24 +1042,24 @@  discard block
 block discarded – undo
1042 1042
 	{
1043 1043
 		$this->deleteModuleExtraVars($module_srl);
1044 1044
 		getDestroyXeVars($obj);
1045
-		if(!$obj || !count($obj)) return;
1045
+		if (!$obj || !count($obj)) return;
1046 1046
 
1047
-		foreach($obj as $key => $val)
1047
+		foreach ($obj as $key => $val)
1048 1048
 		{
1049
-			if(is_object($val) || is_array($val)) continue;
1049
+			if (is_object($val) || is_array($val)) continue;
1050 1050
 
1051 1051
 			$args = new stdClass();
1052 1052
 			$args->module_srl = $module_srl;
1053 1053
 			$args->name = trim($key);
1054 1054
 			$args->value = trim($val);
1055
-			if(!$args->name || !$args->value) continue;
1055
+			if (!$args->name || !$args->value) continue;
1056 1056
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1057 1057
 		}
1058 1058
 
1059 1059
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1060
-		if($oCacheHandler->isSupport())
1060
+		if ($oCacheHandler->isSupport())
1061 1061
 		{
1062
-			$object_key = 'module_extra_vars:'.$module_srl;
1062
+			$object_key = 'module_extra_vars:' . $module_srl;
1063 1063
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1064 1064
 			$oCacheHandler->delete($cache_key);
1065 1065
 		}
@@ -1076,9 +1076,9 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
 		//remove from cache
1078 1078
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1079
-		if($oCacheHandler->isSupport())
1079
+		if ($oCacheHandler->isSupport())
1080 1080
 		{
1081
-			$object_key = 'module_extra_vars:'.$module_srl;
1081
+			$object_key = 'module_extra_vars:' . $module_srl;
1082 1082
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1083 1083
 			$oCacheHandler->delete($cache_key);
1084 1084
 		}
@@ -1092,19 +1092,19 @@  discard block
 block discarded – undo
1092 1092
 	function insertModuleGrants($module_srl, $obj)
1093 1093
 	{
1094 1094
 		$this->deleteModuleGrants($module_srl);
1095
-		if(!$obj || !count($obj)) return;
1095
+		if (!$obj || !count($obj)) return;
1096 1096
 
1097
-		foreach($obj as $name => $val)
1097
+		foreach ($obj as $name => $val)
1098 1098
 		{
1099
-			if(!$val || !count($val)) continue;
1099
+			if (!$val || !count($val)) continue;
1100 1100
 
1101
-			foreach($val as $group_srl)
1101
+			foreach ($val as $group_srl)
1102 1102
 			{
1103 1103
 				$args = new stdClass();
1104 1104
 				$args->module_srl = $module_srl;
1105 1105
 				$args->name = $name;
1106 1106
 				$args->group_srl = trim($group_srl);
1107
-				if(!$args->name || !$args->group_srl) continue;
1107
+				if (!$args->name || !$args->group_srl) continue;
1108 1108
 				executeQuery('module.insertModuleGrant', $args);
1109 1109
 			}
1110 1110
 		}
@@ -1125,9 +1125,9 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1127 1127
 	{
1128
-		if($isReplaceLangCode)
1128
+		if ($isReplaceLangCode)
1129 1129
 		{
1130
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1130
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1131 1131
 		}
1132 1132
 	}
1133 1133
 
@@ -1135,27 +1135,27 @@  discard block
 block discarded – undo
1135 1135
 	{
1136 1136
 		static $lang = null;
1137 1137
 
1138
-		if(is_null($lang))
1138
+		if (is_null($lang))
1139 1139
 		{
1140 1140
 			$site_module_info = Context::get('site_module_info');
1141
-			if(!$site_module_info)
1141
+			if (!$site_module_info)
1142 1142
 			{
1143 1143
 				$oModuleModel = getModel('module');
1144 1144
 				$site_module_info = $oModuleModel->getDefaultMid();
1145 1145
 				Context::set('site_module_info', $site_module_info);
1146 1146
 			}
1147 1147
 			$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
1148
-			if(!file_exists($cache_file))
1148
+			if (!file_exists($cache_file))
1149 1149
 			{
1150 1150
 				$oModuleAdminController = getAdminController('module');
1151 1151
 				$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1152 1152
 			}
1153 1153
 
1154
-			if(file_exists($cache_file))
1154
+			if (file_exists($cache_file))
1155 1155
 			{
1156 1156
 				$moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php');
1157 1157
 				$cacheFileMtime = filemtime($cache_file);
1158
-				if($cacheFileMtime < $moduleAdminControllerMtime)
1158
+				if ($cacheFileMtime < $moduleAdminControllerMtime)
1159 1159
 				{
1160 1160
 					$oModuleAdminController = getAdminController('module');
1161 1161
 					$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
 				require_once($cache_file);
1165 1165
 			}
1166 1166
 		}
1167
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1167
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1168 1168
 
1169
-		return str_replace('$user_lang->','',$matches[0]);
1169
+		return str_replace('$user_lang->', '', $matches[0]);
1170 1170
 	}
1171 1171
 
1172 1172
 
@@ -1179,17 +1179,17 @@  discard block
 block discarded – undo
1179 1179
 		if ($ajax) Context::setRequestMethod('JSON');
1180 1180
 
1181 1181
 		$logged_info = Context::get('logged_info');
1182
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1182
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1183 1183
 
1184
-		$vars = Context::gets('addfile','filter');
1184
+		$vars = Context::gets('addfile', 'filter');
1185 1185
 		$attributeNames = Context::get('attribute_name');
1186 1186
 		$attributeValues = Context::get('attribute_value');
1187
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1187
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1188 1188
 		{
1189 1189
 			$attributes = array();
1190
-			foreach($attributeNames as $no => $name)
1190
+			foreach ($attributeNames as $no => $name)
1191 1191
 			{
1192
-				if(empty($name))
1192
+				if (empty($name))
1193 1193
 				{
1194 1194
 					continue;
1195 1195
 				}
@@ -1201,16 +1201,16 @@  discard block
 block discarded – undo
1201 1201
 		$vars->comment = $attributes;
1202 1202
 		$module_filebox_srl = Context::get('module_filebox_srl');
1203 1203
 
1204
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1204
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1205 1205
 		$vars->ext = $ext;
1206
-		if($vars->filter) $filter = explode(',',$vars->filter);
1207
-		else $filter = array('jpg','jpeg','gif','png');
1208
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1206
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1207
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1208
+		if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured');
1209 1209
 
1210 1210
 		$vars->member_srl = $logged_info->member_srl;
1211 1211
 
1212 1212
 		// update
1213
-		if($module_filebox_srl > 0)
1213
+		if ($module_filebox_srl > 0)
1214 1214
 		{
1215 1215
 			$vars->module_filebox_srl = $module_filebox_srl;
1216 1216
 			$output = $this->updateModuleFileBox($vars);
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 		// insert
1219 1219
 		else
1220 1220
 		{
1221
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1221
+			if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1222 1222
 			$addfile = Context::get('addfile');
1223
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1223
+			if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
+			if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1225 1225
 			$output = $this->insertModuleFileBox($vars);
1226 1226
 		}
1227 1227
 
1228
-		$this->setTemplatePath($this->module_path.'tpl');
1228
+		$this->setTemplatePath($this->module_path . 'tpl');
1229 1229
 
1230 1230
 		if (!$ajax)
1231 1231
 		{
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 		else
1237 1237
 		{
1238
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1238
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1239 1239
 			else $this->add('save_filename', '');
1240 1240
 		}
1241 1241
 	}
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 	{
1248 1248
 		$args = new stdClass;
1249 1249
 		// have file
1250
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1250
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1251 1251
 		{
1252 1252
 			$oModuleModel = getModel('module');
1253 1253
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1256,18 +1256,18 @@  discard block
 block discarded – undo
1256 1256
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1257 1257
 			FileHandler::makeDir($path);
1258 1258
 
1259
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1259
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1260 1260
 			$tmp = $vars->addfile['tmp_name'];
1261 1261
 
1262 1262
 			// Check uploaded file
1263
-			if(!checkUploadedFile($tmp)) return false;
1263
+			if (!checkUploadedFile($tmp)) return false;
1264 1264
 
1265
-			if(!@move_uploaded_file($tmp, $save_filename))
1265
+			if (!@move_uploaded_file($tmp, $save_filename))
1266 1266
 			{
1267 1267
 				return false;
1268 1268
 			}
1269 1269
 
1270
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1270
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1271 1271
 			$args->filename = $save_filename;
1272 1272
 			$args->filesize = $vars->addfile['size'];
1273 1273
 		}
@@ -1293,14 +1293,14 @@  discard block
 block discarded – undo
1293 1293
 		$oModuleModel = getModel('module');
1294 1294
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1295 1295
 		FileHandler::makeDir($path);
1296
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1296
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1297 1297
 		$tmp = $vars->addfile['tmp_name'];
1298 1298
 
1299 1299
 		// Check uploaded file
1300
-		if(!checkUploadedFile($tmp)) return false;
1300
+		if (!checkUploadedFile($tmp)) return false;
1301 1301
 
1302 1302
 		// upload
1303
-		if(!@move_uploaded_file($tmp, $save_filename))
1303
+		if (!@move_uploaded_file($tmp, $save_filename))
1304 1304
 		{
1305 1305
 			return false;
1306 1306
 		}
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		$args->member_srl = $vars->member_srl;
1312 1312
 		$args->comment = $vars->comment;
1313 1313
 		$args->filename = $save_filename;
1314
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1314
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1315 1315
 		$args->filesize = $vars->addfile['size'];
1316 1316
 
1317 1317
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1326,14 +1326,14 @@  discard block
 block discarded – undo
1326 1326
 	function procModuleFileBoxDelete()
1327 1327
 	{
1328 1328
 		$logged_info = Context::get('logged_info');
1329
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1329
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1330 1330
 
1331 1331
 		$module_filebox_srl = Context::get('module_filebox_srl');
1332
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1332
+		if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1333 1333
 		$vars = new stdClass();
1334 1334
 		$vars->module_filebox_srl = $module_filebox_srl;
1335 1335
 		$output = $this->deleteModuleFileBox($vars);
1336
-		if(!$output->toBool()) return $output;
1336
+		if (!$output->toBool()) return $output;
1337 1337
 	}
1338 1338
 
1339 1339
 	function deleteModuleFileBox($vars)
@@ -1356,11 +1356,11 @@  discard block
 block discarded – undo
1356 1356
 		$this->unlockTimeoutPassed();
1357 1357
 		$args = new stdClass;
1358 1358
 		$args->lock_name = $lock_name;
1359
-		if(!$timeout) $timeout = 60;
1359
+		if (!$timeout) $timeout = 60;
1360 1360
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1361
-		if($member_srl) $args->member_srl = $member_srl;
1361
+		if ($member_srl) $args->member_srl = $member_srl;
1362 1362
 		$output = executeQuery('module.insertLock', $args);
1363
-		if($output->toBool())
1363
+		if ($output->toBool())
1364 1364
 		{
1365 1365
 			$output->add('lock_name', $lock_name);
1366 1366
 			$output->add('deadline', $args->deadline);
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 		$output = executeQuery('module.updateModuleInSites', $args);
1390 1390
 
1391 1391
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1392
-		if($oCacheHandler->isSupport())
1392
+		if ($oCacheHandler->isSupport())
1393 1393
 		{
1394 1394
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1395 1395
 		}
Please login to merge, or discard this patch.
Braces   +217 added lines, -101 removed lines patch added patch discarded remove patch
@@ -150,9 +150,15 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if($kind != 'admin') {
154
+			$kind = '';
155
+		}
156
+		if(!in_array($type,array('model','controller','view','api','mobile'))) {
157
+			return false;
158
+		}
159
+		if(in_array($parent_module, array('module','addon','widget','layout'))) {
160
+			return false;
161
+		}
156 162
 
157 163
 		$cache_file = './files/config/module_extend.php';
158 164
 		FileHandler::removeFile($cache_file);
@@ -164,7 +170,9 @@  discard block
 block discarded – undo
164 170
 		$args->kind = $kind;
165 171
 
166 172
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
173
+		if($output->data->count>0) {
174
+			return false;
175
+		}
168 176
 
169 177
 		$output = executeQuery('module.insertModuleExtend', $args);
170 178
 		return $output;
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 		$oModuleModel = getModel('module');
200 208
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 209
 
202
-		if(!$origin_config) $origin_config = new stdClass;
210
+		if(!$origin_config) {
211
+			$origin_config = new stdClass;
212
+		}
203 213
 
204 214
 		foreach($config as $key => $val)
205 215
 		{
@@ -221,7 +231,9 @@  discard block
 block discarded – undo
221 231
 		$args->site_srl = $site_srl;
222 232
 
223 233
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
234
+		if(!$output->toBool()) {
235
+			return $output;
236
+		}
225 237
 
226 238
 		$output = executeQuery('module.insertModuleConfig', $args);
227 239
 
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 		$args->config = serialize($config);
247 259
 
248 260
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
250 264
 
251 265
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 266
 
@@ -268,9 +282,10 @@  discard block
 block discarded – undo
268 282
 		if(isSiteID($domain))
269 283
 		{
270 284
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
272
-		}
273
-		else
285
+			if($oModuleModel->isIDExists($domain, 0)) {
286
+				return new Object(-1,'msg_already_registed_vid');
287
+			}
288
+		} else
274 289
 		{
275 290
 			$domain = strtolower($domain);
276 291
 		}
@@ -284,10 +299,14 @@  discard block
 block discarded – undo
284 299
 		$columnList = array('modules.site_srl');
285 300
 		$oModuleModel = getModel('module');
286 301
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new Object(-1,'msg_already_registed_vid');
302
+		if($output) {
303
+			return new Object(-1,'msg_already_registed_vid');
304
+		}
288 305
 
289 306
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
307
+		if(!$output->toBool()) {
308
+			return $output;
309
+		}
291 310
 
292 311
 		$output->add('site_srl', $args->site_srl);
293 312
 		return $output;
@@ -310,8 +329,12 @@  discard block
 block discarded – undo
310 329
 		if($site_info->domain != $args->domain)
311 330
 		{
312 331
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
332
+			if($info->site_srl && $info->site_srl != $args->site_srl) {
333
+				return new Object(-1,'msg_already_registed_domain');
334
+			}
335
+			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) {
336
+				return new Object(-1,'msg_already_registed_vid');
337
+			}
315 338
 
316 339
 			if($args->domain && !isSiteID($args->domain))
317 340
 			{
@@ -320,8 +343,11 @@  discard block
 block discarded – undo
320 343
 		}
321 344
 		$output = executeQuery('module.updateSite', $args);
322 345
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
346
+		if($args->site_srl == 0) {
347
+			$vid='';
348
+		} else {
349
+			$vid=$args->domain;
350
+		}
325 351
 
326 352
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 353
 		$mid = $module_info->mid;
@@ -345,7 +371,9 @@  discard block
 block discarded – undo
345 371
 		unset($args->act);
346 372
 		unset($args->page);
347 373
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
374
+		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) {
375
+			return new Object(-1, 'msg_limit_mid');
376
+		}
349 377
 		// Test variables (separate basic vars and other vars in modules)
350 378
 		$extra_vars = clone($args);
351 379
 		unset($extra_vars->module_srl);
@@ -382,18 +410,23 @@  discard block
 block discarded – undo
382 410
 		if(isset($args->isMenuCreate))
383 411
 		{
384 412
 			$isMenuCreate = $args->isMenuCreate;
385
-		}
386
-		else
413
+		} else
387 414
 		{
388 415
 			$isMenuCreate = TRUE;
389 416
 		}
390 417
 
391 418
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
419
+		if(!$output->toBool()) {
420
+			return $output;
421
+		}
393 422
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
423
+		if(!$args->site_srl) {
424
+			$args->site_srl = 0;
425
+		}
395 426
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
427
+		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) {
428
+			return new Object(-1, 'msg_module_name_exists');
429
+		}
397 430
 
398 431
 		// begin transaction
399 432
 		$oDB = &DB::getInstance();
@@ -404,20 +437,20 @@  discard block
 block discarded – undo
404 437
 		$skin_vars = new stdClass();
405 438
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 439
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
440
+		if(!$args->module_srl) {
441
+			$args->module_srl = getNextSequence();
442
+		}
408 443
 
409 444
 		// default value
410 445
 		if($args->skin == '/USE_DEFAULT/')
411 446
 		{
412 447
 			$args->is_skin_fix = 'N';
413
-		}
414
-		else
448
+		} else
415 449
 		{
416 450
 			if(isset($args->is_skin_fix))
417 451
 			{
418 452
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419
-			}
420
-			else
453
+			} else
421 454
 			{
422 455
 				$args->is_skin_fix = 'Y';
423 456
 			}
@@ -426,14 +459,12 @@  discard block
 block discarded – undo
426 459
 		if($args->mskin == '/USE_DEFAULT/')
427 460
 		{
428 461
 			$args->is_mskin_fix = 'N';
429
-		}
430
-		else
462
+		} else
431 463
 		{
432 464
 			if(isset($args->is_mskin_fix))
433 465
 			{
434 466
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435
-			}
436
-			else
467
+			} else
437 468
 			{
438 469
 				$args->is_mskin_fix = 'Y';
439 470
 			}
@@ -508,7 +539,9 @@  discard block
 block discarded – undo
508 539
 	function updateModule($args)
509 540
 	{
510 541
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
511
-		if(!$output->toBool()) return $output;
542
+		if(!$output->toBool()) {
543
+			return $output;
544
+		}
512 545
 		// begin transaction
513 546
 		$oDB = &DB::getInstance();
514 547
 		$oDB->begin();
@@ -519,8 +552,12 @@  discard block
 block discarded – undo
519 552
 
520 553
 		if(!$args->site_srl || !$args->browser_title)
521 554
 		{
522
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
523
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
555
+			if(!$args->site_srl) {
556
+				$args->site_srl = (int)$module_info->site_srl;
557
+			}
558
+			if(!$args->browser_title) {
559
+				$args->browser_title = $module_info->browser_title;
560
+			}
524 561
 		}
525 562
 
526 563
 		$args->browser_title = strip_tags($args->browser_title);
@@ -536,14 +573,12 @@  discard block
 block discarded – undo
536 573
 		if($args->skin == '/USE_DEFAULT/')
537 574
 		{
538 575
 			$args->is_skin_fix = 'N';
539
-		}
540
-		else
576
+		} else
541 577
 		{
542 578
 			if(isset($args->is_skin_fix))
543 579
 			{
544 580
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
545
-			}
546
-			else
581
+			} else
547 582
 			{
548 583
 				$args->is_skin_fix = 'Y';
549 584
 			}
@@ -552,14 +587,12 @@  discard block
 block discarded – undo
552 587
 		if($args->mskin == '/USE_DEFAULT/')
553 588
 		{
554 589
 			$args->is_mskin_fix = 'N';
555
-		}
556
-		else
590
+		} else
557 591
 		{
558 592
 			if(isset($args->is_mskin_fix))
559 593
 			{
560 594
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
561
-			}
562
-			else
595
+			} else
563 596
 			{
564 597
 				$args->is_mskin_fix = 'Y';
565 598
 			}
@@ -624,7 +657,9 @@  discard block
 block discarded – undo
624 657
 		$args->site_srl = $site_srl;
625 658
 		$args->layout_srl = $layout_srl;
626 659
 		$output = executeQuery('module.updateModuleSite', $args);
627
-		if(!$output->toBool()) return $output;
660
+		if(!$output->toBool()) {
661
+			return $output;
662
+		}
628 663
 
629 664
 		//remove from cache
630 665
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -643,7 +678,9 @@  discard block
 block discarded – undo
643 678
 	 */
644 679
 	function deleteModule($module_srl, $site_srl = 0)
645 680
 	{
646
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
681
+		if(!$module_srl) {
682
+			return new Object(-1,'msg_invalid_request');
683
+		}
647 684
 
648 685
 		$site_module_info = Context::get('site_module_info');
649 686
 
@@ -653,8 +690,11 @@  discard block
 block discarded – undo
653 690
 		$args = new stdClass();
654 691
 		$args->url = $output->mid;
655 692
 		$args->is_shortcut = 'N';
656
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
657
-		else $args->site_srl = $site_srl;
693
+		if(!$site_srl) {
694
+			$args->site_srl = $site_module_info->site_srl;
695
+		} else {
696
+			$args->site_srl = $site_srl;
697
+		}
658 698
 
659 699
 		unset($output);
660 700
 
@@ -687,8 +727,7 @@  discard block
 block discarded – undo
687 727
 			if($output->isSuccess)
688 728
 			{
689 729
 				return new Object(0, 'success_deleted');
690
-			}
691
-			else
730
+			} else
692 731
 			{
693 732
 				return new Object($output->error, $output->message);
694 733
 			}
@@ -706,19 +745,25 @@  discard block
 block discarded – undo
706 745
 	 */
707 746
 	public function onlyDeleteModule($module_srl)
708 747
 	{
709
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
748
+		if(!$module_srl) {
749
+			return new Object(-1,'msg_invalid_request');
750
+		}
710 751
 
711 752
 		// check start module
712 753
 		$oModuleModel = getModel('module');
713 754
 		$columnList = array('sites.index_module_srl');
714 755
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
715
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
756
+		if($module_srl == $start_module->index_module_srl) {
757
+			return new Object(-1, 'msg_cannot_delete_startmodule');
758
+		}
716 759
 
717 760
 		// Call a trigger (before)
718 761
 		$trigger_obj = new stdClass();
719 762
 		$trigger_obj->module_srl = $module_srl;
720 763
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
721
-		if(!$output->toBool()) return $output;
764
+		if(!$output->toBool()) {
765
+			return $output;
766
+		}
722 767
 
723 768
 		// begin transaction
724 769
 		$oDB = &DB::getInstance();
@@ -779,7 +824,9 @@  discard block
 block discarded – undo
779 824
 	function clearDefaultModule()
780 825
 	{
781 826
 		$output = executeQuery('module.clearDefaultModule');
782
-		if(!$output->toBool()) return $output;
827
+		if(!$output->toBool()) {
828
+			return $output;
829
+		}
783 830
 
784 831
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
785 832
 		if($oCacheHandler->isSupport())
@@ -811,7 +858,9 @@  discard block
 block discarded – undo
811 858
 	 */
812 859
 	function updateModuleLayout($layout_srl, $menu_srl_list)
813 860
 	{
814
-		if(!count($menu_srl_list)) return;
861
+		if(!count($menu_srl_list)) {
862
+			return;
863
+		}
815 864
 
816 865
 		$args = new stdClass;
817 866
 		$args->layout_srl = $layout_srl;
@@ -838,28 +887,37 @@  discard block
 block discarded – undo
838 887
 
839 888
 		$output = executeQuery('module.deleteSiteAdmin', $args);
840 889
 
841
-		if(!$output->toBool()) return $output;
890
+		if(!$output->toBool()) {
891
+			return $output;
892
+		}
842 893
 		// Get user id of an administrator
843
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
894
+		if(!is_array($arr_admins) || !count($arr_admins)) {
895
+			return new Object();
896
+		}
844 897
 		foreach($arr_admins as $key => $user_id)
845 898
 		{
846
-			if(!trim($user_id)) continue;
899
+			if(!trim($user_id)) {
900
+				continue;
901
+			}
847 902
 			$admins[] = trim($user_id);
848 903
 		}
849
-		if(!count($admins)) return new Object();
904
+		if(!count($admins)) {
905
+			return new Object();
906
+		}
850 907
 
851 908
 		$oMemberModel = getModel('member');
852 909
 		$member_config = $oMemberModel->getMemberConfig();
853 910
 		if($member_config->identifier == 'email_address')
854 911
 		{
855 912
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
856
-		}
857
-		else
913
+		} else
858 914
 		{
859 915
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
860 916
 		}
861 917
 		$output = executeQueryArray('module.getAdminSrls', $args);
862
-		if(!$output->toBool()||!$output->data) return $output;
918
+		if(!$output->toBool()||!$output->data) {
919
+			return $output;
920
+		}
863 921
 
864 922
 		foreach($output->data as $key => $val)
865 923
 		{
@@ -868,7 +926,9 @@  discard block
 block discarded – undo
868 926
 			$args->site_srl = $site_srl;
869 927
 			$args->member_srl = $val->member_srl;
870 928
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
871
-			if(!$output->toBool()) return $output;
929
+			if(!$output->toBool()) {
930
+				return $output;
931
+			}
872 932
 		}
873 933
 		return new Object();
874 934
 	}
@@ -881,12 +941,15 @@  discard block
 block discarded – undo
881 941
 		$oMemberModel = getModel('member');
882 942
 		$member_config = $oMemberModel->getMemberConfig();
883 943
 
884
-		if($member_config->identifier == 'email_address')
885
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
886
-		else
887
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
944
+		if($member_config->identifier == 'email_address') {
945
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
946
+		} else {
947
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
948
+		}
888 949
 
889
-		if(!$member_info->member_srl) return;
950
+		if(!$member_info->member_srl) {
951
+			return;
952
+		}
890 953
 		$args = new stdClass();
891 954
 		$args->module_srl = $module_srl;
892 955
 		$args->member_srl = $member_info->member_srl;
@@ -905,7 +968,9 @@  discard block
 block discarded – undo
905 968
 		{
906 969
 			$oMemberModel = getModel('member');
907 970
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
908
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
971
+			if($member_info->member_srl) {
972
+				$args->member_srl = $member_info->member_srl;
973
+			}
909 974
 		}
910 975
 		return executeQuery('module.deleteAdminId', $args);
911 976
 	}
@@ -949,7 +1014,9 @@  discard block
 block discarded – undo
949 1014
 		}
950 1015
 
951 1016
 		getDestroyXeVars($obj);
952
-		if(!$obj || !count($obj)) return new Object();
1017
+		if(!$obj || !count($obj)) {
1018
+			return new Object();
1019
+		}
953 1020
 
954 1021
 		$args = new stdClass;
955 1022
 		$args->module_srl = $module_srl;
@@ -959,18 +1026,23 @@  discard block
 block discarded – undo
959 1026
 			// it often saved menu item(stdClass) on the skin info column
960 1027
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
961 1028
 			// fixed the error
962
-			if (is_object($val)) continue;
963
-			if (is_array($val)) $val = serialize($val);
1029
+			if (is_object($val)) {
1030
+				continue;
1031
+			}
1032
+			if (is_array($val)) {
1033
+				$val = serialize($val);
1034
+			}
964 1035
 
965 1036
 			$args->name = trim($key);
966 1037
 			$args->value = trim($val);
967
-			if(!$args->name || !$args->value) continue;
1038
+			if(!$args->name || !$args->value) {
1039
+				continue;
1040
+			}
968 1041
 
969 1042
 			if($mode === 'P')
970 1043
 			{
971 1044
 				$output = executeQuery('module.insertModuleSkinVars', $args);
972
-			}
973
-			else
1045
+			} else
974 1046
 			{
975 1047
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
976 1048
 			}
@@ -1017,8 +1089,7 @@  discard block
 block discarded – undo
1017 1089
 		{
1018 1090
 			$object_key = 'module_skin_vars:'.$module_srl;
1019 1091
 			$query = 'module.deleteModuleSkinVars';
1020
-		}
1021
-		else
1092
+		} else
1022 1093
 		{
1023 1094
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1024 1095
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1042,17 +1113,23 @@  discard block
 block discarded – undo
1042 1113
 	{
1043 1114
 		$this->deleteModuleExtraVars($module_srl);
1044 1115
 		getDestroyXeVars($obj);
1045
-		if(!$obj || !count($obj)) return;
1116
+		if(!$obj || !count($obj)) {
1117
+			return;
1118
+		}
1046 1119
 
1047 1120
 		foreach($obj as $key => $val)
1048 1121
 		{
1049
-			if(is_object($val) || is_array($val)) continue;
1122
+			if(is_object($val) || is_array($val)) {
1123
+				continue;
1124
+			}
1050 1125
 
1051 1126
 			$args = new stdClass();
1052 1127
 			$args->module_srl = $module_srl;
1053 1128
 			$args->name = trim($key);
1054 1129
 			$args->value = trim($val);
1055
-			if(!$args->name || !$args->value) continue;
1130
+			if(!$args->name || !$args->value) {
1131
+				continue;
1132
+			}
1056 1133
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1057 1134
 		}
1058 1135
 
@@ -1092,11 +1169,15 @@  discard block
 block discarded – undo
1092 1169
 	function insertModuleGrants($module_srl, $obj)
1093 1170
 	{
1094 1171
 		$this->deleteModuleGrants($module_srl);
1095
-		if(!$obj || !count($obj)) return;
1172
+		if(!$obj || !count($obj)) {
1173
+			return;
1174
+		}
1096 1175
 
1097 1176
 		foreach($obj as $name => $val)
1098 1177
 		{
1099
-			if(!$val || !count($val)) continue;
1178
+			if(!$val || !count($val)) {
1179
+				continue;
1180
+			}
1100 1181
 
1101 1182
 			foreach($val as $group_srl)
1102 1183
 			{
@@ -1104,7 +1185,9 @@  discard block
 block discarded – undo
1104 1185
 				$args->module_srl = $module_srl;
1105 1186
 				$args->name = $name;
1106 1187
 				$args->group_srl = trim($group_srl);
1107
-				if(!$args->name || !$args->group_srl) continue;
1188
+				if(!$args->name || !$args->group_srl) {
1189
+					continue;
1190
+				}
1108 1191
 				executeQuery('module.insertModuleGrant', $args);
1109 1192
 			}
1110 1193
 		}
@@ -1164,7 +1247,9 @@  discard block
 block discarded – undo
1164 1247
 				require_once($cache_file);
1165 1248
 			}
1166 1249
 		}
1167
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1250
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1251
+			return $lang[$matches[1]];
1252
+		}
1168 1253
 
1169 1254
 		return str_replace('$user_lang->','',$matches[0]);
1170 1255
 	}
@@ -1176,10 +1261,14 @@  discard block
 block discarded – undo
1176 1261
 	function procModuleFileBoxAdd()
1177 1262
 	{
1178 1263
 		$ajax = Context::get('ajax');
1179
-		if ($ajax) Context::setRequestMethod('JSON');
1264
+		if ($ajax) {
1265
+			Context::setRequestMethod('JSON');
1266
+		}
1180 1267
 
1181 1268
 		$logged_info = Context::get('logged_info');
1182
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1269
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1270
+			return new Object(-1, 'msg_not_permitted');
1271
+		}
1183 1272
 
1184 1273
 		$vars = Context::gets('addfile','filter');
1185 1274
 		$attributeNames = Context::get('attribute_name');
@@ -1203,9 +1292,14 @@  discard block
 block discarded – undo
1203 1292
 
1204 1293
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1205 1294
 		$vars->ext = $ext;
1206
-		if($vars->filter) $filter = explode(',',$vars->filter);
1207
-		else $filter = array('jpg','jpeg','gif','png');
1208
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1295
+		if($vars->filter) {
1296
+			$filter = explode(',',$vars->filter);
1297
+		} else {
1298
+			$filter = array('jpg','jpeg','gif','png');
1299
+		}
1300
+		if(!in_array($ext,$filter)) {
1301
+			return new Object(-1, 'msg_error_occured');
1302
+		}
1209 1303
 
1210 1304
 		$vars->member_srl = $logged_info->member_srl;
1211 1305
 
@@ -1218,10 +1312,16 @@  discard block
 block discarded – undo
1218 1312
 		// insert
1219 1313
 		else
1220 1314
 		{
1221
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1315
+			if(!Context::isUploaded()) {
1316
+				return new Object(-1, 'msg_error_occured');
1317
+			}
1222 1318
 			$addfile = Context::get('addfile');
1223
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1319
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1320
+				return new Object(-1, 'msg_error_occured');
1321
+			}
1322
+			if($vars->addfile['error'] != 0) {
1323
+				return new Object(-1, 'msg_error_occured');
1324
+			}
1225 1325
 			$output = $this->insertModuleFileBox($vars);
1226 1326
 		}
1227 1327
 
@@ -1232,11 +1332,13 @@  discard block
 block discarded – undo
1232 1332
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1233 1333
 			$this->setRedirectUrl($returnUrl);
1234 1334
 			return;
1235
-		}
1236
-		else
1335
+		} else
1237 1336
 		{
1238
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1239
-			else $this->add('save_filename', '');
1337
+			if($output) {
1338
+				$this->add('save_filename', $output->get('save_filename'));
1339
+			} else {
1340
+				$this->add('save_filename', '');
1341
+			}
1240 1342
 		}
1241 1343
 	}
1242 1344
 
@@ -1260,7 +1362,9 @@  discard block
 block discarded – undo
1260 1362
 			$tmp = $vars->addfile['tmp_name'];
1261 1363
 
1262 1364
 			// Check uploaded file
1263
-			if(!checkUploadedFile($tmp)) return false;
1365
+			if(!checkUploadedFile($tmp)) {
1366
+				return false;
1367
+			}
1264 1368
 
1265 1369
 			if(!@move_uploaded_file($tmp, $save_filename))
1266 1370
 			{
@@ -1297,7 +1401,9 @@  discard block
 block discarded – undo
1297 1401
 		$tmp = $vars->addfile['tmp_name'];
1298 1402
 
1299 1403
 		// Check uploaded file
1300
-		if(!checkUploadedFile($tmp)) return false;
1404
+		if(!checkUploadedFile($tmp)) {
1405
+			return false;
1406
+		}
1301 1407
 
1302 1408
 		// upload
1303 1409
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1326,14 +1432,20 @@  discard block
 block discarded – undo
1326 1432
 	function procModuleFileBoxDelete()
1327 1433
 	{
1328 1434
 		$logged_info = Context::get('logged_info');
1329
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1435
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1436
+			return new Object(-1, 'msg_not_permitted');
1437
+		}
1330 1438
 
1331 1439
 		$module_filebox_srl = Context::get('module_filebox_srl');
1332
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1440
+		if(!$module_filebox_srl) {
1441
+			return new Object(-1, 'msg_invalid_request');
1442
+		}
1333 1443
 		$vars = new stdClass();
1334 1444
 		$vars->module_filebox_srl = $module_filebox_srl;
1335 1445
 		$output = $this->deleteModuleFileBox($vars);
1336
-		if(!$output->toBool()) return $output;
1446
+		if(!$output->toBool()) {
1447
+			return $output;
1448
+		}
1337 1449
 	}
1338 1450
 
1339 1451
 	function deleteModuleFileBox($vars)
@@ -1356,9 +1468,13 @@  discard block
 block discarded – undo
1356 1468
 		$this->unlockTimeoutPassed();
1357 1469
 		$args = new stdClass;
1358 1470
 		$args->lock_name = $lock_name;
1359
-		if(!$timeout) $timeout = 60;
1471
+		if(!$timeout) {
1472
+			$timeout = 60;
1473
+		}
1360 1474
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1361
-		if($member_srl) $args->member_srl = $member_srl;
1475
+		if($member_srl) {
1476
+			$args->member_srl = $member_srl;
1477
+		}
1362 1478
 		$output = executeQuery('module.insertLock', $args);
1363 1479
 		if($output->toBool())
1364 1480
 		{
Please login to merge, or discard this patch.
modules/module/module.model.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1035,6 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 	/**
1036 1036
 	 * @brief Get a list of skins for the module
1037 1037
 	 * Return file analysis of skin and skin.xml
1038
+	 * @param string $path
1038 1039
 	 */
1039 1040
 	function getSkins($path, $dir = 'skins')
1040 1041
 	{
@@ -1359,6 +1360,8 @@  discard block
 block discarded – undo
1359 1360
 	/**
1360 1361
 	 * @brief Return module configurations
1361 1362
 	 * Global configuration is used to manage board, member and others
1363
+	 * @param string $module
1364
+	 * @return string
1362 1365
 	 */
1363 1366
 	function getModuleConfig($module, $site_srl = 0)
1364 1367
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleModel
5
- * @author NAVER ([email protected])
6
- * @brief Model class of module module
7
- */
4
+	 * @class  moduleModel
5
+	 * @author NAVER ([email protected])
6
+	 * @brief Model class of module module
7
+	 */
8 8
 class moduleModel extends module
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +367 added lines, -367 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
 			$url_info = parse_url($request_url);
101 101
 			$hostname = $url_info['host'];
102 102
 			$path = $url_info['path'];
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, $url_info['port']&&$url_info['port']!=80?':'.$url_info['port']:'',$path);
105
+			$domain = sprintf('%s%s%s', $hostname, $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['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 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,25 +207,25 @@  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
-			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
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 230
 				$object_key = 'mid_info:' . $module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
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
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
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,19 +321,19 @@  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
-			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
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 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
 
@@ -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 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,9 +500,9 @@  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 507
 				$object_key = 'module:mid_list_' . $args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -510,27 +510,27 @@  discard block
 block discarded – undo
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
-		$key = $parent_module.'.'.$kind.'.'.$type;
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 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,7 +1106,7 @@  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
 
@@ -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 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
-			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
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
-			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
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
-			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
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
-				$object_key = 'module_extra_vars:'.$module_srl;
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,37 +1749,37 @@  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
-					$object_key = 'module_extra_vars:'.$val->module_srl;
1782
+					$object_key = 'module_extra_vars:' . $val->module_srl;
1783 1783
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1784 1784
 					$oCacheHandler->put($cache_key, $extra_vars[$val->module_srl]);
1785 1785
 				}
@@ -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
-			$object_key = 'module_skin_vars:'.$module_srl;
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
-		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834
-		if(is_readable($designInfoFile))
1833
+		$designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl);
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
-			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
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
-			$object_key = 'module_mobile_skin_vars:'.$module_srl;
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
-			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
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');
@@ -2219,17 +2219,17 @@  discard block
 block discarded – undo
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);
@@ -2237,22 +2237,22 @@  discard block
 block discarded – undo
2237 2237
 		}
2238 2238
 		else if (strpos($ruleset, '#') !== false)
2239 2239
 		{
2240
-			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
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,12 +2276,12 @@  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
-				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
2284
+				$codeInfo = array('name'=>'$user_lang->' . $code_info->name, 'value'=>$code_info->value);
2285 2285
 				$list[] = $codeInfo;
2286 2286
 			}
2287 2287
 		}
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
 			$url_info = parse_url($request_url);
101 113
 			$hostname = $url_info['host'];
102 114
 			$path = $url_info['path'];
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, $url_info['port']&&$url_info['port']!=80?':'.$url_info['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 = new stdClass();
1526
+				if($output->data->config) {
1527
+					$config = unserialize($output->data->config);
1528
+				} else {
1529
+					$config = new stdClass();
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/page/page.view.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -129,6 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
 	/**
131 131
 	 * @brief Save the file and return if a file is requested by http
132
+	 * @param integer $caching_interval
133
+	 * @param string $cache_file
132 134
 	 */
133 135
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 136
 	{
@@ -167,6 +169,8 @@  discard block
 block discarded – undo
167 169
 
168 170
 	/**
169 171
 	 * @brief Create a cache file in order to include if it is an internal file
172
+	 * @param integer $caching_interval
173
+	 * @param string $cache_file
170 174
 	 */
171 175
 	function executeFile($target_file, $caching_interval, $cache_file)
172 176
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  pageView
5
- * @author NAVER ([email protected])
6
- * @brief page view class of the module
7
- */
4
+	 * @class  pageView
5
+	 * @author NAVER ([email protected])
6
+	 * @brief page view class of the module
7
+	 */
8 8
 class pageView extends page
9 9
 {
10 10
 	var $module_srl = 0;
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@  discard block
 block discarded – undo
20 20
 	function init()
21 21
 	{
22 22
 		// Get a template path (page in the administrative template tpl putting together)
23
-		$this->setTemplatePath($this->module_path.'tpl');
23
+		$this->setTemplatePath($this->module_path . 'tpl');
24 24
 
25
-		switch($this->module_info->page_type)
25
+		switch ($this->module_info->page_type)
26 26
 		{
27 27
 			case 'WIDGET' :
28 28
 				{
29 29
 					$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
30
-					$this->interval = (int)($this->module_info->page_caching_interval);
30
+					$this->interval = (int) ($this->module_info->page_caching_interval);
31 31
 					break;
32 32
 				}
33 33
 			case 'OUTSIDE' :
34 34
 				{
35 35
 					$this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus());
36
-					$this->interval = (int)($this->module_info->page_caching_interval);
36
+					$this->interval = (int) ($this->module_info->page_caching_interval);
37 37
 					$this->path = $this->module_info->path;
38 38
 					break;
39 39
 				}
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if ($this->module_srl) Context::set('module_srl', $this->module_srl);
50 50
 
51 51
 		$page_type_name = strtolower($this->module_info->page_type);
52 52
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
53
+		if (method_exists($this, $method)) $page_content = $this->{$method}();
54 54
 		else return new Object(-1, sprintf('%s method is not exists', $method));
55 55
 
56 56
 		Context::set('module_info', $this->module_info);
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
 	function _getWidgetContent()
63 63
 	{
64
-		if($this->interval>0)
64
+		if ($this->interval > 0)
65 65
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
66
+			if (!file_exists($this->cache_file)) $mtime = 0;
67 67
 			else $mtime = filemtime($this->cache_file);
68 68
 
69
-			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
69
+			if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME'])
70 70
 			{
71 71
 				$page_content = FileHandler::readFile($this->cache_file); 
72 72
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		}
81 81
 		else
82 82
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
83
+			if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
84 84
 			$page_content = $this->module_info->content;
85 85
 		}
86 86
 		return $page_content;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		$oDocumentModel = getModel('document');
94 94
 		$oDocument = $oDocumentModel->getDocument(0, true);
95 95
 
96
-		if($this->module_info->document_srl)
96
+		if ($this->module_info->document_srl)
97 97
 		{
98 98
 			$document_srl = $this->module_info->document_srl;
99 99
 			$oDocument->setDocument($document_srl);
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
 		if ($this->module_info->skin)
105 105
 		{
106
-			$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
106
+			$templatePath = (sprintf($this->module_path . 'skins/%s', $this->module_info->skin));
107 107
 		}
108 108
 		else
109 109
 		{
110
-			$templatePath = ($this->module_path.'skins/default');
110
+			$templatePath = ($this->module_path . 'skins/default');
111 111
 		}
112 112
 
113 113
 		$page_content = $oTemplate->compile($templatePath, 'content');
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	function _getOutsideContent()
119 119
 	{
120 120
 		// check if it is http or internal file
121
-		if($this->path)
121
+		if ($this->path)
122 122
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
123
+			if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124 124
 			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
125 125
 		}
126 126
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 134
 	{
135 135
 		// Verify cache
136
-		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
136
+		if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME'])
137 137
 		{
138 138
 			$content = FileHandler::readFile($cache_file);
139 139
 		}
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		$content = $buff->content;
155 155
 		// Extract a title
156 156
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
157
+		if ($title) Context::setBrowserTitle($title);
158 158
 		// Extract header script
159 159
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
160
+		if ($head_script) Context::addHtmlHeader($head_script);
161 161
 		// Extract content from the body
162 162
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
163
+		if (!$body_script) $body_script = $content;
164 164
 
165 165
 		return $content;
166 166
 	}
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
 	function executeFile($target_file, $caching_interval, $cache_file)
172 172
 	{
173 173
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
174
+		if (!file_exists(FileHandler::getRealPath($target_file))) return;
175 175
 
176 176
 		// Get a path and filename
177
-		$tmp_path = explode('/',$cache_file);
178
-		$filename = $tmp_path[count($tmp_path)-1];
179
-		$filepath = preg_replace('/'.$filename."$/i","",$cache_file);
177
+		$tmp_path = explode('/', $cache_file);
178
+		$filename = $tmp_path[count($tmp_path) - 1];
179
+		$filepath = preg_replace('/' . $filename . "$/i", "", $cache_file);
180 180
 		$cache_file = FileHandler::getRealPath($cache_file);
181 181
 
182 182
 		$level = ob_get_level();
183 183
 		// Verify cache
184
-		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
184
+		if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file))
185 185
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
186
+			if (file_exists($cache_file)) FileHandler::removeFile($cache_file);
187 187
 
188 188
 			// Read a target file and get content
189 189
 			ob_start();
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 			$content = ob_get_clean();
192 192
 			// Replace relative path to the absolute path 
193 193
 			$this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/';
194
-			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content);
195
-			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content);
194
+			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content);
195
+			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content);
196 196
 
197 197
 			FileHandler::writeFile($cache_file, $content);
198 198
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
199
+			if (!file_exists($cache_file)) return;
200 200
 			// Attempt to compile
201 201
 			$oTemplate = &TemplateHandler::getInstance();
202 202
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 		$val = trim($matches[3]);
224 224
 		// Pass if the path is external or starts with /, #, { characters
225 225
 		// /=absolute path, #=hash in a page, {=Template syntax
226
-		if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val))
226
+		if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val))
227 227
 		{
228 228
 				return $matches[0];
229 229
 			// In case of  .. , get a path
230 230
 		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
231
+		else if (strncasecmp('..', $val, 2) === 0)
232 232
 		{
233 233
 			$p = Context::pathToUrl($this->path);
234
-			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
234
+			return sprintf("%s%s%s%s", $matches[1], $matches[2], $p . $val, $matches[4]);
235 235
 		}
236 236
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
237
+		if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2);
238 238
 		$p = Context::pathToUrl($this->path);
239
-		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
239
+		$path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p . $val, $matches[4]);
240 240
 
241 241
 		return $path;
242 242
 	}
Please login to merge, or discard this patch.
Braces   +47 added lines, -25 removed lines patch added patch discarded remove patch
@@ -46,12 +46,17 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if($this->module_srl) {
50
+			Context::set('module_srl',$this->module_srl);
51
+		}
50 52
 
51 53
 		$page_type_name = strtolower($this->module_info->page_type);
52 54
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
54
-		else return new Object(-1, sprintf('%s method is not exists', $method));
55
+		if(method_exists($this, $method)) {
56
+			$page_content = $this->{$method}();
57
+		} else {
58
+			return new Object(-1, sprintf('%s method is not exists', $method));
59
+		}
55 60
 
56 61
 		Context::set('module_info', $this->module_info);
57 62
 		Context::set('page_content', $page_content);
@@ -63,24 +68,27 @@  discard block
 block discarded – undo
63 68
 	{
64 69
 		if($this->interval>0)
65 70
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
67
-			else $mtime = filemtime($this->cache_file);
71
+			if(!file_exists($this->cache_file)) {
72
+				$mtime = 0;
73
+			} else {
74
+				$mtime = filemtime($this->cache_file);
75
+			}
68 76
 
69 77
 			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
70 78
 			{
71 79
 				$page_content = FileHandler::readFile($this->cache_file); 
72 80
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
73
-			}
74
-			else
81
+			} else
75 82
 			{
76 83
 				$oWidgetController = getController('widget');
77 84
 				$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
78 85
 				FileHandler::writeFile($this->cache_file, $page_content);
79 86
 			}
80
-		}
81
-		else
87
+		} else
82 88
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
89
+			if(file_exists($this->cache_file)) {
90
+				FileHandler::removeFile($this->cache_file);
91
+			}
84 92
 			$page_content = $this->module_info->content;
85 93
 		}
86 94
 		return $page_content;
@@ -104,8 +112,7 @@  discard block
 block discarded – undo
104 112
 		if ($this->module_info->skin)
105 113
 		{
106 114
 			$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
107
-		}
108
-		else
115
+		} else
109 116
 		{
110 117
 			$templatePath = ($this->module_path.'skins/default');
111 118
 		}
@@ -120,8 +127,11 @@  discard block
 block discarded – undo
120 127
 		// check if it is http or internal file
121 128
 		if($this->path)
122 129
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124
-			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
130
+			if(preg_match("/^([a-z]+):\/\//i",$this->path)) {
131
+				$content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
132
+			} else {
133
+				$content = $this->executeFile($this->path, $this->interval, $this->cache_file);
134
+			}
125 135
 		}
126 136
 
127 137
 		return $content;
@@ -136,8 +146,7 @@  discard block
 block discarded – undo
136 146
 		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
137 147
 		{
138 148
 			$content = FileHandler::readFile($cache_file);
139
-		}
140
-		else
149
+		} else
141 150
 		{
142 151
 			FileHandler::getRemoteFile($path, $cache_file);
143 152
 			$content = FileHandler::readFile($cache_file);
@@ -154,13 +163,19 @@  discard block
 block discarded – undo
154 163
 		$content = $buff->content;
155 164
 		// Extract a title
156 165
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
166
+		if($title) {
167
+			Context::setBrowserTitle($title);
168
+		}
158 169
 		// Extract header script
159 170
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
171
+		if($head_script) {
172
+			Context::addHtmlHeader($head_script);
173
+		}
161 174
 		// Extract content from the body
162 175
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
176
+		if(!$body_script) {
177
+			$body_script = $content;
178
+		}
164 179
 
165 180
 		return $content;
166 181
 	}
@@ -171,7 +186,9 @@  discard block
 block discarded – undo
171 186
 	function executeFile($target_file, $caching_interval, $cache_file)
172 187
 	{
173 188
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
189
+		if(!file_exists(FileHandler::getRealPath($target_file))) {
190
+			return;
191
+		}
175 192
 
176 193
 		// Get a path and filename
177 194
 		$tmp_path = explode('/',$cache_file);
@@ -183,7 +200,9 @@  discard block
 block discarded – undo
183 200
 		// Verify cache
184 201
 		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
185 202
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
203
+			if(file_exists($cache_file)) {
204
+				FileHandler::removeFile($cache_file);
205
+			}
187 206
 
188 207
 			// Read a target file and get content
189 208
 			ob_start();
@@ -196,7 +215,9 @@  discard block
 block discarded – undo
196 215
 
197 216
 			FileHandler::writeFile($cache_file, $content);
198 217
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
218
+			if(!file_exists($cache_file)) {
219
+				return;
220
+			}
200 221
 			// Attempt to compile
201 222
 			$oTemplate = &TemplateHandler::getInstance();
202 223
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -227,14 +248,15 @@  discard block
 block discarded – undo
227 248
 		{
228 249
 				return $matches[0];
229 250
 			// In case of  .. , get a path
230
-		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
251
+		} else if(strncasecmp('..', $val, 2) === 0)
232 252
 		{
233 253
 			$p = Context::pathToUrl($this->path);
234 254
 			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
235 255
 		}
236 256
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
257
+		if(strncasecmp('..', $val, 2) === 0) {
258
+			$val = substr($val,2);
259
+		}
238 260
 		$p = Context::pathToUrl($this->path);
239 261
 		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
240 262
 
Please login to merge, or discard this patch.
modules/point/point.controller.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -478,6 +478,7 @@
 block discarded – undo
478 478
 
479 479
 	/**
480 480
 	 * @brief Set points
481
+	 * @param string $mode
481 482
 	 */
482 483
 	function setPoint($member_srl, $point, $mode = null)
483 484
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  pointController
5
- * @author NAVER ([email protected])
6
- * @brief Controller class of point modules
7
- */
4
+	 * @class  pointController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief Controller class of point modules
7
+	 */
8 8
 class pointController extends point
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$point = $config->signup_point;
32 32
 		// Increase the point
33 33
 		$cur_point += $point;
34
-		$this->setPoint($member_srl,$cur_point, 'signup');
34
+		$this->setPoint($member_srl, $cur_point, 'signup');
35 35
 
36 36
 		return new Object();
37 37
 	}
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new Object();
45
+		if (!$member_srl) return new Object();
46 46
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
47
+		if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object();
48 48
 		// Get the point module information
49 49
 		$oModuleModel = getModel('module');
50 50
 		$config = $oModuleModel->getModuleConfig('point');
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$point = $config->login_point;
56 56
 		// Increase the point
57 57
 		$cur_point += $point;
58
-		$this->setPoint($member_srl,$cur_point);
58
+		$this->setPoint($member_srl, $cur_point);
59 59
 
60 60
 		return new Object();
61 61
 	}
@@ -66,30 +66,30 @@  discard block
 block discarded – undo
66 66
 	function triggerInsertDocument(&$obj)
67 67
 	{
68 68
 		$oDocumentModel = getModel('document');
69
-		if($obj->status != $oDocumentModel->getConfigStatus('temp'))
69
+		if ($obj->status != $oDocumentModel->getConfigStatus('temp'))
70 70
 		{
71 71
 			$module_srl = $obj->module_srl;
72 72
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new Object();
73
+			if (!$module_srl || !$member_srl) return new Object();
74 74
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new Object();
75
+			if ($module_srl == $member_srl) return new Object();
76 76
 			// Get the point module information
77 77
 			$oModuleModel = getModel('module');
78 78
 			$config = $oModuleModel->getModuleConfig('point');
79
-			$module_config = $oModuleModel->getModulePartConfig('point',$module_srl);
79
+			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
80 80
 			// Get the points of the member
81 81
 			$oPointModel = getModel('point');
82 82
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 83
 
84 84
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
85
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
86 86
 			$cur_point += $point;
87 87
 			// Add points for attaching a file
88 88
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
89
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
91 91
 			// Increase the point
92
-			$this->setPoint($member_srl,$cur_point);
92
+			$this->setPoint($member_srl, $cur_point);
93 93
 		}
94 94
 
95 95
 		return new Object();
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
 		$oDocument = $oDocumentModel->getDocument($document_srl);
107 107
 
108 108
 		// if status is TEMP or PUBLIC... give not point, only status is empty
109
-		if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
109
+		if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
110 110
 		{
111 111
 			$oModuleModel = getModel('module');
112 112
 
113 113
 			// Get the point module information
114 114
 			$config = $oModuleModel->getModuleConfig('point');
115
-			$module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl);
115
+			$module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl);
116 116
 			// Get the points of the member
117 117
 			$oPointModel = getModel('point');
118 118
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 119
 
120 120
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
121
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
122 122
 			$cur_point += $point;
123 123
 			// Add points for attaching a file
124 124
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
125
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
127 127
 			// Increase the point
128 128
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 129
 		}
@@ -141,42 +141,42 @@  discard block
 block discarded – undo
141 141
 
142 142
 		$oDocumentModel = getModel('document');
143 143
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new Object();
144
+		if (!$oDocument->isExists()) return new Object();
145 145
 		// Get the point module information
146 146
 		$oModuleModel = getModel('module');
147 147
 		$config = $oModuleModel->getModuleConfig('point');
148
-		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
148
+		$module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl'));
149 149
 		// The process related to clearing the post comments
150 150
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
151
+		if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
152 152
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new Object();
153
+		if ($comment_point > 0) return new Object();
154 154
 		// Get all the comments related to this post
155 155
 		$cp_args = new stdClass();
156 156
 		$cp_args->document_srl = $document_srl;
157 157
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 158
 		// Return if there is no object
159
-		if(!$output->data) return new Object();
159
+		if (!$output->data) return new Object();
160 160
 		// Organize the member number
161 161
 		$member_srls = array();
162 162
 		$cnt = count($output->data);
163
-		for($i=0;$i<$cnt;$i++)
163
+		for ($i = 0; $i < $cnt; $i++)
164 164
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
165
+			if ($output->data[$i]->member_srl < 1) continue;
166 166
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 167
 		}
168 168
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new Object();
169
+		if ($member_srl) unset($member_srls[abs($member_srl)]);
170
+		if (!count($member_srls)) return new Object();
171 171
 		// Remove all the points for each member
172 172
 		$oPointModel = getModel('point');
173 173
 		// Get the points
174 174
 		$point = $module_config['download_file'];
175
-		foreach($member_srls as $member_srl => $cnt)
175
+		foreach ($member_srls as $member_srl => $cnt)
176 176
 		{
177 177
 			$cur_point = $oPointModel->getPoint($member_srl, true);
178 178
 			$cur_point -= $cnt * $comment_point;
179
-			$this->setPoint($member_srl,$cur_point);
179
+			$this->setPoint($member_srl, $cur_point);
180 180
 		}
181 181
 
182 182
 		return new Object();
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 		$module_srl = $obj->module_srl;
191 191
 		$member_srl = $obj->member_srl;
192 192
 		// The process related to clearing the post object
193
-		if(!$module_srl || !$member_srl) return new Object();
193
+		if (!$module_srl || !$member_srl) return new Object();
194 194
 		// Run only when logged in
195 195
 		$logged_info = Context::get('logged_info');
196
-		if(!$logged_info->member_srl) return new Object();
196
+		if (!$logged_info->member_srl) return new Object();
197 197
 		// Get the points of the member
198 198
 		$oPointModel = getModel('point');
199 199
 		$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
204 204
 
205 205
 		$point = $module_config['insert_document'];
206
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
206
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
207 207
 		// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
208
-		if($point < 0) return new Object();
208
+		if ($point < 0) return new Object();
209 209
 		$cur_point -= $point;
210 210
 		// Add points related to deleting an attachment
211 211
 		$point = $module_config['upload_file'];
212
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
-		if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
212
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
+		if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
214 214
 		// Increase the point
215
-		$this->setPoint($member_srl,$cur_point);
215
+		$this->setPoint($member_srl, $cur_point);
216 216
 
217 217
 		return new Object();
218 218
 	}
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	{
225 225
 		$module_srl = $obj->module_srl;
226 226
 		$member_srl = $obj->member_srl;
227
-		if(!$module_srl || !$member_srl) return new Object();
227
+		if (!$module_srl || !$member_srl) return new Object();
228 228
 		// Do not increase the points if the member is the author of the post
229 229
 		$document_srl = $obj->document_srl;
230 230
 		$oDocumentModel = getModel('document');
231 231
 		$oDocument = $oDocumentModel->getDocument($document_srl);
232
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
232
+		if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object();
233 233
 		// Get the point module information
234 234
 		$oModuleModel = getModel('module');
235 235
 		$config = $oModuleModel->getModuleConfig('point');
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 		$cur_point = $oPointModel->getPoint($member_srl, true);
240 240
 
241 241
 		$point = $module_config['insert_comment'];
242
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
242
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
243 243
 		// Increase the point
244 244
 		$cur_point += $point;
245
-		$this->setPoint($member_srl,$cur_point);
245
+		$this->setPoint($member_srl, $cur_point);
246 246
 
247 247
 		return new Object();
248 248
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 		$module_srl = $obj->module_srl;
260 260
 		$member_srl = abs($obj->member_srl);
261 261
 		$document_srl = $obj->document_srl;
262
-		if(!$module_srl || !$member_srl) return new Object();
262
+		if (!$module_srl || !$member_srl) return new Object();
263 263
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
264 264
 		$oDocument = $oDocumentModel->getDocument($document_srl);
265
-		if(!$oDocument->isExists()) return new Object();
266
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
265
+		if (!$oDocument->isExists()) return new Object();
266
+		if ($oDocument->get('member_srl') == $member_srl) return new Object();
267 267
 		// Get the point module information
268 268
 		$config = $oModuleModel->getModuleConfig('point');
269 269
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
 		$cur_point = $oPointModel->getPoint($member_srl, true);
272 272
 
273 273
 		$point = $module_config['insert_comment'];
274
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
274
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
275 275
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
276
-		if($point < 0) return new Object();
276
+		if ($point < 0) return new Object();
277 277
 		// Increase the point
278 278
 		$cur_point -= $point;
279
-		$this->setPoint($member_srl,$cur_point);
279
+		$this->setPoint($member_srl, $cur_point);
280 280
 
281 281
 		return new Object();
282 282
 	}
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	function triggerDeleteFile(&$obj)
298 298
 	{
299
-		if($obj->isvalid != 'Y') return new Object();
299
+		if ($obj->isvalid != 'Y') return new Object();
300 300
 
301 301
 		$module_srl = $obj->module_srl;
302 302
 		$member_srl = $obj->member_srl;
303
-		if(!$module_srl || !$member_srl) return new Object();
303
+		if (!$module_srl || !$member_srl) return new Object();
304 304
 		// Get the point module information
305 305
 		$oModuleModel = getModel('module');
306 306
 		$config = $oModuleModel->getModuleConfig('point');
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 		$cur_point = $oPointModel->getPoint($member_srl, true);
311 311
 
312 312
 		$point = $module_config['upload_file'];
313
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
313
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
314 314
 		// Increase the point
315 315
 		$cur_point -= $point;
316
-		$this->setPoint($member_srl,$cur_point);
316
+		$this->setPoint($member_srl, $cur_point);
317 317
 
318 318
 		return new Object();
319 319
 	}
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
 		$logged_info = Context::get('logged_info');
327 327
 		$member_srl = $logged_info->member_srl;
328 328
 		$module_srl = $obj->module_srl;
329
-		if(!$module_srl) return new Object();
329
+		if (!$module_srl) return new Object();
330 330
 		// Pass if it is your file
331
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
331
+		if (abs($obj->member_srl) == abs($member_srl)) return new Object();
332 332
 
333 333
 		$oModuleModel = getModel('module');
334 334
 		$config = $oModuleModel->getModuleConfig('point');
335 335
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
336 336
 		// If it is set not to allow downloading for non-logged in users, do not permit
337
-		if(!Context::get('is_logged'))
337
+		if (!Context::get('is_logged'))
338 338
 		{
339
-			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
339
+			if ($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1, 'msg_not_permitted_download');
340 340
 			else return new Object();
341 341
 		}
342 342
 		// Get the points of the member
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
 		$cur_point = $oPointModel->getPoint($member_srl, true);
345 345
 		// Get the points
346 346
 		$point = $module_config['download_file'];
347
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
347
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
348 348
 		// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
349
-		if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
349
+		if ($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1, 'msg_cannot_download');
350 350
 
351 351
 		return new Object();
352 352
 	}
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 	{
359 359
 		// Run only when logged in
360 360
 		$logged_info = Context::get('logged_info');
361
-		if(!$logged_info->member_srl) return new Object();
361
+		if (!$logged_info->member_srl) return new Object();
362 362
 		$module_srl = $obj->module_srl;
363 363
 		$member_srl = $logged_info->member_srl;
364
-		if(!$module_srl) return new Object();
364
+		if (!$module_srl) return new Object();
365 365
 		// Pass if it is your file
366
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
366
+		if (abs($obj->member_srl) == abs($member_srl)) return new Object();
367 367
 		// Get the point module information
368 368
 		$oModuleModel = getModel('module');
369 369
 		$config = $oModuleModel->getModuleConfig('point');
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 		$cur_point = $oPointModel->getPoint($member_srl, true);
374 374
 		// Get the points
375 375
 		$point = $module_config['download_file'];
376
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
376
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
377 377
 		// Increase the point
378 378
 		$cur_point += $point;
379
-		$this->setPoint($member_srl,$cur_point);
379
+		$this->setPoint($member_srl, $cur_point);
380 380
 
381 381
 		return new Object();
382 382
 	}
@@ -395,22 +395,22 @@  discard block
 block discarded – undo
395 395
 		// Get the original author number
396 396
 		$target_member_srl = abs($obj->get('member_srl'));
397 397
 		// Pass without increasing the hits if the viewer is the same as the author
398
-		if($target_member_srl == $member_srl) return new Object();
398
+		if ($target_member_srl == $member_srl) return new Object();
399 399
 		// Get the point information for each module
400 400
 		$config = $oModuleModel->getModuleConfig('point');
401 401
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
402 402
 		// Get hits points
403 403
 		$point = $module_config['read_document'];
404
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
404
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
405 405
 		// Pass if there are no requested points
406
-		if(!$point) return new Object();
406
+		if (!$point) return new Object();
407 407
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
408
-		if($member_srl)
408
+		if ($member_srl)
409 409
 		{
410 410
 			$args->member_srl = $member_srl;
411 411
 			$args->document_srl = $obj->document_srl;
412 412
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
413
-			if($output->data->count) return new Object();
413
+			if ($output->data->count) return new Object();
414 414
 			$cur_point = $oPointModel->getPoint($member_srl, true);
415 415
 		}
416 416
 		else
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		$config = $oModuleModel->getModuleConfig('point');
422 422
 		// When the requested points are negative, compared it with the current point
423 423
 		$_SESSION['banned_document'][$obj->document_srl] = false;
424
-		if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
424
+		if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point)
425 425
 		{
426 426
 			$message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point);
427 427
 			$obj->add('content', $message);
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
 			return new Object(-1, $message);
430 430
 		}
431 431
 		// If not logged in, pass
432
-		if(!$logged_info->member_srl) return new Object();
432
+		if (!$logged_info->member_srl) return new Object();
433 433
 		// Pass, if there are no requested points
434
-		if(!$point) return new Object();
434
+		if (!$point) return new Object();
435 435
 		// If the read record is missing, leave it
436 436
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
437 437
 		// Increase the point
438 438
 		$cur_point += $point;
439
-		$this->setPoint($member_srl,$cur_point);
439
+		$this->setPoint($member_srl, $cur_point);
440 440
 
441 441
 		return new Object();
442 442
 	}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	{
449 449
 		$module_srl = $obj->module_srl;
450 450
 		$member_srl = $obj->member_srl;
451
-		if(!$module_srl || !$member_srl) return new Object();
451
+		if (!$module_srl || !$member_srl) return new Object();
452 452
 
453 453
 		$oModuleModel = getModel('module');
454 454
 		$config = $oModuleModel->getModuleConfig('point');
@@ -457,21 +457,21 @@  discard block
 block discarded – undo
457 457
 		$oPointModel = getModel('point');
458 458
 		$cur_point = $oPointModel->getPoint($member_srl, true);
459 459
 
460
-		if( $obj->point > 0 )
460
+		if ($obj->point > 0)
461 461
 		{
462 462
 			$point = $module_config['voted'];
463
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
463
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->voted;
464 464
 		}
465 465
 		else
466 466
 		{
467 467
 			$point = $module_config['blamed'];
468
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
468
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
469 469
 		}
470 470
 
471
-		if(!$point) return new Object();
471
+		if (!$point) return new Object();
472 472
 		// Increase the point
473 473
 		$cur_point += $point;
474
-		$this->setPoint($member_srl,$cur_point);
474
+		$this->setPoint($member_srl, $cur_point);
475 475
 
476 476
 		return new Object();
477 477
 	}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		$member_srl = abs($member_srl);
485 485
 		$mode_arr = array('add', 'minus', 'update', 'signup');
486
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
486
+		if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update';
487 487
 
488 488
 		// Get configuration information
489 489
 		$oMemberModel = getModel('member');
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		$args->member_srl = $member_srl;
501 501
 		$args->point = $current_point;
502 502
 
503
-		switch($mode)
503
+		switch ($mode)
504 504
 		{
505 505
 			case 'add' :
506 506
 				$args->point += $point;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				$args->point = $point;
514 514
 				break;
515 515
 		}
516
-		if($args->point < 0) $args->point = 0;
516
+		if ($args->point < 0) $args->point = 0;
517 517
 		$point = $args->point;
518 518
 
519 519
 		// Call a trigger (before)
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		$trigger_obj->current_level = $current_level;
525 525
 		$trigger_obj->set_point = $point;
526 526
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj);
527
-		if(!$trigger_output->toBool())
527
+		if (!$trigger_output->toBool())
528 528
 		{
529 529
 			return $trigger_output;
530 530
 		}
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
 
536 536
 		// If there are points, update, if no, insert
537 537
 		$oPointModel = getModel('point');
538
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
538
+		if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
539 539
 		else executeQuery("point.insertPoint", $args);
540 540
 
541 541
 		// Get a new level
542 542
 		$level = $oPointModel->getLevel($point, $config->level_step);
543 543
 
544 544
 		// If existing level and a new one are different attempt to set a point group
545
-		if($level != $current_level)
545
+		if ($level != $current_level)
546 546
 		{
547 547
 			// Check if the level, for which the current points are prepared, is calculate and set the correct group
548 548
 			$point_group = $config->point_group;
549 549
 			// If the point group exists
550
-			if($point_group && is_array($point_group) && count($point_group) )
550
+			if ($point_group && is_array($point_group) && count($point_group))
551 551
 			{
552 552
 				// Get the default group
553 553
 				$default_group = $oMemberModel->getDefaultGroup();
@@ -557,29 +557,29 @@  discard block
 block discarded – undo
557 557
 
558 558
 				asort($point_group);
559 559
 				// Reset group after initialization
560
-				if($config->group_reset != 'N')
560
+				if ($config->group_reset != 'N')
561 561
 				{
562 562
 					// If the new level is in the right group
563
-					if(in_array($level, $point_group))
563
+					if (in_array($level, $point_group))
564 564
 					{
565 565
 						// Delete all groups except the one which the current level belongs to
566
-						foreach($point_group as $group_srl => $target_level)
566
+						foreach ($point_group as $group_srl => $target_level)
567 567
 						{
568 568
 							$del_group_list[] = $group_srl;
569
-							if($target_level == $level) $new_group_list[] = $group_srl;
569
+							if ($target_level == $level) $new_group_list[] = $group_srl;
570 570
 						}
571 571
 					}
572 572
 					// Otherwise, in case the level is reduced, add the recent group
573 573
 					else
574 574
 					{
575 575
 						$i = $level;
576
-						while($i > 0)
576
+						while ($i > 0)
577 577
 						{
578
-							if(in_array($i, $point_group))
578
+							if (in_array($i, $point_group))
579 579
 							{
580
-								foreach($point_group as $group_srl => $target_level)
580
+								foreach ($point_group as $group_srl => $target_level)
581 581
 								{
582
-									if($target_level == $i)
582
+									if ($target_level == $i)
583 583
 									{
584 584
 										$new_group_list[] = $group_srl;
585 585
 									}
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
 						}
591 591
 					}
592 592
 					// Delete the group of a level which is higher than the current level
593
-					foreach($point_group as $group_srl => $target_level)
593
+					foreach ($point_group as $group_srl => $target_level)
594 594
 					{
595
-						if($target_level > $level) $del_group_list[] = $group_srl;
595
+						if ($target_level > $level) $del_group_list[] = $group_srl;
596 596
 					}
597 597
 					$del_group_list[] = $default_group->group_srl;
598 598
 				}
@@ -600,16 +600,16 @@  discard block
 block discarded – undo
600 600
 				else
601 601
 				{
602 602
 					// Check until the current level by rotating setting the configurations of the point groups
603
-					foreach($point_group as $group_srl => $target_level)
603
+					foreach ($point_group as $group_srl => $target_level)
604 604
 					{
605 605
 						$del_group_list[] = $group_srl;
606
-						if($target_level <= $level) $new_group_list[] = $group_srl;
606
+						if ($target_level <= $level) $new_group_list[] = $group_srl;
607 607
 					}
608 608
 				}
609 609
 				// If there is no a new group, granted the default group
610
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
610
+				if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
611 611
 				// Remove linkage group
612
-				if($del_group_list && count($del_group_list))
612
+				if ($del_group_list && count($del_group_list))
613 613
 				{
614 614
 					$del_group_args = new stdClass;
615 615
 					$del_group_args->member_srl = $member_srl;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 					$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
618 618
 				}
619 619
 				// Grant a new group
620
-				foreach($new_group_list as $group_srl)
620
+				foreach ($new_group_list as $group_srl)
621 621
 				{
622 622
 					$new_group_args = new stdClass;
623 623
 					$new_group_args->member_srl = $member_srl;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$trigger_obj->del_group_list = $del_group_list;
633 633
 		$trigger_obj->new_level = $level;
634 634
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj);
635
-		if(!$trigger_output->toBool())
635
+		if (!$trigger_output->toBool())
636 636
 		{
637 637
 			$oDB->rollback();
638 638
 			return $trigger_output;
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 		FileHandler::writeFile($cache_filename, $point);
649 649
 
650 650
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
651
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
651
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
652 652
 		{
653 653
 			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
654 654
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 		}
657 657
 
658 658
 		$oCacheHandler = CacheHandler::getInstance('object');
659
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
659
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
660 660
 		{
661 661
 			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
662 662
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 		$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
673 673
 
674 674
 		$oModuleController = getController('module');
675
-		if(is_array($obj->moduleSrlList))
675
+		if (is_array($obj->moduleSrlList))
676 676
 		{
677
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
677
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
678 678
 			{
679 679
 				$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
680 680
 			}
Please login to merge, or discard this patch.
Braces   +186 added lines, -66 removed lines patch added patch discarded remove patch
@@ -42,9 +42,13 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new Object();
45
+		if(!$member_srl) {
46
+			return new Object();
47
+		}
46 48
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
49
+		if(substr($obj->last_login,0,8)==date("Ymd")) {
50
+			return new Object();
51
+		}
48 52
 		// Get the point module information
49 53
 		$oModuleModel = getModel('module');
50 54
 		$config = $oModuleModel->getModuleConfig('point');
@@ -70,9 +74,13 @@  discard block
 block discarded – undo
70 74
 		{
71 75
 			$module_srl = $obj->module_srl;
72 76
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new Object();
77
+			if(!$module_srl || !$member_srl) {
78
+				return new Object();
79
+			}
74 80
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new Object();
81
+			if($module_srl == $member_srl) {
82
+				return new Object();
83
+			}
76 84
 			// Get the point module information
77 85
 			$oModuleModel = getModel('module');
78 86
 			$config = $oModuleModel->getModuleConfig('point');
@@ -82,12 +90,18 @@  discard block
 block discarded – undo
82 90
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 91
 
84 92
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
93
+			if(strlen($point) == 0 && !is_int($point)) {
94
+				$point = $config->insert_document;
95
+			}
86 96
 			$cur_point += $point;
87 97
 			// Add points for attaching a file
88 98
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
99
+			if(strlen($point) == 0 && !is_int($point)) {
100
+				$point = $config->upload_file;
101
+			}
102
+			if($obj->uploaded_count) {
103
+				$cur_point += $point * $obj->uploaded_count;
104
+			}
91 105
 			// Increase the point
92 106
 			$this->setPoint($member_srl,$cur_point);
93 107
 		}
@@ -118,12 +132,18 @@  discard block
 block discarded – undo
118 132
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 133
 
120 134
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
135
+			if(strlen($point) == 0 && !is_int($point)) {
136
+				$point = $config->insert_document;
137
+			}
122 138
 			$cur_point += $point;
123 139
 			// Add points for attaching a file
124 140
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
141
+			if(strlen($point) == 0 && !is_int($point)) {
142
+				$point = $config->upload_file;
143
+			}
144
+			if($obj->uploaded_count) {
145
+				$cur_point += $point * $obj->uploaded_count;
146
+			}
127 147
 			// Increase the point
128 148
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 149
 		}
@@ -141,33 +161,47 @@  discard block
 block discarded – undo
141 161
 
142 162
 		$oDocumentModel = getModel('document');
143 163
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new Object();
164
+		if(!$oDocument->isExists()) {
165
+			return new Object();
166
+		}
145 167
 		// Get the point module information
146 168
 		$oModuleModel = getModel('module');
147 169
 		$config = $oModuleModel->getModuleConfig('point');
148 170
 		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
149 171
 		// The process related to clearing the post comments
150 172
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
173
+		if(strlen($comment_point) == 0 && !is_int($comment_point)) {
174
+			$comment_point = $config->insert_comment;
175
+		}
152 176
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new Object();
177
+		if($comment_point>0) {
178
+			return new Object();
179
+		}
154 180
 		// Get all the comments related to this post
155 181
 		$cp_args = new stdClass();
156 182
 		$cp_args->document_srl = $document_srl;
157 183
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 184
 		// Return if there is no object
159
-		if(!$output->data) return new Object();
185
+		if(!$output->data) {
186
+			return new Object();
187
+		}
160 188
 		// Organize the member number
161 189
 		$member_srls = array();
162 190
 		$cnt = count($output->data);
163 191
 		for($i=0;$i<$cnt;$i++)
164 192
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
193
+			if($output->data[$i]->member_srl<1) {
194
+				continue;
195
+			}
166 196
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 197
 		}
168 198
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new Object();
199
+		if($member_srl) {
200
+			unset($member_srls[abs($member_srl)]);
201
+		}
202
+		if(!count($member_srls)) {
203
+			return new Object();
204
+		}
171 205
 		// Remove all the points for each member
172 206
 		$oPointModel = getModel('point');
173 207
 		// Get the points
@@ -190,10 +224,14 @@  discard block
 block discarded – undo
190 224
 		$module_srl = $obj->module_srl;
191 225
 		$member_srl = $obj->member_srl;
192 226
 		// The process related to clearing the post object
193
-		if(!$module_srl || !$member_srl) return new Object();
227
+		if(!$module_srl || !$member_srl) {
228
+			return new Object();
229
+		}
194 230
 		// Run only when logged in
195 231
 		$logged_info = Context::get('logged_info');
196
-		if(!$logged_info->member_srl) return new Object();
232
+		if(!$logged_info->member_srl) {
233
+			return new Object();
234
+		}
197 235
 		// Get the points of the member
198 236
 		$oPointModel = getModel('point');
199 237
 		$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -203,14 +241,22 @@  discard block
 block discarded – undo
203 241
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
204 242
 
205 243
 		$point = $module_config['insert_document'];
206
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
244
+		if(strlen($point) == 0 && !is_int($point)) {
245
+			$point = $config->insert_document;
246
+		}
207 247
 		// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
208
-		if($point < 0) return new Object();
248
+		if($point < 0) {
249
+			return new Object();
250
+		}
209 251
 		$cur_point -= $point;
210 252
 		// Add points related to deleting an attachment
211 253
 		$point = $module_config['upload_file'];
212
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
-		if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
254
+		if(strlen($point) == 0 && !is_int($point)) {
255
+			$point = $config->upload_file;
256
+		}
257
+		if($obj->uploaded_count) {
258
+			$cur_point -= $point * $obj->uploaded_count;
259
+		}
214 260
 		// Increase the point
215 261
 		$this->setPoint($member_srl,$cur_point);
216 262
 
@@ -224,12 +270,16 @@  discard block
 block discarded – undo
224 270
 	{
225 271
 		$module_srl = $obj->module_srl;
226 272
 		$member_srl = $obj->member_srl;
227
-		if(!$module_srl || !$member_srl) return new Object();
273
+		if(!$module_srl || !$member_srl) {
274
+			return new Object();
275
+		}
228 276
 		// Do not increase the points if the member is the author of the post
229 277
 		$document_srl = $obj->document_srl;
230 278
 		$oDocumentModel = getModel('document');
231 279
 		$oDocument = $oDocumentModel->getDocument($document_srl);
232
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
280
+		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) {
281
+			return new Object();
282
+		}
233 283
 		// Get the point module information
234 284
 		$oModuleModel = getModel('module');
235 285
 		$config = $oModuleModel->getModuleConfig('point');
@@ -239,7 +289,9 @@  discard block
 block discarded – undo
239 289
 		$cur_point = $oPointModel->getPoint($member_srl, true);
240 290
 
241 291
 		$point = $module_config['insert_comment'];
242
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
292
+		if(strlen($point) == 0 && !is_int($point)) {
293
+			$point = $config->insert_comment;
294
+		}
243 295
 		// Increase the point
244 296
 		$cur_point += $point;
245 297
 		$this->setPoint($member_srl,$cur_point);
@@ -259,11 +311,17 @@  discard block
 block discarded – undo
259 311
 		$module_srl = $obj->module_srl;
260 312
 		$member_srl = abs($obj->member_srl);
261 313
 		$document_srl = $obj->document_srl;
262
-		if(!$module_srl || !$member_srl) return new Object();
314
+		if(!$module_srl || !$member_srl) {
315
+			return new Object();
316
+		}
263 317
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
264 318
 		$oDocument = $oDocumentModel->getDocument($document_srl);
265
-		if(!$oDocument->isExists()) return new Object();
266
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
319
+		if(!$oDocument->isExists()) {
320
+			return new Object();
321
+		}
322
+		if($oDocument->get('member_srl')==$member_srl) {
323
+			return new Object();
324
+		}
267 325
 		// Get the point module information
268 326
 		$config = $oModuleModel->getModuleConfig('point');
269 327
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -271,9 +329,13 @@  discard block
 block discarded – undo
271 329
 		$cur_point = $oPointModel->getPoint($member_srl, true);
272 330
 
273 331
 		$point = $module_config['insert_comment'];
274
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
332
+		if(strlen($point) == 0 && !is_int($point)) {
333
+			$point = $config->insert_comment;
334
+		}
275 335
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
276
-		if($point < 0) return new Object();
336
+		if($point < 0) {
337
+			return new Object();
338
+		}
277 339
 		// Increase the point
278 340
 		$cur_point -= $point;
279 341
 		$this->setPoint($member_srl,$cur_point);
@@ -296,11 +358,15 @@  discard block
 block discarded – undo
296 358
 	 */
297 359
 	function triggerDeleteFile(&$obj)
298 360
 	{
299
-		if($obj->isvalid != 'Y') return new Object();
361
+		if($obj->isvalid != 'Y') {
362
+			return new Object();
363
+		}
300 364
 
301 365
 		$module_srl = $obj->module_srl;
302 366
 		$member_srl = $obj->member_srl;
303
-		if(!$module_srl || !$member_srl) return new Object();
367
+		if(!$module_srl || !$member_srl) {
368
+			return new Object();
369
+		}
304 370
 		// Get the point module information
305 371
 		$oModuleModel = getModel('module');
306 372
 		$config = $oModuleModel->getModuleConfig('point');
@@ -310,7 +376,9 @@  discard block
 block discarded – undo
310 376
 		$cur_point = $oPointModel->getPoint($member_srl, true);
311 377
 
312 378
 		$point = $module_config['upload_file'];
313
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
379
+		if(strlen($point) == 0 && !is_int($point)) {
380
+			$point = $config->upload_file;
381
+		}
314 382
 		// Increase the point
315 383
 		$cur_point -= $point;
316 384
 		$this->setPoint($member_srl,$cur_point);
@@ -326,9 +394,13 @@  discard block
 block discarded – undo
326 394
 		$logged_info = Context::get('logged_info');
327 395
 		$member_srl = $logged_info->member_srl;
328 396
 		$module_srl = $obj->module_srl;
329
-		if(!$module_srl) return new Object();
397
+		if(!$module_srl) {
398
+			return new Object();
399
+		}
330 400
 		// Pass if it is your file
331
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
401
+		if(abs($obj->member_srl) == abs($member_srl)) {
402
+			return new Object();
403
+		}
332 404
 
333 405
 		$oModuleModel = getModel('module');
334 406
 		$config = $oModuleModel->getModuleConfig('point');
@@ -336,17 +408,24 @@  discard block
 block discarded – undo
336 408
 		// If it is set not to allow downloading for non-logged in users, do not permit
337 409
 		if(!Context::get('is_logged'))
338 410
 		{
339
-			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
340
-			else return new Object();
411
+			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) {
412
+				return new Object(-1,'msg_not_permitted_download');
413
+			} else {
414
+				return new Object();
415
+			}
341 416
 		}
342 417
 		// Get the points of the member
343 418
 		$oPointModel = getModel('point');
344 419
 		$cur_point = $oPointModel->getPoint($member_srl, true);
345 420
 		// Get the points
346 421
 		$point = $module_config['download_file'];
347
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
422
+		if(strlen($point) == 0 && !is_int($point)) {
423
+			$point = $config->download_file;
424
+		}
348 425
 		// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
349
-		if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
426
+		if($cur_point + $point < 0 && $config->disable_download == 'Y') {
427
+			return new Object(-1,'msg_cannot_download');
428
+		}
350 429
 
351 430
 		return new Object();
352 431
 	}
@@ -358,12 +437,18 @@  discard block
 block discarded – undo
358 437
 	{
359 438
 		// Run only when logged in
360 439
 		$logged_info = Context::get('logged_info');
361
-		if(!$logged_info->member_srl) return new Object();
440
+		if(!$logged_info->member_srl) {
441
+			return new Object();
442
+		}
362 443
 		$module_srl = $obj->module_srl;
363 444
 		$member_srl = $logged_info->member_srl;
364
-		if(!$module_srl) return new Object();
445
+		if(!$module_srl) {
446
+			return new Object();
447
+		}
365 448
 		// Pass if it is your file
366
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
449
+		if(abs($obj->member_srl) == abs($member_srl)) {
450
+			return new Object();
451
+		}
367 452
 		// Get the point module information
368 453
 		$oModuleModel = getModel('module');
369 454
 		$config = $oModuleModel->getModuleConfig('point');
@@ -373,7 +458,9 @@  discard block
 block discarded – undo
373 458
 		$cur_point = $oPointModel->getPoint($member_srl, true);
374 459
 		// Get the points
375 460
 		$point = $module_config['download_file'];
376
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
461
+		if(strlen($point) == 0 && !is_int($point)) {
462
+			$point = $config->download_file;
463
+		}
377 464
 		// Increase the point
378 465
 		$cur_point += $point;
379 466
 		$this->setPoint($member_srl,$cur_point);
@@ -395,25 +482,32 @@  discard block
 block discarded – undo
395 482
 		// Get the original author number
396 483
 		$target_member_srl = abs($obj->get('member_srl'));
397 484
 		// Pass without increasing the hits if the viewer is the same as the author
398
-		if($target_member_srl == $member_srl) return new Object();
485
+		if($target_member_srl == $member_srl) {
486
+			return new Object();
487
+		}
399 488
 		// Get the point information for each module
400 489
 		$config = $oModuleModel->getModuleConfig('point');
401 490
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
402 491
 		// Get hits points
403 492
 		$point = $module_config['read_document'];
404
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
493
+		if(strlen($point) == 0 && !is_int($point)) {
494
+			$point = $config->read_document;
495
+		}
405 496
 		// Pass if there are no requested points
406
-		if(!$point) return new Object();
497
+		if(!$point) {
498
+			return new Object();
499
+		}
407 500
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
408 501
 		if($member_srl)
409 502
 		{
410 503
 			$args->member_srl = $member_srl;
411 504
 			$args->document_srl = $obj->document_srl;
412 505
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
413
-			if($output->data->count) return new Object();
506
+			if($output->data->count) {
507
+				return new Object();
508
+			}
414 509
 			$cur_point = $oPointModel->getPoint($member_srl, true);
415
-		}
416
-		else
510
+		} else
417 511
 		{
418 512
 			$cur_point = 0;
419 513
 		}
@@ -429,9 +523,13 @@  discard block
 block discarded – undo
429 523
 			return new Object(-1, $message);
430 524
 		}
431 525
 		// If not logged in, pass
432
-		if(!$logged_info->member_srl) return new Object();
526
+		if(!$logged_info->member_srl) {
527
+			return new Object();
528
+		}
433 529
 		// Pass, if there are no requested points
434
-		if(!$point) return new Object();
530
+		if(!$point) {
531
+			return new Object();
532
+		}
435 533
 		// If the read record is missing, leave it
436 534
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
437 535
 		// Increase the point
@@ -448,7 +546,9 @@  discard block
 block discarded – undo
448 546
 	{
449 547
 		$module_srl = $obj->module_srl;
450 548
 		$member_srl = $obj->member_srl;
451
-		if(!$module_srl || !$member_srl) return new Object();
549
+		if(!$module_srl || !$member_srl) {
550
+			return new Object();
551
+		}
452 552
 
453 553
 		$oModuleModel = getModel('module');
454 554
 		$config = $oModuleModel->getModuleConfig('point');
@@ -460,15 +560,20 @@  discard block
 block discarded – undo
460 560
 		if( $obj->point > 0 )
461 561
 		{
462 562
 			$point = $module_config['voted'];
463
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
464
-		}
465
-		else
563
+			if(strlen($point) == 0 && !is_int($point)) {
564
+				$point = $config->voted;
565
+			}
566
+		} else
466 567
 		{
467 568
 			$point = $module_config['blamed'];
468
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
569
+			if(strlen($point) == 0 && !is_int($point)) {
570
+				$point = $config->blamed;
571
+			}
469 572
 		}
470 573
 
471
-		if(!$point) return new Object();
574
+		if(!$point) {
575
+			return new Object();
576
+		}
472 577
 		// Increase the point
473 578
 		$cur_point += $point;
474 579
 		$this->setPoint($member_srl,$cur_point);
@@ -483,7 +588,9 @@  discard block
 block discarded – undo
483 588
 	{
484 589
 		$member_srl = abs($member_srl);
485 590
 		$mode_arr = array('add', 'minus', 'update', 'signup');
486
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
591
+		if(!$mode || !in_array($mode,$mode_arr)) {
592
+			$mode = 'update';
593
+		}
487 594
 
488 595
 		// Get configuration information
489 596
 		$oMemberModel = getModel('member');
@@ -513,7 +620,9 @@  discard block
 block discarded – undo
513 620
 				$args->point = $point;
514 621
 				break;
515 622
 		}
516
-		if($args->point < 0) $args->point = 0;
623
+		if($args->point < 0) {
624
+			$args->point = 0;
625
+		}
517 626
 		$point = $args->point;
518 627
 
519 628
 		// Call a trigger (before)
@@ -535,8 +644,11 @@  discard block
 block discarded – undo
535 644
 
536 645
 		// If there are points, update, if no, insert
537 646
 		$oPointModel = getModel('point');
538
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
539
-		else executeQuery("point.insertPoint", $args);
647
+		if($oPointModel->isExistsPoint($member_srl)) {
648
+			executeQuery("point.updatePoint", $args);
649
+		} else {
650
+			executeQuery("point.insertPoint", $args);
651
+		}
540 652
 
541 653
 		// Get a new level
542 654
 		$level = $oPointModel->getLevel($point, $config->level_step);
@@ -566,7 +678,9 @@  discard block
 block discarded – undo
566 678
 						foreach($point_group as $group_srl => $target_level)
567 679
 						{
568 680
 							$del_group_list[] = $group_srl;
569
-							if($target_level == $level) $new_group_list[] = $group_srl;
681
+							if($target_level == $level) {
682
+								$new_group_list[] = $group_srl;
683
+							}
570 684
 						}
571 685
 					}
572 686
 					// Otherwise, in case the level is reduced, add the recent group
@@ -592,7 +706,9 @@  discard block
 block discarded – undo
592 706
 					// Delete the group of a level which is higher than the current level
593 707
 					foreach($point_group as $group_srl => $target_level)
594 708
 					{
595
-						if($target_level > $level) $del_group_list[] = $group_srl;
709
+						if($target_level > $level) {
710
+							$del_group_list[] = $group_srl;
711
+						}
596 712
 					}
597 713
 					$del_group_list[] = $default_group->group_srl;
598 714
 				}
@@ -603,11 +719,15 @@  discard block
 block discarded – undo
603 719
 					foreach($point_group as $group_srl => $target_level)
604 720
 					{
605 721
 						$del_group_list[] = $group_srl;
606
-						if($target_level <= $level) $new_group_list[] = $group_srl;
722
+						if($target_level <= $level) {
723
+							$new_group_list[] = $group_srl;
724
+						}
607 725
 					}
608 726
 				}
609 727
 				// If there is no a new group, granted the default group
610
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
728
+				if(!$new_group_list[0]) {
729
+					$new_group_list[0] = $default_group->group_srl;
730
+				}
611 731
 				// Remove linkage group
612 732
 				if($del_group_list && count($del_group_list))
613 733
 				{
Please login to merge, or discard this patch.