GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 359872...ce3ac6 )
by gyeong-won
48:25 queued 39:21
created
modules/module/module.admin.controller.php 2 patches
Spacing   +153 added lines, -153 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 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 BaseObject(-1, 'msg_limit_mid');
110
+			if (!$mid) continue;
111
+			if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
112 112
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
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 BaseObject(-1,'msg_invalid_request');
285
+		if (!$module_info) return new BaseObject(-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 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 428
 					$del_var = $obj->{"del_".$vars->name};
429 429
 					unset($obj->{"del_".$vars->name});
430
-					if($del_var == 'Y')
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 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 BaseObject(-1,'msg_invalid_request');
509
+		if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request');
510 510
 
511
-		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
511
+		$module_srls = explode(',', $vars->module_srls);
512
+		if (count($module_srls) < 1) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request');
564
+		if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
565 565
 
566
-		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
566
+		$modules = explode(',', $module_srls);
567
+		if (count($modules) < 1) return new BaseObject(-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 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 BaseObject(-1,'msg_invalid_request');
673
+		if (!$args->name) return new BaseObject(-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 BaseObject(-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 BaseObject(-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 BaseObject(-1, 'msg_not_permitted');
734
+		if (!Context::get('is_logged')) return new BaseObject(-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 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(stripcslashes($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 BaseObject(-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 BaseObject(-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 BaseObject(-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 BaseObject(-1,'msg_invalid_request');
307
+		if(!$module_info) {
308
+			return new BaseObject(-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 BaseObject(-1,'msg_invalid_request');
541
+		if(!$vars->module_srls) {
542
+			return new BaseObject(-1,'msg_invalid_request');
543
+		}
510 544
 
511 545
 		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
546
+		if(count($module_srls) < 1) {
547
+			return new BaseObject(-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 BaseObject(-1,'msg_invalid_request');
599
+		if(!$module_srls) {
600
+			return new BaseObject(-1,'msg_invalid_request');
601
+		}
565 602
 
566 603
 		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
604
+		if(count($modules) < 1) {
605
+			return new BaseObject(-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 BaseObject(-1,'msg_invalid_request');
722
+		if(!$args->name) {
723
+			return new BaseObject(-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 BaseObject(-1,'msg_invalid_request');
778
+		if(!empty($args->lang_name)) {
779
+			$args->name = $args->lang_name;
780
+		}
781
+		if(!$args->name) {
782
+			return new BaseObject(-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 BaseObject(-1, 'msg_not_permitted');
799
+		if(!Context::get('is_logged')) {
800
+			return new BaseObject(-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.class.php 2 patches
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$oModuleController = getController('module');
17 17
 
18 18
 		$oDB = &DB::getInstance();
19
-		$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true);
20
-		$oDB->addIndex('sites','unique_domain',array('domain'),true);
19
+		$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
20
+		$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
21 21
 		// Create a directory to use in the module module
22 22
 		FileHandler::makeDir('./files/cache/module_info');
23 23
 		FileHandler::makeDir('./files/cache/triggers');
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 		$args = new stdClass;
28 28
 		$args->site_srl = 0;
29 29
 		$output = $oDB->executeQuery('module.getSite', $args);
30
-		if(!$output->data || !$output->data->index_module_srl)
30
+		if (!$output->data || !$output->data->index_module_srl)
31 31
 		{
32 32
 			$db_info = Context::getDBInfo();
33 33
 			$domain = Context::getDefaultUrl();
34 34
 			$url_info = parse_url($domain);
35
-			$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
35
+			$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
36 36
 
37 37
 			$site_args = new stdClass;
38 38
 			$site_args->site_srl = 0;
39
-			$site_args->index_module_srl  = 0;
39
+			$site_args->index_module_srl = 0;
40 40
 			$site_args->domain = $domain;
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if (!$output->toBool()) return $output;
45 45
 		}
46 46
 
47 47
 		return new BaseObject();
@@ -56,66 +56,66 @@  discard block
 block discarded – undo
56 56
 		$oModuleModel = getModel('module');
57 57
 		$oModuleController = getController('module');
58 58
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
59
-		if($oModuleModel->needUpdate($version_update_id))
59
+		if ($oModuleModel->needUpdate($version_update_id))
60 60
 		{
61 61
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
62
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true;
63 63
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
64
+			if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true;
65 65
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
66
+			if ($oDB->isColumnExists('modules', 'grants')) return true;
67 67
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
68
+			if (!$oDB->isColumnExists('sites', 'default_language')) return true;
69 69
 			// Delete extra_vars* column
70
-			for($i=1;$i<=20;$i++)
70
+			for ($i = 1; $i <= 20; $i++)
71 71
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
72
+				if ($oDB->isColumnExists("documents", "extra_vars".$i)) return true;
73 73
 			}
74 74
 			// Insert site information to the table, sites
75 75
 			$args = new stdClass();
76 76
 			$args->site_srl = 0;
77 77
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
78
+			if (!$output->data) return true;
79 79
 
80 80
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
81
+			if ($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
+			if (!$oDB->isIndexExists('sites', 'unique_domain')) return true;
83 83
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
84
+			if (!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
+			if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
+			if (!$oDB->isColumnExists("modules", "mcontent")) return true;
87
+			if (!$oDB->isColumnExists("modules", "mskin")) return true;
88 88
 
89 89
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
90
+			if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
91 91
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
92
+			if (!$oDB->isColumnExists("module_config", "site_srl")) return true;
93 93
 
94 94
 			$args->skin = '.';
95 95
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
96
-			if($output->data && count($output->data) > 0)
96
+			if ($output->data && count($output->data) > 0)
97 97
 			{
98
-				foreach($output->data as $item)
98
+				foreach ($output->data as $item)
99 99
 				{
100 100
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
101
+					if (count($skin_path) != 2) continue;
102
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
103 103
 				}
104 104
 			}
105 105
 
106 106
 			// XE 1.7
107 107
 
108 108
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
109
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
110 110
 
111 111
 			$oModuleModel = getModel('module');
112 112
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
113
-			if(!$moduleConfig->isUpdateFixedValue) return true;
113
+			if (!$moduleConfig->isUpdateFixedValue) return true;
114 114
 
115 115
 			$oModuleController->insertUpdatedLog($version_update_id);
116 116
 		}
117 117
 
118
-		if(!is_dir('./files/ruleset')) return true;
118
+		if (!is_dir('./files/ruleset')) return true;
119 119
 
120 120
 		return false;
121 121
 	}
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$oModuleController = getController('module');
131 131
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
132
-		if($oModuleModel->needUpdate($version_update_id))
132
+		if ($oModuleModel->needUpdate($version_update_id))
133 133
 		{
134 134
 			// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
135
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config"))
135
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config"))
136 136
 			{
137 137
 				$oModuleModel = getModel('module');
138 138
 				$oModuleController = getController('module');
139 139
 				$modules = $oModuleModel->getModuleList();
140
-				foreach($modules as $key => $module_info)
140
+				foreach ($modules as $key => $module_info)
141 141
 				{
142 142
 					$module = $module_info->module;
143
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
143
+					if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue;
144 144
 					$config = $oModuleModel->getModuleConfig($module);
145 145
 
146 146
 					$module_config = null;
147
-					switch($module)
147
+					switch ($module)
148 148
 					{
149 149
 						case 'point' :
150 150
 							$module_config = $config->module_point;
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 						case 'editor' :
158 158
 							$module_config = $config->module_config;
159 159
 							unset($config->module_config);
160
-							if(is_array($module_config) && count($module_config))
160
+							if (is_array($module_config) && count($module_config))
161 161
 							{
162
-								foreach($module_config as $key => $val)
162
+								foreach ($module_config as $key => $val)
163 163
 								{
164
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
164
+									if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
165 165
 								}
166 166
 							}
167 167
 							break;
168 168
 						case 'layout' :
169 169
 							$tmp = $config->header_script;
170
-							if(is_array($tmp) && count($tmp))
170
+							if (is_array($tmp) && count($tmp))
171 171
 							{
172
-								foreach($tmp as $k => $v)
172
+								foreach ($tmp as $k => $v)
173 173
 								{
174
-									if(!$v && !trim($v)) continue;
174
+									if (!$v && !trim($v)) continue;
175 175
 									$module_config[$k]->header_script = $v;
176 176
 								}
177 177
 							}
@@ -181,29 +181,29 @@  discard block
 block discarded – undo
181 181
 
182 182
 					$oModuleController->insertModuleConfig($module, $config);
183 183
 
184
-					if(is_array($module_config) && count($module_config))
184
+					if (is_array($module_config) && count($module_config))
185 185
 					{
186
-						foreach($module_config as $module_srl => $module_part_config)
186
+						foreach ($module_config as $module_srl => $module_part_config)
187 187
 						{
188
-							$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
188
+							$oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config);
189 189
 						}
190 190
 					}
191 191
 				}
192
-				$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
192
+				$oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl"));
193 193
 			}
194 194
 			// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
195
-			if(!$oDB->isIndexExists('modules',"idx_site_mid"))
195
+			if (!$oDB->isIndexExists('modules', "idx_site_mid"))
196 196
 			{
197
-				$oDB->dropIndex("modules","unique_mid",true);
198
-				$oDB->addColumn('modules','site_srl','number',11,0,true);
199
-				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
197
+				$oDB->dropIndex("modules", "unique_mid", true);
198
+				$oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true);
199
+				$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
200 200
 			}
201 201
 			// document extra vars
202
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
202
+			if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
203 203
 
204
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
204
+			if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
205 205
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
206
-			if($oDB->isColumnExists('modules', 'grants'))
206
+			if ($oDB->isColumnExists('modules', 'grants'))
207 207
 			{
208 208
 				$oModuleController = getController('module');
209 209
 				$oDocumentController = getController('document');
@@ -211,26 +211,26 @@  discard block
 block discarded – undo
211 211
 				$lang_code = Context::getLangType();
212 212
 				// Get module_info of all modules
213 213
 				$output = executeQueryArray('module.getModuleInfos');
214
-				if(count($output->data))
214
+				if (count($output->data))
215 215
 				{
216
-					foreach($output->data as $module_info)
216
+					foreach ($output->data as $module_info)
217 217
 					{
218 218
 						// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
219 219
 						$module_srl = trim($module_info->module_srl);
220 220
 						// grant an authority
221 221
 						$grants = unserialize($module_info->grants);
222
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
222
+						if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
223 223
 						// Insert skin vars
224 224
 						$skin_vars = unserialize($module_info->skin_vars);
225
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
225
+						if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
226 226
 						// Insert super admin's ID
227 227
 						$admin_id = trim($module_info->admin_id);
228
-						if($admin_id && $admin_id != 'Array')
228
+						if ($admin_id && $admin_id != 'Array')
229 229
 						{
230
-							$admin_ids = explode(',',$admin_id);
231
-							if(count($admin_id))
230
+							$admin_ids = explode(',', $admin_id);
231
+							if (count($admin_id))
232 232
 							{
233
-								foreach($admin_ids as $admin_id)
233
+								foreach ($admin_ids as $admin_id)
234 234
 								{
235 235
 									$oModuleController->insertAdminId($module_srl, $admin_id);
236 236
 								}
@@ -239,20 +239,20 @@  discard block
 block discarded – undo
239 239
 						// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
240 240
 						$extra_vars = unserialize($module_info->extra_vars);
241 241
 						$document_extra_keys = null;
242
-						if($extra_vars->extra_vars && count($extra_vars->extra_vars))
242
+						if ($extra_vars->extra_vars && count($extra_vars->extra_vars))
243 243
 						{
244 244
 							$document_extra_keys = $extra_vars->extra_vars;
245 245
 							unset($extra_vars->extra_vars);
246 246
 						}
247
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
247
+						if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
248 248
 
249 249
 						/**
250 250
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
251 251
 						 */
252 252
 						// Insert extra vars if planet module is
253
-						if($module_info->module == 'planet')
253
+						if ($module_info->module == 'planet')
254 254
 						{
255
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
255
+							if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
256 256
 							$planet_extra_keys->name = 'postscript';
257 257
 							$planet_extra_keys->type = 'text';
258 258
 							$planet_extra_keys->is_required = 'N';
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 							$document_extra_keys[20] = $planet_extra_keys;
263 263
 						}
264 264
 						// Register keys for document extra vars
265
-						if(count($document_extra_keys))
265
+						if (count($document_extra_keys))
266 266
 						{
267
-							foreach($document_extra_keys as $var_idx => $val)
267
+							foreach ($document_extra_keys as $var_idx => $val)
268 268
 							{
269 269
 								$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
270 270
 							}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 							$oDocumentModel = getModel('document');
273 273
 							$total_count = $oDocumentModel->getDocumentCount($module_srl);
274 274
 
275
-							if($total_count > 0)
275
+							if ($total_count > 0)
276 276
 							{
277 277
 								$per_page = 100;
278 278
 								$total_pages = (int) (($total_count - 1) / $per_page) + 1;
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 								$doc_args->sort_index = 'list_order';
284 284
 								$doc_args->order_type = 'asc';
285 285
 
286
-								for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
286
+								for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
287 287
 								{
288 288
 									$output = executeQueryArray('document.getDocumentList', $doc_args);
289 289
 
290
-									if($output->toBool() && $output->data && count($output->data))
290
+									if ($output->toBool() && $output->data && count($output->data))
291 291
 									{
292 292
 										foreach ($output->data as $document)
293 293
 										{
294
-											if(!$document) continue;
294
+											if (!$document) continue;
295 295
 											foreach ($document as $key => $var)
296 296
 											{
297 297
 												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
298
-												$var_idx = str_replace('extra_vars','',$key);
298
+												$var_idx = str_replace('extra_vars', '', $key);
299 299
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
300 300
 											}
301 301
 										}
@@ -311,96 +311,96 @@  discard block
 block discarded – undo
311 311
 						executeQuery('module.updateModule', $module_info);
312 312
 
313 313
 						$oCacheHandler = CacheHandler::getInstance('object', null, true);
314
-						if($oCacheHandler->isSupport())
314
+						if ($oCacheHandler->isSupport())
315 315
 						{
316 316
 							$oCacheHandler->invalidateGroupKey('site_and_module');
317 317
 						}
318 318
 					}
319 319
 				}
320 320
 				// Various column drop
321
-				$oDB->dropColumn('modules','grants');
322
-				$oDB->dropColumn('modules','admin_id');
323
-				$oDB->dropColumn('modules','skin_vars');
324
-				$oDB->dropColumn('modules','extra_vars');
321
+				$oDB->dropColumn('modules', 'grants');
322
+				$oDB->dropColumn('modules', 'admin_id');
323
+				$oDB->dropColumn('modules', 'skin_vars');
324
+				$oDB->dropColumn('modules', 'extra_vars');
325 325
 			}
326 326
 			// Rights of all modules/skins transferring the information into a table Update grants
327
-			if(!$oDB->isColumnExists('sites', 'default_language'))
327
+			if (!$oDB->isColumnExists('sites', 'default_language'))
328 328
 			{
329
-				$oDB->addColumn('sites','default_language','varchar',255,0,false);
329
+				$oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false);
330 330
 			}
331 331
 			// extra_vars * Remove Column
332
-			for($i=1;$i<=20;$i++)
332
+			for ($i = 1; $i <= 20; $i++)
333 333
 			{
334
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
335
-				$oDB->dropColumn('documents','extra_vars'.$i);
334
+				if (!$oDB->isColumnExists("documents", "extra_vars".$i)) continue;
335
+				$oDB->dropColumn('documents', 'extra_vars'.$i);
336 336
 			}
337 337
 
338 338
 			// Enter the main site information sites on the table
339 339
 			$args = new stdClass;
340 340
 			$args->site_srl = 0;
341 341
 			$output = $oDB->executeQuery('module.getSite', $args);
342
-			if(!$output->data)
342
+			if (!$output->data)
343 343
 			{
344 344
 				// Basic mid, language Wanted
345 345
 				$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
346 346
 				$db_info = Context::getDBInfo();
347 347
 				$domain = Context::getDefaultUrl();
348 348
 				$url_info = parse_url($domain);
349
-				$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
349
+				$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
350 350
 				$site_args->site_srl = 0;
351
-				$site_args->index_module_srl  = $mid_output->data->module_srl;
351
+				$site_args->index_module_srl = $mid_output->data->module_srl;
352 352
 				$site_args->domain = $domain;
353 353
 				$site_args->default_language = $db_info->lang_type;
354 354
 
355 355
 				$output = executeQuery('module.insertSite', $site_args);
356
-				if(!$output->toBool()) return $output;
356
+				if (!$output->toBool()) return $output;
357 357
 			}
358 358
 
359
-			if($oDB->isIndexExists('sites','idx_domain'))
359
+			if ($oDB->isIndexExists('sites', 'idx_domain'))
360 360
 			{
361
-				$oDB->dropIndex('sites','idx_domain');
361
+				$oDB->dropIndex('sites', 'idx_domain');
362 362
 			}
363
-			if(!$oDB->isIndexExists('sites','unique_domain'))
363
+			if (!$oDB->isIndexExists('sites', 'unique_domain'))
364 364
 			{
365 365
 				$this->updateForUniqueSiteDomain();
366
-				$oDB->addIndex('sites','unique_domain',array('domain'),true);
366
+				$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
367 367
 			}
368 368
 
369
-			if(!$oDB->isColumnExists("modules", "use_mobile"))
369
+			if (!$oDB->isColumnExists("modules", "use_mobile"))
370 370
 			{
371
-				$oDB->addColumn('modules','use_mobile','char',1,'N');
371
+				$oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N');
372 372
 			}
373
-			if(!$oDB->isColumnExists("modules", "mlayout_srl"))
373
+			if (!$oDB->isColumnExists("modules", "mlayout_srl"))
374 374
 			{
375
-				$oDB->addColumn('modules','mlayout_srl','number',11, 0);
375
+				$oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0);
376 376
 			}
377
-			if(!$oDB->isColumnExists("modules", "mcontent"))
377
+			if (!$oDB->isColumnExists("modules", "mcontent"))
378 378
 			{
379
-				$oDB->addColumn('modules','mcontent','bigtext');
379
+				$oDB->addColumn('modules', 'mcontent', 'bigtext');
380 380
 			}
381
-			if(!$oDB->isColumnExists("modules", "mskin"))
381
+			if (!$oDB->isColumnExists("modules", "mskin"))
382 382
 			{
383
-				$oDB->addColumn('modules','mskin','varchar',250);
383
+				$oDB->addColumn('modules', 'mskin', 'varchar', 250);
384 384
 			}
385
-			if(!$oDB->isColumnExists("modules", "is_skin_fix"))
385
+			if (!$oDB->isColumnExists("modules", "is_skin_fix"))
386 386
 			{
387 387
 				$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N');
388 388
 				$output = executeQuery('module.updateSkinFixModules');
389 389
 			}
390
-			if(!$oDB->isColumnExists("module_config", "site_srl"))
390
+			if (!$oDB->isColumnExists("module_config", "site_srl"))
391 391
 			{
392 392
 				$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
393 393
 			}
394 394
 
395 395
 			$args->skin = '.';
396 396
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
397
-			if($output->data && count($output->data) > 0)
397
+			if ($output->data && count($output->data) > 0)
398 398
 			{
399
-				foreach($output->data as $item)
399
+				foreach ($output->data as $item)
400 400
 				{
401 401
 					$skin_path = explode('.', $item->skin);
402
-					if(count($skin_path) != 2) continue;
403
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
402
+					if (count($skin_path) != 2) continue;
403
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
404 404
 					{
405 405
 						unset($args);
406 406
 						$args->skin = $item->skin;
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			}
412 412
 
413 413
 			// XE 1.7
414
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix"))
414
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix"))
415 415
 			{
416 416
 				$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N');
417 417
 				$output = executeQuery('module.updateMobileSkinFixModules');
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
 
420 420
 			$oModuleModel = getModel('module');
421 421
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
422
-			if(!$moduleConfig->isUpdateFixedValue)
422
+			if (!$moduleConfig->isUpdateFixedValue)
423 423
 			{
424 424
 				$output = executeQuery('module.updateSkinFixModules');
425 425
 				$output = executeQuery('module.updateMobileSkinFixModules');
426 426
 
427 427
 				$oModuleController = getController('module');
428
-				if(!$moduleConfig) $moduleConfig = new stdClass;
428
+				if (!$moduleConfig) $moduleConfig = new stdClass;
429 429
 				$moduleConfig->isUpdateFixedValue = TRUE;
430 430
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
431 431
 			}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			$oModuleController->insertUpdatedLog($version_update_id);
434 434
 		}
435 435
 
436
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
436
+		if (!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
437 437
 
438 438
 		return new BaseObject(0, 'success_updated');
439 439
 	}
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
 	function updateForUniqueSiteDomain()
442 442
 	{
443 443
 		$output = executeQueryArray("module.getNonuniqueDomains");
444
-		if(!$output->data) return;
445
-		foreach($output->data as $data)
444
+		if (!$output->data) return;
445
+		foreach ($output->data as $data)
446 446
 		{
447
-			if($data->count == 1) continue;
447
+			if ($data->count == 1) continue;
448 448
 			$domain = $data->domain;
449 449
 			$args = new stdClass;
450 450
 			$args->domain = $domain;
451 451
 			$output2 = executeQueryArray("module.getSiteByDomain", $args);
452 452
 			$bFirst = true;
453
-			foreach($output2->data as $site)
453
+			foreach ($output2->data as $site)
454 454
 			{
455
-				if($bFirst)
455
+				if ($bFirst)
456 456
 				{
457 457
 					$bFirst = false;
458 458
 					continue;
Please login to merge, or discard this patch.
Braces   +114 added lines, -38 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if(!$output->toBool()) {
45
+				return $output;
46
+			}
45 47
 		}
46 48
 
47 49
 		return new BaseObject();
@@ -59,37 +61,65 @@  discard block
 block discarded – undo
59 61
 		if($oModuleModel->needUpdate($version_update_id))
60 62
 		{
61 63
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
64
+			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
65
+				return true;
66
+			}
63 67
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
68
+			if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
69
+				return true;
70
+			}
65 71
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
72
+			if($oDB->isColumnExists('modules', 'grants')) {
73
+				return true;
74
+			}
67 75
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
76
+			if(!$oDB->isColumnExists('sites', 'default_language')) {
77
+				return true;
78
+			}
69 79
 			// Delete extra_vars* column
70 80
 			for($i=1;$i<=20;$i++)
71 81
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
82
+				if($oDB->isColumnExists("documents","extra_vars".$i)) {
83
+					return true;
84
+				}
73 85
 			}
74 86
 			// Insert site information to the table, sites
75 87
 			$args = new stdClass();
76 88
 			$args->site_srl = 0;
77 89
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
90
+			if(!$output->data) {
91
+				return true;
92
+			}
79 93
 
80 94
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
95
+			if($oDB->isIndexExists('sites', 'idx_domain')) {
96
+				return true;
97
+			}
98
+			if(!$oDB->isIndexExists('sites','unique_domain')) {
99
+				return true;
100
+			}
83 101
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
102
+			if(!$oDB->isColumnExists("modules", "use_mobile")) {
103
+				return true;
104
+			}
105
+			if(!$oDB->isColumnExists("modules", "mlayout_srl")) {
106
+				return true;
107
+			}
108
+			if(!$oDB->isColumnExists("modules", "mcontent")) {
109
+				return true;
110
+			}
111
+			if(!$oDB->isColumnExists("modules", "mskin")) {
112
+				return true;
113
+			}
88 114
 
89 115
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
116
+			if(!$oDB->isColumnExists("modules", "is_skin_fix")) {
117
+				return true;
118
+			}
91 119
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
120
+			if(!$oDB->isColumnExists("module_config", "site_srl")) {
121
+				return true;
122
+			}
93 123
 
94 124
 			$args->skin = '.';
95 125
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
@@ -98,24 +128,34 @@  discard block
 block discarded – undo
98 128
 				foreach($output->data as $item)
99 129
 				{
100 130
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
131
+					if(count($skin_path) != 2) {
132
+						continue;
133
+					}
134
+					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) {
135
+						return true;
136
+					}
103 137
 				}
104 138
 			}
105 139
 
106 140
 			// XE 1.7
107 141
 
108 142
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
143
+			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) {
144
+				return true;
145
+			}
110 146
 
111 147
 			$oModuleModel = getModel('module');
112 148
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
113
-			if(!$moduleConfig->isUpdateFixedValue) return true;
149
+			if(!$moduleConfig->isUpdateFixedValue) {
150
+				return true;
151
+			}
114 152
 
115 153
 			$oModuleController->insertUpdatedLog($version_update_id);
116 154
 		}
117 155
 
118
-		if(!is_dir('./files/ruleset')) return true;
156
+		if(!is_dir('./files/ruleset')) {
157
+			return true;
158
+		}
119 159
 
120 160
 		return false;
121 161
 	}
@@ -140,7 +180,9 @@  discard block
 block discarded – undo
140 180
 				foreach($modules as $key => $module_info)
141 181
 				{
142 182
 					$module = $module_info->module;
143
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
183
+					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) {
184
+						continue;
185
+					}
144 186
 					$config = $oModuleModel->getModuleConfig($module);
145 187
 
146 188
 					$module_config = null;
@@ -161,7 +203,9 @@  discard block
 block discarded – undo
161 203
 							{
162 204
 								foreach($module_config as $key => $val)
163 205
 								{
164
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
206
+									if(isset($module_config[$key]->module_srl)) {
207
+										unset($module_config[$key]->module_srl);
208
+									}
165 209
 								}
166 210
 							}
167 211
 							break;
@@ -171,7 +215,9 @@  discard block
 block discarded – undo
171 215
 							{
172 216
 								foreach($tmp as $k => $v)
173 217
 								{
174
-									if(!$v && !trim($v)) continue;
218
+									if(!$v && !trim($v)) {
219
+										continue;
220
+									}
175 221
 									$module_config[$k]->header_script = $v;
176 222
 								}
177 223
 							}
@@ -199,9 +245,13 @@  discard block
 block discarded – undo
199 245
 				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
200 246
 			}
201 247
 			// document extra vars
202
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
248
+			if(!$oDB->isTableExists('document_extra_vars')) {
249
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
250
+			}
203 251
 
204
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
252
+			if(!$oDB->isTableExists('document_extra_keys')) {
253
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
254
+			}
205 255
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
206 256
 			if($oDB->isColumnExists('modules', 'grants'))
207 257
 			{
@@ -219,10 +269,14 @@  discard block
 block discarded – undo
219 269
 						$module_srl = trim($module_info->module_srl);
220 270
 						// grant an authority
221 271
 						$grants = unserialize($module_info->grants);
222
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
272
+						if($grants) {
273
+							$oModuleController->insertModuleGrants($module_srl, $grants);
274
+						}
223 275
 						// Insert skin vars
224 276
 						$skin_vars = unserialize($module_info->skin_vars);
225
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
277
+						if($skin_vars) {
278
+							$oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
279
+						}
226 280
 						// Insert super admin's ID
227 281
 						$admin_id = trim($module_info->admin_id);
228 282
 						if($admin_id && $admin_id != 'Array')
@@ -244,7 +298,9 @@  discard block
 block discarded – undo
244 298
 							$document_extra_keys = $extra_vars->extra_vars;
245 299
 							unset($extra_vars->extra_vars);
246 300
 						}
247
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
301
+						if($extra_vars) {
302
+							$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
303
+						}
248 304
 
249 305
 						/**
250 306
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
@@ -252,7 +308,9 @@  discard block
 block discarded – undo
252 308
 						// Insert extra vars if planet module is
253 309
 						if($module_info->module == 'planet')
254 310
 						{
255
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
311
+							if(!$document_extra_keys || !is_array($document_extra_keys)) {
312
+								$document_extra_keys = array();
313
+							}
256 314
 							$planet_extra_keys->name = 'postscript';
257 315
 							$planet_extra_keys->type = 'text';
258 316
 							$planet_extra_keys->is_required = 'N';
@@ -291,10 +349,14 @@  discard block
 block discarded – undo
291 349
 									{
292 350
 										foreach ($output->data as $document)
293 351
 										{
294
-											if(!$document) continue;
352
+											if(!$document) {
353
+												continue;
354
+											}
295 355
 											foreach ($document as $key => $var)
296 356
 											{
297
-												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
357
+												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') {
358
+													continue;
359
+												}
298 360
 												$var_idx = str_replace('extra_vars','',$key);
299 361
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
300 362
 											}
@@ -331,7 +393,9 @@  discard block
 block discarded – undo
331 393
 			// extra_vars * Remove Column
332 394
 			for($i=1;$i<=20;$i++)
333 395
 			{
334
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
396
+				if(!$oDB->isColumnExists("documents","extra_vars".$i)) {
397
+					continue;
398
+				}
335 399
 				$oDB->dropColumn('documents','extra_vars'.$i);
336 400
 			}
337 401
 
@@ -353,7 +417,9 @@  discard block
 block discarded – undo
353 417
 				$site_args->default_language = $db_info->lang_type;
354 418
 
355 419
 				$output = executeQuery('module.insertSite', $site_args);
356
-				if(!$output->toBool()) return $output;
420
+				if(!$output->toBool()) {
421
+					return $output;
422
+				}
357 423
 			}
358 424
 
359 425
 			if($oDB->isIndexExists('sites','idx_domain'))
@@ -399,7 +465,9 @@  discard block
 block discarded – undo
399 465
 				foreach($output->data as $item)
400 466
 				{
401 467
 					$skin_path = explode('.', $item->skin);
402
-					if(count($skin_path) != 2) continue;
468
+					if(count($skin_path) != 2) {
469
+						continue;
470
+					}
403 471
 					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
404 472
 					{
405 473
 						unset($args);
@@ -425,7 +493,9 @@  discard block
 block discarded – undo
425 493
 				$output = executeQuery('module.updateMobileSkinFixModules');
426 494
 
427 495
 				$oModuleController = getController('module');
428
-				if(!$moduleConfig) $moduleConfig = new stdClass;
496
+				if(!$moduleConfig) {
497
+					$moduleConfig = new stdClass;
498
+				}
429 499
 				$moduleConfig->isUpdateFixedValue = TRUE;
430 500
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
431 501
 			}
@@ -433,7 +503,9 @@  discard block
 block discarded – undo
433 503
 			$oModuleController->insertUpdatedLog($version_update_id);
434 504
 		}
435 505
 
436
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
506
+		if(!is_dir('./files/ruleset')) {
507
+			FileHandler::makeDir('./files/ruleset');
508
+		}
437 509
 
438 510
 		return new BaseObject(0, 'success_updated');
439 511
 	}
@@ -441,10 +513,14 @@  discard block
 block discarded – undo
441 513
 	function updateForUniqueSiteDomain()
442 514
 	{
443 515
 		$output = executeQueryArray("module.getNonuniqueDomains");
444
-		if(!$output->data) return;
516
+		if(!$output->data) {
517
+			return;
518
+		}
445 519
 		foreach($output->data as $data)
446 520
 		{
447
-			if($data->count == 1) continue;
521
+			if($data->count == 1) {
522
+				continue;
523
+			}
448 524
 			$domain = $data->domain;
449 525
 			$args = new stdClass;
450 526
 			$args->domain = $domain;
Please login to merge, or discard this patch.
modules/module/module.view.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 		$skin = Context::get('skin');
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if (!is_dir($module_path)) $this->stop("msg_invalid_request");
29 29
 
30 30
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
31
+		if (!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
32 32
 
33 33
 		$oModuleModel = getModel('module');
34 34
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
35
-		Context::set('skin_info',$skin_info);
35
+		Context::set('skin_info', $skin_info);
36 36
 
37 37
 		$this->setLayoutFile("popup_layout");
38 38
 		$this->setTemplateFile("skin_info");
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	function dispModuleSelectList()
45 45
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
46
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
47 47
 
48 48
 		$oModuleModel = getModel('module');
49 49
 		$logged_info = Context::get('logged_info');
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 
58 58
 		$args = new stdClass();
59 59
 		$module_category_exists = false;
60
-		if($logged_info->is_admin == 'Y' && $site_keyword)
60
+		if ($logged_info->is_admin == 'Y' && $site_keyword)
61 61
 		{
62 62
 			$args->site_keyword = $site_keyword;
63 63
 		}
64 64
 		else
65 65
 		{
66
-			$args->site_srl = (int)$site_module_info->site_srl;
66
+			$args->site_srl = (int) $site_module_info->site_srl;
67 67
 			Context::set('site_keyword', null);
68 68
 		}
69 69
 
70
-		if($logged_info->is_admin == 'Y')
70
+		if ($logged_info->is_admin == 'Y')
71 71
 		{
72 72
 			$module_category_exists = true;
73 73
 		}
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 		// Get a list of modules at the site
76 76
 		$mid_list = array();
77 77
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
78
+		if (!$output->data) $output->data = array();
79 79
 
80
-		foreach($output->data as $key => $val)
80
+		foreach ($output->data as $key => $val)
81 81
 		{
82 82
 			$module = trim($val->module);
83
-			if(!$module) continue;
83
+			if (!$module) continue;
84 84
 
85
-			if(!$oModuleModel->getGrant($val, $logged_info)->access)
85
+			if (!$oModuleModel->getGrant($val, $logged_info)->access)
86 86
 			{
87 87
 				continue;
88 88
 			}
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 			$obj->browser_title = $val->browser_title;
94 94
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 95
 
96
-			if(!$selected_module) $selected_module = $module;
97
-			if(!$mid_list[$module]->title)
96
+			if (!$selected_module) $selected_module = $module;
97
+			if (!$mid_list[$module]->title)
98 98
 			{
99 99
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
100 100
 				$mid_list[$module]->title = $xml_info->title;
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	function dispModuleFileBox()
118 118
 	{
119 119
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
120
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
121 121
 
122 122
 		$input_name = Context::get('input');
123
-		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
123
+		if (!preg_match('/^[a-z0-9_]+$/i', $input_name))
124 124
 		{
125 125
 			return new BaseObject(-1, 'msg_invalid_request');
126 126
 		}
127 127
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
128
+		if (!$input_name) return new BaseObject(-1, 'msg_not_permitted');
129 129
 
130 130
 		$addscript = sprintf('<script>//<![CDATA[
131 131
 				var selected_filebox_input_name = "%s";
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		Context::set('filebox_list', $output->data);
138 138
 
139 139
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
140
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
141 141
 
142 142
 		Context::set('page_navigation', $output->page_navigation);
143 143
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	function dispModuleFileBoxAdd()
149 149
 	{
150 150
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
151
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
152 152
 
153 153
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
154
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
155 155
 
156 156
 		$this->setLayoutFile('popup_layout');
157 157
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,10 +25,14 @@  discard block
 block discarded – undo
25 25
 		$skin = Context::get('skin');
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if(!is_dir($module_path)) {
29
+			$this->stop("msg_invalid_request");
30
+		}
29 31
 
30 32
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
33
+		if(!file_exists($skin_info_xml)) {
34
+			$this->stop("msg_invalid_request");
35
+		}
32 36
 
33 37
 		$oModuleModel = getModel('module');
34 38
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
@@ -43,7 +47,9 @@  discard block
 block discarded – undo
43 47
 	 */
44 48
 	function dispModuleSelectList()
45 49
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
50
+		if(!Context::get('is_logged')) {
51
+			return new BaseObject(-1, 'msg_not_permitted');
52
+		}
47 53
 
48 54
 		$oModuleModel = getModel('module');
49 55
 		$logged_info = Context::get('logged_info');
@@ -60,8 +66,7 @@  discard block
 block discarded – undo
60 66
 		if($logged_info->is_admin == 'Y' && $site_keyword)
61 67
 		{
62 68
 			$args->site_keyword = $site_keyword;
63
-		}
64
-		else
69
+		} else
65 70
 		{
66 71
 			$args->site_srl = (int)$site_module_info->site_srl;
67 72
 			Context::set('site_keyword', null);
@@ -75,12 +80,16 @@  discard block
 block discarded – undo
75 80
 		// Get a list of modules at the site
76 81
 		$mid_list = array();
77 82
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
83
+		if(!$output->data) {
84
+			$output->data = array();
85
+		}
79 86
 
80 87
 		foreach($output->data as $key => $val)
81 88
 		{
82 89
 			$module = trim($val->module);
83
-			if(!$module) continue;
90
+			if(!$module) {
91
+				continue;
92
+			}
84 93
 
85 94
 			if(!$oModuleModel->getGrant($val, $logged_info)->access)
86 95
 			{
@@ -93,7 +102,9 @@  discard block
 block discarded – undo
93 102
 			$obj->browser_title = $val->browser_title;
94 103
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 104
 
96
-			if(!$selected_module) $selected_module = $module;
105
+			if(!$selected_module) {
106
+				$selected_module = $module;
107
+			}
97 108
 			if(!$mid_list[$module]->title)
98 109
 			{
99 110
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
@@ -117,7 +128,9 @@  discard block
 block discarded – undo
117 128
 	function dispModuleFileBox()
118 129
 	{
119 130
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
131
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
132
+			return new BaseObject(-1, 'msg_not_permitted');
133
+		}
121 134
 
122 135
 		$input_name = Context::get('input');
123 136
 		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
@@ -125,7 +138,9 @@  discard block
 block discarded – undo
125 138
 			return new BaseObject(-1, 'msg_invalid_request');
126 139
 		}
127 140
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
141
+		if(!$input_name) {
142
+			return new BaseObject(-1, 'msg_not_permitted');
143
+		}
129 144
 
130 145
 		$addscript = sprintf('<script>//<![CDATA[
131 146
 				var selected_filebox_input_name = "%s";
@@ -137,7 +152,9 @@  discard block
 block discarded – undo
137 152
 		Context::set('filebox_list', $output->data);
138 153
 
139 154
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
155
+		if($filter) {
156
+			Context::set('arrfilter',explode(',',$filter));
157
+		}
141 158
 
142 159
 		Context::set('page_navigation', $output->page_navigation);
143 160
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +165,14 @@  discard block
 block discarded – undo
148 165
 	function dispModuleFileBoxAdd()
149 166
 	{
150 167
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
168
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
169
+			return new BaseObject(-1, 'msg_not_permitted');
170
+		}
152 171
 
153 172
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
173
+		if($filter) {
174
+			Context::set('arrfilter',explode(',',$filter));
175
+		}
155 176
 
156 177
 		$this->setLayoutFile('popup_layout');
157 178
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.
modules/module/module.admin.view.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 		$oAutoinstallModel = getModel('autoinstall');
36 36
 
37 37
 		$module_list = $oModuleModel->getModuleList();
38
-		if(is_array($module_list))
38
+		if (is_array($module_list))
39 39
 		{
40
-			foreach($module_list as $key => $val)
40
+			foreach ($module_list as $key => $val)
41 41
 			{
42 42
 				$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
48 48
 
49 49
 				// get easyinstall update url
50
-				if($module_list[$key]->need_autoinstall_update == 'Y')
50
+				if ($module_list[$key]->need_autoinstall_update == 'Y')
51 51
 				{
52 52
 					$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
53 53
 				}
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$favoriteList = $output->get('favoriteList');
60 60
 		$favoriteModuleList = array();
61
-		if($favoriteList)
61
+		if ($favoriteList)
62 62
 		{
63
-			foreach($favoriteList as $favorite => $favorite_info)
63
+			foreach ($favoriteList as $favorite => $favorite_info)
64 64
 			{
65 65
 				$favoriteModuleList[] = $favorite_info->module;
66 66
 			}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 		//Security
111 111
 		$security = new Security();
112 112
 
113
-		if($module_category_srl)
113
+		if ($module_category_srl)
114 114
 		{
115
-			$selected_category  = $oModuleModel->getModuleCategory($module_category_srl);
115
+			$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
116 116
 			Context::set('selected_category', $selected_category);
117 117
 
118 118
 			//Security
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	{
165 165
 		$module_srls = Context::get('module_srls');
166 166
 
167
-		$modules = explode(',',$module_srls);
168
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
167
+		$modules = explode(',', $module_srls);
168
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
169 169
 
170 170
 		$oModuleModel = getModel('module');
171 171
 		$columnList = array('module_srl', 'module');
172 172
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
173 173
 		// Get a skin list of the module
174
-		$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/'.$module_info->module);
175
-		Context::set('skin_list',$skin_list);
174
+		$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$module_info->module);
175
+		Context::set('skin_list', $skin_list);
176 176
 		// Get a layout list
177 177
 		$oLayoutModel = getModel('layout');
178 178
 		$layout_list = $oLayoutModel->getLayoutList();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		Context::set('module_category', $module_category);
183 183
 
184 184
 		$security = new Security();
185
-		$security->encodeHTML('layout_list..title','layout_list..layout');
185
+		$security->encodeHTML('layout_list..title', 'layout_list..layout');
186 186
 		$security->encodeHTML('skin_list....');
187 187
 		$security->encodeHTML('module_category...');
188 188
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	{
201 201
 		$module_srls = Context::get('module_srls');
202 202
 
203
-		$modules = explode(',',$module_srls);
204
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
203
+		$modules = explode(',', $module_srls);
204
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
205 205
 		// pre-define variables because you can get contents from other module (call by reference)
206 206
 		$content = '';
207 207
 		// Call a trigger for additional settings
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	{
224 224
 		$module_srls = Context::get('module_srls');
225 225
 
226
-		$modules = explode(',',$module_srls);
227
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
226
+		$modules = explode(',', $module_srls);
227
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
228 228
 
229 229
 		$oModuleModel = getModel('module');
230 230
 		$columnList = array('module_srl', 'module', 'site_srl');
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		// Grant virtual permissions for access and manager
235 235
 		$grant_list->access->title = Context::getLang('grant_access');
236 236
 		$grant_list->access->default = 'guest';
237
-		if(count($source_grant_list))
237
+		if (count($source_grant_list))
238 238
 		{
239
-			foreach($source_grant_list as $key => $val)
239
+			foreach ($source_grant_list as $key => $val)
240 240
 			{
241
-				if(!$val->default) $val->default = 'guest';
242
-				if($val->default == 'root') $val->default = 'manager';
241
+				if (!$val->default) $val->default = 'guest';
242
+				if ($val->default == 'root') $val->default = 'manager';
243 243
 				$grant_list->{$key} = $val;
244 244
 			}
245 245
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		// Get the language file of the current site
269 269
 		$site_module_info = Context::get('site_module_info');
270 270
 		$args = new stdClass();
271
-		$args->site_srl = (int)$site_module_info->site_srl;
271
+		$args->site_srl = (int) $site_module_info->site_srl;
272 272
 		$args->langCode = Context::get('lang_type');
273 273
 		$args->page = Context::get('page'); // /< Page
274 274
 		$args->list_count = 30; // /< the number of posts to display on a single page
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		Context::set('lang_code_list', $output->data);
288 288
 		Context::set('page_navigation', $output->page_navigation);
289 289
 
290
-		if(Context::get('module') != 'admin')
290
+		if (Context::get('module') != 'admin')
291 291
 		{
292 292
 			$this->setLayoutPath('./common/tpl');
293 293
 			$this->setLayoutFile('popup_layout');
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		$oModuleModel = getModel('module');
302 302
 		$output = $oModuleModel->getModuleFileBoxList();
303 303
 		$page = Context::get('page');
304
-		$page = $page?$page:1;
304
+		$page = $page ? $page : 1;
305 305
 		Context::set('filebox_list', $output->data);
306 306
 		Context::set('page_navigation', $output->page_navigation);
307 307
 		Context::set('page', $page);
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 			// Set a template file
122 122
 			$this->setTemplateFile('category_update_form');
123 123
 			// If not selected, display a list of categories
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$category_list = $oModuleModel->getModuleCategories();
128 127
 			Context::set('category_list', $category_list);
@@ -165,7 +164,9 @@  discard block
 block discarded – undo
165 164
 		$module_srls = Context::get('module_srls');
166 165
 
167 166
 		$modules = explode(',',$module_srls);
168
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
167
+		if(!count($modules)) {
168
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
169
+		}
169 170
 
170 171
 		$oModuleModel = getModel('module');
171 172
 		$columnList = array('module_srl', 'module');
@@ -201,7 +202,9 @@  discard block
 block discarded – undo
201 202
 		$module_srls = Context::get('module_srls');
202 203
 
203 204
 		$modules = explode(',',$module_srls);
204
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
205
+		if(!count($modules)) {
206
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
207
+		}
205 208
 		// pre-define variables because you can get contents from other module (call by reference)
206 209
 		$content = '';
207 210
 		// Call a trigger for additional settings
@@ -224,7 +227,9 @@  discard block
 block discarded – undo
224 227
 		$module_srls = Context::get('module_srls');
225 228
 
226 229
 		$modules = explode(',',$module_srls);
227
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
230
+		if(!count($modules)) {
231
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
232
+		}
228 233
 
229 234
 		$oModuleModel = getModel('module');
230 235
 		$columnList = array('module_srl', 'module', 'site_srl');
@@ -238,8 +243,12 @@  discard block
 block discarded – undo
238 243
 		{
239 244
 			foreach($source_grant_list as $key => $val)
240 245
 			{
241
-				if(!$val->default) $val->default = 'guest';
242
-				if($val->default == 'root') $val->default = 'manager';
246
+				if(!$val->default) {
247
+					$val->default = 'guest';
248
+				}
249
+				if($val->default == 'root') {
250
+					$val->default = 'manager';
251
+				}
243 252
 				$grant_list->{$key} = $val;
244 253
 			}
245 254
 		}
Please login to merge, or discard this patch.
modules/module/module.model.php 2 patches
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$hostname = $request_url_parse['host'];
101 101
 			$path = $request_url_parse['path'];
102 102
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
105
+			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124
-				$object_key = 'site_info:' . md5($domain);
124
+				$object_key = 'site_info:'.md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225 225
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230
-				$object_key = 'mid_info:' . $module_srl;
230
+				$object_key = 'mid_info:'.$module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
232 232
 				$module_info = $oCacheHandler->get($module_info_cache_key);
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
244
-				$object_key = 'mid_info:' . $module_info->module_srl;
244
+				$object_key = 'mid_info:'.$module_info->module_srl;
245 245
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
246 246
 				$oCacheHandler->put($module_info_cache_key, $module_info);
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326 326
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331
-				$object_key = 'mid_info:' . $module_srl;
331
+				$object_key = 'mid_info:'.$module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
340
-				$object_key = 'mid_info:' . $output->data->module_srl;
340
+				$object_key = 'mid_info:'.$output->data->module_srl;
341 341
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 342
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343 343
 			}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,23 +918,23 @@  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:'';
937
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
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
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
938 938
 
939 939
 					$index = $action->attrs->index;
940 940
 					$admin_index = $action->attrs->admin_index;
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 					$info->action->{$name}->ruleset = $ruleset;
950 950
 					$info->action->{$name}->method = $method;
951 951
 					$info->action->{$name}->check_csrf = $check_csrf;
952
-					if($action->attrs->menu_name)
952
+					if ($action->attrs->menu_name)
953 953
 					{
954
-						if($menu_index == 'true')
954
+						if ($menu_index == 'true')
955 955
 						{
956 956
 							$info->menu->{$action->attrs->menu_name}->index = $name;
957 957
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
958 958
 						}
959
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
959
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
960 960
 						{
961 961
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
962 962
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -974,22 +974,22 @@  discard block
 block discarded – undo
974 974
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
975 975
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
976 976
 
977
-					if($index=='true')
977
+					if ($index == 'true')
978 978
 					{
979 979
 						$default_index_act = $name;
980 980
 						$info->default_index_act = $name;
981 981
 					}
982
-					if($admin_index=='true')
982
+					if ($admin_index == 'true')
983 983
 					{
984 984
 						$admin_index_act = $name;
985 985
 						$info->admin_index_act = $name;
986 986
 					}
987
-					if($setup_index=='true')
987
+					if ($setup_index == 'true')
988 988
 					{
989 989
 						$setup_index_act = $name;
990 990
 						$info->setup_index_act = $name;
991 991
 					}
992
-					if($simple_setup_index=='true')
992
+					if ($simple_setup_index == 'true')
993 993
 					{
994 994
 						$simple_setup_index_act = $name;
995 995
 						$info->simple_setup_index_act = $name;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			return $info;
1011 1011
 		}
1012 1012
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1013
+		if (file_exists($cache_file)) return include($cache_file);
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	{
1022 1022
 		$module = Context::get('module_type');
1023 1023
 
1024
-		if($module == 'ARTICLE')
1024
+		if ($module == 'ARTICLE')
1025 1025
 		{
1026 1026
 			$module = 'page';
1027 1027
 		}
@@ -1041,26 +1041,26 @@  discard block
 block discarded – undo
1041 1041
 	 */
1042 1042
 	function getSkins($path, $dir = 'skins')
1043 1043
 	{
1044
-		if(substr($path, -1) == '/')
1044
+		if (substr($path, -1) == '/')
1045 1045
 		{
1046 1046
 			$path = substr($path, 0, -1);
1047 1047
 		}
1048 1048
 
1049 1049
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1050
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1051
+		if (!count($list)) return;
1052 1052
 
1053 1053
 		natcasesort($list);
1054 1054
 
1055
-		foreach($list as $skin_name)
1055
+		foreach ($list as $skin_name)
1056 1056
 		{
1057
-			if(!is_dir($skin_path . $skin_name))
1057
+			if (!is_dir($skin_path.$skin_name))
1058 1058
 			{
1059 1059
 				continue;
1060 1060
 			}
1061 1061
 			unset($skin_info);
1062 1062
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1063
-			if(!$skin_info)
1063
+			if (!$skin_info)
1064 1064
 			{
1065 1065
 				$skin_info = new stdClass();
1066 1066
 				$skin_info->title = $skin_name;
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
 		$tmpPath = trim($tmpPath);
1074 1074
 		$module = array_pop(explode(' ', $tmpPath));
1075 1075
 
1076
-		if($dir == 'skins')
1076
+		if ($dir == 'skins')
1077 1077
 		{
1078 1078
 			$oAdminModel = getAdminModel('admin');
1079 1079
 			$themesInfo = $oAdminModel->getThemeList();
1080 1080
 
1081
-			foreach($themesInfo as $themeName => $info)
1081
+			foreach ($themesInfo as $themeName => $info)
1082 1082
 			{
1083 1083
 				$skinInfos = $info->skin_infos;
1084
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1084
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1085 1085
 				{
1086 1086
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1087 1087
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		$oMenuAdminModel = getAdminModel('menu');
1094 1094
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1095 1095
 		$moduleName = $module;
1096
-		if($moduleName === 'page')
1096
+		if ($moduleName === 'page')
1097 1097
 		{
1098 1098
 			$moduleName = 'ARTICLE';
1099 1099
 		}
1100
-		if(array_key_exists($moduleName, $installedMenuTypes))
1100
+		if (array_key_exists($moduleName, $installedMenuTypes))
1101 1101
 		{
1102
-			if($dir == 'skins')
1102
+			if ($dir == 'skins')
1103 1103
 			{
1104 1104
 				$type = 'P';
1105 1105
 			}
@@ -1109,12 +1109,12 @@  discard block
 block discarded – undo
1109 1109
 			}
1110 1110
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1111 1111
 
1112
-			if(isset($defaultSkinName))
1112
+			if (isset($defaultSkinName))
1113 1113
 			{
1114 1114
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1115 1115
 
1116 1116
 				$useDefault = new stdClass();
1117
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1117
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1118 1118
 
1119 1119
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1120 1120
 
@@ -1131,20 +1131,20 @@  discard block
 block discarded – undo
1131 1131
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1132
 	{
1133 1133
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1134
+		if (substr($path, -1) != '/') $path .= '/';
1135 1135
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1136
+		if (!file_exists($skin_xml_file)) return;
1137 1137
 		// Create XmlParser object
1138 1138
 		$oXmlParser = new XmlParser();
1139 1139
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1140
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1141
+		if (!$_xml_obj->skin) return;
1142 1142
 		$xml_obj = $_xml_obj->skin;
1143 1143
 		// Skin Name
1144 1144
 		$skin_info = new stdClass();
1145 1145
 		$skin_info->title = $xml_obj->title->body;
1146 1146
 		// Author information
1147
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1147
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1148 1148
 		{
1149 1149
 			// skin format v0.2
1150 1150
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1155,10 +1155,10 @@  discard block
 block discarded – undo
1155 1155
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1156
 			$skin_info->description = $xml_obj->description->body;
1157 1157
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1158
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159 1159
 			else $author_list = $xml_obj->author;
1160 1160
 
1161
-			foreach($author_list as $author)
1161
+			foreach ($author_list as $author)
1162 1162
 			{
1163 1163
 				$author_obj = new stdClass();
1164 1164
 				$author_obj->name = $author->name->body;
@@ -1167,25 +1167,25 @@  discard block
 block discarded – undo
1167 1167
 				$skin_info->author[] = $author_obj;
1168 1168
 			}
1169 1169
 			// List extra vars
1170
-			if($xml_obj->extra_vars)
1170
+			if ($xml_obj->extra_vars)
1171 1171
 			{
1172 1172
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1173
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1175 1175
 
1176
-				foreach($extra_var_groups as $group)
1176
+				foreach ($extra_var_groups as $group)
1177 1177
 				{
1178 1178
 					$extra_vars = $group->var;
1179
-					if(!$extra_vars)
1179
+					if (!$extra_vars)
1180 1180
 					{
1181 1181
 						continue;
1182 1182
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1183
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1184 1184
 
1185
-					foreach($extra_vars as $key => $val)
1185
+					foreach ($extra_vars as $key => $val)
1186 1186
 					{
1187 1187
 						$obj = new stdClass();
1188
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1188
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1189 1189
 
1190 1190
 						$obj->group = $group->title->body;
1191 1191
 						$obj->name = $val->attrs->name;
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 						$obj->description = $val->description->body;
1195 1195
 						$obj->value = $extra_vals->{$obj->name};
1196 1196
 						$obj->default = $val->attrs->default;
1197
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1197
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1199 1199
 						// Get an option list from 'select'type
1200
-						if(is_array($val->options))
1200
+						if (is_array($val->options))
1201 1201
 						{
1202 1202
 							$option_count = count($val->options);
1203 1203
 
1204
-							for($i = 0; $i < $option_count; $i++)
1204
+							for ($i = 0; $i < $option_count; $i++)
1205 1205
 							{
1206 1206
 								$obj->options[$i] = new stdClass();
1207 1207
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1238,18 +1238,18 @@  discard block
 block discarded – undo
1238 1238
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1239
 			// Variables used in the skin
1240 1240
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1241
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1243 1243
 
1244
-			foreach($extra_var_groups as $group)
1244
+			foreach ($extra_var_groups as $group)
1245 1245
 			{
1246 1246
 				$extra_vars = $group->var;
1247 1247
 
1248
-				if($extra_vars)
1248
+				if ($extra_vars)
1249 1249
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1250
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1251 1251
 
1252
-					foreach($extra_vars as $var)
1252
+					foreach ($extra_vars as $var)
1253 1253
 					{
1254 1254
 						unset($obj);
1255 1255
 						unset($options);
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
 						$title = $var->title->body;
1261 1261
 						$description = $var->description->body;
1262 1262
 						// Get an option list from 'select'type.
1263
-						if(is_array($var->default))
1263
+						if (is_array($var->default))
1264 1264
 						{
1265 1265
 							$option_count = count($var->default);
1266 1266
 
1267
-							for($i = 0; $i < $option_count; $i++)
1267
+							for ($i = 0; $i < $option_count; $i++)
1268 1268
 							{
1269 1269
 								$options[$i]->title = $var->default[$i]->body;
1270 1270
 								$options[$i]->value = $var->default[$i]->body;
@@ -1298,19 +1298,19 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
 		// colorset
1300 1300
 		$colorset = $xml_obj->colorset->color;
1301
-		if($colorset)
1301
+		if ($colorset)
1302 1302
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1303
+			if (!is_array($colorset)) $colorset = array($colorset);
1304 1304
 
1305
-			foreach($colorset as $color)
1305
+			foreach ($colorset as $color)
1306 1306
 			{
1307 1307
 				$name = $color->attrs->name;
1308 1308
 				$title = $color->title->body;
1309 1309
 				$screenshot = $color->attrs->src;
1310
-				if($screenshot)
1310
+				if ($screenshot)
1311 1311
 				{
1312 1312
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1313
+					if (!file_exists($screenshot)) $screenshot = "";
1314 1314
 				}
1315 1315
 				else $screenshot = "";
1316 1316
 
@@ -1322,19 +1322,19 @@  discard block
 block discarded – undo
1322 1322
 			}
1323 1323
 		}
1324 1324
 		// Menu type (settings for layout)
1325
-		if($xml_obj->menus->menu)
1325
+		if ($xml_obj->menus->menu)
1326 1326
 		{
1327 1327
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1328
+			if (!is_array($menus)) $menus = array($menus);
1329 1329
 
1330 1330
 			$menu_count = count($menus);
1331 1331
 			$skin_info->menu_count = $menu_count;
1332
-			for($i=0;$i<$menu_count;$i++)
1332
+			for ($i = 0; $i < $menu_count; $i++)
1333 1333
 			{
1334 1334
 				unset($obj);
1335 1335
 
1336 1336
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1337
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1338 1338
 				$obj->title = $menus[$i]->title->body;
1339 1339
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1340
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		}
1344 1344
 
1345 1345
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1346
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1346
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1347 1347
 		return $skin_info;
1348 1348
 	}
1349 1349
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	{
1355 1355
 		$args = new stdClass;
1356 1356
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1357
+		if (!is_null($module)) $args->module = $module;
1358 1358
 		$output = executeQuery('module.getModuleCount', $args);
1359 1359
 		return $output->data->count;
1360 1360
 	}
@@ -1368,26 +1368,26 @@  discard block
 block discarded – undo
1368 1368
 		$config = false;
1369 1369
 		// cache controll
1370 1370
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1371
-		if($oCacheHandler->isSupport())
1371
+		if ($oCacheHandler->isSupport())
1372 1372
 		{
1373
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1373
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1374 1374
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1375 1375
 			$config = $oCacheHandler->get($cache_key);
1376 1376
 		}
1377 1377
 
1378
-		if($config === false)
1378
+		if ($config === false)
1379 1379
 		{
1380
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1380
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1381 1381
 			{
1382 1382
 				$args = new stdClass();
1383 1383
 				$args->module = $module;
1384 1384
 				$args->site_srl = $site_srl;
1385 1385
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1386
+				if ($output->data->config) $config = unserialize($output->data->config);
1387 1387
 				else $config = null;
1388 1388
 
1389 1389
 				//insert in cache
1390
-				if($oCacheHandler->isSupport())
1390
+				if ($oCacheHandler->isSupport())
1391 1391
 				{
1392 1392
 					$oCacheHandler->put($cache_key, $config);
1393 1393
 				}
@@ -1408,26 +1408,26 @@  discard block
 block discarded – undo
1408 1408
 		$config = false;
1409 1409
 		// cache controll
1410 1410
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1411
-		if($oCacheHandler->isSupport())
1411
+		if ($oCacheHandler->isSupport())
1412 1412
 		{
1413 1413
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1414 1414
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1415 1415
 			$config = $oCacheHandler->get($cache_key);
1416 1416
 		}
1417 1417
 
1418
-		if($config === false)
1418
+		if ($config === false)
1419 1419
 		{
1420
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1420
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1421 1421
 			{
1422 1422
 				$args = new stdClass();
1423 1423
 				$args->module = $module;
1424 1424
 				$args->module_srl = $module_srl;
1425 1425
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1426
+				if ($output->data->config) $config = unserialize($output->data->config);
1427 1427
 				else $config = null;
1428 1428
 
1429 1429
 				//insert in cache
1430
-				if($oCacheHandler->isSupport())
1430
+				if ($oCacheHandler->isSupport())
1431 1431
 				{
1432 1432
 					$oCacheHandler->put($cache_key, $config);
1433 1433
 				}
@@ -1446,11 +1446,11 @@  discard block
 block discarded – undo
1446 1446
 	{
1447 1447
 		$args = new stdClass();
1448 1448
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1449
+		if ($site_srl) $args->site_srl = $site_srl;
1450 1450
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1451
+		if (!$output->toBool() || !$output->data) return array();
1452 1452
 
1453
-		foreach($output->data as $key => $val)
1453
+		foreach ($output->data as $key => $val)
1454 1454
 		{
1455 1455
 			$result[$val->module_srl] = unserialize($val->config);
1456 1456
 		}
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1467
 		// Get data from the DB
1468 1468
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1469
+		if (!$output->toBool()) return $output;
1470 1470
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1471
+		if (!$list) return;
1472
+		if (!is_array($list)) $list = array($list);
1473 1473
 
1474
-		foreach($list as $val)
1474
+		foreach ($list as $val)
1475 1475
 		{
1476 1476
 			$category_list[$val->module_category_srl] = $val;
1477 1477
 		}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		$args = new stdClass;
1488 1488
 		$args->module_category_srl = $module_category_srl;
1489 1489
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1490
+		if (!$output->toBool()) return $output;
1491 1491
 		return $output->data;
1492 1492
 	}
1493 1493
 
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 		// Get a list of downloaded and installed modules
1500 1500
 		$searched_list = FileHandler::readDir('./modules');
1501 1501
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1502
+		if (!$searched_count) return;
1503 1503
 		sort($searched_list);
1504 1504
 
1505
-		for($i=0;$i<$searched_count;$i++)
1505
+		for ($i = 0; $i < $searched_count; $i++)
1506 1506
 		{
1507 1507
 			// Module name
1508 1508
 			$module_name = $searched_list[$i];
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 			$info = $this->getModuleInfoXml($module_name);
1513 1513
 			unset($obj);
1514 1514
 
1515
-			if(!isset($info)) continue;
1515
+			if (!isset($info)) continue;
1516 1516
 			$info->module = $module_name;
1517 1517
 			$info->created_table_count = $created_table_count;
1518 1518
 			$info->table_count = $table_count;
@@ -1529,19 +1529,19 @@  discard block
 block discarded – undo
1529 1529
 		$info = null;
1530 1530
 
1531 1531
 		$moduledir = ModuleHandler::getModulePath($module_name);
1532
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1532
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1533 1533
 		{
1534 1534
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1535 1535
 			$table_count = count($tmp_files);
1536 1536
 			// Check if the table is created
1537 1537
 			$created_table_count = 0;
1538
-			for($j=0;$j<count($tmp_files);$j++)
1538
+			for ($j = 0; $j < count($tmp_files); $j++)
1539 1539
 			{
1540
-				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1540
+				list($table_name) = explode(".", $tmp_files[$j]);
1541
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1542 1542
 			}
1543 1543
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1544
+			if ($table_count > $created_table_count) return true;
1545 1545
 			else return false;
1546 1546
 		}
1547 1547
 		return false;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 	{
1552 1552
 		// Check if it is upgraded to module.class.php on each module
1553 1553
 		$oDummy = getModule($module_name, 'class');
1554
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1554
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1555 1555
 		{
1556 1556
 			return $oDummy->checkUpdate();
1557 1557
 		}
@@ -1565,15 +1565,15 @@  discard block
 block discarded – undo
1565 1565
 	 */
1566 1566
 	public function needUpdate($update_id)
1567 1567
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1568
+		if (!is_array($update_id)) $update_id = array($update_id);
1569 1569
 
1570 1570
 		$args = new stdClass();
1571 1571
 		$args->update_id = implode(',', $update_id);
1572 1572
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1573
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1574
+		if (!!$output->error) return false;
1575
+		if (!$output->data) $output->data = array();
1576
+		if (count($update_id) === count($output->data)) return false;
1577 1577
 
1578 1578
 		return true;
1579 1579
 	}
@@ -1590,31 +1590,31 @@  discard block
 block discarded – undo
1590 1590
 		sort($searched_list);
1591 1591
 
1592 1592
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1593
+		if (!$searched_count) return;
1594 1594
 
1595
-		for($i=0;$i<$searched_count;$i++)
1595
+		for ($i = 0; $i < $searched_count; $i++)
1596 1596
 		{
1597 1597
 			// module name
1598 1598
 			$module_name = $searched_list[$i];
1599 1599
 
1600 1600
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1601
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1602 1602
 
1603 1603
 			// Get the number of xml files to create a table in schemas
1604 1604
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1605 1605
 			$table_count = count($tmp_files);
1606 1606
 			// Check if the table is created
1607 1607
 			$created_table_count = 0;
1608
-			for($j=0;$j<$table_count;$j++)
1608
+			for ($j = 0; $j < $table_count; $j++)
1609 1609
 			{
1610
-				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1610
+				list($table_name) = explode('.', $tmp_files[$j]);
1611
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1612 1612
 			}
1613 1613
 			// Get information of the module
1614 1614
 			$info = NULL;
1615 1615
 			$info = $this->getModuleInfoXml($module_name);
1616 1616
 
1617
-			if(!$info) continue;
1617
+			if (!$info) continue;
1618 1618
 
1619 1619
 			$info->module = $module_name;
1620 1620
 			$info->category = $info->category;
@@ -1623,12 +1623,12 @@  discard block
 block discarded – undo
1623 1623
 			$info->path = $path;
1624 1624
 			$info->admin_index_act = $info->admin_index_act;
1625 1625
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1626
+			if ($table_count > $created_table_count) $info->need_install = true;
1627 1627
 			else $info->need_install = false;
1628 1628
 			// Check if it is upgraded to module.class.php on each module
1629 1629
 			$oDummy = null;
1630 1630
 			$oDummy = getModule($module_name, 'class');
1631
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1631
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1632
 			{
1633 1633
 				$info->need_update = $oDummy->checkUpdate();
1634 1634
 			}
@@ -1649,15 +1649,15 @@  discard block
 block discarded – undo
1649 1649
 	 */
1650 1650
 	function syncModuleToSite(&$data)
1651 1651
 	{
1652
-		if(!$data) return;
1652
+		if (!$data) return;
1653 1653
 
1654
-		if(is_array($data))
1654
+		if (is_array($data))
1655 1655
 		{
1656
-			foreach($data as $key => $val)
1656
+			foreach ($data as $key => $val)
1657 1657
 			{
1658 1658
 				$module_srls[] = $val->module_srl;
1659 1659
 			}
1660
-			if(!count($module_srls)) return;
1660
+			if (!count($module_srls)) return;
1661 1661
 		}
1662 1662
 		else
1663 1663
 		{
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 		}
1666 1666
 
1667 1667
 		$args = new stdClass();
1668
-		$args->module_srls = implode(',',$module_srls);
1668
+		$args->module_srls = implode(',', $module_srls);
1669 1669
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1671
-		foreach($output->data as $key => $val)
1670
+		if (!$output->data) return array();
1671
+		foreach ($output->data as $key => $val)
1672 1672
 		{
1673 1673
 			$modules[$val->module_srl] = $val;
1674 1674
 		}
1675 1675
 
1676
-		if(is_array($data))
1676
+		if (is_array($data))
1677 1677
 		{
1678
-			foreach($data as $key => $val)
1678
+			foreach ($data as $key => $val)
1679 1679
 			{
1680 1680
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1681
 			}
@@ -1691,14 +1691,14 @@  discard block
 block discarded – undo
1691 1691
 	 */
1692 1692
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1693
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1694
+		if (!$member_info->member_srl) return false;
1695
+		if ($member_info->is_admin == 'Y') return true;
1696 1696
 
1697 1697
 		$args = new stdClass();
1698
-		if(!isset($site_srl))
1698
+		if (!isset($site_srl))
1699 1699
 		{
1700 1700
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1701
+			if (!$site_module_info) return;
1702 1702
 			$args->site_srl = $site_module_info->site_srl;
1703 1703
 		}
1704 1704
 		else
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
 		$args->member_srl = $member_info->member_srl;
1710 1710
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1711
+		if ($output->data->member_srl == $args->member_srl) return true;
1712 1712
 		return false;
1713 1713
 	}
1714 1714
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		$obj = new stdClass();
1732 1732
 		$obj->module_srl = $module_srl;
1733 1733
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1734
+		if (!$output->toBool() || !$output->data) return;
1735 1735
 
1736 1736
 		return $output->data;
1737 1737
 	}
@@ -1744,20 +1744,20 @@  discard block
 block discarded – undo
1744 1744
 	{
1745 1745
 		$extra_vars = array();
1746 1746
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1747
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1748 1748
 
1749 1749
 		$vars = false;
1750 1750
 		// cache controll
1751 1751
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1752
-		if($oCacheHandler->isSupport())
1752
+		if ($oCacheHandler->isSupport())
1753 1753
 		{
1754
-			foreach($list_module_srl as $module_srl)
1754
+			foreach ($list_module_srl as $module_srl)
1755 1755
 			{
1756 1756
 				$object_key = 'module_extra_vars:'.$module_srl;
1757 1757
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1758 1758
 				$vars = $oCacheHandler->get($cache_key);
1759 1759
 
1760
-				if($vars)
1760
+				if ($vars)
1761 1761
 				{
1762 1762
 					$extra_vars[$module_srl] = $vars;
1763 1763
 				}
@@ -1772,35 +1772,35 @@  discard block
 block discarded – undo
1772 1772
 			$get_module_srls = $list_module_srl;
1773 1773
 		}
1774 1774
 
1775
-		if(count($get_module_srls) > 0)
1775
+		if (count($get_module_srls) > 0)
1776 1776
 		{
1777 1777
 			$args = new stdClass();
1778 1778
 			$args->module_srl = implode(',', $get_module_srls);
1779 1779
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1780 1780
 
1781
-			if(!$output->toBool())
1781
+			if (!$output->toBool())
1782 1782
 			{
1783 1783
 				return;
1784 1784
 			}
1785 1785
 
1786
-			if(!$output->data)
1786
+			if (!$output->data)
1787 1787
 			{
1788
-				foreach($get_module_srls as $module_srl)
1788
+				foreach ($get_module_srls as $module_srl)
1789 1789
 				{
1790 1790
 					$extra_vars[$module_srl] = new stdClass;
1791 1791
 				}
1792 1792
 			}
1793
-			foreach($output->data as $key => $val)
1793
+			foreach ($output->data as $key => $val)
1794 1794
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1795
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1796 1796
 
1797
-				if(!isset($extra_vars[$val->module_srl]))
1797
+				if (!isset($extra_vars[$val->module_srl]))
1798 1798
 				{
1799 1799
 					$extra_vars[$val->module_srl] = new stdClass();
1800 1800
 				}
1801 1801
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1802 1802
 
1803
-				if($oCacheHandler->isSupport())
1803
+				if ($oCacheHandler->isSupport())
1804 1804
 				{
1805 1805
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1806 1806
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1819,27 +1819,27 @@  discard block
 block discarded – undo
1819 1819
 	{
1820 1820
 		$skin_vars = false;
1821 1821
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1822
-		if($oCacheHandler->isSupport())
1822
+		if ($oCacheHandler->isSupport())
1823 1823
 		{
1824 1824
 			$object_key = 'module_skin_vars:'.$module_srl;
1825 1825
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1826 1826
 			$skin_vars = $oCacheHandler->get($cache_key);
1827 1827
 		}
1828 1828
 
1829
-		if($skin_vars === false)
1829
+		if ($skin_vars === false)
1830 1830
 		{
1831 1831
 			$args = new stdClass();
1832 1832
 			$args->module_srl = $module_srl;
1833
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
1833
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1834
+			if (!$output->toBool()) return;
1835 1835
 
1836 1836
 			$skin_vars = array();
1837
-			foreach($output->data as $vars)
1837
+			foreach ($output->data as $vars)
1838 1838
 			{
1839 1839
 				$skin_vars[$vars->name] = $vars;
1840 1840
 			}
1841 1841
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1842
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1843 1843
 		}
1844 1844
 
1845 1845
 		return $skin_vars;
@@ -1851,32 +1851,32 @@  discard block
 block discarded – undo
1851 1851
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 1852
 	{
1853 1853
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
1854
+		if (!$site_srl) $site_srl = 0;
1855 1855
 
1856 1856
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857
-		if(is_readable($designInfoFile))
1857
+		if (is_readable($designInfoFile))
1858 1858
 		{
1859 1859
 			include($designInfoFile);
1860 1860
 
1861 1861
 			$skinName = $designInfo->module->{$module_name}->{$target};
1862 1862
 		}
1863
-		if(!$skinName)
1863
+		if (!$skinName)
1864 1864
 		{
1865 1865
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1866 1866
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1867 1867
 
1868
-			if(is_dir($moduleSkinPath.'default'))
1868
+			if (is_dir($moduleSkinPath.'default'))
1869 1869
 			{
1870 1870
 				$skinName = 'default';
1871 1871
 			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
1872
+			else if (is_dir($moduleSkinPath.'xe_default'))
1873 1873
 			{
1874 1874
 				$skinName = 'xe_default';
1875 1875
 			}
1876 1876
 			else
1877 1877
 			{
1878 1878
 				$skins = FileHandler::readDir($moduleSkinPath);
1879
-				if(count($skins) > 0)
1879
+				if (count($skins) > 0)
1880 1880
 				{
1881 1881
 					$skinName = $skins[0];
1882 1882
 				}
@@ -1886,9 +1886,9 @@  discard block
 block discarded – undo
1886 1886
 				}
1887 1887
 			}
1888 1888
 
1889
-			if($updateCache && $skinName)
1889
+			if ($updateCache && $skinName)
1890 1890
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1891
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1892 1892
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 1893
 
1894 1894
 				$oAdminController = getAdminController('admin');
@@ -1904,10 +1904,10 @@  discard block
 block discarded – undo
1904 1904
 	 */
1905 1905
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 1906
 	{
1907
-		if(!$module_info->module_srl) return;
1907
+		if (!$module_info->module_srl) return;
1908 1908
 
1909 1909
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910
-		if(Mobile::isFromMobilePhone())
1910
+		if (Mobile::isFromMobilePhone())
1911 1911
 		{
1912 1912
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913 1913
 		}
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 1917
 		}
1918 1918
 
1919
-		if(!$skin_vars) return;
1919
+		if (!$skin_vars) return;
1920 1920
 
1921
-		foreach($skin_vars as $name => $val)
1921
+		foreach ($skin_vars as $name => $val)
1922 1922
 		{
1923
-			if(isset($module_info->{$name})) continue;
1923
+			if (isset($module_info->{$name})) continue;
1924 1924
 			$module_info->{$name} = $val->value;
1925 1925
 		}
1926 1926
 	}
@@ -1934,27 +1934,27 @@  discard block
 block discarded – undo
1934 1934
 	{
1935 1935
 		$skin_vars = false;
1936 1936
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1937
-		if($oCacheHandler->isSupport())
1937
+		if ($oCacheHandler->isSupport())
1938 1938
 		{
1939 1939
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1940 1940
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1941 1941
 			$skin_vars = $oCacheHandler->get($cache_key);
1942 1942
 		}
1943 1943
 
1944
-		if($skin_vars === false)
1944
+		if ($skin_vars === false)
1945 1945
 		{
1946 1946
 			$args = new stdClass();
1947 1947
 			$args->module_srl = $module_srl;
1948
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
1948
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1949
+			if (!$output->toBool() || !$output->data) return;
1950 1950
 
1951 1951
 			$skin_vars = array();
1952
-			foreach($output->data as $vars)
1952
+			foreach ($output->data as $vars)
1953 1953
 			{
1954 1954
 				$skin_vars[$vars->name] = $vars;
1955 1955
 			}
1956 1956
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1957
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1958 1958
 		}
1959 1959
 
1960 1960
 		return $skin_vars;
@@ -1966,32 +1966,32 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 1968
 	{
1969
-		if(!$module_info->module_srl) return;
1969
+		if (!$module_info->module_srl) return;
1970 1970
 		$skin_vars = false;
1971 1971
 		// cache controll
1972 1972
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1973
-		if($oCacheHandler->isSupport())
1973
+		if ($oCacheHandler->isSupport())
1974 1974
 		{
1975 1975
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1976 1976
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1977 1977
 			$skin_vars = $oCacheHandler->get($cache_key);
1978 1978
 		}
1979
-		if($skin_vars === false)
1979
+		if ($skin_vars === false)
1980 1980
 		{
1981 1981
 			$args = new stdClass;
1982 1982
 			$args->module_srl = $module_info->module_srl;
1983
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
1983
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1984
+			if (!$output->toBool()) return;
1985 1985
 			$skin_vars = $output->data;
1986 1986
 
1987 1987
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1988
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1989 1989
 		}
1990
-		if(!$skin_vars) return;
1990
+		if (!$skin_vars) return;
1991 1991
 
1992
-		foreach($output->data as $val)
1992
+		foreach ($output->data as $val)
1993 1993
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
1994
+			if (isset($module_info->{$val->name})) continue;
1995 1995
 			$module_info->{$val->name} = $val->value;
1996 1996
 		}
1997 1997
 	}
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 	{
2004 2004
 		$grant = new stdClass();
2005 2005
 
2006
-		if(!$xml_info)
2006
+		if (!$xml_info)
2007 2007
 		{
2008 2008
 			$module = $module_info->module;
2009 2009
 			$xml_info = $this->getModuleActionXml($module);
@@ -2011,9 +2011,9 @@  discard block
 block discarded – undo
2011 2011
 		// Set variables to grant group permission
2012 2012
 		$module_srl = $module_info->module_srl;
2013 2013
 		$grant_info = $xml_info->grant;
2014
-		if($member_info->member_srl)
2014
+		if ($member_info->member_srl)
2015 2015
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2016
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017 2017
 			else $group_list = array();
2018 2018
 		}
2019 2019
 		else
@@ -2021,10 +2021,10 @@  discard block
 block discarded – undo
2021 2021
 			$group_list = array();
2022 2022
 		}
2023 2023
 		// If module_srl doesn't exist(if unable to set permissions)
2024
-		if(!$module_srl)
2024
+		if (!$module_srl)
2025 2025
 		{
2026 2026
 			$grant->access = true;
2027
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2027
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2028 2028
 			{
2029 2029
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2030 2030
 			}
@@ -2035,23 +2035,23 @@  discard block
 block discarded – undo
2035 2035
 		{
2036 2036
 			// If module_srl exists
2037 2037
 			// Get a type of granted permission
2038
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2038
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2039 2039
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2040 2040
 			// If a just logged-in member is, check if the member is a module administrator
2041
-			if(!$grant->manager && $member_info->member_srl)
2041
+			if (!$grant->manager && $member_info->member_srl)
2042 2042
 			{
2043 2043
 				$args = new stdClass();
2044 2044
 				$args->module_srl = $module_srl;
2045 2045
 				$args->member_srl = $member_info->member_srl;
2046
-				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2046
+				$output = executeQuery('module.getModuleAdmin', $args);
2047
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2048 2048
 			}
2049 2049
 			// If not an administrator, get information from the DB and grant manager privilege.
2050
-			if(!$grant->manager)
2050
+			if (!$grant->manager)
2051 2051
 			{
2052 2052
 				$args = new stdClass();
2053 2053
 				// If planet, get permission settings from the planet home
2054
-				if($module_info->module == 'planet')
2054
+				if ($module_info->module == 'planet')
2055 2055
 				{
2056 2056
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057 2057
 				}
@@ -2064,42 +2064,42 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
 				$grant_exists = $granted = array();
2066 2066
 
2067
-				if($output->data)
2067
+				if ($output->data)
2068 2068
 				{
2069 2069
 					// Arrange names and groups who has privileges
2070
-					foreach($output->data as $val)
2070
+					foreach ($output->data as $val)
2071 2071
 					{
2072 2072
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2073
+						if ($granted[$val->name]) continue;
2074 2074
 						// Log-in member only
2075
-						if($val->group_srl == -1)
2075
+						if ($val->group_srl == -1)
2076 2076
 						{
2077 2077
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2078
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2079 2079
 							// Site-joined member only
2080 2080
 						}
2081
-						elseif($val->group_srl == -2)
2081
+						elseif ($val->group_srl == -2)
2082 2082
 						{
2083 2083
 							$granted[$val->name] = true;
2084 2084
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2085
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2086 2086
 							// Log-in member
2087 2087
 							else
2088 2088
 							{
2089 2089
 								$site_module_info = Context::get('site_module_info');
2090 2090
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2091
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2092 2092
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2093
+								elseif (count($group_list)) $grant->{$val->name} = true;
2094 2094
 							}
2095 2095
 							// All of non-logged members
2096 2096
 						}
2097
-						elseif($val->group_srl == -3)
2097
+						elseif ($val->group_srl == -3)
2098 2098
 						{
2099 2099
 							$granted[$val->name] = true;
2100 2100
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101 2101
 						}
2102
-						elseif($val->group_srl == 0)
2102
+						elseif ($val->group_srl == 0)
2103 2103
 						{
2104 2104
 							$granted[$val->name] = true;
2105 2105
 							$grant->{$val->name} = true;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 						}
2108 2108
 						else
2109 2109
 						{
2110
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2110
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2111
 							{
2112 2112
 								$grant->{$val->name} = true;
2113 2113
 								$granted[$val->name] = true;
@@ -2116,29 +2116,29 @@  discard block
 block discarded – undo
2116 2116
 					}
2117 2117
 				}
2118 2118
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2120
-				if(count($grant_info))
2119
+				if (!$grant_exists['access']) $grant->access = true;
2120
+				if (count($grant_info))
2121 2121
 				{
2122
-					foreach($grant_info as  $grant_name => $grant_item)
2122
+					foreach ($grant_info as  $grant_name => $grant_item)
2123 2123
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2125
-						switch($grant_item->default)
2124
+						if ($grant_exists[$grant_name]) continue;
2125
+						switch ($grant_item->default)
2126 2126
 						{
2127 2127
 							case 'guest' :
2128 2128
 								$grant->{$grant_name} = true;
2129 2129
 								break;
2130 2130
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2131
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2132 2132
 								else $grant->{$grant_name} = false;
2133 2133
 								break;
2134 2134
 							case 'site' :
2135 2135
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2136
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137 2137
 								else $grant->{$grant_name} = false;
2138 2138
 								break;
2139 2139
 							case 'manager' :
2140 2140
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2141
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142 2142
 								else $grant->{$grant_name} = false;
2143 2143
 								break;
2144 2144
 						}
@@ -2146,12 +2146,12 @@  discard block
 block discarded – undo
2146 2146
 				}
2147 2147
 			}
2148 2148
 			// Set true to grant all privileges if an administrator is
2149
-			if($grant->manager)
2149
+			if ($grant->manager)
2150 2150
 			{
2151 2151
 				$grant->access = true;
2152
-				if(count($grant_info))
2152
+				if (count($grant_info))
2153 2153
 				{
2154
-					foreach($grant_info as $key => $val)
2154
+					foreach ($grant_info as $key => $val)
2155 2155
 					{
2156 2156
 						$grant->{$key} = true;
2157 2157
 					}
@@ -2183,27 +2183,27 @@  discard block
 block discarded – undo
2183 2183
 
2184 2184
 	function unserializeAttributes($module_filebox_list)
2185 2185
 	{
2186
-		if(is_array($module_filebox_list->data))
2186
+		if (is_array($module_filebox_list->data))
2187 2187
 		{
2188
-			foreach($module_filebox_list->data as &$item)
2188
+			foreach ($module_filebox_list->data as &$item)
2189 2189
 			{
2190
-				if(empty($item->comment))
2190
+				if (empty($item->comment))
2191 2191
 				{
2192 2192
 					continue;
2193 2193
 				}
2194 2194
 
2195 2195
 				$attributes = explode(';', $item->comment);
2196
-				foreach($attributes as $attribute)
2196
+				foreach ($attributes as $attribute)
2197 2197
 				{
2198 2198
 					$values = explode(':', $attribute);
2199
-					if((count($values) % 2) ==1)
2199
+					if ((count($values) % 2) == 1)
2200 2200
 					{
2201
-						for($i=2;$i<count($values);$i++)
2201
+						for ($i = 2; $i < count($values); $i++)
2202 2202
 						{
2203
-							$values[1].=":".$values[$i];
2203
+							$values[1] .= ":".$values[$i];
2204 2204
 						}
2205 2205
 					}
2206
-					$atts[$values[0]]=$values[1];
2206
+					$atts[$values[0]] = $values[1];
2207 2207
 				}
2208 2208
 				$item->attributes = $atts;
2209 2209
 				unset($atts);
@@ -2215,16 +2215,16 @@  discard block
 block discarded – undo
2215 2215
 	function getFileBoxListHtml()
2216 2216
 	{
2217 2217
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2218
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2219 2219
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220
-		$link_params = explode('&',$link['query']);
2220
+		$link_params = explode('&', $link['query']);
2221 2221
 		foreach ($link_params as $param)
2222 2222
 		{
2223
-			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2223
+			$param = explode("=", $param);
2224
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2225 2225
 		}
2226 2226
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2227
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2228 2228
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2229
 
2230 2230
 		$oModuleModel = getModel('module');
@@ -2240,24 +2240,24 @@  discard block
 block discarded – undo
2240 2240
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2241 2241
 
2242 2242
 		$oTemplate = &TemplateHandler::getInstance();
2243
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2243
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2244 2244
 
2245 2245
 		$this->add('html', $html);
2246 2246
 	}
2247 2247
 
2248 2248
 	function getModuleFileBoxPath($module_filebox_srl)
2249 2249
 	{
2250
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2250
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2251 2251
 	}
2252 2252
 
2253 2253
 	/**
2254 2254
 	 * @brief Return ruleset cache file path
2255 2255
 	 * @param module, act
2256 2256
 	 */
2257
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2257
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2258 2258
 	{
2259 2259
 		// load dynamic ruleset xml file
2260
-		if(strpos($ruleset, '@') !== false)
2260
+		if (strpos($ruleset, '@') !== false)
2261 2261
 		{
2262 2262
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2263
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2267,20 +2267,20 @@  discard block
 block discarded – undo
2267 2267
 		{
2268 2268
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2269
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2270
+			if (is_readable($xml_file))
2271 2271
 				return FileHandler::getRealPath($xml_file);
2272
-			else{
2272
+			else {
2273 2273
 				$ruleset = str_replace('#', '', $ruleset);
2274 2274
 			}
2275 2275
 
2276 2276
 		}
2277 2277
 		// Get a path of the requested module. Return if not exists.
2278 2278
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2279
+		if (!$class_path) return;
2280 2280
 
2281 2281
 		// Check if module.xml exists in the path. Return if not exist
2282 2282
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2283
+		if (!file_exists($xml_file)) return;
2284 2284
 
2285 2285
 		return $xml_file;
2286 2286
 	}
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 		$requestVars = Context::getRequestVars();
2293 2293
 
2294 2294
 		$args = new stdClass;
2295
-		$args->site_srl = (int)$requestVars->site_srl;
2295
+		$args->site_srl = (int) $requestVars->site_srl;
2296 2296
 		$args->page = 1; // /< Page
2297 2297
 		$args->list_count = 100; // /< the number of posts to display on a single page
2298 2298
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2304,9 +2304,9 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 		$list = array();
2306 2306
 
2307
-		if($output->toBool())
2307
+		if ($output->toBool())
2308 2308
 		{
2309
-			foreach((array)$output->data as $code_info)
2309
+			foreach ((array) $output->data as $code_info)
2310 2310
 			{
2311 2311
 				unset($codeInfo);
2312 2312
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
Braces   +470 added lines, -209 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$hostname = $request_url_parse['host'];
101 113
 			$path = $request_url_parse['path'];
102 114
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,11 +435,14 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
443
+		if(isset($module_info->browser_title)) {
444
+			$oModuleController->replaceDefinedLangCode($module_info->browser_title);
445
+		}
407 446
 
408 447
 		$this->applyDefaultSkin($module_info);
409 448
 		return $this->addModuleExtraVars($module_info);
@@ -451,11 +490,15 @@  discard block
 block discarded – undo
451 490
 	 */
452 491
 	function getModulesInfo($module_srls, $columnList = array())
453 492
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
493
+		if(is_array($module_srls)) {
494
+			$module_srls = implode(',',$module_srls);
495
+		}
455 496
 		$args = new stdClass();
456 497
 		$args->module_srls = $module_srls;
457 498
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
499
+		if(!$output->toBool()) {
500
+			return;
501
+		}
459 502
 		return $this->addModuleExtraVars($output->data);
460 503
 	}
461 504
 
@@ -465,31 +508,44 @@  discard block
 block discarded – undo
465 508
 	function addModuleExtraVars($module_info)
466 509
 	{
467 510
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
469
-		else $target_module_info = $module_info;
511
+		if(!is_array($module_info)) {
512
+			$target_module_info = array($module_info);
513
+		} else {
514
+			$target_module_info = $module_info;
515
+		}
470 516
 		// Get module_srl
471 517
 		$module_srls = array();
472 518
 		foreach($target_module_info as $key => $val)
473 519
 		{
474 520
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
521
+			if(!$module_srl) {
522
+				continue;
523
+			}
476 524
 			$module_srls[] = $val->module_srl;
477 525
 		}
478 526
 		// Extract extra information of the module and skin
479 527
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
528
+		if(!count($module_srls) || !count($extra_vars)) {
529
+			return $module_info;
530
+		}
481 531
 
482 532
 		foreach($target_module_info as $key => $val)
483 533
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
534
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
535
+				continue;
536
+			}
485 537
 			foreach($extra_vars[$val->module_srl] as $k => $v)
486 538
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
539
+				if($target_module_info[$key]->{$k}) {
540
+					continue;
541
+				}
488 542
 				$target_module_info[$key]->{$k} = $v;
489 543
 			}
490 544
 		}
491 545
 
492
-		if(is_array($module_info)) return $target_module_info;
546
+		if(is_array($module_info)) {
547
+			return $target_module_info;
548
+		}
493 549
 		return $target_module_info[0];
494 550
 	}
495 551
 
@@ -518,7 +574,9 @@  discard block
 block discarded – undo
518 574
 			}
519 575
 
520 576
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
577
+			if(!$output->toBool()) {
578
+				return $output;
579
+			}
522 580
 			$list = $output->data;
523 581
 
524 582
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -526,9 +584,13 @@  discard block
 block discarded – undo
526 584
 				$oCacheHandler->put($cache_key, $list);
527 585
 			}
528 586
 		}
529
-		if(!$list) return;
587
+		if(!$list) {
588
+			return;
589
+		}
530 590
 
531
-		if(!is_array($list)) $list = array($list);
591
+		if(!is_array($list)) {
592
+			$list = array($list);
593
+		}
532 594
 
533 595
 		foreach($list as $val)
534 596
 		{
@@ -544,10 +606,14 @@  discard block
 block discarded – undo
544 606
 	function getModuleSrlList($args = null, $columnList = array())
545 607
 	{
546 608
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
609
+		if(!$output->toBool()) {
610
+			return $output;
611
+		}
548 612
 
549 613
 		$list = $output->data;
550
-		if(!$list) return;
614
+		if(!$list) {
615
+			return;
616
+		}
551 617
 
552 618
 		return $list;
553 619
 	}
@@ -557,20 +623,32 @@  discard block
 block discarded – undo
557 623
 	 */
558 624
 	function getModuleSrlByMid($mid)
559 625
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
626
+		if($mid && !is_array($mid)) {
627
+			$mid = explode(',',$mid);
628
+		}
629
+		if(is_array($mid)) {
630
+			$mid = "'".implode("','",$mid)."'";
631
+		}
562 632
 
563 633
 		$site_module_info = Context::get('site_module_info');
564 634
 
565 635
 		$args = new stdClass;
566 636
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
637
+		if($site_module_info) {
638
+			$args->site_srl = $site_module_info->site_srl;
639
+		}
568 640
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
641
+		if(!$output->toBool()) {
642
+			return $output;
643
+		}
570 644
 
571 645
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
646
+		if(!$list) {
647
+			return;
648
+		}
649
+		if(!is_array($list)) {
650
+			$list = array($list);
651
+		}
574 652
 
575 653
 		foreach($list as $key => $val)
576 654
 		{
@@ -599,8 +677,12 @@  discard block
 block discarded – undo
599 677
 		{
600 678
 			$args = new stdClass();
601 679
 			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
680
+			if(!$output->toBool()) {
681
+				return new stdClass;
682
+			}
683
+			if(!$output->data) {
684
+				$output->data = array();
685
+			}
604 686
 
605 687
 			$action_forward = array();
606 688
 			foreach($output->data as $item)
@@ -617,8 +699,7 @@  discard block
 block discarded – undo
617 699
 		if($action_forward[$act])
618 700
 		{
619 701
 			return $action_forward[$act];
620
-		}
621
-		else
702
+		} else
622 703
 		{
623 704
 			return new stdClass();
624 705
 		}
@@ -726,8 +807,7 @@  discard block
 block discarded – undo
726 807
 			if(file_exists($cache_file))
727 808
 			{
728 809
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729
-			}
730
-			else
810
+			} else
731 811
 			{
732 812
 				$GLOBALS['__MODULE_EXTEND__'] = array();
733 813
 			}
@@ -743,16 +823,22 @@  discard block
 block discarded – undo
743 823
 	{
744 824
 		// Get a path of the requested module. Return if not exists.
745 825
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
826
+		if(!$module_path) {
827
+			return;
828
+		}
747 829
 		// Read the xml file for module skin information
748 830
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
831
+		if(!file_exists($xml_file)) {
832
+			return;
833
+		}
750 834
 
751 835
 		$oXmlParser = new XmlParser();
752 836
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 837
 		$xml_obj = $tmp_xml_obj->module;
754 838
 
755
-		if(!$xml_obj) return;
839
+		if(!$xml_obj) {
840
+			return;
841
+		}
756 842
 
757 843
 		// Module Information
758 844
 		$module_info = new stdClass();
@@ -764,14 +850,19 @@  discard block
 block discarded – undo
764 850
 			$module_info->version = $xml_obj->version->body;
765 851
 			$module_info->homepage = $xml_obj->link->body;
766 852
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
853
+			if(!$module_info->category) {
854
+				$module_info->category = 'service';
855
+			}
768 856
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 857
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 858
 			$module_info->license = $xml_obj->license->body;
771 859
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 860
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774
-			else $author_list = $xml_obj->author;
861
+			if(!is_array($xml_obj->author)) {
862
+				$author_list[] = $xml_obj->author;
863
+			} else {
864
+				$author_list = $xml_obj->author;
865
+			}
775 866
 
776 867
 			foreach($author_list as $author)
777 868
 			{
@@ -781,15 +872,16 @@  discard block
 block discarded – undo
781 872
 				$author_obj->homepage = $author->attrs->link;
782 873
 				$module_info->author[] = $author_obj;
783 874
 			}
784
-		}
785
-		else
875
+		} else
786 876
 		{
787 877
 			// module format 0.1
788 878
 			$module_info->title = $xml_obj->title->body;
789 879
 			$module_info->description = $xml_obj->author->description->body;
790 880
 			$module_info->version = $xml_obj->attrs->version;
791 881
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
882
+			if(!$module_info->category) {
883
+				$module_info->category = 'service';
884
+			}
793 885
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 886
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 887
 			$author_obj = new stdClass();
@@ -818,11 +910,15 @@  discard block
 block discarded – undo
818 910
 	{
819 911
 		// Get a path of the requested module. Return if not exists.
820 912
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
913
+		if(!$class_path) {
914
+			return;
915
+		}
822 916
 
823 917
 		// Check if module.xml exists in the path. Return if not exist
824 918
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
919
+		if(!file_exists($xml_file)) {
920
+			return;
921
+		}
826 922
 
827 923
 		// Check if cached file exists
828 924
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -841,7 +937,10 @@  discard block
 block discarded – undo
841 937
 
842 938
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 939
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
940
+			if(!count($xml_obj->module)) {
941
+				return;
942
+			}
943
+			// /< Error occurs if module tag doesn't included in the xml
845 944
 
846 945
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 946
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -853,8 +952,11 @@  discard block
 block discarded – undo
853 952
 			// Arrange permission information
854 953
 			if($grants)
855 954
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
857
-				else $grant_list[] = $grants;
955
+				if(is_array($grants)) {
956
+					$grant_list = $grants;
957
+				} else {
958
+					$grant_list[] = $grants;
959
+				}
858 960
 
859 961
 				$info->grant = new stdClass();
860 962
 				$buff[] = '$info->grant = new stdClass;';
@@ -876,8 +978,11 @@  discard block
 block discarded – undo
876 978
 			// Permissions to grant
877 979
 			if($permissions)
878 980
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
880
-				else $permission_list[] = $permissions;
981
+				if(is_array($permissions)) {
982
+					$permission_list = $permissions;
983
+				} else {
984
+					$permission_list[] = $permissions;
985
+				}
881 986
 
882 987
 				$buff[] = '$info->permission = new stdClass;';
883 988
 
@@ -895,8 +1000,11 @@  discard block
 block discarded – undo
895 1000
 			// for admin menus
896 1001
 			if($menus)
897 1002
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
899
-				else $menu_list[] = $menus;
1003
+				if(is_array($menus)) {
1004
+					$menu_list = $menus;
1005
+				} else {
1006
+					$menu_list[] = $menus;
1007
+				}
900 1008
 
901 1009
 				$buff[] = '$info->menu = new stdClass;';
902 1010
 				$info->menu = new stdClass();
@@ -920,8 +1028,11 @@  discard block
 block discarded – undo
920 1028
 			// actions
921 1029
 			if($actions)
922 1030
 			{
923
-				if(is_array($actions)) $action_list = $actions;
924
-				else $action_list[] = $actions;
1031
+				if(is_array($actions)) {
1032
+					$action_list = $actions;
1033
+				} else {
1034
+					$action_list[] = $actions;
1035
+				}
925 1036
 
926 1037
 				$buff[] = '$info->action = new stdClass;';
927 1038
 				$info->action = new stdClass();
@@ -1010,7 +1121,9 @@  discard block
 block discarded – undo
1010 1121
 			return $info;
1011 1122
 		}
1012 1123
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1124
+		if(file_exists($cache_file)) {
1125
+			return include($cache_file);
1126
+		}
1014 1127
 	}
1015 1128
 
1016 1129
 	/**
@@ -1048,7 +1161,9 @@  discard block
 block discarded – undo
1048 1161
 
1049 1162
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1163
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1164
+		if(!count($list)) {
1165
+			return;
1166
+		}
1052 1167
 
1053 1168
 		natcasesort($list);
1054 1169
 
@@ -1102,8 +1217,7 @@  discard block
 block discarded – undo
1102 1217
 			if($dir == 'skins')
1103 1218
 			{
1104 1219
 				$type = 'P';
1105
-			}
1106
-			else
1220
+			} else
1107 1221
 			{
1108 1222
 				$type = 'M';
1109 1223
 			}
@@ -1131,14 +1245,20 @@  discard block
 block discarded – undo
1131 1245
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1246
 	{
1133 1247
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1248
+		if(substr($path,-1)!='/') {
1249
+			$path .= '/';
1250
+		}
1135 1251
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1252
+		if(!file_exists($skin_xml_file)) {
1253
+			return;
1254
+		}
1137 1255
 		// Create XmlParser object
1138 1256
 		$oXmlParser = new XmlParser();
1139 1257
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1258
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1259
+		if(!$_xml_obj->skin) {
1260
+			return;
1261
+		}
1142 1262
 		$xml_obj = $_xml_obj->skin;
1143 1263
 		// Skin Name
1144 1264
 		$skin_info = new stdClass();
@@ -1155,8 +1275,11 @@  discard block
 block discarded – undo
1155 1275
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1276
 			$skin_info->description = $xml_obj->description->body;
1157 1277
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159
-			else $author_list = $xml_obj->author;
1278
+			if(!is_array($xml_obj->author)) {
1279
+				$author_list[] = $xml_obj->author;
1280
+			} else {
1281
+				$author_list = $xml_obj->author;
1282
+			}
1160 1283
 
1161 1284
 			foreach($author_list as $author)
1162 1285
 			{
@@ -1170,8 +1293,12 @@  discard block
 block discarded – undo
1170 1293
 			if($xml_obj->extra_vars)
1171 1294
 			{
1172 1295
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1296
+				if(!$extra_var_groups) {
1297
+					$extra_var_groups = $xml_obj->extra_vars;
1298
+				}
1299
+				if(!is_array($extra_var_groups)) {
1300
+					$extra_var_groups = array($extra_var_groups);
1301
+				}
1175 1302
 
1176 1303
 				foreach($extra_var_groups as $group)
1177 1304
 				{
@@ -1180,7 +1307,9 @@  discard block
 block discarded – undo
1180 1307
 					{
1181 1308
 						continue;
1182 1309
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1310
+					if(!is_array($group->var)) {
1311
+						$extra_vars = array($group->var);
1312
+					}
1184 1313
 
1185 1314
 					foreach($extra_vars as $key => $val)
1186 1315
 					{
@@ -1207,8 +1336,7 @@  discard block
 block discarded – undo
1207 1336
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1208 1337
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1209 1338
 							}
1210
-						}
1211
-						else
1339
+						} else
1212 1340
 						{
1213 1341
 							$obj->options[0] = new stdClass();
1214 1342
 							$obj->options[0]->title = $val->options->title->body;
@@ -1219,8 +1347,7 @@  discard block
 block discarded – undo
1219 1347
 					}
1220 1348
 				}
1221 1349
 			}
1222
-		}
1223
-		else
1350
+		} else
1224 1351
 		{
1225 1352
 			// skin format v0.1
1226 1353
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1238,8 +1365,12 @@  discard block
 block discarded – undo
1238 1365
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1366
 			// Variables used in the skin
1240 1367
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1368
+			if(!$extra_var_groups) {
1369
+				$extra_var_groups = $xml_obj->extra_vars;
1370
+			}
1371
+			if(!is_array($extra_var_groups)) {
1372
+				$extra_var_groups = array($extra_var_groups);
1373
+			}
1243 1374
 
1244 1375
 			foreach($extra_var_groups as $group)
1245 1376
 			{
@@ -1247,7 +1378,9 @@  discard block
 block discarded – undo
1247 1378
 
1248 1379
 				if($extra_vars)
1249 1380
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1381
+					if(!is_array($extra_vars)) {
1382
+						$extra_vars = array($extra_vars);
1383
+					}
1251 1384
 
1252 1385
 					foreach($extra_vars as $var)
1253 1386
 					{
@@ -1269,8 +1402,7 @@  discard block
 block discarded – undo
1269 1402
 								$options[$i]->title = $var->default[$i]->body;
1270 1403
 								$options[$i]->value = $var->default[$i]->body;
1271 1404
 							}
1272
-						}
1273
-						else
1405
+						} else
1274 1406
 						{
1275 1407
 							$options[0]->title = $var->default->body;
1276 1408
 							$options[0]->value = $var->default->body;
@@ -1300,7 +1432,9 @@  discard block
 block discarded – undo
1300 1432
 		$colorset = $xml_obj->colorset->color;
1301 1433
 		if($colorset)
1302 1434
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1435
+			if(!is_array($colorset)) {
1436
+				$colorset = array($colorset);
1437
+			}
1304 1438
 
1305 1439
 			foreach($colorset as $color)
1306 1440
 			{
@@ -1310,9 +1444,12 @@  discard block
 block discarded – undo
1310 1444
 				if($screenshot)
1311 1445
 				{
1312 1446
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1447
+					if(!file_exists($screenshot)) {
1448
+						$screenshot = "";
1449
+					}
1450
+				} else {
1451
+					$screenshot = "";
1314 1452
 				}
1315
-				else $screenshot = "";
1316 1453
 
1317 1454
 				$obj = new stdClass();
1318 1455
 				$obj->name = $name;
@@ -1325,7 +1462,9 @@  discard block
 block discarded – undo
1325 1462
 		if($xml_obj->menus->menu)
1326 1463
 		{
1327 1464
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1465
+			if(!is_array($menus)) {
1466
+				$menus = array($menus);
1467
+			}
1329 1468
 
1330 1469
 			$menu_count = count($menus);
1331 1470
 			$skin_info->menu_count = $menu_count;
@@ -1334,7 +1473,9 @@  discard block
 block discarded – undo
1334 1473
 				unset($obj);
1335 1474
 
1336 1475
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1476
+				if($menus[$i]->attrs->default == "true") {
1477
+					$obj->default = true;
1478
+				}
1338 1479
 				$obj->title = $menus[$i]->title->body;
1339 1480
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1481
 
@@ -1354,7 +1495,9 @@  discard block
 block discarded – undo
1354 1495
 	{
1355 1496
 		$args = new stdClass;
1356 1497
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1498
+		if(!is_null($module)) {
1499
+			$args->module = $module;
1500
+		}
1358 1501
 		$output = executeQuery('module.getModuleCount', $args);
1359 1502
 		return $output->data->count;
1360 1503
 	}
@@ -1383,8 +1526,11 @@  discard block
 block discarded – undo
1383 1526
 				$args->module = $module;
1384 1527
 				$args->site_srl = $site_srl;
1385 1528
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1387
-				else $config = null;
1529
+				if($output->data->config) {
1530
+					$config = unserialize($output->data->config);
1531
+				} else {
1532
+					$config = null;
1533
+				}
1388 1534
 
1389 1535
 				//insert in cache
1390 1536
 				if($oCacheHandler->isSupport())
@@ -1423,8 +1569,11 @@  discard block
 block discarded – undo
1423 1569
 				$args->module = $module;
1424 1570
 				$args->module_srl = $module_srl;
1425 1571
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1427
-				else $config = null;
1572
+				if($output->data->config) {
1573
+					$config = unserialize($output->data->config);
1574
+				} else {
1575
+					$config = null;
1576
+				}
1428 1577
 
1429 1578
 				//insert in cache
1430 1579
 				if($oCacheHandler->isSupport())
@@ -1446,9 +1595,13 @@  discard block
 block discarded – undo
1446 1595
 	{
1447 1596
 		$args = new stdClass();
1448 1597
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1598
+		if($site_srl) {
1599
+			$args->site_srl = $site_srl;
1600
+		}
1450 1601
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1602
+		if(!$output->toBool() || !$output->data) {
1603
+			return array();
1604
+		}
1452 1605
 
1453 1606
 		foreach($output->data as $key => $val)
1454 1607
 		{
@@ -1466,10 +1619,16 @@  discard block
 block discarded – undo
1466 1619
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1620
 		// Get data from the DB
1468 1621
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1622
+		if(!$output->toBool()) {
1623
+			return $output;
1624
+		}
1470 1625
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1626
+		if(!$list) {
1627
+			return;
1628
+		}
1629
+		if(!is_array($list)) {
1630
+			$list = array($list);
1631
+		}
1473 1632
 
1474 1633
 		foreach($list as $val)
1475 1634
 		{
@@ -1487,7 +1646,9 @@  discard block
 block discarded – undo
1487 1646
 		$args = new stdClass;
1488 1647
 		$args->module_category_srl = $module_category_srl;
1489 1648
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1649
+		if(!$output->toBool()) {
1650
+			return $output;
1651
+		}
1491 1652
 		return $output->data;
1492 1653
 	}
1493 1654
 
@@ -1499,7 +1660,9 @@  discard block
 block discarded – undo
1499 1660
 		// Get a list of downloaded and installed modules
1500 1661
 		$searched_list = FileHandler::readDir('./modules');
1501 1662
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1663
+		if(!$searched_count) {
1664
+			return;
1665
+		}
1503 1666
 		sort($searched_list);
1504 1667
 
1505 1668
 		for($i=0;$i<$searched_count;$i++)
@@ -1512,7 +1675,9 @@  discard block
 block discarded – undo
1512 1675
 			$info = $this->getModuleInfoXml($module_name);
1513 1676
 			unset($obj);
1514 1677
 
1515
-			if(!isset($info)) continue;
1678
+			if(!isset($info)) {
1679
+				continue;
1680
+			}
1516 1681
 			$info->module = $module_name;
1517 1682
 			$info->created_table_count = $created_table_count;
1518 1683
 			$info->table_count = $table_count;
@@ -1538,11 +1703,16 @@  discard block
 block discarded – undo
1538 1703
 			for($j=0;$j<count($tmp_files);$j++)
1539 1704
 			{
1540 1705
 				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1706
+				if($oDB->isTableExists($table_name)) {
1707
+					$created_table_count ++;
1708
+				}
1542 1709
 			}
1543 1710
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1545
-			else return false;
1711
+			if($table_count > $created_table_count) {
1712
+				return true;
1713
+			} else {
1714
+				return false;
1715
+			}
1546 1716
 		}
1547 1717
 		return false;
1548 1718
 	}
@@ -1565,15 +1735,23 @@  discard block
 block discarded – undo
1565 1735
 	 */
1566 1736
 	public function needUpdate($update_id)
1567 1737
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1738
+		if(!is_array($update_id)) {
1739
+			$update_id = array($update_id);
1740
+		}
1569 1741
 
1570 1742
 		$args = new stdClass();
1571 1743
 		$args->update_id = implode(',', $update_id);
1572 1744
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1745
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1746
+		if(!!$output->error) {
1747
+			return false;
1748
+		}
1749
+		if(!$output->data) {
1750
+			$output->data = array();
1751
+		}
1752
+		if(count($update_id) === count($output->data)) {
1753
+			return false;
1754
+		}
1577 1755
 
1578 1756
 		return true;
1579 1757
 	}
@@ -1590,7 +1768,9 @@  discard block
 block discarded – undo
1590 1768
 		sort($searched_list);
1591 1769
 
1592 1770
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1771
+		if(!$searched_count) {
1772
+			return;
1773
+		}
1594 1774
 
1595 1775
 		for($i=0;$i<$searched_count;$i++)
1596 1776
 		{
@@ -1598,7 +1778,9 @@  discard block
 block discarded – undo
1598 1778
 			$module_name = $searched_list[$i];
1599 1779
 
1600 1780
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1781
+			if(!is_dir(FileHandler::getRealPath($path))) {
1782
+				continue;
1783
+			}
1602 1784
 
1603 1785
 			// Get the number of xml files to create a table in schemas
1604 1786
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1608,13 +1790,17 @@  discard block
 block discarded – undo
1608 1790
 			for($j=0;$j<$table_count;$j++)
1609 1791
 			{
1610 1792
 				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1793
+				if($oDB->isTableExists($table_name)) {
1794
+					$created_table_count ++;
1795
+				}
1612 1796
 			}
1613 1797
 			// Get information of the module
1614 1798
 			$info = NULL;
1615 1799
 			$info = $this->getModuleInfoXml($module_name);
1616 1800
 
1617
-			if(!$info) continue;
1801
+			if(!$info) {
1802
+				continue;
1803
+			}
1618 1804
 
1619 1805
 			$info->module = $module_name;
1620 1806
 			$info->category = $info->category;
@@ -1623,16 +1809,18 @@  discard block
 block discarded – undo
1623 1809
 			$info->path = $path;
1624 1810
 			$info->admin_index_act = $info->admin_index_act;
1625 1811
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1627
-			else $info->need_install = false;
1812
+			if($table_count > $created_table_count) {
1813
+				$info->need_install = true;
1814
+			} else {
1815
+				$info->need_install = false;
1816
+			}
1628 1817
 			// Check if it is upgraded to module.class.php on each module
1629 1818
 			$oDummy = null;
1630 1819
 			$oDummy = getModule($module_name, 'class');
1631 1820
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1821
 			{
1633 1822
 				$info->need_update = $oDummy->checkUpdate();
1634
-			}
1635
-			else
1823
+			} else
1636 1824
 			{
1637 1825
 				continue;
1638 1826
 			}
@@ -1649,7 +1837,9 @@  discard block
 block discarded – undo
1649 1837
 	 */
1650 1838
 	function syncModuleToSite(&$data)
1651 1839
 	{
1652
-		if(!$data) return;
1840
+		if(!$data) {
1841
+			return;
1842
+		}
1653 1843
 
1654 1844
 		if(is_array($data))
1655 1845
 		{
@@ -1657,9 +1847,10 @@  discard block
 block discarded – undo
1657 1847
 			{
1658 1848
 				$module_srls[] = $val->module_srl;
1659 1849
 			}
1660
-			if(!count($module_srls)) return;
1661
-		}
1662
-		else
1850
+			if(!count($module_srls)) {
1851
+				return;
1852
+			}
1853
+		} else
1663 1854
 		{
1664 1855
 			$module_srls[] = $data->module_srl;
1665 1856
 		}
@@ -1667,7 +1858,9 @@  discard block
 block discarded – undo
1667 1858
 		$args = new stdClass();
1668 1859
 		$args->module_srls = implode(',',$module_srls);
1669 1860
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1861
+		if(!$output->data) {
1862
+			return array();
1863
+		}
1671 1864
 		foreach($output->data as $key => $val)
1672 1865
 		{
1673 1866
 			$modules[$val->module_srl] = $val;
@@ -1679,8 +1872,7 @@  discard block
 block discarded – undo
1679 1872
 			{
1680 1873
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1874
 			}
1682
-		}
1683
-		else
1875
+		} else
1684 1876
 		{
1685 1877
 			$data->domain = $modules[$data->module_srl]->domain;
1686 1878
 		}
@@ -1691,24 +1883,31 @@  discard block
 block discarded – undo
1691 1883
 	 */
1692 1884
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1885
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1886
+		if(!$member_info->member_srl) {
1887
+			return false;
1888
+		}
1889
+		if($member_info->is_admin == 'Y') {
1890
+			return true;
1891
+		}
1696 1892
 
1697 1893
 		$args = new stdClass();
1698 1894
 		if(!isset($site_srl))
1699 1895
 		{
1700 1896
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1897
+			if(!$site_module_info) {
1898
+				return;
1899
+			}
1702 1900
 			$args->site_srl = $site_module_info->site_srl;
1703
-		}
1704
-		else
1901
+		} else
1705 1902
 		{
1706 1903
 			$args->site_srl = $site_srl;
1707 1904
 		}
1708 1905
 
1709 1906
 		$args->member_srl = $member_info->member_srl;
1710 1907
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1908
+		if($output->data->member_srl == $args->member_srl) {
1909
+			return true;
1910
+		}
1712 1911
 		return false;
1713 1912
 	}
1714 1913
 
@@ -1731,7 +1930,9 @@  discard block
 block discarded – undo
1731 1930
 		$obj = new stdClass();
1732 1931
 		$obj->module_srl = $module_srl;
1733 1932
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1933
+		if(!$output->toBool() || !$output->data) {
1934
+			return;
1935
+		}
1735 1936
 
1736 1937
 		return $output->data;
1737 1938
 	}
@@ -1744,7 +1945,9 @@  discard block
 block discarded – undo
1744 1945
 	{
1745 1946
 		$extra_vars = array();
1746 1947
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1948
+		if(!is_array($list_module_srl)) {
1949
+			$list_module_srl = array($list_module_srl);
1950
+		}
1748 1951
 
1749 1952
 		$vars = false;
1750 1953
 		// cache controll
@@ -1760,14 +1963,12 @@  discard block
 block discarded – undo
1760 1963
 				if($vars)
1761 1964
 				{
1762 1965
 					$extra_vars[$module_srl] = $vars;
1763
-				}
1764
-				else
1966
+				} else
1765 1967
 				{
1766 1968
 					$get_module_srls[] = $module_srl;
1767 1969
 				}
1768 1970
 			}
1769
-		}
1770
-		else
1971
+		} else
1771 1972
 		{
1772 1973
 			$get_module_srls = $list_module_srl;
1773 1974
 		}
@@ -1792,7 +1993,9 @@  discard block
 block discarded – undo
1792 1993
 			}
1793 1994
 			foreach($output->data as $key => $val)
1794 1995
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1996
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1997
+					continue;
1998
+				}
1796 1999
 
1797 2000
 				if(!isset($extra_vars[$val->module_srl]))
1798 2001
 				{
@@ -1831,7 +2034,9 @@  discard block
 block discarded – undo
1831 2034
 			$args = new stdClass();
1832 2035
 			$args->module_srl = $module_srl;
1833 2036
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
2037
+			if(!$output->toBool()) {
2038
+				return;
2039
+			}
1835 2040
 
1836 2041
 			$skin_vars = array();
1837 2042
 			foreach($output->data as $vars)
@@ -1839,7 +2044,9 @@  discard block
 block discarded – undo
1839 2044
 				$skin_vars[$vars->name] = $vars;
1840 2045
 			}
1841 2046
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2047
+			if($oCacheHandler->isSupport()) {
2048
+				$oCacheHandler->put($cache_key, $skin_vars);
2049
+			}
1843 2050
 		}
1844 2051
 
1845 2052
 		return $skin_vars;
@@ -1851,7 +2058,9 @@  discard block
 block discarded – undo
1851 2058
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 2059
 	{
1853 2060
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
2061
+		if(!$site_srl) {
2062
+			$site_srl = 0;
2063
+		}
1855 2064
 
1856 2065
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857 2066
 		if(is_readable($designInfoFile))
@@ -1868,19 +2077,16 @@  discard block
 block discarded – undo
1868 2077
 			if(is_dir($moduleSkinPath.'default'))
1869 2078
 			{
1870 2079
 				$skinName = 'default';
1871
-			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
2080
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1873 2081
 			{
1874 2082
 				$skinName = 'xe_default';
1875
-			}
1876
-			else
2083
+			} else
1877 2084
 			{
1878 2085
 				$skins = FileHandler::readDir($moduleSkinPath);
1879 2086
 				if(count($skins) > 0)
1880 2087
 				{
1881 2088
 					$skinName = $skins[0];
1882
-				}
1883
-				else
2089
+				} else
1884 2090
 				{
1885 2091
 					$skinName = NULL;
1886 2092
 				}
@@ -1888,7 +2094,9 @@  discard block
 block discarded – undo
1888 2094
 
1889 2095
 			if($updateCache && $skinName)
1890 2096
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2097
+				if(!isset($designInfo->module->{$module_name})) {
2098
+					$designInfo->module->{$module_name} = new stdClass();
2099
+				}
1892 2100
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 2101
 
1894 2102
 				$oAdminController = getAdminController('admin');
@@ -1904,23 +2112,28 @@  discard block
 block discarded – undo
1904 2112
 	 */
1905 2113
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 2114
 	{
1907
-		if(!$module_info->module_srl) return;
2115
+		if(!$module_info->module_srl) {
2116
+			return;
2117
+		}
1908 2118
 
1909 2119
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910 2120
 		if(Mobile::isFromMobilePhone())
1911 2121
 		{
1912 2122
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913
-		}
1914
-		else
2123
+		} else
1915 2124
 		{
1916 2125
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 2126
 		}
1918 2127
 
1919
-		if(!$skin_vars) return;
2128
+		if(!$skin_vars) {
2129
+			return;
2130
+		}
1920 2131
 
1921 2132
 		foreach($skin_vars as $name => $val)
1922 2133
 		{
1923
-			if(isset($module_info->{$name})) continue;
2134
+			if(isset($module_info->{$name})) {
2135
+				continue;
2136
+			}
1924 2137
 			$module_info->{$name} = $val->value;
1925 2138
 		}
1926 2139
 	}
@@ -1946,7 +2159,9 @@  discard block
 block discarded – undo
1946 2159
 			$args = new stdClass();
1947 2160
 			$args->module_srl = $module_srl;
1948 2161
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
2162
+			if(!$output->toBool() || !$output->data) {
2163
+				return;
2164
+			}
1950 2165
 
1951 2166
 			$skin_vars = array();
1952 2167
 			foreach($output->data as $vars)
@@ -1954,7 +2169,9 @@  discard block
 block discarded – undo
1954 2169
 				$skin_vars[$vars->name] = $vars;
1955 2170
 			}
1956 2171
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2172
+			if($oCacheHandler->isSupport()) {
2173
+				$oCacheHandler->put($cache_key, $skin_vars);
2174
+			}
1958 2175
 		}
1959 2176
 
1960 2177
 		return $skin_vars;
@@ -1966,7 +2183,9 @@  discard block
 block discarded – undo
1966 2183
 	 */
1967 2184
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 2185
 	{
1969
-		if(!$module_info->module_srl) return;
2186
+		if(!$module_info->module_srl) {
2187
+			return;
2188
+		}
1970 2189
 		$skin_vars = false;
1971 2190
 		// cache controll
1972 2191
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1981,17 +2200,25 @@  discard block
 block discarded – undo
1981 2200
 			$args = new stdClass;
1982 2201
 			$args->module_srl = $module_info->module_srl;
1983 2202
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
2203
+			if(!$output->toBool()) {
2204
+				return;
2205
+			}
1985 2206
 			$skin_vars = $output->data;
1986 2207
 
1987 2208
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2209
+			if($oCacheHandler->isSupport()) {
2210
+				$oCacheHandler->put($cache_key, $skin_vars);
2211
+			}
2212
+		}
2213
+		if(!$skin_vars) {
2214
+			return;
1989 2215
 		}
1990
-		if(!$skin_vars) return;
1991 2216
 
1992 2217
 		foreach($output->data as $val)
1993 2218
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
2219
+			if(isset($module_info->{$val->name})) {
2220
+				continue;
2221
+			}
1995 2222
 			$module_info->{$val->name} = $val->value;
1996 2223
 		}
1997 2224
 	}
@@ -2013,10 +2240,12 @@  discard block
 block discarded – undo
2013 2240
 		$grant_info = $xml_info->grant;
2014 2241
 		if($member_info->member_srl)
2015 2242
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017
-			else $group_list = array();
2018
-		}
2019
-		else
2243
+			if(is_array($member_info->group_list)) {
2244
+				$group_list = array_keys($member_info->group_list);
2245
+			} else {
2246
+				$group_list = array();
2247
+			}
2248
+		} else
2020 2249
 		{
2021 2250
 			$group_list = array();
2022 2251
 		}
@@ -2030,8 +2259,7 @@  discard block
 block discarded – undo
2030 2259
 			}
2031 2260
 
2032 2261
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2033
-		}
2034
-		else
2262
+		} else
2035 2263
 		{
2036 2264
 			// If module_srl exists
2037 2265
 			// Get a type of granted permission
@@ -2044,7 +2272,9 @@  discard block
 block discarded – undo
2044 2272
 				$args->module_srl = $module_srl;
2045 2273
 				$args->member_srl = $member_info->member_srl;
2046 2274
 				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2275
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2276
+					$grant->manager = true;
2277
+				}
2048 2278
 			}
2049 2279
 			// If not an administrator, get information from the DB and grant manager privilege.
2050 2280
 			if(!$grant->manager)
@@ -2054,8 +2284,7 @@  discard block
 block discarded – undo
2054 2284
 				if($module_info->module == 'planet')
2055 2285
 				{
2056 2286
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057
-				}
2058
-				else
2287
+				} else
2059 2288
 				{
2060 2289
 					$args = new stdClass;
2061 2290
 					$args->module_srl = $module_srl;
@@ -2070,42 +2299,48 @@  discard block
 block discarded – undo
2070 2299
 					foreach($output->data as $val)
2071 2300
 					{
2072 2301
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2302
+						if($granted[$val->name]) {
2303
+							continue;
2304
+						}
2074 2305
 						// Log-in member only
2075 2306
 						if($val->group_srl == -1)
2076 2307
 						{
2077 2308
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2309
+							if($member_info->member_srl) {
2310
+								$grant->{$val->name} = true;
2311
+							}
2079 2312
 							// Site-joined member only
2080
-						}
2081
-						elseif($val->group_srl == -2)
2313
+						} elseif($val->group_srl == -2)
2082 2314
 						{
2083 2315
 							$granted[$val->name] = true;
2084 2316
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2317
+							if(!$member_info->member_srl) {
2318
+								$grant->{$val->name} = false;
2319
+							}
2086 2320
 							// Log-in member
2087 2321
 							else
2088 2322
 							{
2089 2323
 								$site_module_info = Context::get('site_module_info');
2090 2324
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2325
+								if(!$site_module_info->site_srl) {
2326
+									$grant->{$val->name} = true;
2327
+								}
2092 2328
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2329
+								elseif(count($group_list)) {
2330
+									$grant->{$val->name} = true;
2331
+								}
2094 2332
 							}
2095 2333
 							// All of non-logged members
2096
-						}
2097
-						elseif($val->group_srl == -3)
2334
+						} elseif($val->group_srl == -3)
2098 2335
 						{
2099 2336
 							$granted[$val->name] = true;
2100 2337
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101
-						}
2102
-						elseif($val->group_srl == 0)
2338
+						} elseif($val->group_srl == 0)
2103 2339
 						{
2104 2340
 							$granted[$val->name] = true;
2105 2341
 							$grant->{$val->name} = true;
2106 2342
 							// If a target is a group
2107
-						}
2108
-						else
2343
+						} else
2109 2344
 						{
2110 2345
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2346
 							{
@@ -2116,30 +2351,43 @@  discard block
 block discarded – undo
2116 2351
 					}
2117 2352
 				}
2118 2353
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2354
+				if(!$grant_exists['access']) {
2355
+					$grant->access = true;
2356
+				}
2120 2357
 				if(count($grant_info))
2121 2358
 				{
2122 2359
 					foreach($grant_info as  $grant_name => $grant_item)
2123 2360
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2361
+						if($grant_exists[$grant_name]) {
2362
+							continue;
2363
+						}
2125 2364
 						switch($grant_item->default)
2126 2365
 						{
2127 2366
 							case 'guest' :
2128 2367
 								$grant->{$grant_name} = true;
2129 2368
 								break;
2130 2369
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2132
-								else $grant->{$grant_name} = false;
2370
+								if($member_info->member_srl) {
2371
+									$grant->{$grant_name} = true;
2372
+								} else {
2373
+									$grant->{$grant_name} = false;
2374
+								}
2133 2375
 								break;
2134 2376
 							case 'site' :
2135 2377
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137
-								else $grant->{$grant_name} = false;
2378
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2379
+									$grant->{$grant_name} = true;
2380
+								} else {
2381
+									$grant->{$grant_name} = false;
2382
+								}
2138 2383
 								break;
2139 2384
 							case 'manager' :
2140 2385
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142
-								else $grant->{$grant_name} = false;
2386
+								if($member_info->is_admin == 'Y') {
2387
+									$grant->{$grant_name} = true;
2388
+								} else {
2389
+									$grant->{$grant_name} = false;
2390
+								}
2143 2391
 								break;
2144 2392
 						}
2145 2393
 					}
@@ -2215,16 +2463,22 @@  discard block
 block discarded – undo
2215 2463
 	function getFileBoxListHtml()
2216 2464
 	{
2217 2465
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2466
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2467
+			return new BaseObject(-1, 'msg_not_permitted');
2468
+		}
2219 2469
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220 2470
 		$link_params = explode('&',$link['query']);
2221 2471
 		foreach ($link_params as $param)
2222 2472
 		{
2223 2473
 			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2474
+			if($param[0] == 'selected_widget') {
2475
+				$selected_widget = $param[1];
2476
+			}
2225 2477
 		}
2226 2478
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2479
+		if($selected_widget) {
2480
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2481
+		}
2228 2482
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2483
 
2230 2484
 		$oModuleModel = getModel('module');
@@ -2232,7 +2486,9 @@  discard block
 block discarded – undo
2232 2486
 		Context::set('filebox_list', $output->data);
2233 2487
 
2234 2488
 		$page = Context::get('page');
2235
-		if (!$page) $page = 1;
2489
+		if (!$page) {
2490
+			$page = 1;
2491
+		}
2236 2492
 		Context::set('page', $page);
2237 2493
 		Context::set('page_navigation', $output->page_navigation);
2238 2494
 
@@ -2262,25 +2518,28 @@  discard block
 block discarded – undo
2262 2518
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2519
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2264 2520
 			return FileHandler::getRealPath($xml_file);
2265
-		}
2266
-		else if (strpos($ruleset, '#') !== false)
2521
+		} else if (strpos($ruleset, '#') !== false)
2267 2522
 		{
2268 2523
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2524
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2271
-				return FileHandler::getRealPath($xml_file);
2272
-			else{
2525
+			if(is_readable($xml_file)) {
2526
+							return FileHandler::getRealPath($xml_file);
2527
+			} else{
2273 2528
 				$ruleset = str_replace('#', '', $ruleset);
2274 2529
 			}
2275 2530
 
2276 2531
 		}
2277 2532
 		// Get a path of the requested module. Return if not exists.
2278 2533
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2534
+		if(!$class_path) {
2535
+			return;
2536
+		}
2280 2537
 
2281 2538
 		// Check if module.xml exists in the path. Return if not exist
2282 2539
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2540
+		if(!file_exists($xml_file)) {
2541
+			return;
2542
+		}
2284 2543
 
2285 2544
 		return $xml_file;
2286 2545
 	}
@@ -2330,7 +2589,9 @@  discard block
 block discarded – undo
2330 2589
 	function getLangByLangcode()
2331 2590
 	{
2332 2591
 		$langCode = Context::get('langCode');
2333
-		if (!$langCode) return;
2592
+		if (!$langCode) {
2593
+			return;
2594
+		}
2334 2595
 
2335 2596
 		$oModuleController = getController('module');
2336 2597
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/module/module.controller.php 2 patches
Spacing   +163 added lines, -163 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 BaseObject(-1,'msg_already_registed_vid');
271
+			if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-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 BaseObject(-1,'msg_already_registed_vid');
287
+		if ($output) return new BaseObject(-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 BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
313
+			if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain');
314
+			if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-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 BaseObject(-1, 'msg_limit_mid');
348
+		if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-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 BaseObject(-1, 'msg_module_name_exists');
396
+		if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-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
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	function updateModule($args)
509 509
 	{
510
-		if(isset($args->isMenuCreate))
510
+		if (isset($args->isMenuCreate))
511 511
 		{
512 512
 			$isMenuCreate = $args->isMenuCreate;
513 513
 		}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		}
518 518
 		
519 519
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
520
+		if (!$output->toBool()) return $output;
521 521
 		// begin transaction
522 522
 		$oDB = &DB::getInstance();
523 523
 		$oDB->begin();
@@ -526,29 +526,29 @@  discard block
 block discarded – undo
526 526
 		$columnList = array('module_srl', 'site_srl', 'browser_title', 'mid');
527 527
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
528 528
 
529
-		if(!$args->site_srl || !$args->browser_title)
529
+		if (!$args->site_srl || !$args->browser_title)
530 530
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
531
+			if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl;
532
+			if (!$args->browser_title) $args->browser_title = $module_info->browser_title;
533 533
 		}
534 534
 
535 535
 		$args->browser_title = strip_tags($args->browser_title);
536 536
 
537 537
 		$output = executeQuery('module.isExistsModuleName', $args);
538
-		if(!$output->toBool() || $output->data->count)
538
+		if (!$output->toBool() || $output->data->count)
539 539
 		{
540 540
 			$oDB->rollback();
541 541
 			return new BaseObject(-1, 'msg_module_name_exists');
542 542
 		}
543 543
 
544 544
 		// default value
545
-		if($args->skin == '/USE_DEFAULT/')
545
+		if ($args->skin == '/USE_DEFAULT/')
546 546
 		{
547 547
 			$args->is_skin_fix = 'N';
548 548
 		}
549 549
 		else
550 550
 		{
551
-			if(isset($args->is_skin_fix))
551
+			if (isset($args->is_skin_fix))
552 552
 			{
553 553
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554 554
 			}
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 			}
559 559
 		}
560 560
 
561
-		if($args->mskin == '/USE_DEFAULT/')
561
+		if ($args->mskin == '/USE_DEFAULT/')
562 562
 		{
563 563
 			$args->is_mskin_fix = 'N';
564 564
 		}
565 565
 		else
566 566
 		{
567
-			if(isset($args->is_mskin_fix))
567
+			if (isset($args->is_mskin_fix))
568 568
 			{
569 569
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570 570
 			}
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 			}
575 575
 		}
576 576
 		$output = executeQuery('module.updateModule', $args);
577
-		if(!$output->toBool())
577
+		if (!$output->toBool())
578 578
 		{
579 579
 			$oDB->rollback();
580 580
 			return $output;
581 581
 		}
582 582
 
583
-		if($isMenuCreate === TRUE)
583
+		if ($isMenuCreate === TRUE)
584 584
 		{
585 585
 			$menuArgs = new stdClass;
586 586
 			$menuArgs->url = $module_info->mid;
587 587
 			$menuArgs->site_srl = $module_info->site_srl;
588 588
 			$menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs);
589
-			if($menuOutput->data && count($menuOutput->data))
589
+			if ($menuOutput->data && count($menuOutput->data))
590 590
 			{
591 591
 				$oMenuAdminController = getAdminController('menu');
592
-				foreach($menuOutput->data as $itemInfo)
592
+				foreach ($menuOutput->data as $itemInfo)
593 593
 				{
594 594
 					$itemInfo->url = $args->mid;
595 595
 	
596 596
 					$updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo);
597
-					if(!$updateMenuItemOutput->toBool())
597
+					if (!$updateMenuItemOutput->toBool())
598 598
 					{
599 599
 						$oDB->rollback();
600 600
 						return $updateMenuItemOutput;
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		}
605 605
 
606 606
 		// if mid changed, change mid of success_return_url to new mid
607
-		if($module_info->mid != $args->mid && Context::get('success_return_url'))
607
+		if ($module_info->mid != $args->mid && Context::get('success_return_url'))
608 608
 		{
609 609
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
610 610
 		}
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$oDB->commit();
616 616
 
617
-		$output->add('module_srl',$args->module_srl);
617
+		$output->add('module_srl', $args->module_srl);
618 618
 
619 619
 		//remove from cache
620 620
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
621
-		if($oCacheHandler->isSupport())
621
+		if ($oCacheHandler->isSupport())
622 622
 		{
623 623
 			$oCacheHandler->invalidateGroupKey('site_and_module');
624 624
 		}
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		$args->update_id = $update_id;
638 638
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 639
 
640
-		if(!!$output->error) return false;
640
+		if (!!$output->error) return false;
641 641
 
642 642
 		return true;
643 643
 	}
@@ -652,11 +652,11 @@  discard block
 block discarded – undo
652 652
 		$args->site_srl = $site_srl;
653 653
 		$args->layout_srl = $layout_srl;
654 654
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
655
+		if (!$output->toBool()) return $output;
656 656
 
657 657
 		//remove from cache
658 658
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
659
-		if($oCacheHandler->isSupport())
659
+		if ($oCacheHandler->isSupport())
660 660
 		{
661 661
 			$oCacheHandler->invalidateGroupKey('site_and_module');
662 662
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	function deleteModule($module_srl, $site_srl = 0)
673 673
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
674
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
675 675
 
676 676
 		$site_module_info = Context::get('site_module_info');
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		$args = new stdClass();
682 682
 		$args->url = $output->mid;
683 683
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
684
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
685 685
 		else $args->site_srl = $site_srl;
686 686
 
687 687
 		unset($output);
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
691 691
 
692 692
 		// get menu_srl by site_srl
693
-		if(is_array($menuOutput->data))
693
+		if (is_array($menuOutput->data))
694 694
 		{
695
-			foreach($menuOutput->data AS $key=>$value)
695
+			foreach ($menuOutput->data AS $key=>$value)
696 696
 			{
697 697
 				$args->menu_srl = $value->menu_srl;
698 698
 				break;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
703 703
 		// menu delete
704
-		if($output->data)
704
+		if ($output->data)
705 705
 		{
706 706
 			unset($args);
707 707
 			$args = new stdClass;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			$oMenuAdminController = getAdminController('menu');
713 713
 			$output = $oMenuAdminController->deleteItem($args);
714 714
 
715
-			if($output->isSuccess)
715
+			if ($output->isSuccess)
716 716
 			{
717 717
 				return new BaseObject(0, 'success_deleted');
718 718
 			}
@@ -734,19 +734,19 @@  discard block
 block discarded – undo
734 734
 	 */
735 735
 	public function onlyDeleteModule($module_srl)
736 736
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
737
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
738 738
 
739 739
 		// check start module
740 740
 		$oModuleModel = getModel('module');
741 741
 		$columnList = array('sites.index_module_srl');
742 742
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
743
+		if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
744 744
 
745 745
 		// Call a trigger (before)
746 746
 		$trigger_obj = new stdClass();
747 747
 		$trigger_obj->module_srl = $module_srl;
748 748
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
749
+		if (!$output->toBool()) return $output;
750 750
 
751 751
 		// begin transaction
752 752
 		$oDB = &DB::getInstance();
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$args->module_srl = $module_srl;
757 757
 		// Delete module information from the DB
758 758
 		$output = executeQuery('module.deleteModule', $args);
759
-		if(!$output->toBool())
759
+		if (!$output->toBool())
760 760
 		{
761 761
 			$oDB->rollback();
762 762
 			return $output;
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 		// Remove the module manager
771 771
 		$this->deleteAdminId($module_srl);
772 772
 		// Call a trigger (after)
773
-		if($output->toBool())
773
+		if ($output->toBool())
774 774
 		{
775 775
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
776
-			if(!$trigger_output->toBool())
776
+			if (!$trigger_output->toBool())
777 777
 			{
778 778
 				$oDB->rollback();
779 779
 				return $trigger_output;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 		//remove from cache
787 787
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
788
-		if($oCacheHandler->isSupport())
788
+		if ($oCacheHandler->isSupport())
789 789
 		{
790 790
 			$oCacheHandler->invalidateGroupKey('site_and_module');
791 791
 		}
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 	function clearDefaultModule()
808 808
 	{
809 809
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
810
+		if (!$output->toBool()) return $output;
811 811
 
812 812
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813
-		if($oCacheHandler->isSupport())
813
+		if ($oCacheHandler->isSupport())
814 814
 		{
815 815
 			$oCacheHandler->invalidateGroupKey('site_and_module');
816 816
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = executeQuery('module.updateModuleMenu', $args);
827 827
 
828 828
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
829
-		if($oCacheHandler->isSupport())
829
+		if ($oCacheHandler->isSupport())
830 830
 		{
831 831
 			$oCacheHandler->invalidateGroupKey('site_and_module');
832 832
 		}
@@ -839,15 +839,15 @@  discard block
 block discarded – undo
839 839
 	 */
840 840
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 841
 	{
842
-		if(!count($menu_srl_list)) return;
842
+		if (!count($menu_srl_list)) return;
843 843
 
844 844
 		$args = new stdClass;
845 845
 		$args->layout_srl = $layout_srl;
846
-		$args->menu_srls = implode(',',$menu_srl_list);
846
+		$args->menu_srls = implode(',', $menu_srl_list);
847 847
 		$output = executeQuery('module.updateModuleLayout', $args);
848 848
 
849 849
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
850
-		if($oCacheHandler->isSupport())
850
+		if ($oCacheHandler->isSupport())
851 851
 		{
852 852
 			$oCacheHandler->invalidateGroupKey('site_and_module');
853 853
 		}
@@ -866,37 +866,37 @@  discard block
 block discarded – undo
866 866
 
867 867
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 868
 
869
-		if(!$output->toBool()) return $output;
869
+		if (!$output->toBool()) return $output;
870 870
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
-		foreach($arr_admins as $key => $user_id)
871
+		if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
+		foreach ($arr_admins as $key => $user_id)
873 873
 		{
874
-			if(!trim($user_id)) continue;
874
+			if (!trim($user_id)) continue;
875 875
 			$admins[] = trim($user_id);
876 876
 		}
877
-		if(!count($admins)) return new BaseObject();
877
+		if (!count($admins)) return new BaseObject();
878 878
 
879 879
 		$oMemberModel = getModel('member');
880 880
 		$member_config = $oMemberModel->getMemberConfig();
881
-		if($member_config->identifier == 'email_address')
881
+		if ($member_config->identifier == 'email_address')
882 882
 		{
883
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
883
+			$args->email_address = '\''.implode('\',\'', $admins).'\'';
884 884
 		}
885 885
 		else
886 886
 		{
887
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
887
+			$args->user_ids = '\''.implode('\',\'', $admins).'\'';
888 888
 		}
889 889
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
890
+		if (!$output->toBool() || !$output->data) return $output;
891 891
 
892
-		foreach($output->data as $key => $val)
892
+		foreach ($output->data as $key => $val)
893 893
 		{
894 894
 			unset($args);
895 895
 			$args = new stdClass;
896 896
 			$args->site_srl = $site_srl;
897 897
 			$args->member_srl = $val->member_srl;
898 898
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
899
+			if (!$output->toBool()) return $output;
900 900
 		}
901 901
 		return new BaseObject();
902 902
 	}
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 		$oMemberModel = getModel('member');
910 910
 		$member_config = $oMemberModel->getMemberConfig();
911 911
 
912
-		if($member_config->identifier == 'email_address')
912
+		if ($member_config->identifier == 'email_address')
913 913
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914 914
 		else
915 915
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
916 916
 
917
-		if(!$member_info->member_srl) return;
917
+		if (!$member_info->member_srl) return;
918 918
 		$args = new stdClass();
919 919
 		$args->module_srl = $module_srl;
920 920
 		$args->member_srl = $member_info->member_srl;
@@ -929,11 +929,11 @@  discard block
 block discarded – undo
929 929
 		$args = new stdClass();
930 930
 		$args->module_srl = $module_srl;
931 931
 
932
-		if($admin_id)
932
+		if ($admin_id)
933 933
 		{
934 934
 			$oMemberModel = getModel('member');
935 935
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
936
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
937 937
 		}
938 938
 		return executeQuery('module.deleteAdminId', $args);
939 939
 	}
@@ -970,18 +970,18 @@  discard block
 block discarded – undo
970 970
 		$oDB->begin();
971 971
 
972 972
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			$oDB->rollback();
976 976
 			return $output;
977 977
 		}
978 978
 
979 979
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
980
+		if (!$obj || !count($obj)) return new BaseObject();
981 981
 
982 982
 		$args = new stdClass;
983 983
 		$args->module_srl = $module_srl;
984
-		foreach($obj as $key => $val)
984
+		foreach ($obj as $key => $val)
985 985
 		{
986 986
 			// #17927989 For an old board which used the old blog module
987 987
 			// it often saved menu item(stdClass) on the skin info column
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
 
993 993
 			$args->name = trim($key);
994 994
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
995
+			if (!$args->name || !$args->value) continue;
996 996
 
997
-			if($mode === 'P')
997
+			if ($mode === 'P')
998 998
 			{
999 999
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000 1000
 			}
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			{
1003 1003
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1004
 			}
1005
-			if(!$output->toBool())
1005
+			if (!$output->toBool())
1006 1006
 			{
1007 1007
 				return $output;
1008 1008
 				$oDB->rollback();
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		$args->module_srl = $module_srl;
1042 1042
 		$mode = $mode === 'P' ? 'P' : 'M';
1043 1043
 
1044
-		if($mode === 'P')
1044
+		if ($mode === 'P')
1045 1045
 		{
1046 1046
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1047
 			$query = 'module.deleteModuleSkinVars';
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		//remove from cache
1056 1056
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1057 1057
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1058
-		if($oCacheHandler->isSupport())
1058
+		if ($oCacheHandler->isSupport())
1059 1059
 		{
1060 1060
 			$oCacheHandler->delete($cache_key);
1061 1061
 		}
@@ -1070,22 +1070,22 @@  discard block
 block discarded – undo
1070 1070
 	{
1071 1071
 		$this->deleteModuleExtraVars($module_srl);
1072 1072
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1073
+		if (!$obj || !count($obj)) return;
1074 1074
 
1075
-		foreach($obj as $key => $val)
1075
+		foreach ($obj as $key => $val)
1076 1076
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1077
+			if (is_object($val) || is_array($val)) continue;
1078 1078
 
1079 1079
 			$args = new stdClass();
1080 1080
 			$args->module_srl = $module_srl;
1081 1081
 			$args->name = trim($key);
1082 1082
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1083
+			if (!$args->name || !$args->value) continue;
1084 1084
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1085
 		}
1086 1086
 
1087 1087
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1088
-		if($oCacheHandler->isSupport())
1088
+		if ($oCacheHandler->isSupport())
1089 1089
 		{
1090 1090
 			$object_key = 'module_extra_vars:'.$module_srl;
1091 1091
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 		//remove from cache
1106 1106
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1107
-		if($oCacheHandler->isSupport())
1107
+		if ($oCacheHandler->isSupport())
1108 1108
 		{
1109 1109
 			$object_key = 'module_extra_vars:'.$module_srl;
1110 1110
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1120,19 +1120,19 @@  discard block
 block discarded – undo
1120 1120
 	function insertModuleGrants($module_srl, $obj)
1121 1121
 	{
1122 1122
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1123
+		if (!$obj || !count($obj)) return;
1124 1124
 
1125
-		foreach($obj as $name => $val)
1125
+		foreach ($obj as $name => $val)
1126 1126
 		{
1127
-			if(!$val || !count($val)) continue;
1127
+			if (!$val || !count($val)) continue;
1128 1128
 
1129
-			foreach($val as $group_srl)
1129
+			foreach ($val as $group_srl)
1130 1130
 			{
1131 1131
 				$args = new stdClass();
1132 1132
 				$args->module_srl = $module_srl;
1133 1133
 				$args->name = $name;
1134 1134
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1135
+				if (!$args->name || !$args->group_srl) continue;
1136 1136
 				executeQuery('module.insertModuleGrant', $args);
1137 1137
 			}
1138 1138
 		}
@@ -1153,9 +1153,9 @@  discard block
 block discarded – undo
1153 1153
 	 */
1154 1154
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1155 1155
 	{
1156
-		if($isReplaceLangCode)
1156
+		if ($isReplaceLangCode)
1157 1157
 		{
1158
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1158
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1159 1159
 		}
1160 1160
 	}
1161 1161
 
@@ -1163,27 +1163,27 @@  discard block
 block discarded – undo
1163 1163
 	{
1164 1164
 		static $lang = null;
1165 1165
 
1166
-		if(is_null($lang))
1166
+		if (is_null($lang))
1167 1167
 		{
1168 1168
 			$site_module_info = Context::get('site_module_info');
1169
-			if(!$site_module_info)
1169
+			if (!$site_module_info)
1170 1170
 			{
1171 1171
 				$oModuleModel = getModel('module');
1172 1172
 				$site_module_info = $oModuleModel->getDefaultMid();
1173 1173
 				Context::set('site_module_info', $site_module_info);
1174 1174
 			}
1175 1175
 			$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
1176
-			if(!file_exists($cache_file))
1176
+			if (!file_exists($cache_file))
1177 1177
 			{
1178 1178
 				$oModuleAdminController = getAdminController('module');
1179 1179
 				$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1180 1180
 			}
1181 1181
 
1182
-			if(file_exists($cache_file))
1182
+			if (file_exists($cache_file))
1183 1183
 			{
1184
-				$moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php');
1184
+				$moduleAdminControllerMtime = filemtime(_XE_PATH_.'modules/module/module.admin.controller.php');
1185 1185
 				$cacheFileMtime = filemtime($cache_file);
1186
-				if($cacheFileMtime < $moduleAdminControllerMtime)
1186
+				if ($cacheFileMtime < $moduleAdminControllerMtime)
1187 1187
 				{
1188 1188
 					$oModuleAdminController = getAdminController('module');
1189 1189
 					$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
@@ -1192,9 +1192,9 @@  discard block
 block discarded – undo
1192 1192
 				require_once($cache_file);
1193 1193
 			}
1194 1194
 		}
1195
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1195
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1196 1196
 
1197
-		return str_replace('$user_lang->','',$matches[0]);
1197
+		return str_replace('$user_lang->', '', $matches[0]);
1198 1198
 	}
1199 1199
 
1200 1200
 
@@ -1207,17 +1207,17 @@  discard block
 block discarded – undo
1207 1207
 		if ($ajax) Context::setRequestMethod('JSON');
1208 1208
 
1209 1209
 		$logged_info = Context::get('logged_info');
1210
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1210
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1211 1211
 
1212
-		$vars = Context::gets('addfile','filter');
1212
+		$vars = Context::gets('addfile', 'filter');
1213 1213
 		$attributeNames = Context::get('attribute_name');
1214 1214
 		$attributeValues = Context::get('attribute_value');
1215
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1215
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1216 1216
 		{
1217 1217
 			$attributes = array();
1218
-			foreach($attributeNames as $no => $name)
1218
+			foreach ($attributeNames as $no => $name)
1219 1219
 			{
1220
-				if(empty($name))
1220
+				if (empty($name))
1221 1221
 				{
1222 1222
 					continue;
1223 1223
 				}
@@ -1229,16 +1229,16 @@  discard block
 block discarded – undo
1229 1229
 		$vars->comment = $attributes;
1230 1230
 		$module_filebox_srl = Context::get('module_filebox_srl');
1231 1231
 
1232
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1232
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1233 1233
 		$vars->ext = $ext;
1234
-		if($vars->filter) $filter = explode(',',$vars->filter);
1235
-		else $filter = array('jpg','jpeg','gif','png');
1236
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1234
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1235
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1236
+		if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured');
1237 1237
 
1238 1238
 		$vars->member_srl = $logged_info->member_srl;
1239 1239
 
1240 1240
 		// update
1241
-		if($module_filebox_srl > 0)
1241
+		if ($module_filebox_srl > 0)
1242 1242
 		{
1243 1243
 			$vars->module_filebox_srl = $module_filebox_srl;
1244 1244
 			$output = $this->updateModuleFileBox($vars);
@@ -1246,10 +1246,10 @@  discard block
 block discarded – undo
1246 1246
 		// insert
1247 1247
 		else
1248 1248
 		{
1249
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1249
+			if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1250 1250
 			$addfile = Context::get('addfile');
1251
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1252
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1251
+			if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1252
+			if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1253 1253
 			$output = $this->insertModuleFileBox($vars);
1254 1254
 		}
1255 1255
 
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 		}
1264 1264
 		else
1265 1265
 		{
1266
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1266
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1267 1267
 			else $this->add('save_filename', '');
1268 1268
 		}
1269 1269
 	}
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 	{
1276 1276
 		$args = new stdClass;
1277 1277
 		// have file
1278
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1278
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1279 1279
 		{
1280 1280
 			$oModuleModel = getModel('module');
1281 1281
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1284,18 +1284,18 @@  discard block
 block discarded – undo
1284 1284
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1285 1285
 			FileHandler::makeDir($path);
1286 1286
 
1287
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1287
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1288 1288
 			$tmp = $vars->addfile['tmp_name'];
1289 1289
 
1290 1290
 			// Check uploaded file
1291
-			if(!checkUploadedFile($tmp)) return false;
1291
+			if (!checkUploadedFile($tmp)) return false;
1292 1292
 
1293
-			if(!@move_uploaded_file($tmp, $save_filename))
1293
+			if (!@move_uploaded_file($tmp, $save_filename))
1294 1294
 			{
1295 1295
 				return false;
1296 1296
 			}
1297 1297
 
1298
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1298
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1299 1299
 			$args->filename = $save_filename;
1300 1300
 			$args->filesize = $vars->addfile['size'];
1301 1301
 		}
@@ -1321,14 +1321,14 @@  discard block
 block discarded – undo
1321 1321
 		$oModuleModel = getModel('module');
1322 1322
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1323 1323
 		FileHandler::makeDir($path);
1324
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1324
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1325 1325
 		$tmp = $vars->addfile['tmp_name'];
1326 1326
 
1327 1327
 		// Check uploaded file
1328
-		if(!checkUploadedFile($tmp)) return false;
1328
+		if (!checkUploadedFile($tmp)) return false;
1329 1329
 
1330 1330
 		// upload
1331
-		if(!@move_uploaded_file($tmp, $save_filename))
1331
+		if (!@move_uploaded_file($tmp, $save_filename))
1332 1332
 		{
1333 1333
 			return false;
1334 1334
 		}
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 		$args->member_srl = $vars->member_srl;
1340 1340
 		$args->comment = $vars->comment;
1341 1341
 		$args->filename = $save_filename;
1342
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1342
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1343 1343
 		$args->filesize = $vars->addfile['size'];
1344 1344
 
1345 1345
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1354,14 +1354,14 @@  discard block
 block discarded – undo
1354 1354
 	function procModuleFileBoxDelete()
1355 1355
 	{
1356 1356
 		$logged_info = Context::get('logged_info');
1357
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1357
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1358 1358
 
1359 1359
 		$module_filebox_srl = Context::get('module_filebox_srl');
1360
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1360
+		if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1361 1361
 		$vars = new stdClass();
1362 1362
 		$vars->module_filebox_srl = $module_filebox_srl;
1363 1363
 		$output = $this->deleteModuleFileBox($vars);
1364
-		if(!$output->toBool()) return $output;
1364
+		if (!$output->toBool()) return $output;
1365 1365
 	}
1366 1366
 
1367 1367
 	function deleteModuleFileBox($vars)
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 		$this->unlockTimeoutPassed();
1385 1385
 		$args = new stdClass;
1386 1386
 		$args->lock_name = $lock_name;
1387
-		if(!$timeout) $timeout = 60;
1387
+		if (!$timeout) $timeout = 60;
1388 1388
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1389
-		if($member_srl) $args->member_srl = $member_srl;
1389
+		if ($member_srl) $args->member_srl = $member_srl;
1390 1390
 		$output = executeQuery('module.insertLock', $args);
1391
-		if($output->toBool())
1391
+		if ($output->toBool())
1392 1392
 		{
1393 1393
 			$output->add('lock_name', $lock_name);
1394 1394
 			$output->add('deadline', $args->deadline);
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 		$output = executeQuery('module.updateModuleInSites', $args);
1418 1418
 
1419 1419
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1420
-		if($oCacheHandler->isSupport())
1420
+		if ($oCacheHandler->isSupport())
1421 1421
 		{
1422 1422
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1423 1423
 		}
Please login to merge, or discard this patch.
Braces   +221 added lines, -104 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 BaseObject(-1,'msg_already_registed_vid');
272
-		}
273
-		else
285
+			if($oModuleModel->isIDExists($domain, 0)) {
286
+				return new BaseObject(-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 BaseObject(-1,'msg_already_registed_vid');
302
+		if($output) {
303
+			return new BaseObject(-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 BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
332
+			if($info->site_srl && $info->site_srl != $args->site_srl) {
333
+				return new BaseObject(-1,'msg_already_registed_domain');
334
+			}
335
+			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) {
336
+				return new BaseObject(-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 BaseObject(-1, 'msg_limit_mid');
374
+		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) {
375
+			return new BaseObject(-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 BaseObject(-1, 'msg_module_name_exists');
427
+		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) {
428
+			return new BaseObject(-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
 			}
@@ -510,14 +541,15 @@  discard block
 block discarded – undo
510 541
 		if(isset($args->isMenuCreate))
511 542
 		{
512 543
 			$isMenuCreate = $args->isMenuCreate;
513
-		}
514
-		else
544
+		} else
515 545
 		{
516 546
 			$isMenuCreate = TRUE;
517 547
 		}
518 548
 		
519 549
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
550
+		if(!$output->toBool()) {
551
+			return $output;
552
+		}
521 553
 		// begin transaction
522 554
 		$oDB = &DB::getInstance();
523 555
 		$oDB->begin();
@@ -528,8 +560,12 @@  discard block
 block discarded – undo
528 560
 
529 561
 		if(!$args->site_srl || !$args->browser_title)
530 562
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
563
+			if(!$args->site_srl) {
564
+				$args->site_srl = (int)$module_info->site_srl;
565
+			}
566
+			if(!$args->browser_title) {
567
+				$args->browser_title = $module_info->browser_title;
568
+			}
533 569
 		}
534 570
 
535 571
 		$args->browser_title = strip_tags($args->browser_title);
@@ -545,14 +581,12 @@  discard block
 block discarded – undo
545 581
 		if($args->skin == '/USE_DEFAULT/')
546 582
 		{
547 583
 			$args->is_skin_fix = 'N';
548
-		}
549
-		else
584
+		} else
550 585
 		{
551 586
 			if(isset($args->is_skin_fix))
552 587
 			{
553 588
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554
-			}
555
-			else
589
+			} else
556 590
 			{
557 591
 				$args->is_skin_fix = 'Y';
558 592
 			}
@@ -561,14 +595,12 @@  discard block
 block discarded – undo
561 595
 		if($args->mskin == '/USE_DEFAULT/')
562 596
 		{
563 597
 			$args->is_mskin_fix = 'N';
564
-		}
565
-		else
598
+		} else
566 599
 		{
567 600
 			if(isset($args->is_mskin_fix))
568 601
 			{
569 602
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570
-			}
571
-			else
603
+			} else
572 604
 			{
573 605
 				$args->is_mskin_fix = 'Y';
574 606
 			}
@@ -637,7 +669,9 @@  discard block
 block discarded – undo
637 669
 		$args->update_id = $update_id;
638 670
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 671
 
640
-		if(!!$output->error) return false;
672
+		if(!!$output->error) {
673
+			return false;
674
+		}
641 675
 
642 676
 		return true;
643 677
 	}
@@ -652,7 +686,9 @@  discard block
 block discarded – undo
652 686
 		$args->site_srl = $site_srl;
653 687
 		$args->layout_srl = $layout_srl;
654 688
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
689
+		if(!$output->toBool()) {
690
+			return $output;
691
+		}
656 692
 
657 693
 		//remove from cache
658 694
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -671,7 +707,9 @@  discard block
 block discarded – undo
671 707
 	 */
672 708
 	function deleteModule($module_srl, $site_srl = 0)
673 709
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
710
+		if(!$module_srl) {
711
+			return new BaseObject(-1,'msg_invalid_request');
712
+		}
675 713
 
676 714
 		$site_module_info = Context::get('site_module_info');
677 715
 
@@ -681,8 +719,11 @@  discard block
 block discarded – undo
681 719
 		$args = new stdClass();
682 720
 		$args->url = $output->mid;
683 721
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
685
-		else $args->site_srl = $site_srl;
722
+		if(!$site_srl) {
723
+			$args->site_srl = $site_module_info->site_srl;
724
+		} else {
725
+			$args->site_srl = $site_srl;
726
+		}
686 727
 
687 728
 		unset($output);
688 729
 
@@ -715,8 +756,7 @@  discard block
 block discarded – undo
715 756
 			if($output->isSuccess)
716 757
 			{
717 758
 				return new BaseObject(0, 'success_deleted');
718
-			}
719
-			else
759
+			} else
720 760
 			{
721 761
 				return new BaseObject($output->error, $output->message);
722 762
 			}
@@ -734,19 +774,25 @@  discard block
 block discarded – undo
734 774
 	 */
735 775
 	public function onlyDeleteModule($module_srl)
736 776
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
777
+		if(!$module_srl) {
778
+			return new BaseObject(-1,'msg_invalid_request');
779
+		}
738 780
 
739 781
 		// check start module
740 782
 		$oModuleModel = getModel('module');
741 783
 		$columnList = array('sites.index_module_srl');
742 784
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
785
+		if($module_srl == $start_module->index_module_srl) {
786
+			return new BaseObject(-1, 'msg_cannot_delete_startmodule');
787
+		}
744 788
 
745 789
 		// Call a trigger (before)
746 790
 		$trigger_obj = new stdClass();
747 791
 		$trigger_obj->module_srl = $module_srl;
748 792
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
793
+		if(!$output->toBool()) {
794
+			return $output;
795
+		}
750 796
 
751 797
 		// begin transaction
752 798
 		$oDB = &DB::getInstance();
@@ -807,7 +853,9 @@  discard block
 block discarded – undo
807 853
 	function clearDefaultModule()
808 854
 	{
809 855
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
856
+		if(!$output->toBool()) {
857
+			return $output;
858
+		}
811 859
 
812 860
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813 861
 		if($oCacheHandler->isSupport())
@@ -839,7 +887,9 @@  discard block
 block discarded – undo
839 887
 	 */
840 888
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 889
 	{
842
-		if(!count($menu_srl_list)) return;
890
+		if(!count($menu_srl_list)) {
891
+			return;
892
+		}
843 893
 
844 894
 		$args = new stdClass;
845 895
 		$args->layout_srl = $layout_srl;
@@ -866,28 +916,37 @@  discard block
 block discarded – undo
866 916
 
867 917
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 918
 
869
-		if(!$output->toBool()) return $output;
919
+		if(!$output->toBool()) {
920
+			return $output;
921
+		}
870 922
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
923
+		if(!is_array($arr_admins) || !count($arr_admins)) {
924
+			return new BaseObject();
925
+		}
872 926
 		foreach($arr_admins as $key => $user_id)
873 927
 		{
874
-			if(!trim($user_id)) continue;
928
+			if(!trim($user_id)) {
929
+				continue;
930
+			}
875 931
 			$admins[] = trim($user_id);
876 932
 		}
877
-		if(!count($admins)) return new BaseObject();
933
+		if(!count($admins)) {
934
+			return new BaseObject();
935
+		}
878 936
 
879 937
 		$oMemberModel = getModel('member');
880 938
 		$member_config = $oMemberModel->getMemberConfig();
881 939
 		if($member_config->identifier == 'email_address')
882 940
 		{
883 941
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
884
-		}
885
-		else
942
+		} else
886 943
 		{
887 944
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
888 945
 		}
889 946
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
947
+		if(!$output->toBool()||!$output->data) {
948
+			return $output;
949
+		}
891 950
 
892 951
 		foreach($output->data as $key => $val)
893 952
 		{
@@ -896,7 +955,9 @@  discard block
 block discarded – undo
896 955
 			$args->site_srl = $site_srl;
897 956
 			$args->member_srl = $val->member_srl;
898 957
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
958
+			if(!$output->toBool()) {
959
+				return $output;
960
+			}
900 961
 		}
901 962
 		return new BaseObject();
902 963
 	}
@@ -909,12 +970,15 @@  discard block
 block discarded – undo
909 970
 		$oMemberModel = getModel('member');
910 971
 		$member_config = $oMemberModel->getMemberConfig();
911 972
 
912
-		if($member_config->identifier == 'email_address')
913
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914
-		else
915
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
973
+		if($member_config->identifier == 'email_address') {
974
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
975
+		} else {
976
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
977
+		}
916 978
 
917
-		if(!$member_info->member_srl) return;
979
+		if(!$member_info->member_srl) {
980
+			return;
981
+		}
918 982
 		$args = new stdClass();
919 983
 		$args->module_srl = $module_srl;
920 984
 		$args->member_srl = $member_info->member_srl;
@@ -933,7 +997,9 @@  discard block
 block discarded – undo
933 997
 		{
934 998
 			$oMemberModel = getModel('member');
935 999
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
1000
+			if($member_info->member_srl) {
1001
+				$args->member_srl = $member_info->member_srl;
1002
+			}
937 1003
 		}
938 1004
 		return executeQuery('module.deleteAdminId', $args);
939 1005
 	}
@@ -977,7 +1043,9 @@  discard block
 block discarded – undo
977 1043
 		}
978 1044
 
979 1045
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
1046
+		if(!$obj || !count($obj)) {
1047
+			return new BaseObject();
1048
+		}
981 1049
 
982 1050
 		$args = new stdClass;
983 1051
 		$args->module_srl = $module_srl;
@@ -987,18 +1055,23 @@  discard block
 block discarded – undo
987 1055
 			// it often saved menu item(stdClass) on the skin info column
988 1056
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
989 1057
 			// fixed the error
990
-			if (is_object($val)) continue;
991
-			if (is_array($val)) $val = serialize($val);
1058
+			if (is_object($val)) {
1059
+				continue;
1060
+			}
1061
+			if (is_array($val)) {
1062
+				$val = serialize($val);
1063
+			}
992 1064
 
993 1065
 			$args->name = trim($key);
994 1066
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
1067
+			if(!$args->name || !$args->value) {
1068
+				continue;
1069
+			}
996 1070
 
997 1071
 			if($mode === 'P')
998 1072
 			{
999 1073
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000
-			}
1001
-			else
1074
+			} else
1002 1075
 			{
1003 1076
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1077
 			}
@@ -1045,8 +1118,7 @@  discard block
 block discarded – undo
1045 1118
 		{
1046 1119
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1120
 			$query = 'module.deleteModuleSkinVars';
1048
-		}
1049
-		else
1121
+		} else
1050 1122
 		{
1051 1123
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1052 1124
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1070,17 +1142,23 @@  discard block
 block discarded – undo
1070 1142
 	{
1071 1143
 		$this->deleteModuleExtraVars($module_srl);
1072 1144
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1145
+		if(!$obj || !count($obj)) {
1146
+			return;
1147
+		}
1074 1148
 
1075 1149
 		foreach($obj as $key => $val)
1076 1150
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1151
+			if(is_object($val) || is_array($val)) {
1152
+				continue;
1153
+			}
1078 1154
 
1079 1155
 			$args = new stdClass();
1080 1156
 			$args->module_srl = $module_srl;
1081 1157
 			$args->name = trim($key);
1082 1158
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1159
+			if(!$args->name || !$args->value) {
1160
+				continue;
1161
+			}
1084 1162
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1163
 		}
1086 1164
 
@@ -1120,11 +1198,15 @@  discard block
 block discarded – undo
1120 1198
 	function insertModuleGrants($module_srl, $obj)
1121 1199
 	{
1122 1200
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1201
+		if(!$obj || !count($obj)) {
1202
+			return;
1203
+		}
1124 1204
 
1125 1205
 		foreach($obj as $name => $val)
1126 1206
 		{
1127
-			if(!$val || !count($val)) continue;
1207
+			if(!$val || !count($val)) {
1208
+				continue;
1209
+			}
1128 1210
 
1129 1211
 			foreach($val as $group_srl)
1130 1212
 			{
@@ -1132,7 +1214,9 @@  discard block
 block discarded – undo
1132 1214
 				$args->module_srl = $module_srl;
1133 1215
 				$args->name = $name;
1134 1216
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1217
+				if(!$args->name || !$args->group_srl) {
1218
+					continue;
1219
+				}
1136 1220
 				executeQuery('module.insertModuleGrant', $args);
1137 1221
 			}
1138 1222
 		}
@@ -1192,7 +1276,9 @@  discard block
 block discarded – undo
1192 1276
 				require_once($cache_file);
1193 1277
 			}
1194 1278
 		}
1195
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1279
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1280
+			return $lang[$matches[1]];
1281
+		}
1196 1282
 
1197 1283
 		return str_replace('$user_lang->','',$matches[0]);
1198 1284
 	}
@@ -1204,10 +1290,14 @@  discard block
 block discarded – undo
1204 1290
 	function procModuleFileBoxAdd()
1205 1291
 	{
1206 1292
 		$ajax = Context::get('ajax');
1207
-		if ($ajax) Context::setRequestMethod('JSON');
1293
+		if ($ajax) {
1294
+			Context::setRequestMethod('JSON');
1295
+		}
1208 1296
 
1209 1297
 		$logged_info = Context::get('logged_info');
1210
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1298
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1299
+			return new BaseObject(-1, 'msg_not_permitted');
1300
+		}
1211 1301
 
1212 1302
 		$vars = Context::gets('addfile','filter');
1213 1303
 		$attributeNames = Context::get('attribute_name');
@@ -1231,9 +1321,14 @@  discard block
 block discarded – undo
1231 1321
 
1232 1322
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1233 1323
 		$vars->ext = $ext;
1234
-		if($vars->filter) $filter = explode(',',$vars->filter);
1235
-		else $filter = array('jpg','jpeg','gif','png');
1236
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1324
+		if($vars->filter) {
1325
+			$filter = explode(',',$vars->filter);
1326
+		} else {
1327
+			$filter = array('jpg','jpeg','gif','png');
1328
+		}
1329
+		if(!in_array($ext,$filter)) {
1330
+			return new BaseObject(-1, 'msg_error_occured');
1331
+		}
1237 1332
 
1238 1333
 		$vars->member_srl = $logged_info->member_srl;
1239 1334
 
@@ -1246,10 +1341,16 @@  discard block
 block discarded – undo
1246 1341
 		// insert
1247 1342
 		else
1248 1343
 		{
1249
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1344
+			if(!Context::isUploaded()) {
1345
+				return new BaseObject(-1, 'msg_error_occured');
1346
+			}
1250 1347
 			$addfile = Context::get('addfile');
1251
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1252
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1348
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1349
+				return new BaseObject(-1, 'msg_error_occured');
1350
+			}
1351
+			if($vars->addfile['error'] != 0) {
1352
+				return new BaseObject(-1, 'msg_error_occured');
1353
+			}
1253 1354
 			$output = $this->insertModuleFileBox($vars);
1254 1355
 		}
1255 1356
 
@@ -1260,11 +1361,13 @@  discard block
 block discarded – undo
1260 1361
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1261 1362
 			$this->setRedirectUrl($returnUrl);
1262 1363
 			return;
1263
-		}
1264
-		else
1364
+		} else
1265 1365
 		{
1266
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1267
-			else $this->add('save_filename', '');
1366
+			if($output) {
1367
+				$this->add('save_filename', $output->get('save_filename'));
1368
+			} else {
1369
+				$this->add('save_filename', '');
1370
+			}
1268 1371
 		}
1269 1372
 	}
1270 1373
 
@@ -1288,7 +1391,9 @@  discard block
 block discarded – undo
1288 1391
 			$tmp = $vars->addfile['tmp_name'];
1289 1392
 
1290 1393
 			// Check uploaded file
1291
-			if(!checkUploadedFile($tmp)) return false;
1394
+			if(!checkUploadedFile($tmp)) {
1395
+				return false;
1396
+			}
1292 1397
 
1293 1398
 			if(!@move_uploaded_file($tmp, $save_filename))
1294 1399
 			{
@@ -1325,7 +1430,9 @@  discard block
 block discarded – undo
1325 1430
 		$tmp = $vars->addfile['tmp_name'];
1326 1431
 
1327 1432
 		// Check uploaded file
1328
-		if(!checkUploadedFile($tmp)) return false;
1433
+		if(!checkUploadedFile($tmp)) {
1434
+			return false;
1435
+		}
1329 1436
 
1330 1437
 		// upload
1331 1438
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1354,14 +1461,20 @@  discard block
 block discarded – undo
1354 1461
 	function procModuleFileBoxDelete()
1355 1462
 	{
1356 1463
 		$logged_info = Context::get('logged_info');
1357
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1464
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1465
+			return new BaseObject(-1, 'msg_not_permitted');
1466
+		}
1358 1467
 
1359 1468
 		$module_filebox_srl = Context::get('module_filebox_srl');
1360
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1469
+		if(!$module_filebox_srl) {
1470
+			return new BaseObject(-1, 'msg_invalid_request');
1471
+		}
1361 1472
 		$vars = new stdClass();
1362 1473
 		$vars->module_filebox_srl = $module_filebox_srl;
1363 1474
 		$output = $this->deleteModuleFileBox($vars);
1364
-		if(!$output->toBool()) return $output;
1475
+		if(!$output->toBool()) {
1476
+			return $output;
1477
+		}
1365 1478
 	}
1366 1479
 
1367 1480
 	function deleteModuleFileBox($vars)
@@ -1384,9 +1497,13 @@  discard block
 block discarded – undo
1384 1497
 		$this->unlockTimeoutPassed();
1385 1498
 		$args = new stdClass;
1386 1499
 		$args->lock_name = $lock_name;
1387
-		if(!$timeout) $timeout = 60;
1500
+		if(!$timeout) {
1501
+			$timeout = 60;
1502
+		}
1388 1503
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1389
-		if($member_srl) $args->member_srl = $member_srl;
1504
+		if($member_srl) {
1505
+			$args->member_srl = $member_srl;
1506
+		}
1390 1507
 		$output = executeQuery('module.insertLock', $args);
1391 1508
 		if($output->toBool())
1392 1509
 		{
Please login to merge, or discard this patch.
modules/module/module.admin.model.php 2 patches
Spacing   +84 added lines, -84 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 BaseObject();
29
+		if (!$output->toBool() || !$output->data) return new BaseObject();
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
 		}
@@ -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;
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
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 BaseObject(-1, 'msg_invalid_request');
219 219
 		}
220 220
 
221
-		if($targetModule == '_SHORTCUT')
221
+		if ($targetModule == '_SHORTCUT')
222 222
 		{
223 223
 			return new BaseObject(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
 			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 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
 
@@ -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,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	function getModuleAdminLangCode()
453 453
 	{
454 454
 		$name = Context::get('name');
455
-		if(!$name) return new BaseObject(-1,'msg_invalid_request');
455
+		if (!$name) return new BaseObject(-1, 'msg_invalid_request');
456 456
 		$site_module_info = Context::get('site_module_info');
457 457
 		$this->add('name', $name);
458 458
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -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
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	function getModuleAdminMultilingualHtml()
529 529
 	{
530 530
 		$oTemplate = TemplateHandler::getInstance();
531
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17.html');
531
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17.html');
532 532
 
533 533
 		$this->add('html', $tpl);
534 534
 	}
@@ -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
 		}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		$oSecurity->encodeHTML('lang_code_list..');
568 568
 
569 569
 		$oTemplate = TemplateHandler::getInstance();
570
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17_list.html');
570
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17_list.html');
571 571
 
572 572
 		$this->add('html', $tpl);
573 573
 	}
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	function getModuleAdminModuleSearcherHtml()
579 579
 	{
580
-		Context::loadLang(_XE_PATH_ . 'modules/admin/lang');
580
+		Context::loadLang(_XE_PATH_.'modules/admin/lang');
581 581
 		$oTemplate = TemplateHandler::getInstance();
582
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html');
582
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'module_searcher_v17.html');
583 583
 
584 584
 		$this->add('html', $tpl);
585 585
 	}
@@ -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 BaseObject();
29
+		if(!$output->toBool() || !$output->data) {
30
+			return new BaseObject();
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 BaseObject(-1,'msg_invalid_request');
480
+		if(!$name) {
481
+			return new BaseObject(-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/comment/comment.model.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$oCommentController = getController('comment');
44 44
 
45 45
 		// feature that only member can do
46
-		if($logged_info->member_srl)
46
+		if ($logged_info->member_srl)
47 47
 		{
48 48
 			$oCommentModel = getModel('comment');
49 49
 			$columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 			$oModuleModel = getModel('module');
55 55
 			$comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
56 56
 
57
-			if($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
57
+			if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
58 58
 			{
59 59
 				// Add a vote-up button for positive feedback
60 60
 				$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
61 61
 				$oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
62 62
 			}
63 63
 
64
-			if($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
64
+			if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
65 65
 			{
66 66
 				// Add a vote-down button for negative feedback
67 67
 				$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
76 76
 		// call a trigger (after)
77 77
 		ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
78 78
 
79
-		if($this->grant->manager){
79
+		if ($this->grant->manager) {
80 80
 			$str_confirm = Context::getLang('confirm_move');
81 81
 			$url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['comment_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('comment', 'procCommentAdminMoveToTrash', params)", $str_confirm, $comment_srl);
82
-			$oCommentController->addCommentPopupMenu($url,'cmd_trash','','javascript');
82
+			$oCommentController->addCommentPopupMenu($url, 'cmd_trash', '', 'javascript');
83 83
 
84 84
 		}
85 85
 
86 86
 		// find a comment by IP matching if an administrator.
87
-		if($logged_info->is_admin == 'Y')
87
+		if ($logged_info->is_admin == 'Y')
88 88
 		{
89 89
 			$oCommentModel = getModel('comment');
90 90
 			$oComment = $oCommentModel->getComment($comment_srl);
91 91
 
92
-			if($oComment->isExists())
92
+			if ($oComment->isExists())
93 93
 			{
94 94
 				// Find a post of the corresponding ip address
95 95
 				$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		$menus = Context::get('comment_popup_menu_list');
105 105
 		$menus_count = count($menus);
106 106
 
107
-		for($i = 0; $i < $menus_count; $i++)
107
+		for ($i = 0; $i < $menus_count; $i++)
108 108
 		{
109 109
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
110 110
 		}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	function getComment($comment_srl = 0, $is_admin = FALSE, $columnList = array())
161 161
 	{
162 162
 		$oComment = new commentItem($comment_srl, $columnList);
163
-		if($is_admin)
163
+		if ($is_admin)
164 164
 		{
165 165
 			$oComment->setGrant();
166 166
 		}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	function getComments($comment_srl_list, $columnList = array())
178 178
 	{
179
-		if(is_array($comment_srl_list))
179
+		if (is_array($comment_srl_list))
180 180
 		{
181 181
 			$comment_srls = implode(',', $comment_srl_list);
182 182
 		}
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$args = new stdClass();
186 186
 		$args->comment_srls = $comment_srls;
187 187
 		$output = executeQuery('comment.getComments', $args, $columnList);
188
-		if(!$output->toBool())
188
+		if (!$output->toBool())
189 189
 		{
190 190
 			return;
191 191
 		}
192 192
 
193 193
 		$comment_list = $output->data;
194
-		if(!$comment_list)
194
+		if (!$comment_list)
195 195
 		{
196 196
 			return;
197 197
 		}
198
-		if(!is_array($comment_list))
198
+		if (!is_array($comment_list))
199 199
 		{
200 200
 			$comment_list = array($comment_list);
201 201
 		}
202 202
 
203 203
 		$comment_count = count($comment_list);
204
-		foreach($comment_list as $key => $attribute)
204
+		foreach ($comment_list as $key => $attribute)
205 205
 		{
206
-			if(!$attribute->comment_srl)
206
+			if (!$attribute->comment_srl)
207 207
 			{
208 208
 				continue;
209 209
 			}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			$oComment = NULL;
212 212
 			$oComment = new commentItem();
213 213
 			$oComment->setAttribute($attribute);
214
-			if($is_admin)
214
+			if ($is_admin)
215 215
 			{
216 216
 				$oComment->setGrant();
217 217
 			}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		$oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList);
239 239
 
240 240
 		// return if no doc exists.
241
-		if(!$oDocument->isExists())
241
+		if (!$oDocument->isExists())
242 242
 		{
243 243
 			return;
244 244
 		}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$oCommentController = getController('comment');
251 251
 
252 252
 		$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
253
-		if($using_validation)
253
+		if ($using_validation)
254 254
 		{
255 255
 			$args->status = 1;
256 256
 		}
@@ -269,18 +269,18 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	function getCommentCountByDate($date = '', $moduleSrlList = array())
271 271
 	{
272
-		if($date)
272
+		if ($date)
273 273
 		{
274 274
 			$args->regDate = date('Ymd', strtotime($date));
275 275
 		}
276 276
 
277
-		if(count($moduleSrlList) > 0)
277
+		if (count($moduleSrlList) > 0)
278 278
 		{
279 279
 			$args->module_srl = $moduleSrlList;
280 280
 		}
281 281
 
282 282
 		$output = executeQuery('comment.getCommentCount', $args);
283
-		if(!$output->toBool())
283
+		if (!$output->toBool())
284 284
 		{
285 285
 			return 0;
286 286
 		}
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 		$args = new stdClass();
300 300
 		$args->module_srl = $module_srl;
301 301
 
302
-		if(is_null($published))
302
+		if (is_null($published))
303 303
 		{
304 304
 			// check if module is using comment validation system
305 305
 			$oCommentController = getController("comment");
306 306
 			$is_using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
307
-			if($is_using_validation)
307
+			if ($is_using_validation)
308 308
 			{
309 309
 				$args->status = 1;
310 310
 			}
311 311
 		}
312 312
 		else
313 313
 		{
314
-			if($published)
314
+			if ($published)
315 315
 			{
316 316
 				$args->status = 1;
317 317
 			}
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	{
364 364
 		$args = new stdClass();
365 365
 
366
-		if(!is_object($obj))
366
+		if (!is_object($obj))
367 367
 		{
368 368
 			$obj = new stdClass();
369 369
 		}
370 370
 
371
-		if($obj->mid)
371
+		if ($obj->mid)
372 372
 		{
373 373
 			$oModuleModel = getModel('module');
374 374
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// check if module_srl is an arrary.
379
-		if(is_array($obj->module_srl))
379
+		if (is_array($obj->module_srl))
380 380
 		{
381 381
 			$args->module_srl = implode(',', $obj->module_srl);
382 382
 		}
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 		$args->document_srl = $obj->document_srl;
389 389
 		$args->list_count = $obj->list_count;
390 390
 
391
-		if(strpos($args->module_srl, ",") === false)
391
+		if (strpos($args->module_srl, ",") === false)
392 392
 		{
393
-			if($args->module_srl)
393
+			if ($args->module_srl)
394 394
 			{
395 395
 				// check if module is using comment validation system
396 396
 				$oCommentController = getController("comment");
397 397
 				$is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
398
-				if($is_using_validation)
398
+				if ($is_using_validation)
399 399
 				{
400 400
 					$args->status = 1;
401 401
 				}
@@ -404,24 +404,24 @@  discard block
 block discarded – undo
404 404
 
405 405
 		$output = executeQuery('comment.getNewestCommentList', $args, $columnList);
406 406
 
407
-		if(!$output->toBool())
407
+		if (!$output->toBool())
408 408
 		{
409 409
 			return $output;
410 410
 		}
411 411
 
412 412
 		$comment_list = $output->data;
413
-		if($comment_list)
413
+		if ($comment_list)
414 414
 		{
415
-			if(!is_array($comment_list))
415
+			if (!is_array($comment_list))
416 416
 			{
417 417
 				$comment_list = array($comment_list);
418 418
 			}
419 419
 
420 420
 			$comment_count = count($comment_list);
421 421
 
422
-			foreach($comment_list as $key => $attribute)
422
+			foreach ($comment_list as $key => $attribute)
423 423
 			{
424
-				if(!$attribute->comment_srl)
424
+				if (!$attribute->comment_srl)
425 425
 				{
426 426
 					continue;
427 427
 				}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	function getCommentList($document_srl, $page = 0, $is_admin = FALSE, $count = 0)
450 450
 	{
451
-		if(!isset($document_srl))
451
+		if (!isset($document_srl))
452 452
 		{
453 453
 			return;
454 454
 		}
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
 		$oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList);
460 460
 
461 461
 		// return if no doc exists.
462
-		if(!$oDocument->isExists())
462
+		if (!$oDocument->isExists())
463 463
 		{
464 464
 			return;
465 465
 		}
466 466
 
467 467
 		// return if no comment exists
468
-		if($oDocument->getCommentCount() < 1)
468
+		if ($oDocument->getCommentCount() < 1)
469 469
 		{
470 470
 			return;
471 471
 		}
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 		// get a list of comments
474 474
 		$module_srl = $oDocument->get('module_srl');
475 475
 
476
-		if(!$count)
476
+		if (!$count)
477 477
 		{
478 478
 			$comment_config = $this->getCommentConfig($module_srl);
479 479
 			$comment_count = $comment_config->comment_count;
480
-			if(!$comment_count)
480
+			if (!$comment_count)
481 481
 			{
482 482
 				$comment_count = 50;
483 483
 			}
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		}
489 489
 
490 490
 		// get a very last page if no page exists
491
-		if(!$page)
491
+		if (!$page)
492 492
 		{
493
-			$page = (int) ( ($oDocument->getCommentCount() - 1) / $comment_count) + 1;
493
+			$page = (int) (($oDocument->getCommentCount() - 1) / $comment_count) + 1;
494 494
 		}
495 495
 
496 496
 		// get a list of comments
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		//check if module is using validation system
504 504
 		$oCommentController = getController('comment');
505 505
 		$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
506
-		if($using_validation)
506
+		if ($using_validation)
507 507
 		{
508 508
 			$args->status = 1;
509 509
 		}
@@ -511,17 +511,17 @@  discard block
 block discarded – undo
511 511
 		$output = executeQueryArray('comment.getCommentPageList', $args);
512 512
 
513 513
 		// return if an error occurs in the query results
514
-		if(!$output->toBool())
514
+		if (!$output->toBool())
515 515
 		{
516 516
 			return;
517 517
 		}
518 518
 
519 519
 		// insert data into CommentPageList table if the number of results is different from stored comments
520
-		if(!$output->data)
520
+		if (!$output->data)
521 521
 		{
522 522
 			$this->fixCommentList($oDocument->get('module_srl'), $document_srl);
523 523
 			$output = executeQueryArray('comment.getCommentPageList', $args);
524
-			if(!$output->toBool())
524
+			if (!$output->toBool())
525 525
 			{
526 526
 				return;
527 527
 			}
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 	function fixCommentList($module_srl, $document_srl)
541 541
 	{
542 542
 		// create a lock file to prevent repeated work when performing a batch job
543
-		$lock_file = "./files/cache/tmp/lock." . $document_srl;
543
+		$lock_file = "./files/cache/tmp/lock.".$document_srl;
544 544
 
545
-		if(file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME'])
545
+		if (file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME'])
546 546
 		{
547 547
 			return;
548 548
 		}
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
 		$args->document_srl = $document_srl;
555 555
 		$args->list_order = 'list_order';
556 556
 		$output = executeQuery('comment.getCommentList', $args);
557
-		if(!$output->toBool())
557
+		if (!$output->toBool())
558 558
 		{
559 559
 			return $output;
560 560
 		}
561 561
 
562 562
 		$source_list = $output->data;
563
-		if(!is_array($source_list))
563
+		if (!is_array($source_list))
564 564
 		{
565 565
 			$source_list = array($source_list);
566 566
 		}
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 		$logged_info = Context::get('logged_info');
577 577
 
578 578
 		// generate a hierarchical structure of comments for loop
579
-		for($i = $comment_count - 1; $i >= 0; $i--)
579
+		for ($i = $comment_count - 1; $i >= 0; $i--)
580 580
 		{
581 581
 			$comment_srl = $source_list[$i]->comment_srl;
582 582
 			$parent_srl = $source_list[$i]->parent_srl;
583
-			if(!$comment_srl)
583
+			if (!$comment_srl)
584 584
 			{
585 585
 				continue;
586 586
 			}
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			// generate a list
589 589
 			$list[$comment_srl] = $source_list[$i];
590 590
 
591
-			if($parent_srl)
591
+			if ($parent_srl)
592 592
 			{
593 593
 				$list[$parent_srl]->child[] = &$list[$comment_srl];
594 594
 			}
@@ -600,9 +600,9 @@  discard block
 block discarded – undo
600 600
 		$this->_arrangeComment($comment_list, $root->child, 0, NULL);
601 601
 
602 602
 		// insert values to the database
603
-		if(count($comment_list))
603
+		if (count($comment_list))
604 604
 		{
605
-			foreach($comment_list as $comment_srl => $item)
605
+			foreach ($comment_list as $comment_srl => $item)
606 606
 			{
607 607
 				$comment_args = new stdClass();
608 608
 				$comment_args->comment_srl = $comment_srl;
@@ -631,14 +631,14 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	function _arrangeComment(&$comment_list, $list, $depth, $parent = NULL)
633 633
 	{
634
-		if(!count($list))
634
+		if (!count($list))
635 635
 		{
636 636
 			return;
637 637
 		}
638 638
 
639
-		foreach($list as $key => $val)
639
+		foreach ($list as $key => $val)
640 640
 		{
641
-			if($parent)
641
+			if ($parent)
642 642
 			{
643 643
 				$val->head = $parent->head;
644 644
 			}
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
 			$val->arrange = count($comment_list) + 1;
651 651
 
652
-			if($val->child)
652
+			if ($val->child)
653 653
 			{
654 654
 				$val->depth = $depth;
655 655
 				$comment_list[$val->comment_srl] = $val;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		// check if module is using comment validation system
687 687
 		$oCommentController = getController("comment");
688 688
 		$is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
689
-		if($is_using_validation)
689
+		if ($is_using_validation)
690 690
 		{
691 691
 			$args->s_is_published = 1;
692 692
 		}
@@ -694,12 +694,12 @@  discard block
 block discarded – undo
694 694
 		// Search options
695 695
 		$search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target'));
696 696
 		$search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword'));
697
-		if($search_target && $search_keyword)
697
+		if ($search_target && $search_keyword)
698 698
 		{
699
-			switch($search_target)
699
+			switch ($search_target)
700 700
 			{
701 701
 				case 'content' :
702
-					if($search_keyword)
702
+					if ($search_keyword)
703 703
 					{
704 704
 						$search_keyword = str_replace(' ', '%', $search_keyword);
705 705
 					}
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 					break;
709 709
 
710 710
 				case 'user_id' :
711
-					if($search_keyword)
711
+					if ($search_keyword)
712 712
 					{
713 713
 						$search_keyword = str_replace(' ', '%', $search_keyword);
714 714
 					}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 					break;
720 720
 
721 721
 				case 'user_name' :
722
-					if($search_keyword)
722
+					if ($search_keyword)
723 723
 					{
724 724
 						$search_keyword = str_replace(' ', '%', $search_keyword);
725 725
 					}
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 					break;
729 729
 
730 730
 				case 'nick_name' :
731
-					if($search_keyword)
731
+					if ($search_keyword)
732 732
 					{
733 733
 						$search_keyword = str_replace(' ', '%', $search_keyword);
734 734
 					}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 					break;
738 738
 
739 739
 				case 'email_address' :
740
-					if($search_keyword)
740
+					if ($search_keyword)
741 741
 					{
742 742
 						$search_keyword = str_replace(' ', '%', $search_keyword);
743 743
 					}
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 					break;
747 747
 
748 748
 				case 'homepage' :
749
-					if($search_keyword)
749
+					if ($search_keyword)
750 750
 					{
751 751
 						$search_keyword = str_replace(' ', '%', $search_keyword);
752 752
 					}
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
 					break;
772 772
 
773 773
 				case 'is_published' :
774
-					if($search_keyword == 'Y')
774
+					if ($search_keyword == 'Y')
775 775
 					{
776 776
 						$args->s_is_published = 1;
777 777
 					}
778 778
 
779
-					if($search_keyword == 'N')
779
+					if ($search_keyword == 'N')
780 780
 					{
781 781
 						$args->s_is_published = 0;
782 782
 					}
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 					break;
789 789
 
790 790
 				case 'member_srl' :
791
-					$args->{"s_" . $search_target} = (int) $search_keyword;
791
+					$args->{"s_".$search_target} = (int) $search_keyword;
792 792
 					break;
793 793
 			}
794 794
 		}
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 		$output = executeQueryArray($query_id, $args, $columnList);
798 798
 
799 799
 		// return when no result or error occurance
800
-		if(!$output->toBool() || !count($output->data))
800
+		if (!$output->toBool() || !count($output->data))
801 801
 		{
802 802
 			return $output;
803 803
 		}
804 804
 
805
-		foreach($output->data as $key => $val)
805
+		foreach ($output->data as $key => $val)
806 806
 		{
807 807
 			unset($_oComment);
808 808
 			$_oComment = new CommentItem(0);
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 		$search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target'));
832 832
 		$search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword'));
833 833
 
834
-		if($search_target && $search_keyword)
834
+		if ($search_target && $search_keyword)
835 835
 		{
836
-			switch($search_target)
836
+			switch ($search_target)
837 837
 			{
838 838
 				case 'content' :
839
-					if($search_keyword)
839
+					if ($search_keyword)
840 840
 					{
841 841
 						$search_keyword = str_replace(' ', '%', $search_keyword);
842 842
 					}
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 					break;
846 846
 
847 847
 				case 'user_id' :
848
-					if($search_keyword)
848
+					if ($search_keyword)
849 849
 					{
850 850
 						$search_keyword = str_replace(' ', '%', $search_keyword);
851 851
 					}
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 					break;
856 856
 
857 857
 				case 'user_name' :
858
-					if($search_keyword)
858
+					if ($search_keyword)
859 859
 					{
860 860
 						$search_keyword = str_replace(' ', '%', $search_keyword);
861 861
 					}
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 					break;
865 865
 
866 866
 				case 'nick_name' :
867
-					if($search_keyword)
867
+					if ($search_keyword)
868 868
 					{
869 869
 						$search_keyword = str_replace(' ', '%', $search_keyword);
870 870
 					}
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 					break;
874 874
 
875 875
 				case 'email_address' :
876
-					if($search_keyword)
876
+					if ($search_keyword)
877 877
 					{
878 878
 						$search_keyword = str_replace(' ', '%', $search_keyword);
879 879
 					}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 					break;
883 883
 
884 884
 				case 'homepage' :
885
-					if($search_keyword)
885
+					if ($search_keyword)
886 886
 					{
887 887
 						$search_keyword = str_replace(' ', '%', $search_keyword);
888 888
 					}
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 					break;
908 908
 
909 909
 				case 'member_srl' :
910
-					$args->{"s_" . $search_target} = (int) $search_keyword;
910
+					$args->{"s_".$search_target} = (int) $search_keyword;
911 911
 					break;
912 912
 			}
913 913
 		}
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		$output = executeQueryArray($query_id, $args);
916 916
 
917 917
 		// return when no result or error occurance
918
-		if(!$output->toBool() || !count($output->data))
918
+		if (!$output->toBool() || !count($output->data))
919 919
 		{
920 920
 			return $output;
921 921
 		}
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
 	{
933 933
 		$oModuleModel = getModel('module');
934 934
 		$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
935
-		if(!is_object($comment_config))
935
+		if (!is_object($comment_config))
936 936
 		{
937 937
 			$comment_config = new stdClass();
938 938
 		}
939 939
 
940
-		if(!isset($comment_config->comment_count))
940
+		if (!isset($comment_config->comment_count))
941 941
 		{
942 942
 			$comment_config->comment_count = 50;
943 943
 		}
@@ -952,13 +952,13 @@  discard block
 block discarded – undo
952 952
 	function getCommentVotedMemberList()
953 953
 	{
954 954
 		$comment_srl = Context::get('comment_srl');
955
-		if(!$comment_srl)
955
+		if (!$comment_srl)
956 956
 		{
957 957
 			return new BaseObject(-1, 'msg_invalid_request');
958 958
 		}
959 959
 
960 960
 		$point = Context::get('point');
961
-		if($point != -1)
961
+		if ($point != -1)
962 962
 		{
963 963
 			$point = 1;
964 964
 		}
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		$oCommentModel = getModel('comment');
967 967
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
968 968
 		$module_srl = $oComment->get('module_srl');
969
-		if(!$module_srl)
969
+		if (!$module_srl)
970 970
 		{
971 971
 			return new BaseObject(-1, 'msg_invalid_request');
972 972
 		}
@@ -976,9 +976,9 @@  discard block
 block discarded – undo
976 976
 
977 977
 		$args = new stdClass();
978 978
 
979
-		if($point == -1)
979
+		if ($point == -1)
980 980
 		{
981
-			if($comment_config->use_vote_down != 'S')
981
+			if ($comment_config->use_vote_down != 'S')
982 982
 			{
983 983
 				return new BaseObject(-1, 'msg_invalid_request');
984 984
 			}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		}
988 988
 		else
989 989
 		{
990
-			if($comment_config->use_vote_up != 'S')
990
+			if ($comment_config->use_vote_up != 'S')
991 991
 			{
992 992
 				return new BaseObject(-1, 'msg_invalid_request');
993 993
 			}
@@ -997,15 +997,15 @@  discard block
 block discarded – undo
997 997
 
998 998
 		$args->comment_srl = $comment_srl;
999 999
 		$output = executeQueryArray('comment.getVotedMemberList', $args);
1000
-		if(!$output->toBool())
1000
+		if (!$output->toBool())
1001 1001
 		{
1002 1002
 			return $output;
1003 1003
 		}
1004 1004
 
1005 1005
 		$oMemberModel = getModel('member');
1006
-		if($output->data)
1006
+		if ($output->data)
1007 1007
 		{
1008
-			foreach($output->data as $k => $d)
1008
+			foreach ($output->data as $k => $d)
1009 1009
 			{
1010 1010
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1011 1011
 				$output->data[$k]->src = $profile_image->src;
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	{
1024 1024
 		global $lang;
1025 1025
 
1026
-		if(!isset($lang->secret_name_list))
1026
+		if (!isset($lang->secret_name_list))
1027 1027
 		{
1028 1028
 			return array('Y' => 'Secret', 'N' => 'Public');
1029 1029
 		}
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
 		$output = executeQuery('comment.getCommentListByMemberSrl', $args, $columnList);
1065 1065
 		$comment_list = $output->data;
1066 1066
 
1067
-		if(!$comment_list) return array();
1068
-		if(!is_array($comment_list)) $comment_list = array($comment_list);
1067
+		if (!$comment_list) return array();
1068
+		if (!is_array($comment_list)) $comment_list = array($comment_list);
1069 1069
 
1070 1070
 		return $comment_list;
1071 1071
 
Please login to merge, or discard this patch.
modules/comment/comment.admin.controller.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		// Error display if none is selected
31 31
 		$cart = Context::get('cart');
32
-		if(!is_array($cart))
32
+		if (!is_array($cart))
33 33
 		{
34 34
 			$comment_srl_list = explode('|@|', $cart);
35 35
 		}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 
55 55
 		// Error display if none is selected
56 56
 		$cart = Context::get('cart');
57
-		if(!$cart)
57
+		if (!$cart)
58 58
 		{
59 59
 			return $this->stop('msg_cart_is_null');
60 60
 		}
61
-		if(!is_array($cart))
61
+		if (!is_array($cart))
62 62
 		{
63 63
 			$comment_srl_list = explode('|@|', $cart);
64 64
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		$args->status = $will_publish;
72 72
 		$args->comment_srls_list = $comment_srl_list;
73 73
 		$output = executeQuery('comment.updatePublishedStatus', $args);
74
-		if(!$output->toBool())
74
+		if (!$output->toBool())
75 75
 		{
76 76
 			return $output;
77 77
 		}
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 			//$oMemberModule = getModel("member");
91 91
 			//$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl);
92 92
 			$new_status = ($will_publish) ? "published" : "unpublished";
93
-			foreach($comment_srl_list as $comment_srl)
93
+			foreach ($comment_srl_list as $comment_srl)
94 94
 			{
95 95
 				// check if comment already exists
96 96
 				$comment = $oCommentModel->getComment($comment_srl);
97
-				if($comment->comment_srl != $comment_srl)
97
+				if ($comment->comment_srl != $comment_srl)
98 98
 				{
99 99
 					return new BaseObject(-1, 'msg_invalid_request');
100 100
 				}
101 101
 				$document_srl = $comment->document_srl;
102
-				if(!in_array($document_srl, $updated_documents_arr))
102
+				if (!in_array($document_srl, $updated_documents_arr))
103 103
 				{
104 104
 					$updated_documents_arr[] = $document_srl;
105 105
 					// update the number of comments
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 					// send email to comment's author, all admins and thread(document) subscribers - START
118 118
 					// -------------------------------------------------------
119 119
 					$oMail = new Mail();
120
-					$mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\"";
120
+					$mail_title = "[XE - ".$module_info->mid."] comment(s) status changed to ".$new_status." on document: \"".$oDocument->getTitleText()."\"";
121 121
 					$oMail->setTitle($mail_title);
122 122
 					$mail_content = "
123
-						The comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module.
123
+						The comment #" . $comment_srl." on document \"".$oDocument->getTitleText()."\" has been ".$new_status." by admin of <strong><i>".strtoupper($module_info->mid)."</i></strong> module.
124 124
 						<br />
125 125
 						<br />Comment content:
126
-						" . $comment->content . "
126
+						" . $comment->content."
127 127
 						<br />
128 128
 						";
129 129
 					$oMail->setContent($mail_content);
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 					*/
146 146
 					//mail to author of thread - STOP
147 147
 					//mail to all emails set for administrators - START
148
-					if($module_info->admin_mail)
148
+					if ($module_info->admin_mail)
149 149
 					{
150 150
 						$target_mail = explode(',', $module_info->admin_mail);
151
-						for($i = 0; $i < count($target_mail); $i++)
151
+						for ($i = 0; $i < count($target_mail); $i++)
152 152
 						{
153 153
 							$email_address = trim($target_mail[$i]);
154
-							if(!$email_address)
154
+							if (!$email_address)
155 155
 							{
156 156
 								continue;
157 157
 							}
158
-							if($author_email != $email_address)
158
+							if ($author_email != $email_address)
159 159
 							{
160 160
 								$oMail->setReceiptor($email_address, $email_address);
161 161
 								$oMail->send();
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 
174 174
 		// for message send - start
175 175
 		$message_content = Context::get('message_content');
176
-		if($message_content)
176
+		if ($message_content)
177 177
 		{
178 178
 			$message_content = nl2br($message_content);
179 179
 		}
180 180
 
181
-		if($message_content)
181
+		if ($message_content)
182 182
 		{
183 183
 			$this->_sendMessageForComment($message_content, $comment_srl_list);
184 184
 		}
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
 		// Error display if none is selected
197 197
 		$cart = Context::get('cart');
198
-		if(!$cart)
198
+		if (!$cart)
199 199
 		{
200 200
 			return $this->stop('msg_cart_is_null');
201 201
 		}
202
-		if(!is_array($cart))
202
+		if (!is_array($cart))
203 203
 		{
204 204
 			$comment_srl_list = explode('|@|', $cart);
205 205
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$comment_srl_list = $cart;
209 209
 		}
210 210
 		$comment_count = count($comment_srl_list);
211
-		if(!$comment_count)
211
+		if (!$comment_count)
212 212
 		{
213 213
 			return $this->stop('msg_cart_is_null');
214 214
 		}
@@ -220,34 +220,34 @@  discard block
 block discarded – undo
220 220
 
221 221
 		// for message send - start
222 222
 		$message_content = Context::get('message_content');
223
-		if($message_content)
223
+		if ($message_content)
224 224
 		{
225 225
 			$message_content = nl2br($message_content);
226 226
 		}
227 227
 
228
-		if($message_content)
228
+		if ($message_content)
229 229
 		{
230 230
 			$this->_sendMessageForComment($message_content, $comment_srl_list);
231 231
 		}
232 232
 		// for message send - end
233 233
 		// comment into trash
234
-		if($isTrash == 'true')
234
+		if ($isTrash == 'true')
235 235
 		{
236 236
 			$this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB, $message_content);
237 237
 		}
238 238
 
239 239
 		$deleted_count = 0;
240 240
 		// Delete the comment posting
241
-		for($i = 0; $i < $comment_count; $i++)
241
+		for ($i = 0; $i < $comment_count; $i++)
242 242
 		{
243 243
 			$comment_srl = trim($comment_srl_list[$i]);
244
-			if(!$comment_srl)
244
+			if (!$comment_srl)
245 245
 			{
246 246
 				continue;
247 247
 			}
248 248
 
249 249
 			$output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash);
250
-			if(!$output->toBool())
250
+			if (!$output->toBool())
251 251
 			{
252 252
 				$oDB->rollback();
253 253
 				return $output;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$oDB->commit();
260 260
 
261 261
 		$msgCode = '';
262
-		if($isTrash == 'true')
262
+		if ($isTrash == 'true')
263 263
 		{
264 264
 			$msgCode = 'success_trashed';
265 265
 		}
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
 		$sender_member_srl = $logged_info->member_srl;
291 291
 
292 292
 		$comment_count = count($comment_srl_list);
293
-		for($i = 0; $i < $comment_count; $i++)
293
+		for ($i = 0; $i < $comment_count; $i++)
294 294
 		{
295 295
 			$comment_srl = $comment_srl_list[$i];
296 296
 			$oComment = $oCommentModel->getComment($comment_srl, TRUE);
297 297
 
298
-			if(!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl)
298
+			if (!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl)
299 299
 			{
300 300
 				continue;
301 301
 			}
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL)
314 314
 	{
315
-		require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php');
315
+		require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
316 316
 
317
-		if(is_array($commentSrlList))
317
+		if (is_array($commentSrlList))
318 318
 		{
319 319
 			$logged_info = Context::get('logged_info');
320 320
 			$oCommentModel = getModel('comment');
321 321
 			$commentItemList = $oCommentModel->getComments($commentSrlList);
322 322
 			$oTrashAdminController = getAdminController('trash');
323 323
 
324
-			foreach($commentItemList AS $key => $oComment)
324
+			foreach ($commentItemList AS $key => $oComment)
325 325
 			{
326 326
 				$oTrashVO = new TrashVO();
327 327
 				$oTrashVO->setTrashSrl(getNextSequence());
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 				$oTrashVO->setDescription($message_content);
332 332
 
333 333
 				$output = $oTrashAdminController->insertTrash($oTrashVO);
334
-				if(!$output->toBool())
334
+				if (!$output->toBool())
335 335
 				{
336 336
 					$oDB->rollback();
337 337
 					return $output;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		$oCommentController = getController('comment');
356 356
 		$oComment = $oCommentModel->getComment($comment_srl, false);
357 357
 
358
-		if(!$oComment->isGranted()) return $this->stop('msg_not_permitted');
358
+		if (!$oComment->isGranted()) return $this->stop('msg_not_permitted');
359 359
 
360 360
 		$message_content = "";
361 361
 		$this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content);
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 	{
378 378
 		$comment_srl = trim(Context::get('comment_srl'));
379 379
 
380
-		if($comment_srl)
380
+		if ($comment_srl)
381 381
 		{
382 382
 			$args = new stdClass();
383 383
 			$args->comment_srl = $comment_srl;
384 384
 			$output = executeQuery('comment.deleteDeclaredComments', $args);
385
-			if(!$output->toBool())
385
+			if (!$output->toBool())
386 386
 			{
387 387
 				return $output;
388 388
 			}
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 
404 404
 		$output = $oCommentModel->getComments($commentSrlList);
405 405
 
406
-		if(is_array($output))
406
+		if (is_array($output))
407 407
 		{
408
-			foreach($output AS $key => $value)
408
+			foreach ($output AS $key => $value)
409 409
 			{
410
-				if($_SESSION['comment_management'][$key])
410
+				if ($_SESSION['comment_management'][$key])
411 411
 				{
412 412
 					unset($_SESSION['comment_management'][$key]);
413 413
 				}
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		$args = new stdClass();
429 429
 		$args->module_srl = $module_srl;
430 430
 		$output = executeQuery('comment.deleteModuleComments', $args);
431
-		if(!$output->toBool())
431
+		if (!$output->toBool())
432 432
 		{
433 433
 			return $output;
434 434
 		}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 		//remove from cache
439 439
 		$oCacheHandler = CacheHandler::getInstance('object');
440
-		if($oCacheHandler->isSupport())
440
+		if ($oCacheHandler->isSupport())
441 441
 		{
442 442
 			// Invalidate newest comments. Per document cache is invalidated inside document admin controller.
443 443
 			$oCacheHandler->invalidateGroupKey('newestCommentsList');
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	function restoreTrash($originObject)
454 454
 	{
455
-		if(is_array($originObject))
455
+		if (is_array($originObject))
456 456
 		{
457 457
 			$originObject = (object) $originObject;
458 458
 		}
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	function emptyTrash($originObject)
486 486
 	{
487 487
 		$originObject = unserialize($originObject);
488
-		if(is_array($originObject))
488
+		if (is_array($originObject))
489 489
 		{
490 490
 			$originObject = (object) $originObject;
491 491
 		}
Please login to merge, or discard this patch.