GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#1814)
by
unknown
11:57
created
modules/module/module.controller.php 4 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -933,6 +933,7 @@  discard block
 block discarded – undo
933 933
 
934 934
 	/**
935 935
 	 * @brief Insert skin vars to a module
936
+	 * @param string $mode
936 937
 	 */
937 938
 	function _insertModuleSkinVars($module_srl, $obj, $mode)
938 939
 	{
@@ -1006,6 +1007,7 @@  discard block
 block discarded – undo
1006 1007
 
1007 1008
 	/**
1008 1009
 	 * @brief Remove skin vars of a module
1010
+	 * @param string $mode
1009 1011
 	 */
1010 1012
 	function _deleteModuleSkinVars($module_srl, $mode)
1011 1013
 	{
@@ -1242,6 +1244,7 @@  discard block
 block discarded – undo
1242 1244
 
1243 1245
 	/**
1244 1246
 	 * @brief Update a file into the file box
1247
+	 * @param stdClass $vars
1245 1248
 	 */
1246 1249
 	function updateModuleFileBox($vars)
1247 1250
 	{
@@ -1283,6 +1286,7 @@  discard block
 block discarded – undo
1283 1286
 
1284 1287
 	/**
1285 1288
 	 * @brief Add a file into the file box
1289
+	 * @param stdClass $vars
1286 1290
 	 */
1287 1291
 	function insertModuleFileBox($vars)
1288 1292
 	{
@@ -1336,6 +1340,9 @@  discard block
 block discarded – undo
1336 1340
 		if(!$output->toBool()) return $output;
1337 1341
 	}
1338 1342
 
1343
+	/**
1344
+	 * @param stdClass $vars
1345
+	 */
1339 1346
 	function deleteModuleFileBox($vars)
1340 1347
 	{
1341 1348
 		// delete real file
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleController
5
- * @author NAVER ([email protected])
6
- * @brief controller class of the module module
7
- */
4
+	 * @class  moduleController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief controller class of the module module
7
+	 */
8 8
 class moduleController extends module
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$output = executeQuery('module.insertActionForward', $args);
30 30
 
31 31
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
32
-		if($oCacheHandler->isSupport())
32
+		if ($oCacheHandler->isSupport())
33 33
 		{
34 34
 			$cache_key = 'action_forward';
35 35
 			$oCacheHandler->delete($cache_key);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$output = executeQuery('module.deleteActionForward', $args);
52 52
 
53 53
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
54
-		if($oCacheHandler->isSupport())
54
+		if ($oCacheHandler->isSupport())
55 55
 		{
56 56
 			$cache_key = 'action_forward';
57 57
 			$oCacheHandler->delete($cache_key);
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$args->called_position = $called_position;
76 76
 
77 77
 		$output = executeQuery('module.insertTrigger', $args);
78
-		if($output->toBool())
78
+		if ($output->toBool())
79 79
 		{
80 80
 			//remove from cache
81 81
 			$GLOBALS['__triggers__'] = NULL;
82 82
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
83
-			if($oCacheHandler->isSupport())
83
+			if ($oCacheHandler->isSupport())
84 84
 			{
85 85
 				$cache_key = 'triggers';
86 86
 				$oCacheHandler->delete($cache_key);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 		$args->called_position = $called_position;
105 105
 
106 106
 		$output = executeQuery('module.deleteTrigger', $args);
107
-		if($output->toBool())
107
+		if ($output->toBool())
108 108
 		{
109 109
 			//remove from cache
110 110
 			$GLOBALS['__triggers__'] = NULL;
111 111
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
112
-			if($oCacheHandler->isSupport())
112
+			if ($oCacheHandler->isSupport())
113 113
 			{
114 114
 				$cache_key = 'triggers';
115 115
 				$oCacheHandler->delete($cache_key);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 		$args->module = $module;
130 130
 
131 131
 		$output = executeQuery('module.deleteModuleTriggers', $args);
132
-		if($output->toBool())
132
+		if ($output->toBool())
133 133
 		{
134 134
 			//remove from cache
135 135
 			$GLOBALS['__triggers__'] = NULL;
136 136
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
137
-			if($oCacheHandler->isSupport())
137
+			if ($oCacheHandler->isSupport())
138 138
 			{
139 139
 				$cache_key = 'triggers';
140 140
 				$oCacheHandler->delete($cache_key);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 * @brief Add module extend
149 149
 	 *
150 150
 	 */
151
-	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
151
+	function insertModuleExtend($parent_module, $extend_module, $type, $kind = '')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if ($kind != 'admin') $kind = '';
154
+		if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false;
155
+		if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false;
156 156
 
157 157
 		$cache_file = './files/config/module_extend.php';
158 158
 		FileHandler::removeFile($cache_file);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$args->kind = $kind;
165 165
 
166 166
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
167
+		if ($output->data->count > 0) return false;
168 168
 
169 169
 		$output = executeQuery('module.insertModuleExtend', $args);
170 170
 		return $output;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @brief Delete module extend
175 175
 	 *
176 176
 	 */
177
-	function deleteModuleExtend($parent_module, $extend_module, $type, $kind='')
177
+	function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '')
178 178
 	{
179 179
 		$cache_file = './files/config/module_extend.php';
180 180
 		FileHandler::removeFile($cache_file);
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		$oModuleModel = getModel('module');
200 200
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 201
 
202
-		if(!$origin_config) $origin_config = new stdClass;
202
+		if (!$origin_config) $origin_config = new stdClass;
203 203
 
204
-		foreach($config as $key => $val)
204
+		foreach ($config as $key => $val)
205 205
 		{
206 206
 			$origin_config->{$key} = $val;
207 207
 		}
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	function insertModuleConfig($module, $config, $site_srl = 0)
217 217
 	{
218
-		$args =new stdClass();
218
+		$args = new stdClass();
219 219
 		$args->module = $module;
220 220
 		$args->config = serialize($config);
221 221
 		$args->site_srl = $site_srl;
222 222
 
223 223
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
224
+		if (!$output->toBool()) return $output;
225 225
 
226 226
 		$output = executeQuery('module.insertModuleConfig', $args);
227 227
 
228 228
 		//remove from cache
229 229
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
230
-		if($oCacheHandler->isSupport())
230
+		if ($oCacheHandler->isSupport())
231 231
 		{
232 232
 			$oCacheHandler->invalidateGroupKey('site_and_module');
233 233
 		}
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 		$args->config = serialize($config);
247 247
 
248 248
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
249
+		if (!$output->toBool()) return $output;
250 250
 
251 251
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 252
 
253 253
 		//remove from cache
254 254
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
255
-		if($oCacheHandler->isSupport())
255
+		if ($oCacheHandler->isSupport())
256 256
 		{
257 257
 			$oCacheHandler->invalidateGroupKey('site_and_module');
258 258
 		}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	function insertSite($domain, $index_module_srl)
267 267
 	{
268
-		if(isSiteID($domain))
268
+		if (isSiteID($domain))
269 269
 		{
270 270
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
271
+			if ($oModuleModel->isIDExists($domain, 0)) return new Object(-1, 'msg_already_registed_vid');
272 272
 		}
273 273
 		else
274 274
 		{
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 		$columnList = array('modules.site_srl');
285 285
 		$oModuleModel = getModel('module');
286 286
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new Object(-1,'msg_already_registed_vid');
287
+		if ($output) return new Object(-1, 'msg_already_registed_vid');
288 288
 
289 289
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
290
+		if (!$output->toBool()) return $output;
291 291
 
292 292
 		$output->add('site_srl', $args->site_srl);
293 293
 		return $output;
@@ -302,32 +302,32 @@  discard block
 block discarded – undo
302 302
 		$columnList = array('sites.site_srl', 'sites.domain');
303 303
 		$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
304 304
 
305
-		if(!$args->domain && $site_info->site_srl == $args->site_srl)
305
+		if (!$args->domain && $site_info->site_srl == $args->site_srl)
306 306
 		{
307 307
 			$args->domain = $site_info->domain;
308 308
 		}
309 309
 
310
-		if($site_info->domain != $args->domain)
310
+		if ($site_info->domain != $args->domain)
311 311
 		{
312 312
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
313
+			if ($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1, 'msg_already_registed_domain');
314
+			if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1, 'msg_already_registed_vid');
315 315
 
316
-			if($args->domain && !isSiteID($args->domain))
316
+			if ($args->domain && !isSiteID($args->domain))
317 317
 			{
318 318
 				$args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain;
319 319
 			}
320 320
 		}
321 321
 		$output = executeQuery('module.updateSite', $args);
322 322
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
323
+		if ($args->site_srl == 0) $vid = '';
324
+		else $vid = $args->domain;
325 325
 
326 326
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 327
 		$mid = $module_info->mid;
328 328
 
329 329
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
330
-		if($oCacheHandler->isSupport())
330
+		if ($oCacheHandler->isSupport())
331 331
 		{
332 332
 			$oCacheHandler->invalidateGroupKey('site_and_module');
333 333
 		}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		unset($args->act);
346 346
 		unset($args->page);
347 347
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
348
+		if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
349 349
 		// Test variables (separate basic vars and other vars in modules)
350 350
 		$extra_vars = clone($args);
351 351
 		unset($extra_vars->module_srl);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function insertModule($args)
381 381
 	{
382
-		if(isset($args->isMenuCreate))
382
+		if (isset($args->isMenuCreate))
383 383
 		{
384 384
 			$isMenuCreate = $args->isMenuCreate;
385 385
 		}
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 		}
390 390
 
391 391
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
392
+		if (!$output->toBool()) return $output;
393 393
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
394
+		if (!$args->site_srl) $args->site_srl = 0;
395 395
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
396
+		if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
397 397
 
398 398
 		// begin transaction
399 399
 		$oDB = &DB::getInstance();
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		$skin_vars = new stdClass();
405 405
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 406
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
407
+		if (!$args->module_srl) $args->module_srl = getNextSequence();
408 408
 
409 409
 		// default value
410
-		if($args->skin == '/USE_DEFAULT/')
410
+		if ($args->skin == '/USE_DEFAULT/')
411 411
 		{
412 412
 			$args->is_skin_fix = 'N';
413 413
 		}
414 414
 		else
415 415
 		{
416
-			if(isset($args->is_skin_fix))
416
+			if (isset($args->is_skin_fix))
417 417
 			{
418 418
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419 419
 			}
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			}
424 424
 		}
425 425
 
426
-		if($args->mskin == '/USE_DEFAULT/')
426
+		if ($args->mskin == '/USE_DEFAULT/')
427 427
 		{
428 428
 			$args->is_mskin_fix = 'N';
429 429
 		}
430 430
 		else
431 431
 		{
432
-			if(isset($args->is_mskin_fix))
432
+			if (isset($args->is_mskin_fix))
433 433
 			{
434 434
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435 435
 			}
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 
444 444
 		$args->browser_title = strip_tags($args->browser_title);
445 445
 
446
-		if($isMenuCreate == TRUE)
446
+		if ($isMenuCreate == TRUE)
447 447
 		{
448 448
 			$menuArgs = new stdClass;
449 449
 			$menuArgs->menu_srl = $args->menu_srl;
450 450
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
451 451
 
452 452
 			// if menu is not created, create menu also. and does not supported that in virtual site.
453
-			if(!$menuOutput->data && !$args->site_srl)
453
+			if (!$menuOutput->data && !$args->site_srl)
454 454
 			{
455 455
 				$oMenuAdminModel = getAdminModel('menu');
456 456
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				$menuArgs->listorder = $args->menu_item_srl * -1;
469 469
 
470 470
 				$menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs);
471
-				if(!$menuItemOutput->toBool())
471
+				if (!$menuItemOutput->toBool())
472 472
 				{
473 473
 					$oDB->rollback();
474 474
 					return $menuItemOutput;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		// Insert a module
482 482
 		$args->menu_srl = $menuArgs->menu_srl;
483 483
 		$output = executeQuery('module.insertModule', $args);
484
-		if(!$output->toBool())
484
+		if (!$output->toBool())
485 485
 		{
486 486
 			$oDB->rollback();
487 487
 			return $output;
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 		$oDB->commit();
494 494
 
495 495
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
496
-		if($oCacheHandler->isSupport())
496
+		if ($oCacheHandler->isSupport())
497 497
 		{
498 498
 			$oCacheHandler->invalidateGroupKey('site_and_module');
499 499
 		}
500 500
 
501
-		$output->add('module_srl',$args->module_srl);
501
+		$output->add('module_srl', $args->module_srl);
502 502
 		return $output;
503 503
 	}
504 504
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	function updateModule($args)
509 509
 	{
510 510
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
511
-		if(!$output->toBool()) return $output;
511
+		if (!$output->toBool()) return $output;
512 512
 		// begin transaction
513 513
 		$oDB = &DB::getInstance();
514 514
 		$oDB->begin();
@@ -517,29 +517,29 @@  discard block
 block discarded – undo
517 517
 		$columnList = array('module_srl', 'site_srl', 'browser_title', 'mid');
518 518
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
519 519
 
520
-		if(!$args->site_srl || !$args->browser_title)
520
+		if (!$args->site_srl || !$args->browser_title)
521 521
 		{
522
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
523
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
522
+			if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl;
523
+			if (!$args->browser_title) $args->browser_title = $module_info->browser_title;
524 524
 		}
525 525
 
526 526
 		$args->browser_title = strip_tags($args->browser_title);
527 527
 
528 528
 		$output = executeQuery('module.isExistsModuleName', $args);
529
-		if(!$output->toBool() || $output->data->count)
529
+		if (!$output->toBool() || $output->data->count)
530 530
 		{
531 531
 			$oDB->rollback();
532 532
 			return new Object(-1, 'msg_module_name_exists');
533 533
 		}
534 534
 
535 535
 		// default value
536
-		if($args->skin == '/USE_DEFAULT/')
536
+		if ($args->skin == '/USE_DEFAULT/')
537 537
 		{
538 538
 			$args->is_skin_fix = 'N';
539 539
 		}
540 540
 		else
541 541
 		{
542
-			if(isset($args->is_skin_fix))
542
+			if (isset($args->is_skin_fix))
543 543
 			{
544 544
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
545 545
 			}
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 			}
550 550
 		}
551 551
 
552
-		if($args->mskin == '/USE_DEFAULT/')
552
+		if ($args->mskin == '/USE_DEFAULT/')
553 553
 		{
554 554
 			$args->is_mskin_fix = 'N';
555 555
 		}
556 556
 		else
557 557
 		{
558
-			if(isset($args->is_mskin_fix))
558
+			if (isset($args->is_mskin_fix))
559 559
 			{
560 560
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
561 561
 			}
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			}
566 566
 		}
567 567
 		$output = executeQuery('module.updateModule', $args);
568
-		if(!$output->toBool())
568
+		if (!$output->toBool())
569 569
 		{
570 570
 			$oDB->rollback();
571 571
 			return $output;
@@ -575,15 +575,15 @@  discard block
 block discarded – undo
575 575
 		$menuArgs->url = $module_info->mid;
576 576
 		$menuArgs->site_srl = $module_info->site_srl;
577 577
 		$menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs);
578
-		if($menuOutput->data && count($menuOutput->data))
578
+		if ($menuOutput->data && count($menuOutput->data))
579 579
 		{
580 580
 			$oMenuAdminController = getAdminController('menu');
581
-			foreach($menuOutput->data as $itemInfo)
581
+			foreach ($menuOutput->data as $itemInfo)
582 582
 			{
583 583
 				$itemInfo->url = $args->mid;
584 584
 
585 585
 				$updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo);
586
-				if(!$updateMenuItemOutput->toBool())
586
+				if (!$updateMenuItemOutput->toBool())
587 587
 				{
588 588
 					$oDB->rollback();
589 589
 					return $updateMenuItemOutput;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		}
593 593
 
594 594
 		// if mid changed, change mid of success_return_url to new mid
595
-		if($module_info->mid != $args->mid && Context::get('success_return_url'))
595
+		if ($module_info->mid != $args->mid && Context::get('success_return_url'))
596 596
 		{
597 597
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
598 598
 		}
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 
603 603
 		$oDB->commit();
604 604
 
605
-		$output->add('module_srl',$args->module_srl);
605
+		$output->add('module_srl', $args->module_srl);
606 606
 
607 607
 		//remove from cache
608 608
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
609
-		if($oCacheHandler->isSupport())
609
+		if ($oCacheHandler->isSupport())
610 610
 		{
611 611
 			$oCacheHandler->invalidateGroupKey('site_and_module');
612 612
 		}
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 		$args->site_srl = $site_srl;
625 625
 		$args->layout_srl = $layout_srl;
626 626
 		$output = executeQuery('module.updateModuleSite', $args);
627
-		if(!$output->toBool()) return $output;
627
+		if (!$output->toBool()) return $output;
628 628
 
629 629
 		//remove from cache
630 630
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
631
-		if($oCacheHandler->isSupport())
631
+		if ($oCacheHandler->isSupport())
632 632
 		{
633 633
 			$oCacheHandler->invalidateGroupKey('site_and_module');
634 634
 		}
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 */
644 644
 	function deleteModule($module_srl, $site_srl = 0)
645 645
 	{
646
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
646
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
647 647
 
648 648
 		$site_module_info = Context::get('site_module_info');
649 649
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$args = new stdClass();
654 654
 		$args->url = $output->mid;
655 655
 		$args->is_shortcut = 'N';
656
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
656
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
657 657
 		else $args->site_srl = $site_srl;
658 658
 
659 659
 		unset($output);
@@ -662,9 +662,9 @@  discard block
 block discarded – undo
662 662
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
663 663
 
664 664
 		// get menu_srl by site_srl
665
-		if(is_array($menuOutput->data))
665
+		if (is_array($menuOutput->data))
666 666
 		{
667
-			foreach($menuOutput->data AS $key=>$value)
667
+			foreach ($menuOutput->data AS $key=>$value)
668 668
 			{
669 669
 				$args->menu_srl = $value->menu_srl;
670 670
 				break;
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 
674 674
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
675 675
 		// menu delete
676
-		if($output->data)
676
+		if ($output->data)
677 677
 		{
678 678
 			unset($args);
679 679
 			$args = new stdClass;
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			$oMenuAdminController = getAdminController('menu');
685 685
 			$output = $oMenuAdminController->deleteItem($args);
686 686
 
687
-			if($output->isSuccess)
687
+			if ($output->isSuccess)
688 688
 			{
689 689
 				return new Object(0, 'success_deleted');
690 690
 			}
@@ -706,19 +706,19 @@  discard block
 block discarded – undo
706 706
 	 */
707 707
 	public function onlyDeleteModule($module_srl)
708 708
 	{
709
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
709
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
710 710
 
711 711
 		// check start module
712 712
 		$oModuleModel = getModel('module');
713 713
 		$columnList = array('sites.index_module_srl');
714 714
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
715
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
715
+		if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
716 716
 
717 717
 		// Call a trigger (before)
718 718
 		$trigger_obj = new stdClass();
719 719
 		$trigger_obj->module_srl = $module_srl;
720 720
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
721
-		if(!$output->toBool()) return $output;
721
+		if (!$output->toBool()) return $output;
722 722
 
723 723
 		// begin transaction
724 724
 		$oDB = &DB::getInstance();
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		$args->module_srl = $module_srl;
729 729
 		// Delete module information from the DB
730 730
 		$output = executeQuery('module.deleteModule', $args);
731
-		if(!$output->toBool())
731
+		if (!$output->toBool())
732 732
 		{
733 733
 			$oDB->rollback();
734 734
 			return $output;
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
 		// Remove the module manager
743 743
 		$this->deleteAdminId($module_srl);
744 744
 		// Call a trigger (after)
745
-		if($output->toBool())
745
+		if ($output->toBool())
746 746
 		{
747 747
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
748
-			if(!$trigger_output->toBool())
748
+			if (!$trigger_output->toBool())
749 749
 			{
750 750
 				$oDB->rollback();
751 751
 				return $trigger_output;
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 
758 758
 		//remove from cache
759 759
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
760
-		if($oCacheHandler->isSupport())
760
+		if ($oCacheHandler->isSupport())
761 761
 		{
762 762
 			$oCacheHandler->invalidateGroupKey('site_and_module');
763 763
 		}
@@ -779,10 +779,10 @@  discard block
 block discarded – undo
779 779
 	function clearDefaultModule()
780 780
 	{
781 781
 		$output = executeQuery('module.clearDefaultModule');
782
-		if(!$output->toBool()) return $output;
782
+		if (!$output->toBool()) return $output;
783 783
 
784 784
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
785
-		if($oCacheHandler->isSupport())
785
+		if ($oCacheHandler->isSupport())
786 786
 		{
787 787
 			$oCacheHandler->invalidateGroupKey('site_and_module');
788 788
 		}
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		$output = executeQuery('module.updateModuleMenu', $args);
799 799
 
800 800
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
801
-		if($oCacheHandler->isSupport())
801
+		if ($oCacheHandler->isSupport())
802 802
 		{
803 803
 			$oCacheHandler->invalidateGroupKey('site_and_module');
804 804
 		}
@@ -811,15 +811,15 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	function updateModuleLayout($layout_srl, $menu_srl_list)
813 813
 	{
814
-		if(!count($menu_srl_list)) return;
814
+		if (!count($menu_srl_list)) return;
815 815
 
816 816
 		$args = new stdClass;
817 817
 		$args->layout_srl = $layout_srl;
818
-		$args->menu_srls = implode(',',$menu_srl_list);
818
+		$args->menu_srls = implode(',', $menu_srl_list);
819 819
 		$output = executeQuery('module.updateModuleLayout', $args);
820 820
 
821 821
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
822
-		if($oCacheHandler->isSupport())
822
+		if ($oCacheHandler->isSupport())
823 823
 		{
824 824
 			$oCacheHandler->invalidateGroupKey('site_and_module');
825 825
 		}
@@ -838,37 +838,37 @@  discard block
 block discarded – undo
838 838
 
839 839
 		$output = executeQuery('module.deleteSiteAdmin', $args);
840 840
 
841
-		if(!$output->toBool()) return $output;
841
+		if (!$output->toBool()) return $output;
842 842
 		// Get user id of an administrator
843
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
844
-		foreach($arr_admins as $key => $user_id)
843
+		if (!is_array($arr_admins) || !count($arr_admins)) return new Object();
844
+		foreach ($arr_admins as $key => $user_id)
845 845
 		{
846
-			if(!trim($user_id)) continue;
846
+			if (!trim($user_id)) continue;
847 847
 			$admins[] = trim($user_id);
848 848
 		}
849
-		if(!count($admins)) return new Object();
849
+		if (!count($admins)) return new Object();
850 850
 
851 851
 		$oMemberModel = getModel('member');
852 852
 		$member_config = $oMemberModel->getMemberConfig();
853
-		if($member_config->identifier == 'email_address')
853
+		if ($member_config->identifier == 'email_address')
854 854
 		{
855
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
855
+			$args->email_address = '\'' . implode('\',\'', $admins) . '\'';
856 856
 		}
857 857
 		else
858 858
 		{
859
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
859
+			$args->user_ids = '\'' . implode('\',\'', $admins) . '\'';
860 860
 		}
861 861
 		$output = executeQueryArray('module.getAdminSrls', $args);
862
-		if(!$output->toBool()||!$output->data) return $output;
862
+		if (!$output->toBool() || !$output->data) return $output;
863 863
 
864
-		foreach($output->data as $key => $val)
864
+		foreach ($output->data as $key => $val)
865 865
 		{
866 866
 			unset($args);
867 867
 			$args = new stdClass;
868 868
 			$args->site_srl = $site_srl;
869 869
 			$args->member_srl = $val->member_srl;
870 870
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
871
-			if(!$output->toBool()) return $output;
871
+			if (!$output->toBool()) return $output;
872 872
 		}
873 873
 		return new Object();
874 874
 	}
@@ -881,12 +881,12 @@  discard block
 block discarded – undo
881 881
 		$oMemberModel = getModel('member');
882 882
 		$member_config = $oMemberModel->getMemberConfig();
883 883
 
884
-		if($member_config->identifier == 'email_address')
884
+		if ($member_config->identifier == 'email_address')
885 885
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
886 886
 		else
887 887
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
888 888
 
889
-		if(!$member_info->member_srl) return;
889
+		if (!$member_info->member_srl) return;
890 890
 		$args = new stdClass();
891 891
 		$args->module_srl = $module_srl;
892 892
 		$args->member_srl = $member_info->member_srl;
@@ -901,11 +901,11 @@  discard block
 block discarded – undo
901 901
 		$args = new stdClass();
902 902
 		$args->module_srl = $module_srl;
903 903
 
904
-		if($admin_id)
904
+		if ($admin_id)
905 905
 		{
906 906
 			$oMemberModel = getModel('member');
907 907
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
908
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
908
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
909 909
 		}
910 910
 		return executeQuery('module.deleteAdminId', $args);
911 911
 	}
@@ -942,18 +942,18 @@  discard block
 block discarded – undo
942 942
 		$oDB->begin();
943 943
 
944 944
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
945
-		if(!$output->toBool())
945
+		if (!$output->toBool())
946 946
 		{
947 947
 			$oDB->rollback();
948 948
 			return $output;
949 949
 		}
950 950
 
951 951
 		getDestroyXeVars($obj);
952
-		if(!$obj || !count($obj)) return new Object();
952
+		if (!$obj || !count($obj)) return new Object();
953 953
 
954 954
 		$args = new stdClass;
955 955
 		$args->module_srl = $module_srl;
956
-		foreach($obj as $key => $val)
956
+		foreach ($obj as $key => $val)
957 957
 		{
958 958
 			// #17927989 For an old board which used the old blog module
959 959
 			// it often saved menu item(stdClass) on the skin info column
@@ -964,9 +964,9 @@  discard block
 block discarded – undo
964 964
 
965 965
 			$args->name = trim($key);
966 966
 			$args->value = trim($val);
967
-			if(!$args->name || !$args->value) continue;
967
+			if (!$args->name || !$args->value) continue;
968 968
 
969
-			if($mode === 'P')
969
+			if ($mode === 'P')
970 970
 			{
971 971
 				$output = executeQuery('module.insertModuleSkinVars', $args);
972 972
 			}
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 			{
975 975
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
976 976
 			}
977
-			if(!$output->toBool())
977
+			if (!$output->toBool())
978 978
 			{
979 979
 				return $output;
980 980
 				$oDB->rollback();
@@ -1013,21 +1013,21 @@  discard block
 block discarded – undo
1013 1013
 		$args->module_srl = $module_srl;
1014 1014
 		$mode = $mode === 'P' ? 'P' : 'M';
1015 1015
 
1016
-		if($mode === 'P')
1016
+		if ($mode === 'P')
1017 1017
 		{
1018
-			$object_key = 'module_skin_vars:'.$module_srl;
1018
+			$object_key = 'module_skin_vars:' . $module_srl;
1019 1019
 			$query = 'module.deleteModuleSkinVars';
1020 1020
 		}
1021 1021
 		else
1022 1022
 		{
1023
-			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1023
+			$object_key = 'module_mobile_skin_vars:' . $module_srl;
1024 1024
 			$query = 'module.deleteModuleMobileSkinVars';
1025 1025
 		}
1026 1026
 
1027 1027
 		//remove from cache
1028 1028
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1029 1029
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1030
-		if($oCacheHandler->isSupport())
1030
+		if ($oCacheHandler->isSupport())
1031 1031
 		{
1032 1032
 			$oCacheHandler->delete($cache_key);
1033 1033
 		}
@@ -1042,24 +1042,24 @@  discard block
 block discarded – undo
1042 1042
 	{
1043 1043
 		$this->deleteModuleExtraVars($module_srl);
1044 1044
 		getDestroyXeVars($obj);
1045
-		if(!$obj || !count($obj)) return;
1045
+		if (!$obj || !count($obj)) return;
1046 1046
 
1047
-		foreach($obj as $key => $val)
1047
+		foreach ($obj as $key => $val)
1048 1048
 		{
1049
-			if(is_object($val) || is_array($val)) continue;
1049
+			if (is_object($val) || is_array($val)) continue;
1050 1050
 
1051 1051
 			$args = new stdClass();
1052 1052
 			$args->module_srl = $module_srl;
1053 1053
 			$args->name = trim($key);
1054 1054
 			$args->value = trim($val);
1055
-			if(!$args->name || !$args->value) continue;
1055
+			if (!$args->name || !$args->value) continue;
1056 1056
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1057 1057
 		}
1058 1058
 
1059 1059
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1060
-		if($oCacheHandler->isSupport())
1060
+		if ($oCacheHandler->isSupport())
1061 1061
 		{
1062
-			$object_key = 'module_extra_vars:'.$module_srl;
1062
+			$object_key = 'module_extra_vars:' . $module_srl;
1063 1063
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1064 1064
 			$oCacheHandler->delete($cache_key);
1065 1065
 		}
@@ -1076,9 +1076,9 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
 		//remove from cache
1078 1078
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1079
-		if($oCacheHandler->isSupport())
1079
+		if ($oCacheHandler->isSupport())
1080 1080
 		{
1081
-			$object_key = 'module_extra_vars:'.$module_srl;
1081
+			$object_key = 'module_extra_vars:' . $module_srl;
1082 1082
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1083 1083
 			$oCacheHandler->delete($cache_key);
1084 1084
 		}
@@ -1092,19 +1092,19 @@  discard block
 block discarded – undo
1092 1092
 	function insertModuleGrants($module_srl, $obj)
1093 1093
 	{
1094 1094
 		$this->deleteModuleGrants($module_srl);
1095
-		if(!$obj || !count($obj)) return;
1095
+		if (!$obj || !count($obj)) return;
1096 1096
 
1097
-		foreach($obj as $name => $val)
1097
+		foreach ($obj as $name => $val)
1098 1098
 		{
1099
-			if(!$val || !count($val)) continue;
1099
+			if (!$val || !count($val)) continue;
1100 1100
 
1101
-			foreach($val as $group_srl)
1101
+			foreach ($val as $group_srl)
1102 1102
 			{
1103 1103
 				$args = new stdClass();
1104 1104
 				$args->module_srl = $module_srl;
1105 1105
 				$args->name = $name;
1106 1106
 				$args->group_srl = trim($group_srl);
1107
-				if(!$args->name || !$args->group_srl) continue;
1107
+				if (!$args->name || !$args->group_srl) continue;
1108 1108
 				executeQuery('module.insertModuleGrant', $args);
1109 1109
 			}
1110 1110
 		}
@@ -1125,9 +1125,9 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1127 1127
 	{
1128
-		if($isReplaceLangCode)
1128
+		if ($isReplaceLangCode)
1129 1129
 		{
1130
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1130
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1131 1131
 		}
1132 1132
 	}
1133 1133
 
@@ -1135,27 +1135,27 @@  discard block
 block discarded – undo
1135 1135
 	{
1136 1136
 		static $lang = null;
1137 1137
 
1138
-		if(is_null($lang))
1138
+		if (is_null($lang))
1139 1139
 		{
1140 1140
 			$site_module_info = Context::get('site_module_info');
1141
-			if(!$site_module_info)
1141
+			if (!$site_module_info)
1142 1142
 			{
1143 1143
 				$oModuleModel = getModel('module');
1144 1144
 				$site_module_info = $oModuleModel->getDefaultMid();
1145 1145
 				Context::set('site_module_info', $site_module_info);
1146 1146
 			}
1147 1147
 			$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
1148
-			if(!file_exists($cache_file))
1148
+			if (!file_exists($cache_file))
1149 1149
 			{
1150 1150
 				$oModuleAdminController = getAdminController('module');
1151 1151
 				$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1152 1152
 			}
1153 1153
 
1154
-			if(file_exists($cache_file))
1154
+			if (file_exists($cache_file))
1155 1155
 			{
1156 1156
 				$moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php');
1157 1157
 				$cacheFileMtime = filemtime($cache_file);
1158
-				if($cacheFileMtime < $moduleAdminControllerMtime)
1158
+				if ($cacheFileMtime < $moduleAdminControllerMtime)
1159 1159
 				{
1160 1160
 					$oModuleAdminController = getAdminController('module');
1161 1161
 					$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
 				require_once($cache_file);
1165 1165
 			}
1166 1166
 		}
1167
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1167
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1168 1168
 
1169
-		return str_replace('$user_lang->','',$matches[0]);
1169
+		return str_replace('$user_lang->', '', $matches[0]);
1170 1170
 	}
1171 1171
 
1172 1172
 
@@ -1179,17 +1179,17 @@  discard block
 block discarded – undo
1179 1179
 		if ($ajax) Context::setRequestMethod('JSON');
1180 1180
 
1181 1181
 		$logged_info = Context::get('logged_info');
1182
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1182
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1183 1183
 
1184
-		$vars = Context::gets('addfile','filter');
1184
+		$vars = Context::gets('addfile', 'filter');
1185 1185
 		$attributeNames = Context::get('attribute_name');
1186 1186
 		$attributeValues = Context::get('attribute_value');
1187
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1187
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1188 1188
 		{
1189 1189
 			$attributes = array();
1190
-			foreach($attributeNames as $no => $name)
1190
+			foreach ($attributeNames as $no => $name)
1191 1191
 			{
1192
-				if(empty($name))
1192
+				if (empty($name))
1193 1193
 				{
1194 1194
 					continue;
1195 1195
 				}
@@ -1201,16 +1201,16 @@  discard block
 block discarded – undo
1201 1201
 		$vars->comment = $attributes;
1202 1202
 		$module_filebox_srl = Context::get('module_filebox_srl');
1203 1203
 
1204
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1204
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1205 1205
 		$vars->ext = $ext;
1206
-		if($vars->filter) $filter = explode(',',$vars->filter);
1207
-		else $filter = array('jpg','jpeg','gif','png');
1208
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1206
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1207
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1208
+		if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured');
1209 1209
 
1210 1210
 		$vars->member_srl = $logged_info->member_srl;
1211 1211
 
1212 1212
 		// update
1213
-		if($module_filebox_srl > 0)
1213
+		if ($module_filebox_srl > 0)
1214 1214
 		{
1215 1215
 			$vars->module_filebox_srl = $module_filebox_srl;
1216 1216
 			$output = $this->updateModuleFileBox($vars);
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 		// insert
1219 1219
 		else
1220 1220
 		{
1221
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1221
+			if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1222 1222
 			$addfile = Context::get('addfile');
1223
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1223
+			if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
+			if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1225 1225
 			$output = $this->insertModuleFileBox($vars);
1226 1226
 		}
1227 1227
 
1228
-		$this->setTemplatePath($this->module_path.'tpl');
1228
+		$this->setTemplatePath($this->module_path . 'tpl');
1229 1229
 
1230 1230
 		if (!$ajax)
1231 1231
 		{
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 		else
1237 1237
 		{
1238
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1238
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1239 1239
 			else $this->add('save_filename', '');
1240 1240
 		}
1241 1241
 	}
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 	{
1248 1248
 		$args = new stdClass;
1249 1249
 		// have file
1250
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1250
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1251 1251
 		{
1252 1252
 			$oModuleModel = getModel('module');
1253 1253
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1256,18 +1256,18 @@  discard block
 block discarded – undo
1256 1256
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1257 1257
 			FileHandler::makeDir($path);
1258 1258
 
1259
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1259
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1260 1260
 			$tmp = $vars->addfile['tmp_name'];
1261 1261
 
1262 1262
 			// Check uploaded file
1263
-			if(!checkUploadedFile($tmp)) return false;
1263
+			if (!checkUploadedFile($tmp)) return false;
1264 1264
 
1265
-			if(!@move_uploaded_file($tmp, $save_filename))
1265
+			if (!@move_uploaded_file($tmp, $save_filename))
1266 1266
 			{
1267 1267
 				return false;
1268 1268
 			}
1269 1269
 
1270
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1270
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1271 1271
 			$args->filename = $save_filename;
1272 1272
 			$args->filesize = $vars->addfile['size'];
1273 1273
 		}
@@ -1293,14 +1293,14 @@  discard block
 block discarded – undo
1293 1293
 		$oModuleModel = getModel('module');
1294 1294
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1295 1295
 		FileHandler::makeDir($path);
1296
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1296
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1297 1297
 		$tmp = $vars->addfile['tmp_name'];
1298 1298
 
1299 1299
 		// Check uploaded file
1300
-		if(!checkUploadedFile($tmp)) return false;
1300
+		if (!checkUploadedFile($tmp)) return false;
1301 1301
 
1302 1302
 		// upload
1303
-		if(!@move_uploaded_file($tmp, $save_filename))
1303
+		if (!@move_uploaded_file($tmp, $save_filename))
1304 1304
 		{
1305 1305
 			return false;
1306 1306
 		}
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		$args->member_srl = $vars->member_srl;
1312 1312
 		$args->comment = $vars->comment;
1313 1313
 		$args->filename = $save_filename;
1314
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1314
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1315 1315
 		$args->filesize = $vars->addfile['size'];
1316 1316
 
1317 1317
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1326,14 +1326,14 @@  discard block
 block discarded – undo
1326 1326
 	function procModuleFileBoxDelete()
1327 1327
 	{
1328 1328
 		$logged_info = Context::get('logged_info');
1329
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1329
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1330 1330
 
1331 1331
 		$module_filebox_srl = Context::get('module_filebox_srl');
1332
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1332
+		if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1333 1333
 		$vars = new stdClass();
1334 1334
 		$vars->module_filebox_srl = $module_filebox_srl;
1335 1335
 		$output = $this->deleteModuleFileBox($vars);
1336
-		if(!$output->toBool()) return $output;
1336
+		if (!$output->toBool()) return $output;
1337 1337
 	}
1338 1338
 
1339 1339
 	function deleteModuleFileBox($vars)
@@ -1356,11 +1356,11 @@  discard block
 block discarded – undo
1356 1356
 		$this->unlockTimeoutPassed();
1357 1357
 		$args = new stdClass;
1358 1358
 		$args->lock_name = $lock_name;
1359
-		if(!$timeout) $timeout = 60;
1359
+		if (!$timeout) $timeout = 60;
1360 1360
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1361
-		if($member_srl) $args->member_srl = $member_srl;
1361
+		if ($member_srl) $args->member_srl = $member_srl;
1362 1362
 		$output = executeQuery('module.insertLock', $args);
1363
-		if($output->toBool())
1363
+		if ($output->toBool())
1364 1364
 		{
1365 1365
 			$output->add('lock_name', $lock_name);
1366 1366
 			$output->add('deadline', $args->deadline);
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 		$output = executeQuery('module.updateModuleInSites', $args);
1390 1390
 
1391 1391
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1392
-		if($oCacheHandler->isSupport())
1392
+		if ($oCacheHandler->isSupport())
1393 1393
 		{
1394 1394
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1395 1395
 		}
Please login to merge, or discard this patch.
Braces   +217 added lines, -101 removed lines patch added patch discarded remove patch
@@ -150,9 +150,15 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if($kind != 'admin') {
154
+			$kind = '';
155
+		}
156
+		if(!in_array($type,array('model','controller','view','api','mobile'))) {
157
+			return false;
158
+		}
159
+		if(in_array($parent_module, array('module','addon','widget','layout'))) {
160
+			return false;
161
+		}
156 162
 
157 163
 		$cache_file = './files/config/module_extend.php';
158 164
 		FileHandler::removeFile($cache_file);
@@ -164,7 +170,9 @@  discard block
 block discarded – undo
164 170
 		$args->kind = $kind;
165 171
 
166 172
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
173
+		if($output->data->count>0) {
174
+			return false;
175
+		}
168 176
 
169 177
 		$output = executeQuery('module.insertModuleExtend', $args);
170 178
 		return $output;
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 		$oModuleModel = getModel('module');
200 208
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 209
 
202
-		if(!$origin_config) $origin_config = new stdClass;
210
+		if(!$origin_config) {
211
+			$origin_config = new stdClass;
212
+		}
203 213
 
204 214
 		foreach($config as $key => $val)
205 215
 		{
@@ -221,7 +231,9 @@  discard block
 block discarded – undo
221 231
 		$args->site_srl = $site_srl;
222 232
 
223 233
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
234
+		if(!$output->toBool()) {
235
+			return $output;
236
+		}
225 237
 
226 238
 		$output = executeQuery('module.insertModuleConfig', $args);
227 239
 
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 		$args->config = serialize($config);
247 259
 
248 260
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
250 264
 
251 265
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 266
 
@@ -268,9 +282,10 @@  discard block
 block discarded – undo
268 282
 		if(isSiteID($domain))
269 283
 		{
270 284
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
272
-		}
273
-		else
285
+			if($oModuleModel->isIDExists($domain, 0)) {
286
+				return new Object(-1,'msg_already_registed_vid');
287
+			}
288
+		} else
274 289
 		{
275 290
 			$domain = strtolower($domain);
276 291
 		}
@@ -284,10 +299,14 @@  discard block
 block discarded – undo
284 299
 		$columnList = array('modules.site_srl');
285 300
 		$oModuleModel = getModel('module');
286 301
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new Object(-1,'msg_already_registed_vid');
302
+		if($output) {
303
+			return new Object(-1,'msg_already_registed_vid');
304
+		}
288 305
 
289 306
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
307
+		if(!$output->toBool()) {
308
+			return $output;
309
+		}
291 310
 
292 311
 		$output->add('site_srl', $args->site_srl);
293 312
 		return $output;
@@ -310,8 +329,12 @@  discard block
 block discarded – undo
310 329
 		if($site_info->domain != $args->domain)
311 330
 		{
312 331
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
332
+			if($info->site_srl && $info->site_srl != $args->site_srl) {
333
+				return new Object(-1,'msg_already_registed_domain');
334
+			}
335
+			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) {
336
+				return new Object(-1,'msg_already_registed_vid');
337
+			}
315 338
 
316 339
 			if($args->domain && !isSiteID($args->domain))
317 340
 			{
@@ -320,8 +343,11 @@  discard block
 block discarded – undo
320 343
 		}
321 344
 		$output = executeQuery('module.updateSite', $args);
322 345
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
346
+		if($args->site_srl == 0) {
347
+			$vid='';
348
+		} else {
349
+			$vid=$args->domain;
350
+		}
325 351
 
326 352
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 353
 		$mid = $module_info->mid;
@@ -345,7 +371,9 @@  discard block
 block discarded – undo
345 371
 		unset($args->act);
346 372
 		unset($args->page);
347 373
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid');
374
+		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) {
375
+			return new Object(-1, 'msg_limit_mid');
376
+		}
349 377
 		// Test variables (separate basic vars and other vars in modules)
350 378
 		$extra_vars = clone($args);
351 379
 		unset($extra_vars->module_srl);
@@ -382,18 +410,23 @@  discard block
 block discarded – undo
382 410
 		if(isset($args->isMenuCreate))
383 411
 		{
384 412
 			$isMenuCreate = $args->isMenuCreate;
385
-		}
386
-		else
413
+		} else
387 414
 		{
388 415
 			$isMenuCreate = TRUE;
389 416
 		}
390 417
 
391 418
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
419
+		if(!$output->toBool()) {
420
+			return $output;
421
+		}
393 422
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
423
+		if(!$args->site_srl) {
424
+			$args->site_srl = 0;
425
+		}
395 426
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists');
427
+		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) {
428
+			return new Object(-1, 'msg_module_name_exists');
429
+		}
397 430
 
398 431
 		// begin transaction
399 432
 		$oDB = &DB::getInstance();
@@ -404,20 +437,20 @@  discard block
 block discarded – undo
404 437
 		$skin_vars = new stdClass();
405 438
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 439
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
440
+		if(!$args->module_srl) {
441
+			$args->module_srl = getNextSequence();
442
+		}
408 443
 
409 444
 		// default value
410 445
 		if($args->skin == '/USE_DEFAULT/')
411 446
 		{
412 447
 			$args->is_skin_fix = 'N';
413
-		}
414
-		else
448
+		} else
415 449
 		{
416 450
 			if(isset($args->is_skin_fix))
417 451
 			{
418 452
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419
-			}
420
-			else
453
+			} else
421 454
 			{
422 455
 				$args->is_skin_fix = 'Y';
423 456
 			}
@@ -426,14 +459,12 @@  discard block
 block discarded – undo
426 459
 		if($args->mskin == '/USE_DEFAULT/')
427 460
 		{
428 461
 			$args->is_mskin_fix = 'N';
429
-		}
430
-		else
462
+		} else
431 463
 		{
432 464
 			if(isset($args->is_mskin_fix))
433 465
 			{
434 466
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435
-			}
436
-			else
467
+			} else
437 468
 			{
438 469
 				$args->is_mskin_fix = 'Y';
439 470
 			}
@@ -508,7 +539,9 @@  discard block
 block discarded – undo
508 539
 	function updateModule($args)
509 540
 	{
510 541
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
511
-		if(!$output->toBool()) return $output;
542
+		if(!$output->toBool()) {
543
+			return $output;
544
+		}
512 545
 		// begin transaction
513 546
 		$oDB = &DB::getInstance();
514 547
 		$oDB->begin();
@@ -519,8 +552,12 @@  discard block
 block discarded – undo
519 552
 
520 553
 		if(!$args->site_srl || !$args->browser_title)
521 554
 		{
522
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
523
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
555
+			if(!$args->site_srl) {
556
+				$args->site_srl = (int)$module_info->site_srl;
557
+			}
558
+			if(!$args->browser_title) {
559
+				$args->browser_title = $module_info->browser_title;
560
+			}
524 561
 		}
525 562
 
526 563
 		$args->browser_title = strip_tags($args->browser_title);
@@ -536,14 +573,12 @@  discard block
 block discarded – undo
536 573
 		if($args->skin == '/USE_DEFAULT/')
537 574
 		{
538 575
 			$args->is_skin_fix = 'N';
539
-		}
540
-		else
576
+		} else
541 577
 		{
542 578
 			if(isset($args->is_skin_fix))
543 579
 			{
544 580
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
545
-			}
546
-			else
581
+			} else
547 582
 			{
548 583
 				$args->is_skin_fix = 'Y';
549 584
 			}
@@ -552,14 +587,12 @@  discard block
 block discarded – undo
552 587
 		if($args->mskin == '/USE_DEFAULT/')
553 588
 		{
554 589
 			$args->is_mskin_fix = 'N';
555
-		}
556
-		else
590
+		} else
557 591
 		{
558 592
 			if(isset($args->is_mskin_fix))
559 593
 			{
560 594
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
561
-			}
562
-			else
595
+			} else
563 596
 			{
564 597
 				$args->is_mskin_fix = 'Y';
565 598
 			}
@@ -624,7 +657,9 @@  discard block
 block discarded – undo
624 657
 		$args->site_srl = $site_srl;
625 658
 		$args->layout_srl = $layout_srl;
626 659
 		$output = executeQuery('module.updateModuleSite', $args);
627
-		if(!$output->toBool()) return $output;
660
+		if(!$output->toBool()) {
661
+			return $output;
662
+		}
628 663
 
629 664
 		//remove from cache
630 665
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -643,7 +678,9 @@  discard block
 block discarded – undo
643 678
 	 */
644 679
 	function deleteModule($module_srl, $site_srl = 0)
645 680
 	{
646
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
681
+		if(!$module_srl) {
682
+			return new Object(-1,'msg_invalid_request');
683
+		}
647 684
 
648 685
 		$site_module_info = Context::get('site_module_info');
649 686
 
@@ -653,8 +690,11 @@  discard block
 block discarded – undo
653 690
 		$args = new stdClass();
654 691
 		$args->url = $output->mid;
655 692
 		$args->is_shortcut = 'N';
656
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
657
-		else $args->site_srl = $site_srl;
693
+		if(!$site_srl) {
694
+			$args->site_srl = $site_module_info->site_srl;
695
+		} else {
696
+			$args->site_srl = $site_srl;
697
+		}
658 698
 
659 699
 		unset($output);
660 700
 
@@ -687,8 +727,7 @@  discard block
 block discarded – undo
687 727
 			if($output->isSuccess)
688 728
 			{
689 729
 				return new Object(0, 'success_deleted');
690
-			}
691
-			else
730
+			} else
692 731
 			{
693 732
 				return new Object($output->error, $output->message);
694 733
 			}
@@ -706,19 +745,25 @@  discard block
 block discarded – undo
706 745
 	 */
707 746
 	public function onlyDeleteModule($module_srl)
708 747
 	{
709
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
748
+		if(!$module_srl) {
749
+			return new Object(-1,'msg_invalid_request');
750
+		}
710 751
 
711 752
 		// check start module
712 753
 		$oModuleModel = getModel('module');
713 754
 		$columnList = array('sites.index_module_srl');
714 755
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
715
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
756
+		if($module_srl == $start_module->index_module_srl) {
757
+			return new Object(-1, 'msg_cannot_delete_startmodule');
758
+		}
716 759
 
717 760
 		// Call a trigger (before)
718 761
 		$trigger_obj = new stdClass();
719 762
 		$trigger_obj->module_srl = $module_srl;
720 763
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
721
-		if(!$output->toBool()) return $output;
764
+		if(!$output->toBool()) {
765
+			return $output;
766
+		}
722 767
 
723 768
 		// begin transaction
724 769
 		$oDB = &DB::getInstance();
@@ -779,7 +824,9 @@  discard block
 block discarded – undo
779 824
 	function clearDefaultModule()
780 825
 	{
781 826
 		$output = executeQuery('module.clearDefaultModule');
782
-		if(!$output->toBool()) return $output;
827
+		if(!$output->toBool()) {
828
+			return $output;
829
+		}
783 830
 
784 831
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
785 832
 		if($oCacheHandler->isSupport())
@@ -811,7 +858,9 @@  discard block
 block discarded – undo
811 858
 	 */
812 859
 	function updateModuleLayout($layout_srl, $menu_srl_list)
813 860
 	{
814
-		if(!count($menu_srl_list)) return;
861
+		if(!count($menu_srl_list)) {
862
+			return;
863
+		}
815 864
 
816 865
 		$args = new stdClass;
817 866
 		$args->layout_srl = $layout_srl;
@@ -838,28 +887,37 @@  discard block
 block discarded – undo
838 887
 
839 888
 		$output = executeQuery('module.deleteSiteAdmin', $args);
840 889
 
841
-		if(!$output->toBool()) return $output;
890
+		if(!$output->toBool()) {
891
+			return $output;
892
+		}
842 893
 		// Get user id of an administrator
843
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
894
+		if(!is_array($arr_admins) || !count($arr_admins)) {
895
+			return new Object();
896
+		}
844 897
 		foreach($arr_admins as $key => $user_id)
845 898
 		{
846
-			if(!trim($user_id)) continue;
899
+			if(!trim($user_id)) {
900
+				continue;
901
+			}
847 902
 			$admins[] = trim($user_id);
848 903
 		}
849
-		if(!count($admins)) return new Object();
904
+		if(!count($admins)) {
905
+			return new Object();
906
+		}
850 907
 
851 908
 		$oMemberModel = getModel('member');
852 909
 		$member_config = $oMemberModel->getMemberConfig();
853 910
 		if($member_config->identifier == 'email_address')
854 911
 		{
855 912
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
856
-		}
857
-		else
913
+		} else
858 914
 		{
859 915
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
860 916
 		}
861 917
 		$output = executeQueryArray('module.getAdminSrls', $args);
862
-		if(!$output->toBool()||!$output->data) return $output;
918
+		if(!$output->toBool()||!$output->data) {
919
+			return $output;
920
+		}
863 921
 
864 922
 		foreach($output->data as $key => $val)
865 923
 		{
@@ -868,7 +926,9 @@  discard block
 block discarded – undo
868 926
 			$args->site_srl = $site_srl;
869 927
 			$args->member_srl = $val->member_srl;
870 928
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
871
-			if(!$output->toBool()) return $output;
929
+			if(!$output->toBool()) {
930
+				return $output;
931
+			}
872 932
 		}
873 933
 		return new Object();
874 934
 	}
@@ -881,12 +941,15 @@  discard block
 block discarded – undo
881 941
 		$oMemberModel = getModel('member');
882 942
 		$member_config = $oMemberModel->getMemberConfig();
883 943
 
884
-		if($member_config->identifier == 'email_address')
885
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
886
-		else
887
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
944
+		if($member_config->identifier == 'email_address') {
945
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
946
+		} else {
947
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
948
+		}
888 949
 
889
-		if(!$member_info->member_srl) return;
950
+		if(!$member_info->member_srl) {
951
+			return;
952
+		}
890 953
 		$args = new stdClass();
891 954
 		$args->module_srl = $module_srl;
892 955
 		$args->member_srl = $member_info->member_srl;
@@ -905,7 +968,9 @@  discard block
 block discarded – undo
905 968
 		{
906 969
 			$oMemberModel = getModel('member');
907 970
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
908
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
971
+			if($member_info->member_srl) {
972
+				$args->member_srl = $member_info->member_srl;
973
+			}
909 974
 		}
910 975
 		return executeQuery('module.deleteAdminId', $args);
911 976
 	}
@@ -949,7 +1014,9 @@  discard block
 block discarded – undo
949 1014
 		}
950 1015
 
951 1016
 		getDestroyXeVars($obj);
952
-		if(!$obj || !count($obj)) return new Object();
1017
+		if(!$obj || !count($obj)) {
1018
+			return new Object();
1019
+		}
953 1020
 
954 1021
 		$args = new stdClass;
955 1022
 		$args->module_srl = $module_srl;
@@ -959,18 +1026,23 @@  discard block
 block discarded – undo
959 1026
 			// it often saved menu item(stdClass) on the skin info column
960 1027
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
961 1028
 			// fixed the error
962
-			if (is_object($val)) continue;
963
-			if (is_array($val)) $val = serialize($val);
1029
+			if (is_object($val)) {
1030
+				continue;
1031
+			}
1032
+			if (is_array($val)) {
1033
+				$val = serialize($val);
1034
+			}
964 1035
 
965 1036
 			$args->name = trim($key);
966 1037
 			$args->value = trim($val);
967
-			if(!$args->name || !$args->value) continue;
1038
+			if(!$args->name || !$args->value) {
1039
+				continue;
1040
+			}
968 1041
 
969 1042
 			if($mode === 'P')
970 1043
 			{
971 1044
 				$output = executeQuery('module.insertModuleSkinVars', $args);
972
-			}
973
-			else
1045
+			} else
974 1046
 			{
975 1047
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
976 1048
 			}
@@ -1017,8 +1089,7 @@  discard block
 block discarded – undo
1017 1089
 		{
1018 1090
 			$object_key = 'module_skin_vars:'.$module_srl;
1019 1091
 			$query = 'module.deleteModuleSkinVars';
1020
-		}
1021
-		else
1092
+		} else
1022 1093
 		{
1023 1094
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1024 1095
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1042,17 +1113,23 @@  discard block
 block discarded – undo
1042 1113
 	{
1043 1114
 		$this->deleteModuleExtraVars($module_srl);
1044 1115
 		getDestroyXeVars($obj);
1045
-		if(!$obj || !count($obj)) return;
1116
+		if(!$obj || !count($obj)) {
1117
+			return;
1118
+		}
1046 1119
 
1047 1120
 		foreach($obj as $key => $val)
1048 1121
 		{
1049
-			if(is_object($val) || is_array($val)) continue;
1122
+			if(is_object($val) || is_array($val)) {
1123
+				continue;
1124
+			}
1050 1125
 
1051 1126
 			$args = new stdClass();
1052 1127
 			$args->module_srl = $module_srl;
1053 1128
 			$args->name = trim($key);
1054 1129
 			$args->value = trim($val);
1055
-			if(!$args->name || !$args->value) continue;
1130
+			if(!$args->name || !$args->value) {
1131
+				continue;
1132
+			}
1056 1133
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1057 1134
 		}
1058 1135
 
@@ -1092,11 +1169,15 @@  discard block
 block discarded – undo
1092 1169
 	function insertModuleGrants($module_srl, $obj)
1093 1170
 	{
1094 1171
 		$this->deleteModuleGrants($module_srl);
1095
-		if(!$obj || !count($obj)) return;
1172
+		if(!$obj || !count($obj)) {
1173
+			return;
1174
+		}
1096 1175
 
1097 1176
 		foreach($obj as $name => $val)
1098 1177
 		{
1099
-			if(!$val || !count($val)) continue;
1178
+			if(!$val || !count($val)) {
1179
+				continue;
1180
+			}
1100 1181
 
1101 1182
 			foreach($val as $group_srl)
1102 1183
 			{
@@ -1104,7 +1185,9 @@  discard block
 block discarded – undo
1104 1185
 				$args->module_srl = $module_srl;
1105 1186
 				$args->name = $name;
1106 1187
 				$args->group_srl = trim($group_srl);
1107
-				if(!$args->name || !$args->group_srl) continue;
1188
+				if(!$args->name || !$args->group_srl) {
1189
+					continue;
1190
+				}
1108 1191
 				executeQuery('module.insertModuleGrant', $args);
1109 1192
 			}
1110 1193
 		}
@@ -1164,7 +1247,9 @@  discard block
 block discarded – undo
1164 1247
 				require_once($cache_file);
1165 1248
 			}
1166 1249
 		}
1167
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1250
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1251
+			return $lang[$matches[1]];
1252
+		}
1168 1253
 
1169 1254
 		return str_replace('$user_lang->','',$matches[0]);
1170 1255
 	}
@@ -1176,10 +1261,14 @@  discard block
 block discarded – undo
1176 1261
 	function procModuleFileBoxAdd()
1177 1262
 	{
1178 1263
 		$ajax = Context::get('ajax');
1179
-		if ($ajax) Context::setRequestMethod('JSON');
1264
+		if ($ajax) {
1265
+			Context::setRequestMethod('JSON');
1266
+		}
1180 1267
 
1181 1268
 		$logged_info = Context::get('logged_info');
1182
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1269
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1270
+			return new Object(-1, 'msg_not_permitted');
1271
+		}
1183 1272
 
1184 1273
 		$vars = Context::gets('addfile','filter');
1185 1274
 		$attributeNames = Context::get('attribute_name');
@@ -1203,9 +1292,14 @@  discard block
 block discarded – undo
1203 1292
 
1204 1293
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1205 1294
 		$vars->ext = $ext;
1206
-		if($vars->filter) $filter = explode(',',$vars->filter);
1207
-		else $filter = array('jpg','jpeg','gif','png');
1208
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1295
+		if($vars->filter) {
1296
+			$filter = explode(',',$vars->filter);
1297
+		} else {
1298
+			$filter = array('jpg','jpeg','gif','png');
1299
+		}
1300
+		if(!in_array($ext,$filter)) {
1301
+			return new Object(-1, 'msg_error_occured');
1302
+		}
1209 1303
 
1210 1304
 		$vars->member_srl = $logged_info->member_srl;
1211 1305
 
@@ -1218,10 +1312,16 @@  discard block
 block discarded – undo
1218 1312
 		// insert
1219 1313
 		else
1220 1314
 		{
1221
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1315
+			if(!Context::isUploaded()) {
1316
+				return new Object(-1, 'msg_error_occured');
1317
+			}
1222 1318
 			$addfile = Context::get('addfile');
1223
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1224
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1319
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1320
+				return new Object(-1, 'msg_error_occured');
1321
+			}
1322
+			if($vars->addfile['error'] != 0) {
1323
+				return new Object(-1, 'msg_error_occured');
1324
+			}
1225 1325
 			$output = $this->insertModuleFileBox($vars);
1226 1326
 		}
1227 1327
 
@@ -1232,11 +1332,13 @@  discard block
 block discarded – undo
1232 1332
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1233 1333
 			$this->setRedirectUrl($returnUrl);
1234 1334
 			return;
1235
-		}
1236
-		else
1335
+		} else
1237 1336
 		{
1238
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1239
-			else $this->add('save_filename', '');
1337
+			if($output) {
1338
+				$this->add('save_filename', $output->get('save_filename'));
1339
+			} else {
1340
+				$this->add('save_filename', '');
1341
+			}
1240 1342
 		}
1241 1343
 	}
1242 1344
 
@@ -1260,7 +1362,9 @@  discard block
 block discarded – undo
1260 1362
 			$tmp = $vars->addfile['tmp_name'];
1261 1363
 
1262 1364
 			// Check uploaded file
1263
-			if(!checkUploadedFile($tmp)) return false;
1365
+			if(!checkUploadedFile($tmp)) {
1366
+				return false;
1367
+			}
1264 1368
 
1265 1369
 			if(!@move_uploaded_file($tmp, $save_filename))
1266 1370
 			{
@@ -1297,7 +1401,9 @@  discard block
 block discarded – undo
1297 1401
 		$tmp = $vars->addfile['tmp_name'];
1298 1402
 
1299 1403
 		// Check uploaded file
1300
-		if(!checkUploadedFile($tmp)) return false;
1404
+		if(!checkUploadedFile($tmp)) {
1405
+			return false;
1406
+		}
1301 1407
 
1302 1408
 		// upload
1303 1409
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1326,14 +1432,20 @@  discard block
 block discarded – undo
1326 1432
 	function procModuleFileBoxDelete()
1327 1433
 	{
1328 1434
 		$logged_info = Context::get('logged_info');
1329
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1435
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1436
+			return new Object(-1, 'msg_not_permitted');
1437
+		}
1330 1438
 
1331 1439
 		$module_filebox_srl = Context::get('module_filebox_srl');
1332
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1440
+		if(!$module_filebox_srl) {
1441
+			return new Object(-1, 'msg_invalid_request');
1442
+		}
1333 1443
 		$vars = new stdClass();
1334 1444
 		$vars->module_filebox_srl = $module_filebox_srl;
1335 1445
 		$output = $this->deleteModuleFileBox($vars);
1336
-		if(!$output->toBool()) return $output;
1446
+		if(!$output->toBool()) {
1447
+			return $output;
1448
+		}
1337 1449
 	}
1338 1450
 
1339 1451
 	function deleteModuleFileBox($vars)
@@ -1356,9 +1468,13 @@  discard block
 block discarded – undo
1356 1468
 		$this->unlockTimeoutPassed();
1357 1469
 		$args = new stdClass;
1358 1470
 		$args->lock_name = $lock_name;
1359
-		if(!$timeout) $timeout = 60;
1471
+		if(!$timeout) {
1472
+			$timeout = 60;
1473
+		}
1360 1474
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1361
-		if($member_srl) $args->member_srl = $member_srl;
1475
+		if($member_srl) {
1476
+			$args->member_srl = $member_srl;
1477
+		}
1362 1478
 		$output = executeQuery('module.insertLock', $args);
1363 1479
 		if($output->toBool())
1364 1480
 		{
Please login to merge, or discard this patch.
modules/module/module.model.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1035,6 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 	/**
1036 1036
 	 * @brief Get a list of skins for the module
1037 1037
 	 * Return file analysis of skin and skin.xml
1038
+	 * @param string $path
1038 1039
 	 */
1039 1040
 	function getSkins($path, $dir = 'skins')
1040 1041
 	{
@@ -1359,6 +1360,8 @@  discard block
 block discarded – undo
1359 1360
 	/**
1360 1361
 	 * @brief Return module configurations
1361 1362
 	 * Global configuration is used to manage board, member and others
1363
+	 * @param string $module
1364
+	 * @return string
1362 1365
 	 */
1363 1366
 	function getModuleConfig($module, $site_srl = 0)
1364 1367
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  moduleModel
5
- * @author NAVER ([email protected])
6
- * @brief Model class of module module
7
- */
4
+	 * @class  moduleModel
5
+	 * @author NAVER ([email protected])
6
+	 * @brief Model class of module module
7
+	 */
8 8
 class moduleModel extends module
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$url_info = parse_url($request_url);
101 101
 			$hostname = $url_info['host'];
102 102
 			$path = $url_info['path'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $url_info['port']&&$url_info['port']!=80?':'.$url_info['port']:'',$path);
105
+			$domain = sprintf('%s%s%s', $hostname, $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124 124
 				$object_key = 'site_info:' . md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_ . 'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'] . ((!empty($url_info['port']) && $url_info['port'] != 80) ? ':' . $url_info['port'] : '') . $url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225
-			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
225
+			$object_key = 'module_srl:' . $mid . '_' . $site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230 230
 				$object_key = 'mid_info:' . $module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326
-			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
326
+			$object_key = 'module_srl:' . $mid . '_' . $site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331 331
 				$object_key = 'mid_info:' . $module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374 374
 			$object_key = 'mid_info:' . $module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,9 +500,9 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507 507
 				$object_key = 'module:mid_list_' . $args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -510,27 +510,27 @@  discard block
 block discarded – undo
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'" . implode("','", $mid) . "'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685
-		$key = $parent_module.'.'.$kind.'.'.$type;
685
+		$key = $parent_module . '.' . $kind . '.' . $type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828 828
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,22 +918,22 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937 937
 
938 938
 					$index = $action->attrs->index;
939 939
 					$admin_index = $action->attrs->admin_index;
@@ -947,14 +947,14 @@  discard block
 block discarded – undo
947 947
 					$info->action->{$name}->standalone = $standalone;
948 948
 					$info->action->{$name}->ruleset = $ruleset;
949 949
 					$info->action->{$name}->method = $method;
950
-					if($action->attrs->menu_name)
950
+					if ($action->attrs->menu_name)
951 951
 					{
952
-						if($menu_index == 'true')
952
+						if ($menu_index == 'true')
953 953
 						{
954 954
 							$info->menu->{$action->attrs->menu_name}->index = $name;
955 955
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
956 956
 						}
957
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
957
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
958 958
 						{
959 959
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
960 960
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -971,22 +971,22 @@  discard block
 block discarded – undo
971 971
 					$buff[] = sprintf('$info->action->%s->ruleset=\'%s\';', $name, $ruleset);
972 972
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
973 973
 
974
-					if($index=='true')
974
+					if ($index == 'true')
975 975
 					{
976 976
 						$default_index_act = $name;
977 977
 						$info->default_index_act = $name;
978 978
 					}
979
-					if($admin_index=='true')
979
+					if ($admin_index == 'true')
980 980
 					{
981 981
 						$admin_index_act = $name;
982 982
 						$info->admin_index_act = $name;
983 983
 					}
984
-					if($setup_index=='true')
984
+					if ($setup_index == 'true')
985 985
 					{
986 986
 						$setup_index_act = $name;
987 987
 						$info->setup_index_act = $name;
988 988
 					}
989
-					if($simple_setup_index=='true')
989
+					if ($simple_setup_index == 'true')
990 990
 					{
991 991
 						$simple_setup_index_act = $name;
992 992
 						$info->simple_setup_index_act = $name;
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			return $info;
1008 1008
 		}
1009 1009
 
1010
-		if(file_exists($cache_file)) return include($cache_file);
1010
+		if (file_exists($cache_file)) return include($cache_file);
1011 1011
 	}
1012 1012
 
1013 1013
 	/**
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	{
1019 1019
 		$module = Context::get('module_type');
1020 1020
 
1021
-		if($module == 'ARTICLE')
1021
+		if ($module == 'ARTICLE')
1022 1022
 		{
1023 1023
 			$module = 'page';
1024 1024
 		}
@@ -1038,26 +1038,26 @@  discard block
 block discarded – undo
1038 1038
 	 */
1039 1039
 	function getSkins($path, $dir = 'skins')
1040 1040
 	{
1041
-		if(substr($path, -1) == '/')
1041
+		if (substr($path, -1) == '/')
1042 1042
 		{
1043 1043
 			$path = substr($path, 0, -1);
1044 1044
 		}
1045 1045
 
1046 1046
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1047 1047
 		$list = FileHandler::readDir($skin_path);
1048
-		if(!count($list)) return;
1048
+		if (!count($list)) return;
1049 1049
 
1050 1050
 		natcasesort($list);
1051 1051
 
1052
-		foreach($list as $skin_name)
1052
+		foreach ($list as $skin_name)
1053 1053
 		{
1054
-			if(!is_dir($skin_path . $skin_name))
1054
+			if (!is_dir($skin_path . $skin_name))
1055 1055
 			{
1056 1056
 				continue;
1057 1057
 			}
1058 1058
 			unset($skin_info);
1059 1059
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1060
-			if(!$skin_info)
1060
+			if (!$skin_info)
1061 1061
 			{
1062 1062
 				$skin_info = new stdClass();
1063 1063
 				$skin_info->title = $skin_name;
@@ -1070,15 +1070,15 @@  discard block
 block discarded – undo
1070 1070
 		$tmpPath = trim($tmpPath);
1071 1071
 		$module = array_pop(explode(' ', $tmpPath));
1072 1072
 
1073
-		if($dir == 'skins')
1073
+		if ($dir == 'skins')
1074 1074
 		{
1075 1075
 			$oAdminModel = getAdminModel('admin');
1076 1076
 			$themesInfo = $oAdminModel->getThemeList();
1077 1077
 
1078
-			foreach($themesInfo as $themeName => $info)
1078
+			foreach ($themesInfo as $themeName => $info)
1079 1079
 			{
1080 1080
 				$skinInfos = $info->skin_infos;
1081
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1081
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1082 1082
 				{
1083 1083
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1084 1084
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1090,13 +1090,13 @@  discard block
 block discarded – undo
1090 1090
 		$oMenuAdminModel = getAdminModel('menu');
1091 1091
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1092 1092
 		$moduleName = $module;
1093
-		if($moduleName === 'page')
1093
+		if ($moduleName === 'page')
1094 1094
 		{
1095 1095
 			$moduleName = 'ARTICLE';
1096 1096
 		}
1097
-		if(array_key_exists($moduleName, $installedMenuTypes))
1097
+		if (array_key_exists($moduleName, $installedMenuTypes))
1098 1098
 		{
1099
-			if($dir == 'skins')
1099
+			if ($dir == 'skins')
1100 1100
 			{
1101 1101
 				$type = 'P';
1102 1102
 			}
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 			}
1107 1107
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1108 1108
 
1109
-			if(isset($defaultSkinName))
1109
+			if (isset($defaultSkinName))
1110 1110
 			{
1111 1111
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1112 1112
 
@@ -1128,20 +1128,20 @@  discard block
 block discarded – undo
1128 1128
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1129 1129
 	{
1130 1130
 		// Read xml file having skin information
1131
-		if(substr($path,-1)!='/') $path .= '/';
1131
+		if (substr($path, -1) != '/') $path .= '/';
1132 1132
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1133
-		if(!file_exists($skin_xml_file)) return;
1133
+		if (!file_exists($skin_xml_file)) return;
1134 1134
 		// Create XmlParser object
1135 1135
 		$oXmlParser = new XmlParser();
1136 1136
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1137 1137
 		// Return if no skin information is
1138
-		if(!$_xml_obj->skin) return;
1138
+		if (!$_xml_obj->skin) return;
1139 1139
 		$xml_obj = $_xml_obj->skin;
1140 1140
 		// Skin Name
1141 1141
 		$skin_info = new stdClass();
1142 1142
 		$skin_info->title = $xml_obj->title->body;
1143 1143
 		// Author information
1144
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1144
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1145 1145
 		{
1146 1146
 			// skin format v0.2
1147 1147
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1152,10 +1152,10 @@  discard block
 block discarded – undo
1152 1152
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1153 1153
 			$skin_info->description = $xml_obj->description->body;
1154 1154
 
1155
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1155
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1156 1156
 			else $author_list = $xml_obj->author;
1157 1157
 
1158
-			foreach($author_list as $author)
1158
+			foreach ($author_list as $author)
1159 1159
 			{
1160 1160
 				$author_obj = new stdClass();
1161 1161
 				$author_obj->name = $author->name->body;
@@ -1164,25 +1164,25 @@  discard block
 block discarded – undo
1164 1164
 				$skin_info->author[] = $author_obj;
1165 1165
 			}
1166 1166
 			// List extra vars
1167
-			if($xml_obj->extra_vars)
1167
+			if ($xml_obj->extra_vars)
1168 1168
 			{
1169 1169
 				$extra_var_groups = $xml_obj->extra_vars->group;
1170
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1170
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1172 1172
 
1173
-				foreach($extra_var_groups as $group)
1173
+				foreach ($extra_var_groups as $group)
1174 1174
 				{
1175 1175
 					$extra_vars = $group->var;
1176
-					if(!$extra_vars)
1176
+					if (!$extra_vars)
1177 1177
 					{
1178 1178
 						continue;
1179 1179
 					}
1180
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1180
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1181 1181
 
1182
-					foreach($extra_vars as $key => $val)
1182
+					foreach ($extra_vars as $key => $val)
1183 1183
 					{
1184 1184
 						$obj = new stdClass();
1185
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1185
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1186 1186
 
1187 1187
 						$obj->group = $group->title->body;
1188 1188
 						$obj->name = $val->attrs->name;
@@ -1191,14 +1191,14 @@  discard block
 block discarded – undo
1191 1191
 						$obj->description = $val->description->body;
1192 1192
 						$obj->value = $extra_vals->{$obj->name};
1193 1193
 						$obj->default = $val->attrs->default;
1194
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1195
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1194
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1195
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1196 1196
 						// Get an option list from 'select'type
1197
-						if(is_array($val->options))
1197
+						if (is_array($val->options))
1198 1198
 						{
1199 1199
 							$option_count = count($val->options);
1200 1200
 
1201
-							for($i = 0; $i < $option_count; $i++)
1201
+							for ($i = 0; $i < $option_count; $i++)
1202 1202
 							{
1203 1203
 								$obj->options[$i] = new stdClass();
1204 1204
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1235,18 +1235,18 @@  discard block
 block discarded – undo
1235 1235
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1236 1236
 			// Variables used in the skin
1237 1237
 			$extra_var_groups = $xml_obj->extra_vars->group;
1238
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1238
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1240 1240
 
1241
-			foreach($extra_var_groups as $group)
1241
+			foreach ($extra_var_groups as $group)
1242 1242
 			{
1243 1243
 				$extra_vars = $group->var;
1244 1244
 
1245
-				if($extra_vars)
1245
+				if ($extra_vars)
1246 1246
 				{
1247
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1247
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1248 1248
 
1249
-					foreach($extra_vars as $var)
1249
+					foreach ($extra_vars as $var)
1250 1250
 					{
1251 1251
 						unset($obj);
1252 1252
 						unset($options);
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 						$title = $var->title->body;
1258 1258
 						$description = $var->description->body;
1259 1259
 						// Get an option list from 'select'type.
1260
-						if(is_array($var->default))
1260
+						if (is_array($var->default))
1261 1261
 						{
1262 1262
 							$option_count = count($var->default);
1263 1263
 
1264
-							for($i = 0; $i < $option_count; $i++)
1264
+							for ($i = 0; $i < $option_count; $i++)
1265 1265
 							{
1266 1266
 								$options[$i]->title = $var->default[$i]->body;
1267 1267
 								$options[$i]->value = $var->default[$i]->body;
@@ -1295,19 +1295,19 @@  discard block
 block discarded – undo
1295 1295
 
1296 1296
 		// colorset
1297 1297
 		$colorset = $xml_obj->colorset->color;
1298
-		if($colorset)
1298
+		if ($colorset)
1299 1299
 		{
1300
-			if(!is_array($colorset)) $colorset = array($colorset);
1300
+			if (!is_array($colorset)) $colorset = array($colorset);
1301 1301
 
1302
-			foreach($colorset as $color)
1302
+			foreach ($colorset as $color)
1303 1303
 			{
1304 1304
 				$name = $color->attrs->name;
1305 1305
 				$title = $color->title->body;
1306 1306
 				$screenshot = $color->attrs->src;
1307
-				if($screenshot)
1307
+				if ($screenshot)
1308 1308
 				{
1309 1309
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1310
-					if(!file_exists($screenshot)) $screenshot = "";
1310
+					if (!file_exists($screenshot)) $screenshot = "";
1311 1311
 				}
1312 1312
 				else $screenshot = "";
1313 1313
 
@@ -1319,19 +1319,19 @@  discard block
 block discarded – undo
1319 1319
 			}
1320 1320
 		}
1321 1321
 		// Menu type (settings for layout)
1322
-		if($xml_obj->menus->menu)
1322
+		if ($xml_obj->menus->menu)
1323 1323
 		{
1324 1324
 			$menus = $xml_obj->menus->menu;
1325
-			if(!is_array($menus)) $menus = array($menus);
1325
+			if (!is_array($menus)) $menus = array($menus);
1326 1326
 
1327 1327
 			$menu_count = count($menus);
1328 1328
 			$skin_info->menu_count = $menu_count;
1329
-			for($i=0;$i<$menu_count;$i++)
1329
+			for ($i = 0; $i < $menu_count; $i++)
1330 1330
 			{
1331 1331
 				unset($obj);
1332 1332
 
1333 1333
 				$obj->name = $menus[$i]->attrs->name;
1334
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1334
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1335 1335
 				$obj->title = $menus[$i]->title->body;
1336 1336
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1337 1337
 
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 		}
1341 1341
 
1342 1342
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1343
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1343
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1344 1344
 		return $skin_info;
1345 1345
 	}
1346 1346
 
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 	{
1352 1352
 		$args = new stdClass;
1353 1353
 		$args->site_srl = $site_srl;
1354
-		if(!is_null($module)) $args->module = $module;
1354
+		if (!is_null($module)) $args->module = $module;
1355 1355
 		$output = executeQuery('module.getModuleCount', $args);
1356 1356
 		return $output->data->count;
1357 1357
 	}
@@ -1365,26 +1365,26 @@  discard block
 block discarded – undo
1365 1365
 		$config = false;
1366 1366
 		// cache controll
1367 1367
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1368
-		if($oCacheHandler->isSupport())
1368
+		if ($oCacheHandler->isSupport())
1369 1369
 		{
1370 1370
 			$object_key = 'module_config:' . $module . '_' . $site_srl;
1371 1371
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1372 1372
 			$config = $oCacheHandler->get($cache_key);
1373 1373
 		}
1374 1374
 
1375
-		if($config === false)
1375
+		if ($config === false)
1376 1376
 		{
1377
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1377
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1378 1378
 			{
1379 1379
 				$args = new stdClass();
1380 1380
 				$args->module = $module;
1381 1381
 				$args->site_srl = $site_srl;
1382 1382
 				$output = executeQuery('module.getModuleConfig', $args);
1383
-				if($output->data->config) $config = unserialize($output->data->config);
1383
+				if ($output->data->config) $config = unserialize($output->data->config);
1384 1384
 				else $config = null;
1385 1385
 
1386 1386
 				//insert in cache
1387
-				if($oCacheHandler->isSupport())
1387
+				if ($oCacheHandler->isSupport())
1388 1388
 				{
1389 1389
 					$oCacheHandler->put($cache_key, $config);
1390 1390
 				}
@@ -1405,26 +1405,26 @@  discard block
 block discarded – undo
1405 1405
 		$config = false;
1406 1406
 		// cache controll
1407 1407
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1408
-		if($oCacheHandler->isSupport())
1408
+		if ($oCacheHandler->isSupport())
1409 1409
 		{
1410
-			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1410
+			$object_key = 'module_part_config:' . $module . '_' . $module_srl;
1411 1411
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1412 1412
 			$config = $oCacheHandler->get($cache_key);
1413 1413
 		}
1414 1414
 
1415
-		if($config === false)
1415
+		if ($config === false)
1416 1416
 		{
1417
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1417
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1418 1418
 			{
1419 1419
 				$args = new stdClass();
1420 1420
 				$args->module = $module;
1421 1421
 				$args->module_srl = $module_srl;
1422 1422
 				$output = executeQuery('module.getModulePartConfig', $args);
1423
-				if($output->data->config) $config = unserialize($output->data->config);
1423
+				if ($output->data->config) $config = unserialize($output->data->config);
1424 1424
 				else $config = null;
1425 1425
 
1426 1426
 				//insert in cache
1427
-				if($oCacheHandler->isSupport())
1427
+				if ($oCacheHandler->isSupport())
1428 1428
 				{
1429 1429
 					$oCacheHandler->put($cache_key, $config);
1430 1430
 				}
@@ -1443,11 +1443,11 @@  discard block
 block discarded – undo
1443 1443
 	{
1444 1444
 		$args = new stdClass();
1445 1445
 		$args->module = $module;
1446
-		if($site_srl) $args->site_srl = $site_srl;
1446
+		if ($site_srl) $args->site_srl = $site_srl;
1447 1447
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1448
-		if(!$output->toBool() || !$output->data) return array();
1448
+		if (!$output->toBool() || !$output->data) return array();
1449 1449
 
1450
-		foreach($output->data as $key => $val)
1450
+		foreach ($output->data as $key => $val)
1451 1451
 		{
1452 1452
 			$result[$val->module_srl] = unserialize($val->config);
1453 1453
 		}
@@ -1463,12 +1463,12 @@  discard block
 block discarded – undo
1463 1463
 		$args->moduleCategorySrl = $moduleCategorySrl;
1464 1464
 		// Get data from the DB
1465 1465
 		$output = executeQuery('module.getModuleCategories', $args);
1466
-		if(!$output->toBool()) return $output;
1466
+		if (!$output->toBool()) return $output;
1467 1467
 		$list = $output->data;
1468
-		if(!$list) return;
1469
-		if(!is_array($list)) $list = array($list);
1468
+		if (!$list) return;
1469
+		if (!is_array($list)) $list = array($list);
1470 1470
 
1471
-		foreach($list as $val)
1471
+		foreach ($list as $val)
1472 1472
 		{
1473 1473
 			$category_list[$val->module_category_srl] = $val;
1474 1474
 		}
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 		$args = new stdClass;
1485 1485
 		$args->module_category_srl = $module_category_srl;
1486 1486
 		$output = executeQuery('module.getModuleCategory', $args);
1487
-		if(!$output->toBool()) return $output;
1487
+		if (!$output->toBool()) return $output;
1488 1488
 		return $output->data;
1489 1489
 	}
1490 1490
 
@@ -1496,10 +1496,10 @@  discard block
 block discarded – undo
1496 1496
 		// Get a list of downloaded and installed modules
1497 1497
 		$searched_list = FileHandler::readDir('./modules');
1498 1498
 		$searched_count = count($searched_list);
1499
-		if(!$searched_count) return;
1499
+		if (!$searched_count) return;
1500 1500
 		sort($searched_list);
1501 1501
 
1502
-		for($i=0;$i<$searched_count;$i++)
1502
+		for ($i = 0; $i < $searched_count; $i++)
1503 1503
 		{
1504 1504
 			// Module name
1505 1505
 			$module_name = $searched_list[$i];
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 			$info = $this->getModuleInfoXml($module_name);
1510 1510
 			unset($obj);
1511 1511
 
1512
-			if(!isset($info)) continue;
1512
+			if (!isset($info)) continue;
1513 1513
 			$info->module = $module_name;
1514 1514
 			$info->created_table_count = $created_table_count;
1515 1515
 			$info->table_count = $table_count;
@@ -1526,19 +1526,19 @@  discard block
 block discarded – undo
1526 1526
 		$info = null;
1527 1527
 
1528 1528
 		$moduledir = ModuleHandler::getModulePath($module_name);
1529
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1529
+		if (file_exists(FileHandler::getRealPath($moduledir . "schemas")))
1530 1530
 		{
1531
-			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1531
+			$tmp_files = FileHandler::readDir($moduledir . "schemas", '/(\.xml)$/');
1532 1532
 			$table_count = count($tmp_files);
1533 1533
 			// Check if the table is created
1534 1534
 			$created_table_count = 0;
1535
-			for($j=0;$j<count($tmp_files);$j++)
1535
+			for ($j = 0; $j < count($tmp_files); $j++)
1536 1536
 			{
1537
-				list($table_name) = explode(".",$tmp_files[$j]);
1538
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1537
+				list($table_name) = explode(".", $tmp_files[$j]);
1538
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1539 1539
 			}
1540 1540
 			// Check if DB is installed
1541
-			if($table_count > $created_table_count) return true;
1541
+			if ($table_count > $created_table_count) return true;
1542 1542
 			else return false;
1543 1543
 		}
1544 1544
 		return false;
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 	{
1549 1549
 		// Check if it is upgraded to module.class.php on each module
1550 1550
 		$oDummy = getModule($module_name, 'class');
1551
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1551
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1552 1552
 		{
1553 1553
 			return $oDummy->checkUpdate();
1554 1554
 		}
@@ -1567,31 +1567,31 @@  discard block
 block discarded – undo
1567 1567
 		sort($searched_list);
1568 1568
 
1569 1569
 		$searched_count = count($searched_list);
1570
-		if(!$searched_count) return;
1570
+		if (!$searched_count) return;
1571 1571
 
1572
-		for($i=0;$i<$searched_count;$i++)
1572
+		for ($i = 0; $i < $searched_count; $i++)
1573 1573
 		{
1574 1574
 			// module name
1575 1575
 			$module_name = $searched_list[$i];
1576 1576
 
1577 1577
 			$path = ModuleHandler::getModulePath($module_name);
1578
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1578
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1579 1579
 
1580 1580
 			// Get the number of xml files to create a table in schemas
1581
-			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1581
+			$tmp_files = FileHandler::readDir($path . 'schemas', '/(\.xml)$/');
1582 1582
 			$table_count = count($tmp_files);
1583 1583
 			// Check if the table is created
1584 1584
 			$created_table_count = 0;
1585
-			for($j=0;$j<$table_count;$j++)
1585
+			for ($j = 0; $j < $table_count; $j++)
1586 1586
 			{
1587
-				list($table_name) = explode('.',$tmp_files[$j]);
1588
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1587
+				list($table_name) = explode('.', $tmp_files[$j]);
1588
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1589 1589
 			}
1590 1590
 			// Get information of the module
1591 1591
 			$info = NULL;
1592 1592
 			$info = $this->getModuleInfoXml($module_name);
1593 1593
 
1594
-			if(!$info) continue;
1594
+			if (!$info) continue;
1595 1595
 
1596 1596
 			$info->module = $module_name;
1597 1597
 			$info->category = $info->category;
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
 			$info->path = $path;
1601 1601
 			$info->admin_index_act = $info->admin_index_act;
1602 1602
 			// Check if DB is installed
1603
-			if($table_count > $created_table_count) $info->need_install = true;
1603
+			if ($table_count > $created_table_count) $info->need_install = true;
1604 1604
 			else $info->need_install = false;
1605 1605
 			// Check if it is upgraded to module.class.php on each module
1606 1606
 			$oDummy = null;
1607 1607
 			$oDummy = getModule($module_name, 'class');
1608
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1608
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1609 1609
 			{
1610 1610
 				$info->need_update = $oDummy->checkUpdate();
1611 1611
 			}
@@ -1626,15 +1626,15 @@  discard block
 block discarded – undo
1626 1626
 	 */
1627 1627
 	function syncModuleToSite(&$data)
1628 1628
 	{
1629
-		if(!$data) return;
1629
+		if (!$data) return;
1630 1630
 
1631
-		if(is_array($data))
1631
+		if (is_array($data))
1632 1632
 		{
1633
-			foreach($data as $key => $val)
1633
+			foreach ($data as $key => $val)
1634 1634
 			{
1635 1635
 				$module_srls[] = $val->module_srl;
1636 1636
 			}
1637
-			if(!count($module_srls)) return;
1637
+			if (!count($module_srls)) return;
1638 1638
 		}
1639 1639
 		else
1640 1640
 		{
@@ -1642,17 +1642,17 @@  discard block
 block discarded – undo
1642 1642
 		}
1643 1643
 
1644 1644
 		$args = new stdClass();
1645
-		$args->module_srls = implode(',',$module_srls);
1645
+		$args->module_srls = implode(',', $module_srls);
1646 1646
 		$output = executeQueryArray('module.getModuleSites', $args);
1647
-		if(!$output->data) return array();
1648
-		foreach($output->data as $key => $val)
1647
+		if (!$output->data) return array();
1648
+		foreach ($output->data as $key => $val)
1649 1649
 		{
1650 1650
 			$modules[$val->module_srl] = $val;
1651 1651
 		}
1652 1652
 
1653
-		if(is_array($data))
1653
+		if (is_array($data))
1654 1654
 		{
1655
-			foreach($data as $key => $val)
1655
+			foreach ($data as $key => $val)
1656 1656
 			{
1657 1657
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1658 1658
 			}
@@ -1668,14 +1668,14 @@  discard block
 block discarded – undo
1668 1668
 	 */
1669 1669
 	function isSiteAdmin($member_info, $site_srl = null)
1670 1670
 	{
1671
-		if(!$member_info->member_srl) return false;
1672
-		if($member_info->is_admin == 'Y') return true;
1671
+		if (!$member_info->member_srl) return false;
1672
+		if ($member_info->is_admin == 'Y') return true;
1673 1673
 
1674 1674
 		$args = new stdClass();
1675
-		if(!isset($site_srl))
1675
+		if (!isset($site_srl))
1676 1676
 		{
1677 1677
 			$site_module_info = Context::get('site_module_info');
1678
-			if(!$site_module_info) return;
1678
+			if (!$site_module_info) return;
1679 1679
 			$args->site_srl = $site_module_info->site_srl;
1680 1680
 		}
1681 1681
 		else
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
 		$args->member_srl = $member_info->member_srl;
1687 1687
 		$output = executeQuery('module.isSiteAdmin', $args);
1688
-		if($output->data->member_srl == $args->member_srl) return true;
1688
+		if ($output->data->member_srl == $args->member_srl) return true;
1689 1689
 		return false;
1690 1690
 	}
1691 1691
 
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 		$obj = new stdClass();
1709 1709
 		$obj->module_srl = $module_srl;
1710 1710
 		$output = executeQueryArray('module.getAdminID', $obj);
1711
-		if(!$output->toBool() || !$output->data) return;
1711
+		if (!$output->toBool() || !$output->data) return;
1712 1712
 
1713 1713
 		return $output->data;
1714 1714
 	}
@@ -1721,20 +1721,20 @@  discard block
 block discarded – undo
1721 1721
 	{
1722 1722
 		$extra_vars = array();
1723 1723
 		$get_module_srls = array();
1724
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1724
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1725 1725
 
1726 1726
 		$vars = false;
1727 1727
 		// cache controll
1728 1728
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1729
-		if($oCacheHandler->isSupport())
1729
+		if ($oCacheHandler->isSupport())
1730 1730
 		{
1731
-			foreach($list_module_srl as $module_srl)
1731
+			foreach ($list_module_srl as $module_srl)
1732 1732
 			{
1733
-				$object_key = 'module_extra_vars:'.$module_srl;
1733
+				$object_key = 'module_extra_vars:' . $module_srl;
1734 1734
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1735 1735
 				$vars = $oCacheHandler->get($cache_key);
1736 1736
 
1737
-				if($vars)
1737
+				if ($vars)
1738 1738
 				{
1739 1739
 					$extra_vars[$module_srl] = $vars;
1740 1740
 				}
@@ -1749,37 +1749,37 @@  discard block
 block discarded – undo
1749 1749
 			$get_module_srls = $list_module_srl;
1750 1750
 		}
1751 1751
 
1752
-		if(count($get_module_srls) > 0)
1752
+		if (count($get_module_srls) > 0)
1753 1753
 		{
1754 1754
 			$args = new stdClass();
1755 1755
 			$args->module_srl = implode(',', $get_module_srls);
1756 1756
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1757 1757
 
1758
-			if(!$output->toBool())
1758
+			if (!$output->toBool())
1759 1759
 			{
1760 1760
 				return;
1761 1761
 			}
1762 1762
 
1763
-			if(!$output->data)
1763
+			if (!$output->data)
1764 1764
 			{
1765
-				foreach($get_module_srls as $module_srl)
1765
+				foreach ($get_module_srls as $module_srl)
1766 1766
 				{
1767 1767
 					$extra_vars[$module_srl] = new stdClass;
1768 1768
 				}
1769 1769
 			}
1770
-			foreach($output->data as $key => $val)
1770
+			foreach ($output->data as $key => $val)
1771 1771
 			{
1772
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1772
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1773 1773
 
1774
-				if(!isset($extra_vars[$val->module_srl]))
1774
+				if (!isset($extra_vars[$val->module_srl]))
1775 1775
 				{
1776 1776
 					$extra_vars[$val->module_srl] = new stdClass();
1777 1777
 				}
1778 1778
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1779 1779
 
1780
-				if($oCacheHandler->isSupport())
1780
+				if ($oCacheHandler->isSupport())
1781 1781
 				{
1782
-					$object_key = 'module_extra_vars:'.$val->module_srl;
1782
+					$object_key = 'module_extra_vars:' . $val->module_srl;
1783 1783
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1784 1784
 					$oCacheHandler->put($cache_key, $extra_vars[$val->module_srl]);
1785 1785
 				}
@@ -1796,27 +1796,27 @@  discard block
 block discarded – undo
1796 1796
 	{
1797 1797
 		$skin_vars = false;
1798 1798
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1799
-		if($oCacheHandler->isSupport())
1799
+		if ($oCacheHandler->isSupport())
1800 1800
 		{
1801
-			$object_key = 'module_skin_vars:'.$module_srl;
1801
+			$object_key = 'module_skin_vars:' . $module_srl;
1802 1802
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1803 1803
 			$skin_vars = $oCacheHandler->get($cache_key);
1804 1804
 		}
1805 1805
 
1806
-		if($skin_vars === false)
1806
+		if ($skin_vars === false)
1807 1807
 		{
1808 1808
 			$args = new stdClass();
1809 1809
 			$args->module_srl = $module_srl;
1810
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1811
-			if(!$output->toBool()) return;
1810
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1811
+			if (!$output->toBool()) return;
1812 1812
 
1813 1813
 			$skin_vars = array();
1814
-			foreach($output->data as $vars)
1814
+			foreach ($output->data as $vars)
1815 1815
 			{
1816 1816
 				$skin_vars[$vars->name] = $vars;
1817 1817
 			}
1818 1818
 
1819
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1819
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1820 1820
 		}
1821 1821
 
1822 1822
 		return $skin_vars;
@@ -1828,32 +1828,32 @@  discard block
 block discarded – undo
1828 1828
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1829 1829
 	{
1830 1830
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1831
-		if(!$site_srl) $site_srl = 0;
1831
+		if (!$site_srl) $site_srl = 0;
1832 1832
 
1833
-		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834
-		if(is_readable($designInfoFile))
1833
+		$designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl);
1834
+		if (is_readable($designInfoFile))
1835 1835
 		{
1836 1836
 			include($designInfoFile);
1837 1837
 
1838 1838
 			$skinName = $designInfo->module->{$module_name}->{$target};
1839 1839
 		}
1840
-		if(!$skinName)
1840
+		if (!$skinName)
1841 1841
 		{
1842 1842
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1843
-			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1843
+			$moduleSkinPath = ModuleHandler::getModulePath($module_name) . $dir;
1844 1844
 
1845
-			if(is_dir($moduleSkinPath.'default'))
1845
+			if (is_dir($moduleSkinPath . 'default'))
1846 1846
 			{
1847 1847
 				$skinName = 'default';
1848 1848
 			}
1849
-			else if(is_dir($moduleSkinPath.'xe_default'))
1849
+			else if (is_dir($moduleSkinPath . 'xe_default'))
1850 1850
 			{
1851 1851
 				$skinName = 'xe_default';
1852 1852
 			}
1853 1853
 			else
1854 1854
 			{
1855 1855
 				$skins = FileHandler::readDir($moduleSkinPath);
1856
-				if(count($skins) > 0)
1856
+				if (count($skins) > 0)
1857 1857
 				{
1858 1858
 					$skinName = $skins[0];
1859 1859
 				}
@@ -1863,9 +1863,9 @@  discard block
 block discarded – undo
1863 1863
 				}
1864 1864
 			}
1865 1865
 
1866
-			if($updateCache && $skinName)
1866
+			if ($updateCache && $skinName)
1867 1867
 			{
1868
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1868
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1869 1869
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1870 1870
 
1871 1871
 				$oAdminController = getAdminController('admin');
@@ -1881,10 +1881,10 @@  discard block
 block discarded – undo
1881 1881
 	 */
1882 1882
 	function syncSkinInfoToModuleInfo(&$module_info)
1883 1883
 	{
1884
-		if(!$module_info->module_srl) return;
1884
+		if (!$module_info->module_srl) return;
1885 1885
 
1886 1886
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1887
-		if(Mobile::isFromMobilePhone())
1887
+		if (Mobile::isFromMobilePhone())
1888 1888
 		{
1889 1889
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1890 1890
 		}
@@ -1893,11 +1893,11 @@  discard block
 block discarded – undo
1893 1893
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1894 1894
 		}
1895 1895
 
1896
-		if(!$skin_vars) return;
1896
+		if (!$skin_vars) return;
1897 1897
 
1898
-		foreach($skin_vars as $name => $val)
1898
+		foreach ($skin_vars as $name => $val)
1899 1899
 		{
1900
-			if(isset($module_info->{$name})) continue;
1900
+			if (isset($module_info->{$name})) continue;
1901 1901
 			$module_info->{$name} = $val->value;
1902 1902
 		}
1903 1903
 	}
@@ -1911,27 +1911,27 @@  discard block
 block discarded – undo
1911 1911
 	{
1912 1912
 		$skin_vars = false;
1913 1913
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1914
-		if($oCacheHandler->isSupport())
1914
+		if ($oCacheHandler->isSupport())
1915 1915
 		{
1916
-			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1916
+			$object_key = 'module_mobile_skin_vars:' . $module_srl;
1917 1917
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1918 1918
 			$skin_vars = $oCacheHandler->get($cache_key);
1919 1919
 		}
1920 1920
 
1921
-		if($skin_vars === false)
1921
+		if ($skin_vars === false)
1922 1922
 		{
1923 1923
 			$args = new stdClass();
1924 1924
 			$args->module_srl = $module_srl;
1925
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1926
-			if(!$output->toBool() || !$output->data) return;
1925
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1926
+			if (!$output->toBool() || !$output->data) return;
1927 1927
 
1928 1928
 			$skin_vars = array();
1929
-			foreach($output->data as $vars)
1929
+			foreach ($output->data as $vars)
1930 1930
 			{
1931 1931
 				$skin_vars[$vars->name] = $vars;
1932 1932
 			}
1933 1933
 
1934
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1934
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1935 1935
 		}
1936 1936
 
1937 1937
 		return $skin_vars;
@@ -1943,32 +1943,32 @@  discard block
 block discarded – undo
1943 1943
 	 */
1944 1944
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1945 1945
 	{
1946
-		if(!$module_info->module_srl) return;
1946
+		if (!$module_info->module_srl) return;
1947 1947
 		$skin_vars = false;
1948 1948
 		// cache controll
1949 1949
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1950
-		if($oCacheHandler->isSupport())
1950
+		if ($oCacheHandler->isSupport())
1951 1951
 		{
1952
-			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1952
+			$object_key = 'module_mobile_skin_vars:' . $module_info->module_srl;
1953 1953
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1954 1954
 			$skin_vars = $oCacheHandler->get($cache_key);
1955 1955
 		}
1956
-		if($skin_vars === false)
1956
+		if ($skin_vars === false)
1957 1957
 		{
1958 1958
 			$args = new stdClass;
1959 1959
 			$args->module_srl = $module_info->module_srl;
1960
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1961
-			if(!$output->toBool()) return;
1960
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1961
+			if (!$output->toBool()) return;
1962 1962
 			$skin_vars = $output->data;
1963 1963
 
1964 1964
 			//insert in cache
1965
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1965
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1966 1966
 		}
1967
-		if(!$skin_vars) return;
1967
+		if (!$skin_vars) return;
1968 1968
 
1969
-		foreach($output->data as $val)
1969
+		foreach ($output->data as $val)
1970 1970
 		{
1971
-			if(isset($module_info->{$val->name})) continue;
1971
+			if (isset($module_info->{$val->name})) continue;
1972 1972
 			$module_info->{$val->name} = $val->value;
1973 1973
 		}
1974 1974
 	}
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
 	{
1981 1981
 		$grant = new stdClass();
1982 1982
 
1983
-		if(!$xml_info)
1983
+		if (!$xml_info)
1984 1984
 		{
1985 1985
 			$module = $module_info->module;
1986 1986
 			$xml_info = $this->getModuleActionXml($module);
@@ -1988,9 +1988,9 @@  discard block
 block discarded – undo
1988 1988
 		// Set variables to grant group permission
1989 1989
 		$module_srl = $module_info->module_srl;
1990 1990
 		$grant_info = $xml_info->grant;
1991
-		if($member_info->member_srl)
1991
+		if ($member_info->member_srl)
1992 1992
 		{
1993
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1993
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1994 1994
 			else $group_list = array();
1995 1995
 		}
1996 1996
 		else
@@ -1998,10 +1998,10 @@  discard block
 block discarded – undo
1998 1998
 			$group_list = array();
1999 1999
 		}
2000 2000
 		// If module_srl doesn't exist(if unable to set permissions)
2001
-		if(!$module_srl)
2001
+		if (!$module_srl)
2002 2002
 		{
2003 2003
 			$grant->access = true;
2004
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2004
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2005 2005
 			{
2006 2006
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2007 2007
 			}
@@ -2012,23 +2012,23 @@  discard block
 block discarded – undo
2012 2012
 		{
2013 2013
 			// If module_srl exists
2014 2014
 			// Get a type of granted permission
2015
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2015
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false;
2016 2016
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2017 2017
 			// If a just logged-in member is, check if the member is a module administrator
2018
-			if(!$grant->manager && $member_info->member_srl)
2018
+			if (!$grant->manager && $member_info->member_srl)
2019 2019
 			{
2020 2020
 				$args = new stdClass();
2021 2021
 				$args->module_srl = $module_srl;
2022 2022
 				$args->member_srl = $member_info->member_srl;
2023
-				$output = executeQuery('module.getModuleAdmin',$args);
2024
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2023
+				$output = executeQuery('module.getModuleAdmin', $args);
2024
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2025 2025
 			}
2026 2026
 			// If not an administrator, get information from the DB and grant manager privilege.
2027
-			if(!$grant->manager)
2027
+			if (!$grant->manager)
2028 2028
 			{
2029 2029
 				$args = new stdClass();
2030 2030
 				// If planet, get permission settings from the planet home
2031
-				if($module_info->module == 'planet')
2031
+				if ($module_info->module == 'planet')
2032 2032
 				{
2033 2033
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2034 2034
 				}
@@ -2041,37 +2041,37 @@  discard block
 block discarded – undo
2041 2041
 
2042 2042
 				$grant_exists = $granted = array();
2043 2043
 
2044
-				if($output->data)
2044
+				if ($output->data)
2045 2045
 				{
2046 2046
 					// Arrange names and groups who has privileges
2047
-					foreach($output->data as $val)
2047
+					foreach ($output->data as $val)
2048 2048
 					{
2049 2049
 						$grant_exists[$val->name] = true;
2050
-						if($granted[$val->name]) continue;
2050
+						if ($granted[$val->name]) continue;
2051 2051
 						// Log-in member only
2052
-						if($val->group_srl == -1)
2052
+						if ($val->group_srl == -1)
2053 2053
 						{
2054 2054
 							$granted[$val->name] = true;
2055
-							if($member_info->member_srl) $grant->{$val->name} = true;
2055
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2056 2056
 							// Site-joined member only
2057 2057
 						}
2058
-						elseif($val->group_srl == -2)
2058
+						elseif ($val->group_srl == -2)
2059 2059
 						{
2060 2060
 							$granted[$val->name] = true;
2061 2061
 							// Do not grant any permission for non-logged member
2062
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2062
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2063 2063
 							// Log-in member
2064 2064
 							else
2065 2065
 							{
2066 2066
 								$site_module_info = Context::get('site_module_info');
2067 2067
 								// Permission granted if no information of the currently connected site exists
2068
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2068
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2069 2069
 								// Permission is not granted if information of the currently connected site exists
2070
-								elseif(count($group_list)) $grant->{$val->name} = true;
2070
+								elseif (count($group_list)) $grant->{$val->name} = true;
2071 2071
 							}
2072 2072
 							// All of non-logged members
2073 2073
 						}
2074
-						elseif($val->group_srl == 0)
2074
+						elseif ($val->group_srl == 0)
2075 2075
 						{
2076 2076
 							$granted[$val->name] = true;
2077 2077
 							$grant->{$val->name} = true;
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 						}
2080 2080
 						else
2081 2081
 						{
2082
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2082
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2083 2083
 							{
2084 2084
 								$grant->{$val->name} = true;
2085 2085
 								$granted[$val->name] = true;
@@ -2088,29 +2088,29 @@  discard block
 block discarded – undo
2088 2088
 					}
2089 2089
 				}
2090 2090
 				// Separate processing for the virtual group access
2091
-				if(!$grant_exists['access']) $grant->access = true;
2092
-				if(count($grant_info))
2091
+				if (!$grant_exists['access']) $grant->access = true;
2092
+				if (count($grant_info))
2093 2093
 				{
2094
-					foreach($grant_info as  $grant_name => $grant_item)
2094
+					foreach ($grant_info as  $grant_name => $grant_item)
2095 2095
 					{
2096
-						if($grant_exists[$grant_name]) continue;
2097
-						switch($grant_item->default)
2096
+						if ($grant_exists[$grant_name]) continue;
2097
+						switch ($grant_item->default)
2098 2098
 						{
2099 2099
 							case 'guest' :
2100 2100
 								$grant->{$grant_name} = true;
2101 2101
 								break;
2102 2102
 							case 'member' :
2103
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2103
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2104 2104
 								else $grant->{$grant_name} = false;
2105 2105
 								break;
2106 2106
 							case 'site' :
2107 2107
 								$site_module_info = Context::get('site_module_info');
2108
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2108
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2109 2109
 								else $grant->{$grant_name} = false;
2110 2110
 								break;
2111 2111
 							case 'manager' :
2112 2112
 							case 'root' :
2113
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2113
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2114 2114
 								else $grant->{$grant_name} = false;
2115 2115
 								break;
2116 2116
 						}
@@ -2118,12 +2118,12 @@  discard block
 block discarded – undo
2118 2118
 				}
2119 2119
 			}
2120 2120
 			// Set true to grant all privileges if an administrator is
2121
-			if($grant->manager)
2121
+			if ($grant->manager)
2122 2122
 			{
2123 2123
 				$grant->access = true;
2124
-				if(count($grant_info))
2124
+				if (count($grant_info))
2125 2125
 				{
2126
-					foreach($grant_info as $key => $val)
2126
+					foreach ($grant_info as $key => $val)
2127 2127
 					{
2128 2128
 						$grant->{$key} = true;
2129 2129
 					}
@@ -2155,27 +2155,27 @@  discard block
 block discarded – undo
2155 2155
 
2156 2156
 	function unserializeAttributes($module_filebox_list)
2157 2157
 	{
2158
-		if(is_array($module_filebox_list->data))
2158
+		if (is_array($module_filebox_list->data))
2159 2159
 		{
2160
-			foreach($module_filebox_list->data as &$item)
2160
+			foreach ($module_filebox_list->data as &$item)
2161 2161
 			{
2162
-				if(empty($item->comment))
2162
+				if (empty($item->comment))
2163 2163
 				{
2164 2164
 					continue;
2165 2165
 				}
2166 2166
 
2167 2167
 				$attributes = explode(';', $item->comment);
2168
-				foreach($attributes as $attribute)
2168
+				foreach ($attributes as $attribute)
2169 2169
 				{
2170 2170
 					$values = explode(':', $attribute);
2171
-					if((count($values) % 2) ==1)
2171
+					if ((count($values) % 2) == 1)
2172 2172
 					{
2173
-						for($i=2;$i<count($values);$i++)
2173
+						for ($i = 2; $i < count($values); $i++)
2174 2174
 						{
2175
-							$values[1].=":".$values[$i];
2175
+							$values[1] .= ":" . $values[$i];
2176 2176
 						}
2177 2177
 					}
2178
-					$atts[$values[0]]=$values[1];
2178
+					$atts[$values[0]] = $values[1];
2179 2179
 				}
2180 2180
 				$item->attributes = $atts;
2181 2181
 				unset($atts);
@@ -2187,16 +2187,16 @@  discard block
 block discarded – undo
2187 2187
 	function getFileBoxListHtml()
2188 2188
 	{
2189 2189
 		$logged_info = Context::get('logged_info');
2190
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2190
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2191 2191
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2192
-		$link_params = explode('&',$link['query']);
2192
+		$link_params = explode('&', $link['query']);
2193 2193
 		foreach ($link_params as $param)
2194 2194
 		{
2195
-			$param = explode("=",$param);
2196
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2195
+			$param = explode("=", $param);
2196
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2197 2197
 		}
2198 2198
 		$oWidgetModel = getModel('widget');
2199
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2199
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2200 2200
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2201 2201
 
2202 2202
 		$oModuleModel = getModel('module');
@@ -2219,17 +2219,17 @@  discard block
 block discarded – undo
2219 2219
 
2220 2220
 	function getModuleFileBoxPath($module_filebox_srl)
2221 2221
 	{
2222
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2222
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2223 2223
 	}
2224 2224
 
2225 2225
 	/**
2226 2226
 	 * @brief Return ruleset cache file path
2227 2227
 	 * @param module, act
2228 2228
 	 */
2229
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2229
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2230 2230
 	{
2231 2231
 		// load dynamic ruleset xml file
2232
-		if(strpos($ruleset, '@') !== false)
2232
+		if (strpos($ruleset, '@') !== false)
2233 2233
 		{
2234 2234
 			$rulsetFile = str_replace('@', '', $ruleset);
2235 2235
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2237,22 +2237,22 @@  discard block
 block discarded – undo
2237 2237
 		}
2238 2238
 		else if (strpos($ruleset, '#') !== false)
2239 2239
 		{
2240
-			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2240
+			$rulsetFile = str_replace('#', '', $ruleset) . '.' . $mid;
2241 2241
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2242
-			if(is_readable($xml_file))
2242
+			if (is_readable($xml_file))
2243 2243
 				return FileHandler::getRealPath($xml_file);
2244
-			else{
2244
+			else {
2245 2245
 				$ruleset = str_replace('#', '', $ruleset);
2246 2246
 			}
2247 2247
 
2248 2248
 		}
2249 2249
 		// Get a path of the requested module. Return if not exists.
2250 2250
 		$class_path = ModuleHandler::getModulePath($module);
2251
-		if(!$class_path) return;
2251
+		if (!$class_path) return;
2252 2252
 
2253 2253
 		// Check if module.xml exists in the path. Return if not exist
2254 2254
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2255
-		if(!file_exists($xml_file)) return;
2255
+		if (!file_exists($xml_file)) return;
2256 2256
 
2257 2257
 		return $xml_file;
2258 2258
 	}
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 		$requestVars = Context::getRequestVars();
2265 2265
 
2266 2266
 		$args = new stdClass;
2267
-		$args->site_srl = (int)$requestVars->site_srl;
2267
+		$args->site_srl = (int) $requestVars->site_srl;
2268 2268
 		$args->page = 1; // /< Page
2269 2269
 		$args->list_count = 100; // /< the number of posts to display on a single page
2270 2270
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2276,12 +2276,12 @@  discard block
 block discarded – undo
2276 2276
 
2277 2277
 		$list = array();
2278 2278
 
2279
-		if($output->toBool())
2279
+		if ($output->toBool())
2280 2280
 		{
2281
-			foreach((array)$output->data as $code_info)
2281
+			foreach ((array) $output->data as $code_info)
2282 2282
 			{
2283 2283
 				unset($codeInfo);
2284
-				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
2284
+				$codeInfo = array('name'=>'$user_lang->' . $code_info->name, 'value'=>$code_info->value);
2285 2285
 				$list[] = $codeInfo;
2286 2286
 			}
2287 2287
 		}
Please login to merge, or discard this patch.
Braces   +457 added lines, -203 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$url_info = parse_url($request_url);
101 113
 			$hostname = $url_info['host'];
102 114
 			$path = $url_info['path'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $url_info['port']&&$url_info['port']!=80?':'.$url_info['port']:'',$path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,11 +435,14 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
443
+		if(isset($module_info->browser_title)) {
444
+			$oModuleController->replaceDefinedLangCode($module_info->browser_title);
445
+		}
407 446
 
408 447
 		$this->applyDefaultSkin($module_info);
409 448
 		return $this->addModuleExtraVars($module_info);
@@ -451,11 +490,15 @@  discard block
 block discarded – undo
451 490
 	 */
452 491
 	function getModulesInfo($module_srls, $columnList = array())
453 492
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
493
+		if(is_array($module_srls)) {
494
+			$module_srls = implode(',',$module_srls);
495
+		}
455 496
 		$args = new stdClass();
456 497
 		$args->module_srls = $module_srls;
457 498
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
499
+		if(!$output->toBool()) {
500
+			return;
501
+		}
459 502
 		return $this->addModuleExtraVars($output->data);
460 503
 	}
461 504
 
@@ -465,31 +508,44 @@  discard block
 block discarded – undo
465 508
 	function addModuleExtraVars($module_info)
466 509
 	{
467 510
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
469
-		else $target_module_info = $module_info;
511
+		if(!is_array($module_info)) {
512
+			$target_module_info = array($module_info);
513
+		} else {
514
+			$target_module_info = $module_info;
515
+		}
470 516
 		// Get module_srl
471 517
 		$module_srls = array();
472 518
 		foreach($target_module_info as $key => $val)
473 519
 		{
474 520
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
521
+			if(!$module_srl) {
522
+				continue;
523
+			}
476 524
 			$module_srls[] = $val->module_srl;
477 525
 		}
478 526
 		// Extract extra information of the module and skin
479 527
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
528
+		if(!count($module_srls) || !count($extra_vars)) {
529
+			return $module_info;
530
+		}
481 531
 
482 532
 		foreach($target_module_info as $key => $val)
483 533
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
534
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
535
+				continue;
536
+			}
485 537
 			foreach($extra_vars[$val->module_srl] as $k => $v)
486 538
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
539
+				if($target_module_info[$key]->{$k}) {
540
+					continue;
541
+				}
488 542
 				$target_module_info[$key]->{$k} = $v;
489 543
 			}
490 544
 		}
491 545
 
492
-		if(is_array($module_info)) return $target_module_info;
546
+		if(is_array($module_info)) {
547
+			return $target_module_info;
548
+		}
493 549
 		return $target_module_info[0];
494 550
 	}
495 551
 
@@ -518,7 +574,9 @@  discard block
 block discarded – undo
518 574
 			}
519 575
 
520 576
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
577
+			if(!$output->toBool()) {
578
+				return $output;
579
+			}
522 580
 			$list = $output->data;
523 581
 
524 582
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -526,9 +584,13 @@  discard block
 block discarded – undo
526 584
 				$oCacheHandler->put($cache_key, $list);
527 585
 			}
528 586
 		}
529
-		if(!$list) return;
587
+		if(!$list) {
588
+			return;
589
+		}
530 590
 
531
-		if(!is_array($list)) $list = array($list);
591
+		if(!is_array($list)) {
592
+			$list = array($list);
593
+		}
532 594
 
533 595
 		foreach($list as $val)
534 596
 		{
@@ -544,10 +606,14 @@  discard block
 block discarded – undo
544 606
 	function getModuleSrlList($args = null, $columnList = array())
545 607
 	{
546 608
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
609
+		if(!$output->toBool()) {
610
+			return $output;
611
+		}
548 612
 
549 613
 		$list = $output->data;
550
-		if(!$list) return;
614
+		if(!$list) {
615
+			return;
616
+		}
551 617
 
552 618
 		return $list;
553 619
 	}
@@ -557,20 +623,32 @@  discard block
 block discarded – undo
557 623
 	 */
558 624
 	function getModuleSrlByMid($mid)
559 625
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
626
+		if($mid && !is_array($mid)) {
627
+			$mid = explode(',',$mid);
628
+		}
629
+		if(is_array($mid)) {
630
+			$mid = "'".implode("','",$mid)."'";
631
+		}
562 632
 
563 633
 		$site_module_info = Context::get('site_module_info');
564 634
 
565 635
 		$args = new stdClass;
566 636
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
637
+		if($site_module_info) {
638
+			$args->site_srl = $site_module_info->site_srl;
639
+		}
568 640
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
641
+		if(!$output->toBool()) {
642
+			return $output;
643
+		}
570 644
 
571 645
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
646
+		if(!$list) {
647
+			return;
648
+		}
649
+		if(!is_array($list)) {
650
+			$list = array($list);
651
+		}
574 652
 
575 653
 		foreach($list as $key => $val)
576 654
 		{
@@ -599,8 +677,12 @@  discard block
 block discarded – undo
599 677
 		{
600 678
 			$args = new stdClass();
601 679
 			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
680
+			if(!$output->toBool()) {
681
+				return new stdClass;
682
+			}
683
+			if(!$output->data) {
684
+				$output->data = array();
685
+			}
604 686
 
605 687
 			$action_forward = array();
606 688
 			foreach($output->data as $item)
@@ -617,8 +699,7 @@  discard block
 block discarded – undo
617 699
 		if($action_forward[$act])
618 700
 		{
619 701
 			return $action_forward[$act];
620
-		}
621
-		else
702
+		} else
622 703
 		{
623 704
 			return new stdClass();
624 705
 		}
@@ -726,8 +807,7 @@  discard block
 block discarded – undo
726 807
 			if(file_exists($cache_file))
727 808
 			{
728 809
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729
-			}
730
-			else
810
+			} else
731 811
 			{
732 812
 				$GLOBALS['__MODULE_EXTEND__'] = array();
733 813
 			}
@@ -743,16 +823,22 @@  discard block
 block discarded – undo
743 823
 	{
744 824
 		// Get a path of the requested module. Return if not exists.
745 825
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
826
+		if(!$module_path) {
827
+			return;
828
+		}
747 829
 		// Read the xml file for module skin information
748 830
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
831
+		if(!file_exists($xml_file)) {
832
+			return;
833
+		}
750 834
 
751 835
 		$oXmlParser = new XmlParser();
752 836
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 837
 		$xml_obj = $tmp_xml_obj->module;
754 838
 
755
-		if(!$xml_obj) return;
839
+		if(!$xml_obj) {
840
+			return;
841
+		}
756 842
 
757 843
 		// Module Information
758 844
 		$module_info = new stdClass();
@@ -764,14 +850,19 @@  discard block
 block discarded – undo
764 850
 			$module_info->version = $xml_obj->version->body;
765 851
 			$module_info->homepage = $xml_obj->link->body;
766 852
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
853
+			if(!$module_info->category) {
854
+				$module_info->category = 'service';
855
+			}
768 856
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 857
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 858
 			$module_info->license = $xml_obj->license->body;
771 859
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 860
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774
-			else $author_list = $xml_obj->author;
861
+			if(!is_array($xml_obj->author)) {
862
+				$author_list[] = $xml_obj->author;
863
+			} else {
864
+				$author_list = $xml_obj->author;
865
+			}
775 866
 
776 867
 			foreach($author_list as $author)
777 868
 			{
@@ -781,15 +872,16 @@  discard block
 block discarded – undo
781 872
 				$author_obj->homepage = $author->attrs->link;
782 873
 				$module_info->author[] = $author_obj;
783 874
 			}
784
-		}
785
-		else
875
+		} else
786 876
 		{
787 877
 			// module format 0.1
788 878
 			$module_info->title = $xml_obj->title->body;
789 879
 			$module_info->description = $xml_obj->author->description->body;
790 880
 			$module_info->version = $xml_obj->attrs->version;
791 881
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
882
+			if(!$module_info->category) {
883
+				$module_info->category = 'service';
884
+			}
793 885
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 886
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 887
 			$author_obj = new stdClass();
@@ -818,11 +910,15 @@  discard block
 block discarded – undo
818 910
 	{
819 911
 		// Get a path of the requested module. Return if not exists.
820 912
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
913
+		if(!$class_path) {
914
+			return;
915
+		}
822 916
 
823 917
 		// Check if module.xml exists in the path. Return if not exist
824 918
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
919
+		if(!file_exists($xml_file)) {
920
+			return;
921
+		}
826 922
 
827 923
 		// Check if cached file exists
828 924
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -841,7 +937,10 @@  discard block
 block discarded – undo
841 937
 
842 938
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 939
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
940
+			if(!count($xml_obj->module)) {
941
+				return;
942
+			}
943
+			// /< Error occurs if module tag doesn't included in the xml
845 944
 
846 945
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 946
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -853,8 +952,11 @@  discard block
 block discarded – undo
853 952
 			// Arrange permission information
854 953
 			if($grants)
855 954
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
857
-				else $grant_list[] = $grants;
955
+				if(is_array($grants)) {
956
+					$grant_list = $grants;
957
+				} else {
958
+					$grant_list[] = $grants;
959
+				}
858 960
 
859 961
 				$info->grant = new stdClass();
860 962
 				$buff[] = '$info->grant = new stdClass;';
@@ -876,8 +978,11 @@  discard block
 block discarded – undo
876 978
 			// Permissions to grant
877 979
 			if($permissions)
878 980
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
880
-				else $permission_list[] = $permissions;
981
+				if(is_array($permissions)) {
982
+					$permission_list = $permissions;
983
+				} else {
984
+					$permission_list[] = $permissions;
985
+				}
881 986
 
882 987
 				$buff[] = '$info->permission = new stdClass;';
883 988
 
@@ -895,8 +1000,11 @@  discard block
 block discarded – undo
895 1000
 			// for admin menus
896 1001
 			if($menus)
897 1002
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
899
-				else $menu_list[] = $menus;
1003
+				if(is_array($menus)) {
1004
+					$menu_list = $menus;
1005
+				} else {
1006
+					$menu_list[] = $menus;
1007
+				}
900 1008
 
901 1009
 				$buff[] = '$info->menu = new stdClass;';
902 1010
 				$info->menu = new stdClass();
@@ -920,8 +1028,11 @@  discard block
 block discarded – undo
920 1028
 			// actions
921 1029
 			if($actions)
922 1030
 			{
923
-				if(is_array($actions)) $action_list = $actions;
924
-				else $action_list[] = $actions;
1031
+				if(is_array($actions)) {
1032
+					$action_list = $actions;
1033
+				} else {
1034
+					$action_list[] = $actions;
1035
+				}
925 1036
 
926 1037
 				$buff[] = '$info->action = new stdClass;';
927 1038
 				$info->action = new stdClass();
@@ -1007,7 +1118,9 @@  discard block
 block discarded – undo
1007 1118
 			return $info;
1008 1119
 		}
1009 1120
 
1010
-		if(file_exists($cache_file)) return include($cache_file);
1121
+		if(file_exists($cache_file)) {
1122
+			return include($cache_file);
1123
+		}
1011 1124
 	}
1012 1125
 
1013 1126
 	/**
@@ -1045,7 +1158,9 @@  discard block
 block discarded – undo
1045 1158
 
1046 1159
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1047 1160
 		$list = FileHandler::readDir($skin_path);
1048
-		if(!count($list)) return;
1161
+		if(!count($list)) {
1162
+			return;
1163
+		}
1049 1164
 
1050 1165
 		natcasesort($list);
1051 1166
 
@@ -1099,8 +1214,7 @@  discard block
 block discarded – undo
1099 1214
 			if($dir == 'skins')
1100 1215
 			{
1101 1216
 				$type = 'P';
1102
-			}
1103
-			else
1217
+			} else
1104 1218
 			{
1105 1219
 				$type = 'M';
1106 1220
 			}
@@ -1128,14 +1242,20 @@  discard block
 block discarded – undo
1128 1242
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1129 1243
 	{
1130 1244
 		// Read xml file having skin information
1131
-		if(substr($path,-1)!='/') $path .= '/';
1245
+		if(substr($path,-1)!='/') {
1246
+			$path .= '/';
1247
+		}
1132 1248
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1133
-		if(!file_exists($skin_xml_file)) return;
1249
+		if(!file_exists($skin_xml_file)) {
1250
+			return;
1251
+		}
1134 1252
 		// Create XmlParser object
1135 1253
 		$oXmlParser = new XmlParser();
1136 1254
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1137 1255
 		// Return if no skin information is
1138
-		if(!$_xml_obj->skin) return;
1256
+		if(!$_xml_obj->skin) {
1257
+			return;
1258
+		}
1139 1259
 		$xml_obj = $_xml_obj->skin;
1140 1260
 		// Skin Name
1141 1261
 		$skin_info = new stdClass();
@@ -1152,8 +1272,11 @@  discard block
 block discarded – undo
1152 1272
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1153 1273
 			$skin_info->description = $xml_obj->description->body;
1154 1274
 
1155
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1156
-			else $author_list = $xml_obj->author;
1275
+			if(!is_array($xml_obj->author)) {
1276
+				$author_list[] = $xml_obj->author;
1277
+			} else {
1278
+				$author_list = $xml_obj->author;
1279
+			}
1157 1280
 
1158 1281
 			foreach($author_list as $author)
1159 1282
 			{
@@ -1167,8 +1290,12 @@  discard block
 block discarded – undo
1167 1290
 			if($xml_obj->extra_vars)
1168 1291
 			{
1169 1292
 				$extra_var_groups = $xml_obj->extra_vars->group;
1170
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1293
+				if(!$extra_var_groups) {
1294
+					$extra_var_groups = $xml_obj->extra_vars;
1295
+				}
1296
+				if(!is_array($extra_var_groups)) {
1297
+					$extra_var_groups = array($extra_var_groups);
1298
+				}
1172 1299
 
1173 1300
 				foreach($extra_var_groups as $group)
1174 1301
 				{
@@ -1177,7 +1304,9 @@  discard block
 block discarded – undo
1177 1304
 					{
1178 1305
 						continue;
1179 1306
 					}
1180
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1307
+					if(!is_array($group->var)) {
1308
+						$extra_vars = array($group->var);
1309
+					}
1181 1310
 
1182 1311
 					foreach($extra_vars as $key => $val)
1183 1312
 					{
@@ -1204,8 +1333,7 @@  discard block
 block discarded – undo
1204 1333
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1205 1334
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1206 1335
 							}
1207
-						}
1208
-						else
1336
+						} else
1209 1337
 						{
1210 1338
 							$obj->options[0] = new stdClass();
1211 1339
 							$obj->options[0]->title = $val->options->title->body;
@@ -1216,8 +1344,7 @@  discard block
 block discarded – undo
1216 1344
 					}
1217 1345
 				}
1218 1346
 			}
1219
-		}
1220
-		else
1347
+		} else
1221 1348
 		{
1222 1349
 			// skin format v0.1
1223 1350
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1235,8 +1362,12 @@  discard block
 block discarded – undo
1235 1362
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1236 1363
 			// Variables used in the skin
1237 1364
 			$extra_var_groups = $xml_obj->extra_vars->group;
1238
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1365
+			if(!$extra_var_groups) {
1366
+				$extra_var_groups = $xml_obj->extra_vars;
1367
+			}
1368
+			if(!is_array($extra_var_groups)) {
1369
+				$extra_var_groups = array($extra_var_groups);
1370
+			}
1240 1371
 
1241 1372
 			foreach($extra_var_groups as $group)
1242 1373
 			{
@@ -1244,7 +1375,9 @@  discard block
 block discarded – undo
1244 1375
 
1245 1376
 				if($extra_vars)
1246 1377
 				{
1247
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1378
+					if(!is_array($extra_vars)) {
1379
+						$extra_vars = array($extra_vars);
1380
+					}
1248 1381
 
1249 1382
 					foreach($extra_vars as $var)
1250 1383
 					{
@@ -1266,8 +1399,7 @@  discard block
 block discarded – undo
1266 1399
 								$options[$i]->title = $var->default[$i]->body;
1267 1400
 								$options[$i]->value = $var->default[$i]->body;
1268 1401
 							}
1269
-						}
1270
-						else
1402
+						} else
1271 1403
 						{
1272 1404
 							$options[0]->title = $var->default->body;
1273 1405
 							$options[0]->value = $var->default->body;
@@ -1297,7 +1429,9 @@  discard block
 block discarded – undo
1297 1429
 		$colorset = $xml_obj->colorset->color;
1298 1430
 		if($colorset)
1299 1431
 		{
1300
-			if(!is_array($colorset)) $colorset = array($colorset);
1432
+			if(!is_array($colorset)) {
1433
+				$colorset = array($colorset);
1434
+			}
1301 1435
 
1302 1436
 			foreach($colorset as $color)
1303 1437
 			{
@@ -1307,9 +1441,12 @@  discard block
 block discarded – undo
1307 1441
 				if($screenshot)
1308 1442
 				{
1309 1443
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1310
-					if(!file_exists($screenshot)) $screenshot = "";
1444
+					if(!file_exists($screenshot)) {
1445
+						$screenshot = "";
1446
+					}
1447
+				} else {
1448
+					$screenshot = "";
1311 1449
 				}
1312
-				else $screenshot = "";
1313 1450
 
1314 1451
 				$obj = new stdClass();
1315 1452
 				$obj->name = $name;
@@ -1322,7 +1459,9 @@  discard block
 block discarded – undo
1322 1459
 		if($xml_obj->menus->menu)
1323 1460
 		{
1324 1461
 			$menus = $xml_obj->menus->menu;
1325
-			if(!is_array($menus)) $menus = array($menus);
1462
+			if(!is_array($menus)) {
1463
+				$menus = array($menus);
1464
+			}
1326 1465
 
1327 1466
 			$menu_count = count($menus);
1328 1467
 			$skin_info->menu_count = $menu_count;
@@ -1331,7 +1470,9 @@  discard block
 block discarded – undo
1331 1470
 				unset($obj);
1332 1471
 
1333 1472
 				$obj->name = $menus[$i]->attrs->name;
1334
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1473
+				if($menus[$i]->attrs->default == "true") {
1474
+					$obj->default = true;
1475
+				}
1335 1476
 				$obj->title = $menus[$i]->title->body;
1336 1477
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1337 1478
 
@@ -1351,7 +1492,9 @@  discard block
 block discarded – undo
1351 1492
 	{
1352 1493
 		$args = new stdClass;
1353 1494
 		$args->site_srl = $site_srl;
1354
-		if(!is_null($module)) $args->module = $module;
1495
+		if(!is_null($module)) {
1496
+			$args->module = $module;
1497
+		}
1355 1498
 		$output = executeQuery('module.getModuleCount', $args);
1356 1499
 		return $output->data->count;
1357 1500
 	}
@@ -1380,8 +1523,11 @@  discard block
 block discarded – undo
1380 1523
 				$args->module = $module;
1381 1524
 				$args->site_srl = $site_srl;
1382 1525
 				$output = executeQuery('module.getModuleConfig', $args);
1383
-				if($output->data->config) $config = unserialize($output->data->config);
1384
-				else $config = new stdClass();
1526
+				if($output->data->config) {
1527
+					$config = unserialize($output->data->config);
1528
+				} else {
1529
+					$config = new stdClass();
1530
+				}
1385 1531
 
1386 1532
 				//insert in cache
1387 1533
 				if($oCacheHandler->isSupport())
@@ -1420,8 +1566,11 @@  discard block
 block discarded – undo
1420 1566
 				$args->module = $module;
1421 1567
 				$args->module_srl = $module_srl;
1422 1568
 				$output = executeQuery('module.getModulePartConfig', $args);
1423
-				if($output->data->config) $config = unserialize($output->data->config);
1424
-				else $config = null;
1569
+				if($output->data->config) {
1570
+					$config = unserialize($output->data->config);
1571
+				} else {
1572
+					$config = null;
1573
+				}
1425 1574
 
1426 1575
 				//insert in cache
1427 1576
 				if($oCacheHandler->isSupport())
@@ -1443,9 +1592,13 @@  discard block
 block discarded – undo
1443 1592
 	{
1444 1593
 		$args = new stdClass();
1445 1594
 		$args->module = $module;
1446
-		if($site_srl) $args->site_srl = $site_srl;
1595
+		if($site_srl) {
1596
+			$args->site_srl = $site_srl;
1597
+		}
1447 1598
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1448
-		if(!$output->toBool() || !$output->data) return array();
1599
+		if(!$output->toBool() || !$output->data) {
1600
+			return array();
1601
+		}
1449 1602
 
1450 1603
 		foreach($output->data as $key => $val)
1451 1604
 		{
@@ -1463,10 +1616,16 @@  discard block
 block discarded – undo
1463 1616
 		$args->moduleCategorySrl = $moduleCategorySrl;
1464 1617
 		// Get data from the DB
1465 1618
 		$output = executeQuery('module.getModuleCategories', $args);
1466
-		if(!$output->toBool()) return $output;
1619
+		if(!$output->toBool()) {
1620
+			return $output;
1621
+		}
1467 1622
 		$list = $output->data;
1468
-		if(!$list) return;
1469
-		if(!is_array($list)) $list = array($list);
1623
+		if(!$list) {
1624
+			return;
1625
+		}
1626
+		if(!is_array($list)) {
1627
+			$list = array($list);
1628
+		}
1470 1629
 
1471 1630
 		foreach($list as $val)
1472 1631
 		{
@@ -1484,7 +1643,9 @@  discard block
 block discarded – undo
1484 1643
 		$args = new stdClass;
1485 1644
 		$args->module_category_srl = $module_category_srl;
1486 1645
 		$output = executeQuery('module.getModuleCategory', $args);
1487
-		if(!$output->toBool()) return $output;
1646
+		if(!$output->toBool()) {
1647
+			return $output;
1648
+		}
1488 1649
 		return $output->data;
1489 1650
 	}
1490 1651
 
@@ -1496,7 +1657,9 @@  discard block
 block discarded – undo
1496 1657
 		// Get a list of downloaded and installed modules
1497 1658
 		$searched_list = FileHandler::readDir('./modules');
1498 1659
 		$searched_count = count($searched_list);
1499
-		if(!$searched_count) return;
1660
+		if(!$searched_count) {
1661
+			return;
1662
+		}
1500 1663
 		sort($searched_list);
1501 1664
 
1502 1665
 		for($i=0;$i<$searched_count;$i++)
@@ -1509,7 +1672,9 @@  discard block
 block discarded – undo
1509 1672
 			$info = $this->getModuleInfoXml($module_name);
1510 1673
 			unset($obj);
1511 1674
 
1512
-			if(!isset($info)) continue;
1675
+			if(!isset($info)) {
1676
+				continue;
1677
+			}
1513 1678
 			$info->module = $module_name;
1514 1679
 			$info->created_table_count = $created_table_count;
1515 1680
 			$info->table_count = $table_count;
@@ -1535,11 +1700,16 @@  discard block
 block discarded – undo
1535 1700
 			for($j=0;$j<count($tmp_files);$j++)
1536 1701
 			{
1537 1702
 				list($table_name) = explode(".",$tmp_files[$j]);
1538
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1703
+				if($oDB->isTableExists($table_name)) {
1704
+					$created_table_count ++;
1705
+				}
1539 1706
 			}
1540 1707
 			// Check if DB is installed
1541
-			if($table_count > $created_table_count) return true;
1542
-			else return false;
1708
+			if($table_count > $created_table_count) {
1709
+				return true;
1710
+			} else {
1711
+				return false;
1712
+			}
1543 1713
 		}
1544 1714
 		return false;
1545 1715
 	}
@@ -1567,7 +1737,9 @@  discard block
 block discarded – undo
1567 1737
 		sort($searched_list);
1568 1738
 
1569 1739
 		$searched_count = count($searched_list);
1570
-		if(!$searched_count) return;
1740
+		if(!$searched_count) {
1741
+			return;
1742
+		}
1571 1743
 
1572 1744
 		for($i=0;$i<$searched_count;$i++)
1573 1745
 		{
@@ -1575,7 +1747,9 @@  discard block
 block discarded – undo
1575 1747
 			$module_name = $searched_list[$i];
1576 1748
 
1577 1749
 			$path = ModuleHandler::getModulePath($module_name);
1578
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1750
+			if(!is_dir(FileHandler::getRealPath($path))) {
1751
+				continue;
1752
+			}
1579 1753
 
1580 1754
 			// Get the number of xml files to create a table in schemas
1581 1755
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1585,13 +1759,17 @@  discard block
 block discarded – undo
1585 1759
 			for($j=0;$j<$table_count;$j++)
1586 1760
 			{
1587 1761
 				list($table_name) = explode('.',$tmp_files[$j]);
1588
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1762
+				if($oDB->isTableExists($table_name)) {
1763
+					$created_table_count ++;
1764
+				}
1589 1765
 			}
1590 1766
 			// Get information of the module
1591 1767
 			$info = NULL;
1592 1768
 			$info = $this->getModuleInfoXml($module_name);
1593 1769
 
1594
-			if(!$info) continue;
1770
+			if(!$info) {
1771
+				continue;
1772
+			}
1595 1773
 
1596 1774
 			$info->module = $module_name;
1597 1775
 			$info->category = $info->category;
@@ -1600,16 +1778,18 @@  discard block
 block discarded – undo
1600 1778
 			$info->path = $path;
1601 1779
 			$info->admin_index_act = $info->admin_index_act;
1602 1780
 			// Check if DB is installed
1603
-			if($table_count > $created_table_count) $info->need_install = true;
1604
-			else $info->need_install = false;
1781
+			if($table_count > $created_table_count) {
1782
+				$info->need_install = true;
1783
+			} else {
1784
+				$info->need_install = false;
1785
+			}
1605 1786
 			// Check if it is upgraded to module.class.php on each module
1606 1787
 			$oDummy = null;
1607 1788
 			$oDummy = getModule($module_name, 'class');
1608 1789
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1609 1790
 			{
1610 1791
 				$info->need_update = $oDummy->checkUpdate();
1611
-			}
1612
-			else
1792
+			} else
1613 1793
 			{
1614 1794
 				continue;
1615 1795
 			}
@@ -1626,7 +1806,9 @@  discard block
 block discarded – undo
1626 1806
 	 */
1627 1807
 	function syncModuleToSite(&$data)
1628 1808
 	{
1629
-		if(!$data) return;
1809
+		if(!$data) {
1810
+			return;
1811
+		}
1630 1812
 
1631 1813
 		if(is_array($data))
1632 1814
 		{
@@ -1634,9 +1816,10 @@  discard block
 block discarded – undo
1634 1816
 			{
1635 1817
 				$module_srls[] = $val->module_srl;
1636 1818
 			}
1637
-			if(!count($module_srls)) return;
1638
-		}
1639
-		else
1819
+			if(!count($module_srls)) {
1820
+				return;
1821
+			}
1822
+		} else
1640 1823
 		{
1641 1824
 			$module_srls[] = $data->module_srl;
1642 1825
 		}
@@ -1644,7 +1827,9 @@  discard block
 block discarded – undo
1644 1827
 		$args = new stdClass();
1645 1828
 		$args->module_srls = implode(',',$module_srls);
1646 1829
 		$output = executeQueryArray('module.getModuleSites', $args);
1647
-		if(!$output->data) return array();
1830
+		if(!$output->data) {
1831
+			return array();
1832
+		}
1648 1833
 		foreach($output->data as $key => $val)
1649 1834
 		{
1650 1835
 			$modules[$val->module_srl] = $val;
@@ -1656,8 +1841,7 @@  discard block
 block discarded – undo
1656 1841
 			{
1657 1842
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1658 1843
 			}
1659
-		}
1660
-		else
1844
+		} else
1661 1845
 		{
1662 1846
 			$data->domain = $modules[$data->module_srl]->domain;
1663 1847
 		}
@@ -1668,24 +1852,31 @@  discard block
 block discarded – undo
1668 1852
 	 */
1669 1853
 	function isSiteAdmin($member_info, $site_srl = null)
1670 1854
 	{
1671
-		if(!$member_info->member_srl) return false;
1672
-		if($member_info->is_admin == 'Y') return true;
1855
+		if(!$member_info->member_srl) {
1856
+			return false;
1857
+		}
1858
+		if($member_info->is_admin == 'Y') {
1859
+			return true;
1860
+		}
1673 1861
 
1674 1862
 		$args = new stdClass();
1675 1863
 		if(!isset($site_srl))
1676 1864
 		{
1677 1865
 			$site_module_info = Context::get('site_module_info');
1678
-			if(!$site_module_info) return;
1866
+			if(!$site_module_info) {
1867
+				return;
1868
+			}
1679 1869
 			$args->site_srl = $site_module_info->site_srl;
1680
-		}
1681
-		else
1870
+		} else
1682 1871
 		{
1683 1872
 			$args->site_srl = $site_srl;
1684 1873
 		}
1685 1874
 
1686 1875
 		$args->member_srl = $member_info->member_srl;
1687 1876
 		$output = executeQuery('module.isSiteAdmin', $args);
1688
-		if($output->data->member_srl == $args->member_srl) return true;
1877
+		if($output->data->member_srl == $args->member_srl) {
1878
+			return true;
1879
+		}
1689 1880
 		return false;
1690 1881
 	}
1691 1882
 
@@ -1708,7 +1899,9 @@  discard block
 block discarded – undo
1708 1899
 		$obj = new stdClass();
1709 1900
 		$obj->module_srl = $module_srl;
1710 1901
 		$output = executeQueryArray('module.getAdminID', $obj);
1711
-		if(!$output->toBool() || !$output->data) return;
1902
+		if(!$output->toBool() || !$output->data) {
1903
+			return;
1904
+		}
1712 1905
 
1713 1906
 		return $output->data;
1714 1907
 	}
@@ -1721,7 +1914,9 @@  discard block
 block discarded – undo
1721 1914
 	{
1722 1915
 		$extra_vars = array();
1723 1916
 		$get_module_srls = array();
1724
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1917
+		if(!is_array($list_module_srl)) {
1918
+			$list_module_srl = array($list_module_srl);
1919
+		}
1725 1920
 
1726 1921
 		$vars = false;
1727 1922
 		// cache controll
@@ -1737,14 +1932,12 @@  discard block
 block discarded – undo
1737 1932
 				if($vars)
1738 1933
 				{
1739 1934
 					$extra_vars[$module_srl] = $vars;
1740
-				}
1741
-				else
1935
+				} else
1742 1936
 				{
1743 1937
 					$get_module_srls[] = $module_srl;
1744 1938
 				}
1745 1939
 			}
1746
-		}
1747
-		else
1940
+		} else
1748 1941
 		{
1749 1942
 			$get_module_srls = $list_module_srl;
1750 1943
 		}
@@ -1769,7 +1962,9 @@  discard block
 block discarded – undo
1769 1962
 			}
1770 1963
 			foreach($output->data as $key => $val)
1771 1964
 			{
1772
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1965
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1966
+					continue;
1967
+				}
1773 1968
 
1774 1969
 				if(!isset($extra_vars[$val->module_srl]))
1775 1970
 				{
@@ -1808,7 +2003,9 @@  discard block
 block discarded – undo
1808 2003
 			$args = new stdClass();
1809 2004
 			$args->module_srl = $module_srl;
1810 2005
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1811
-			if(!$output->toBool()) return;
2006
+			if(!$output->toBool()) {
2007
+				return;
2008
+			}
1812 2009
 
1813 2010
 			$skin_vars = array();
1814 2011
 			foreach($output->data as $vars)
@@ -1816,7 +2013,9 @@  discard block
 block discarded – undo
1816 2013
 				$skin_vars[$vars->name] = $vars;
1817 2014
 			}
1818 2015
 
1819
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2016
+			if($oCacheHandler->isSupport()) {
2017
+				$oCacheHandler->put($cache_key, $skin_vars);
2018
+			}
1820 2019
 		}
1821 2020
 
1822 2021
 		return $skin_vars;
@@ -1828,7 +2027,9 @@  discard block
 block discarded – undo
1828 2027
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1829 2028
 	{
1830 2029
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1831
-		if(!$site_srl) $site_srl = 0;
2030
+		if(!$site_srl) {
2031
+			$site_srl = 0;
2032
+		}
1832 2033
 
1833 2034
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834 2035
 		if(is_readable($designInfoFile))
@@ -1845,19 +2046,16 @@  discard block
 block discarded – undo
1845 2046
 			if(is_dir($moduleSkinPath.'default'))
1846 2047
 			{
1847 2048
 				$skinName = 'default';
1848
-			}
1849
-			else if(is_dir($moduleSkinPath.'xe_default'))
2049
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1850 2050
 			{
1851 2051
 				$skinName = 'xe_default';
1852
-			}
1853
-			else
2052
+			} else
1854 2053
 			{
1855 2054
 				$skins = FileHandler::readDir($moduleSkinPath);
1856 2055
 				if(count($skins) > 0)
1857 2056
 				{
1858 2057
 					$skinName = $skins[0];
1859
-				}
1860
-				else
2058
+				} else
1861 2059
 				{
1862 2060
 					$skinName = NULL;
1863 2061
 				}
@@ -1865,7 +2063,9 @@  discard block
 block discarded – undo
1865 2063
 
1866 2064
 			if($updateCache && $skinName)
1867 2065
 			{
1868
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2066
+				if(!isset($designInfo->module->{$module_name})) {
2067
+					$designInfo->module->{$module_name} = new stdClass();
2068
+				}
1869 2069
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1870 2070
 
1871 2071
 				$oAdminController = getAdminController('admin');
@@ -1881,23 +2081,28 @@  discard block
 block discarded – undo
1881 2081
 	 */
1882 2082
 	function syncSkinInfoToModuleInfo(&$module_info)
1883 2083
 	{
1884
-		if(!$module_info->module_srl) return;
2084
+		if(!$module_info->module_srl) {
2085
+			return;
2086
+		}
1885 2087
 
1886 2088
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1887 2089
 		if(Mobile::isFromMobilePhone())
1888 2090
 		{
1889 2091
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1890
-		}
1891
-		else
2092
+		} else
1892 2093
 		{
1893 2094
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1894 2095
 		}
1895 2096
 
1896
-		if(!$skin_vars) return;
2097
+		if(!$skin_vars) {
2098
+			return;
2099
+		}
1897 2100
 
1898 2101
 		foreach($skin_vars as $name => $val)
1899 2102
 		{
1900
-			if(isset($module_info->{$name})) continue;
2103
+			if(isset($module_info->{$name})) {
2104
+				continue;
2105
+			}
1901 2106
 			$module_info->{$name} = $val->value;
1902 2107
 		}
1903 2108
 	}
@@ -1923,7 +2128,9 @@  discard block
 block discarded – undo
1923 2128
 			$args = new stdClass();
1924 2129
 			$args->module_srl = $module_srl;
1925 2130
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1926
-			if(!$output->toBool() || !$output->data) return;
2131
+			if(!$output->toBool() || !$output->data) {
2132
+				return;
2133
+			}
1927 2134
 
1928 2135
 			$skin_vars = array();
1929 2136
 			foreach($output->data as $vars)
@@ -1931,7 +2138,9 @@  discard block
 block discarded – undo
1931 2138
 				$skin_vars[$vars->name] = $vars;
1932 2139
 			}
1933 2140
 
1934
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2141
+			if($oCacheHandler->isSupport()) {
2142
+				$oCacheHandler->put($cache_key, $skin_vars);
2143
+			}
1935 2144
 		}
1936 2145
 
1937 2146
 		return $skin_vars;
@@ -1943,7 +2152,9 @@  discard block
 block discarded – undo
1943 2152
 	 */
1944 2153
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1945 2154
 	{
1946
-		if(!$module_info->module_srl) return;
2155
+		if(!$module_info->module_srl) {
2156
+			return;
2157
+		}
1947 2158
 		$skin_vars = false;
1948 2159
 		// cache controll
1949 2160
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1958,17 +2169,25 @@  discard block
 block discarded – undo
1958 2169
 			$args = new stdClass;
1959 2170
 			$args->module_srl = $module_info->module_srl;
1960 2171
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1961
-			if(!$output->toBool()) return;
2172
+			if(!$output->toBool()) {
2173
+				return;
2174
+			}
1962 2175
 			$skin_vars = $output->data;
1963 2176
 
1964 2177
 			//insert in cache
1965
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2178
+			if($oCacheHandler->isSupport()) {
2179
+				$oCacheHandler->put($cache_key, $skin_vars);
2180
+			}
2181
+		}
2182
+		if(!$skin_vars) {
2183
+			return;
1966 2184
 		}
1967
-		if(!$skin_vars) return;
1968 2185
 
1969 2186
 		foreach($output->data as $val)
1970 2187
 		{
1971
-			if(isset($module_info->{$val->name})) continue;
2188
+			if(isset($module_info->{$val->name})) {
2189
+				continue;
2190
+			}
1972 2191
 			$module_info->{$val->name} = $val->value;
1973 2192
 		}
1974 2193
 	}
@@ -1990,10 +2209,12 @@  discard block
 block discarded – undo
1990 2209
 		$grant_info = $xml_info->grant;
1991 2210
 		if($member_info->member_srl)
1992 2211
 		{
1993
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1994
-			else $group_list = array();
1995
-		}
1996
-		else
2212
+			if(is_array($member_info->group_list)) {
2213
+				$group_list = array_keys($member_info->group_list);
2214
+			} else {
2215
+				$group_list = array();
2216
+			}
2217
+		} else
1997 2218
 		{
1998 2219
 			$group_list = array();
1999 2220
 		}
@@ -2007,8 +2228,7 @@  discard block
 block discarded – undo
2007 2228
 			}
2008 2229
 
2009 2230
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2010
-		}
2011
-		else
2231
+		} else
2012 2232
 		{
2013 2233
 			// If module_srl exists
2014 2234
 			// Get a type of granted permission
@@ -2021,7 +2241,9 @@  discard block
 block discarded – undo
2021 2241
 				$args->module_srl = $module_srl;
2022 2242
 				$args->member_srl = $member_info->member_srl;
2023 2243
 				$output = executeQuery('module.getModuleAdmin',$args);
2024
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2244
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2245
+					$grant->manager = true;
2246
+				}
2025 2247
 			}
2026 2248
 			// If not an administrator, get information from the DB and grant manager privilege.
2027 2249
 			if(!$grant->manager)
@@ -2031,8 +2253,7 @@  discard block
 block discarded – undo
2031 2253
 				if($module_info->module == 'planet')
2032 2254
 				{
2033 2255
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2034
-				}
2035
-				else
2256
+				} else
2036 2257
 				{
2037 2258
 					$args = new stdClass;
2038 2259
 					$args->module_srl = $module_srl;
@@ -2047,37 +2268,44 @@  discard block
 block discarded – undo
2047 2268
 					foreach($output->data as $val)
2048 2269
 					{
2049 2270
 						$grant_exists[$val->name] = true;
2050
-						if($granted[$val->name]) continue;
2271
+						if($granted[$val->name]) {
2272
+							continue;
2273
+						}
2051 2274
 						// Log-in member only
2052 2275
 						if($val->group_srl == -1)
2053 2276
 						{
2054 2277
 							$granted[$val->name] = true;
2055
-							if($member_info->member_srl) $grant->{$val->name} = true;
2278
+							if($member_info->member_srl) {
2279
+								$grant->{$val->name} = true;
2280
+							}
2056 2281
 							// Site-joined member only
2057
-						}
2058
-						elseif($val->group_srl == -2)
2282
+						} elseif($val->group_srl == -2)
2059 2283
 						{
2060 2284
 							$granted[$val->name] = true;
2061 2285
 							// Do not grant any permission for non-logged member
2062
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2286
+							if(!$member_info->member_srl) {
2287
+								$grant->{$val->name} = false;
2288
+							}
2063 2289
 							// Log-in member
2064 2290
 							else
2065 2291
 							{
2066 2292
 								$site_module_info = Context::get('site_module_info');
2067 2293
 								// Permission granted if no information of the currently connected site exists
2068
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2294
+								if(!$site_module_info->site_srl) {
2295
+									$grant->{$val->name} = true;
2296
+								}
2069 2297
 								// Permission is not granted if information of the currently connected site exists
2070
-								elseif(count($group_list)) $grant->{$val->name} = true;
2298
+								elseif(count($group_list)) {
2299
+									$grant->{$val->name} = true;
2300
+								}
2071 2301
 							}
2072 2302
 							// All of non-logged members
2073
-						}
2074
-						elseif($val->group_srl == 0)
2303
+						} elseif($val->group_srl == 0)
2075 2304
 						{
2076 2305
 							$granted[$val->name] = true;
2077 2306
 							$grant->{$val->name} = true;
2078 2307
 							// If a target is a group
2079
-						}
2080
-						else
2308
+						} else
2081 2309
 						{
2082 2310
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2083 2311
 							{
@@ -2088,30 +2316,43 @@  discard block
 block discarded – undo
2088 2316
 					}
2089 2317
 				}
2090 2318
 				// Separate processing for the virtual group access
2091
-				if(!$grant_exists['access']) $grant->access = true;
2319
+				if(!$grant_exists['access']) {
2320
+					$grant->access = true;
2321
+				}
2092 2322
 				if(count($grant_info))
2093 2323
 				{
2094 2324
 					foreach($grant_info as  $grant_name => $grant_item)
2095 2325
 					{
2096
-						if($grant_exists[$grant_name]) continue;
2326
+						if($grant_exists[$grant_name]) {
2327
+							continue;
2328
+						}
2097 2329
 						switch($grant_item->default)
2098 2330
 						{
2099 2331
 							case 'guest' :
2100 2332
 								$grant->{$grant_name} = true;
2101 2333
 								break;
2102 2334
 							case 'member' :
2103
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2104
-								else $grant->{$grant_name} = false;
2335
+								if($member_info->member_srl) {
2336
+									$grant->{$grant_name} = true;
2337
+								} else {
2338
+									$grant->{$grant_name} = false;
2339
+								}
2105 2340
 								break;
2106 2341
 							case 'site' :
2107 2342
 								$site_module_info = Context::get('site_module_info');
2108
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2109
-								else $grant->{$grant_name} = false;
2343
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2344
+									$grant->{$grant_name} = true;
2345
+								} else {
2346
+									$grant->{$grant_name} = false;
2347
+								}
2110 2348
 								break;
2111 2349
 							case 'manager' :
2112 2350
 							case 'root' :
2113
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2114
-								else $grant->{$grant_name} = false;
2351
+								if($member_info->is_admin == 'Y') {
2352
+									$grant->{$grant_name} = true;
2353
+								} else {
2354
+									$grant->{$grant_name} = false;
2355
+								}
2115 2356
 								break;
2116 2357
 						}
2117 2358
 					}
@@ -2187,16 +2428,22 @@  discard block
 block discarded – undo
2187 2428
 	function getFileBoxListHtml()
2188 2429
 	{
2189 2430
 		$logged_info = Context::get('logged_info');
2190
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2431
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2432
+			return new Object(-1, 'msg_not_permitted');
2433
+		}
2191 2434
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2192 2435
 		$link_params = explode('&',$link['query']);
2193 2436
 		foreach ($link_params as $param)
2194 2437
 		{
2195 2438
 			$param = explode("=",$param);
2196
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2439
+			if($param[0] == 'selected_widget') {
2440
+				$selected_widget = $param[1];
2441
+			}
2197 2442
 		}
2198 2443
 		$oWidgetModel = getModel('widget');
2199
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2444
+		if($selected_widget) {
2445
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2446
+		}
2200 2447
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2201 2448
 
2202 2449
 		$oModuleModel = getModel('module');
@@ -2204,7 +2451,9 @@  discard block
 block discarded – undo
2204 2451
 		Context::set('filebox_list', $output->data);
2205 2452
 
2206 2453
 		$page = Context::get('page');
2207
-		if (!$page) $page = 1;
2454
+		if (!$page) {
2455
+			$page = 1;
2456
+		}
2208 2457
 		Context::set('page', $page);
2209 2458
 		Context::set('page_navigation', $output->page_navigation);
2210 2459
 
@@ -2234,25 +2483,28 @@  discard block
 block discarded – undo
2234 2483
 			$rulsetFile = str_replace('@', '', $ruleset);
2235 2484
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2236 2485
 			return FileHandler::getRealPath($xml_file);
2237
-		}
2238
-		else if (strpos($ruleset, '#') !== false)
2486
+		} else if (strpos($ruleset, '#') !== false)
2239 2487
 		{
2240 2488
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2241 2489
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2242
-			if(is_readable($xml_file))
2243
-				return FileHandler::getRealPath($xml_file);
2244
-			else{
2490
+			if(is_readable($xml_file)) {
2491
+							return FileHandler::getRealPath($xml_file);
2492
+			} else{
2245 2493
 				$ruleset = str_replace('#', '', $ruleset);
2246 2494
 			}
2247 2495
 
2248 2496
 		}
2249 2497
 		// Get a path of the requested module. Return if not exists.
2250 2498
 		$class_path = ModuleHandler::getModulePath($module);
2251
-		if(!$class_path) return;
2499
+		if(!$class_path) {
2500
+			return;
2501
+		}
2252 2502
 
2253 2503
 		// Check if module.xml exists in the path. Return if not exist
2254 2504
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2255
-		if(!file_exists($xml_file)) return;
2505
+		if(!file_exists($xml_file)) {
2506
+			return;
2507
+		}
2256 2508
 
2257 2509
 		return $xml_file;
2258 2510
 	}
@@ -2302,7 +2554,9 @@  discard block
 block discarded – undo
2302 2554
 	function getLangByLangcode()
2303 2555
 	{
2304 2556
 		$langCode = Context::get('langCode');
2305
-		if (!$langCode) return;
2557
+		if (!$langCode) {
2558
+			return;
2559
+		}
2306 2560
 
2307 2561
 		$oModuleController = getController('module');
2308 2562
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/page/page.view.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -129,6 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
 	/**
131 131
 	 * @brief Save the file and return if a file is requested by http
132
+	 * @param integer $caching_interval
133
+	 * @param string $cache_file
132 134
 	 */
133 135
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 136
 	{
@@ -167,6 +169,8 @@  discard block
 block discarded – undo
167 169
 
168 170
 	/**
169 171
 	 * @brief Create a cache file in order to include if it is an internal file
172
+	 * @param integer $caching_interval
173
+	 * @param string $cache_file
170 174
 	 */
171 175
 	function executeFile($target_file, $caching_interval, $cache_file)
172 176
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  pageView
5
- * @author NAVER ([email protected])
6
- * @brief page view class of the module
7
- */
4
+	 * @class  pageView
5
+	 * @author NAVER ([email protected])
6
+	 * @brief page view class of the module
7
+	 */
8 8
 class pageView extends page
9 9
 {
10 10
 	var $module_srl = 0;
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@  discard block
 block discarded – undo
20 20
 	function init()
21 21
 	{
22 22
 		// Get a template path (page in the administrative template tpl putting together)
23
-		$this->setTemplatePath($this->module_path.'tpl');
23
+		$this->setTemplatePath($this->module_path . 'tpl');
24 24
 
25
-		switch($this->module_info->page_type)
25
+		switch ($this->module_info->page_type)
26 26
 		{
27 27
 			case 'WIDGET' :
28 28
 				{
29 29
 					$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
30
-					$this->interval = (int)($this->module_info->page_caching_interval);
30
+					$this->interval = (int) ($this->module_info->page_caching_interval);
31 31
 					break;
32 32
 				}
33 33
 			case 'OUTSIDE' :
34 34
 				{
35 35
 					$this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus());
36
-					$this->interval = (int)($this->module_info->page_caching_interval);
36
+					$this->interval = (int) ($this->module_info->page_caching_interval);
37 37
 					$this->path = $this->module_info->path;
38 38
 					break;
39 39
 				}
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if ($this->module_srl) Context::set('module_srl', $this->module_srl);
50 50
 
51 51
 		$page_type_name = strtolower($this->module_info->page_type);
52 52
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
53
+		if (method_exists($this, $method)) $page_content = $this->{$method}();
54 54
 		else return new Object(-1, sprintf('%s method is not exists', $method));
55 55
 
56 56
 		Context::set('module_info', $this->module_info);
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
 	function _getWidgetContent()
63 63
 	{
64
-		if($this->interval>0)
64
+		if ($this->interval > 0)
65 65
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
66
+			if (!file_exists($this->cache_file)) $mtime = 0;
67 67
 			else $mtime = filemtime($this->cache_file);
68 68
 
69
-			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
69
+			if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME'])
70 70
 			{
71 71
 				$page_content = FileHandler::readFile($this->cache_file); 
72 72
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		}
81 81
 		else
82 82
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
83
+			if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
84 84
 			$page_content = $this->module_info->content;
85 85
 		}
86 86
 		return $page_content;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		$oDocumentModel = getModel('document');
94 94
 		$oDocument = $oDocumentModel->getDocument(0, true);
95 95
 
96
-		if($this->module_info->document_srl)
96
+		if ($this->module_info->document_srl)
97 97
 		{
98 98
 			$document_srl = $this->module_info->document_srl;
99 99
 			$oDocument->setDocument($document_srl);
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
 		if ($this->module_info->skin)
105 105
 		{
106
-			$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
106
+			$templatePath = (sprintf($this->module_path . 'skins/%s', $this->module_info->skin));
107 107
 		}
108 108
 		else
109 109
 		{
110
-			$templatePath = ($this->module_path.'skins/default');
110
+			$templatePath = ($this->module_path . 'skins/default');
111 111
 		}
112 112
 
113 113
 		$page_content = $oTemplate->compile($templatePath, 'content');
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	function _getOutsideContent()
119 119
 	{
120 120
 		// check if it is http or internal file
121
-		if($this->path)
121
+		if ($this->path)
122 122
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
123
+			if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124 124
 			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
125 125
 		}
126 126
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 134
 	{
135 135
 		// Verify cache
136
-		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
136
+		if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME'])
137 137
 		{
138 138
 			$content = FileHandler::readFile($cache_file);
139 139
 		}
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		$content = $buff->content;
155 155
 		// Extract a title
156 156
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
157
+		if ($title) Context::setBrowserTitle($title);
158 158
 		// Extract header script
159 159
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
160
+		if ($head_script) Context::addHtmlHeader($head_script);
161 161
 		// Extract content from the body
162 162
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
163
+		if (!$body_script) $body_script = $content;
164 164
 
165 165
 		return $content;
166 166
 	}
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
 	function executeFile($target_file, $caching_interval, $cache_file)
172 172
 	{
173 173
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
174
+		if (!file_exists(FileHandler::getRealPath($target_file))) return;
175 175
 
176 176
 		// Get a path and filename
177
-		$tmp_path = explode('/',$cache_file);
178
-		$filename = $tmp_path[count($tmp_path)-1];
179
-		$filepath = preg_replace('/'.$filename."$/i","",$cache_file);
177
+		$tmp_path = explode('/', $cache_file);
178
+		$filename = $tmp_path[count($tmp_path) - 1];
179
+		$filepath = preg_replace('/' . $filename . "$/i", "", $cache_file);
180 180
 		$cache_file = FileHandler::getRealPath($cache_file);
181 181
 
182 182
 		$level = ob_get_level();
183 183
 		// Verify cache
184
-		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
184
+		if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file))
185 185
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
186
+			if (file_exists($cache_file)) FileHandler::removeFile($cache_file);
187 187
 
188 188
 			// Read a target file and get content
189 189
 			ob_start();
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 			$content = ob_get_clean();
192 192
 			// Replace relative path to the absolute path 
193 193
 			$this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/';
194
-			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content);
195
-			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content);
194
+			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content);
195
+			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content);
196 196
 
197 197
 			FileHandler::writeFile($cache_file, $content);
198 198
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
199
+			if (!file_exists($cache_file)) return;
200 200
 			// Attempt to compile
201 201
 			$oTemplate = &TemplateHandler::getInstance();
202 202
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 		$val = trim($matches[3]);
224 224
 		// Pass if the path is external or starts with /, #, { characters
225 225
 		// /=absolute path, #=hash in a page, {=Template syntax
226
-		if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val))
226
+		if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val))
227 227
 		{
228 228
 				return $matches[0];
229 229
 			// In case of  .. , get a path
230 230
 		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
231
+		else if (strncasecmp('..', $val, 2) === 0)
232 232
 		{
233 233
 			$p = Context::pathToUrl($this->path);
234
-			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
234
+			return sprintf("%s%s%s%s", $matches[1], $matches[2], $p . $val, $matches[4]);
235 235
 		}
236 236
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
237
+		if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2);
238 238
 		$p = Context::pathToUrl($this->path);
239
-		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
239
+		$path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p . $val, $matches[4]);
240 240
 
241 241
 		return $path;
242 242
 	}
Please login to merge, or discard this patch.
Braces   +47 added lines, -25 removed lines patch added patch discarded remove patch
@@ -46,12 +46,17 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if($this->module_srl) {
50
+			Context::set('module_srl',$this->module_srl);
51
+		}
50 52
 
51 53
 		$page_type_name = strtolower($this->module_info->page_type);
52 54
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
54
-		else return new Object(-1, sprintf('%s method is not exists', $method));
55
+		if(method_exists($this, $method)) {
56
+			$page_content = $this->{$method}();
57
+		} else {
58
+			return new Object(-1, sprintf('%s method is not exists', $method));
59
+		}
55 60
 
56 61
 		Context::set('module_info', $this->module_info);
57 62
 		Context::set('page_content', $page_content);
@@ -63,24 +68,27 @@  discard block
 block discarded – undo
63 68
 	{
64 69
 		if($this->interval>0)
65 70
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
67
-			else $mtime = filemtime($this->cache_file);
71
+			if(!file_exists($this->cache_file)) {
72
+				$mtime = 0;
73
+			} else {
74
+				$mtime = filemtime($this->cache_file);
75
+			}
68 76
 
69 77
 			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
70 78
 			{
71 79
 				$page_content = FileHandler::readFile($this->cache_file); 
72 80
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
73
-			}
74
-			else
81
+			} else
75 82
 			{
76 83
 				$oWidgetController = getController('widget');
77 84
 				$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
78 85
 				FileHandler::writeFile($this->cache_file, $page_content);
79 86
 			}
80
-		}
81
-		else
87
+		} else
82 88
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
89
+			if(file_exists($this->cache_file)) {
90
+				FileHandler::removeFile($this->cache_file);
91
+			}
84 92
 			$page_content = $this->module_info->content;
85 93
 		}
86 94
 		return $page_content;
@@ -104,8 +112,7 @@  discard block
 block discarded – undo
104 112
 		if ($this->module_info->skin)
105 113
 		{
106 114
 			$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
107
-		}
108
-		else
115
+		} else
109 116
 		{
110 117
 			$templatePath = ($this->module_path.'skins/default');
111 118
 		}
@@ -120,8 +127,11 @@  discard block
 block discarded – undo
120 127
 		// check if it is http or internal file
121 128
 		if($this->path)
122 129
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124
-			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
130
+			if(preg_match("/^([a-z]+):\/\//i",$this->path)) {
131
+				$content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
132
+			} else {
133
+				$content = $this->executeFile($this->path, $this->interval, $this->cache_file);
134
+			}
125 135
 		}
126 136
 
127 137
 		return $content;
@@ -136,8 +146,7 @@  discard block
 block discarded – undo
136 146
 		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
137 147
 		{
138 148
 			$content = FileHandler::readFile($cache_file);
139
-		}
140
-		else
149
+		} else
141 150
 		{
142 151
 			FileHandler::getRemoteFile($path, $cache_file);
143 152
 			$content = FileHandler::readFile($cache_file);
@@ -154,13 +163,19 @@  discard block
 block discarded – undo
154 163
 		$content = $buff->content;
155 164
 		// Extract a title
156 165
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
166
+		if($title) {
167
+			Context::setBrowserTitle($title);
168
+		}
158 169
 		// Extract header script
159 170
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
171
+		if($head_script) {
172
+			Context::addHtmlHeader($head_script);
173
+		}
161 174
 		// Extract content from the body
162 175
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
176
+		if(!$body_script) {
177
+			$body_script = $content;
178
+		}
164 179
 
165 180
 		return $content;
166 181
 	}
@@ -171,7 +186,9 @@  discard block
 block discarded – undo
171 186
 	function executeFile($target_file, $caching_interval, $cache_file)
172 187
 	{
173 188
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
189
+		if(!file_exists(FileHandler::getRealPath($target_file))) {
190
+			return;
191
+		}
175 192
 
176 193
 		// Get a path and filename
177 194
 		$tmp_path = explode('/',$cache_file);
@@ -183,7 +200,9 @@  discard block
 block discarded – undo
183 200
 		// Verify cache
184 201
 		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
185 202
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
203
+			if(file_exists($cache_file)) {
204
+				FileHandler::removeFile($cache_file);
205
+			}
187 206
 
188 207
 			// Read a target file and get content
189 208
 			ob_start();
@@ -196,7 +215,9 @@  discard block
 block discarded – undo
196 215
 
197 216
 			FileHandler::writeFile($cache_file, $content);
198 217
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
218
+			if(!file_exists($cache_file)) {
219
+				return;
220
+			}
200 221
 			// Attempt to compile
201 222
 			$oTemplate = &TemplateHandler::getInstance();
202 223
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -227,14 +248,15 @@  discard block
 block discarded – undo
227 248
 		{
228 249
 				return $matches[0];
229 250
 			// In case of  .. , get a path
230
-		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
251
+		} else if(strncasecmp('..', $val, 2) === 0)
232 252
 		{
233 253
 			$p = Context::pathToUrl($this->path);
234 254
 			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
235 255
 		}
236 256
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
257
+		if(strncasecmp('..', $val, 2) === 0) {
258
+			$val = substr($val,2);
259
+		}
238 260
 		$p = Context::pathToUrl($this->path);
239 261
 		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
240 262
 
Please login to merge, or discard this patch.
modules/point/point.controller.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -478,6 +478,7 @@
 block discarded – undo
478 478
 
479 479
 	/**
480 480
 	 * @brief Set points
481
+	 * @param string $mode
481 482
 	 */
482 483
 	function setPoint($member_srl, $point, $mode = null)
483 484
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  pointController
5
- * @author NAVER ([email protected])
6
- * @brief Controller class of point modules
7
- */
4
+	 * @class  pointController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief Controller class of point modules
7
+	 */
8 8
 class pointController extends point
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$point = $config->signup_point;
32 32
 		// Increase the point
33 33
 		$cur_point += $point;
34
-		$this->setPoint($member_srl,$cur_point, 'signup');
34
+		$this->setPoint($member_srl, $cur_point, 'signup');
35 35
 
36 36
 		return new Object();
37 37
 	}
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new Object();
45
+		if (!$member_srl) return new Object();
46 46
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
47
+		if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object();
48 48
 		// Get the point module information
49 49
 		$oModuleModel = getModel('module');
50 50
 		$config = $oModuleModel->getModuleConfig('point');
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$point = $config->login_point;
56 56
 		// Increase the point
57 57
 		$cur_point += $point;
58
-		$this->setPoint($member_srl,$cur_point);
58
+		$this->setPoint($member_srl, $cur_point);
59 59
 
60 60
 		return new Object();
61 61
 	}
@@ -66,30 +66,30 @@  discard block
 block discarded – undo
66 66
 	function triggerInsertDocument(&$obj)
67 67
 	{
68 68
 		$oDocumentModel = getModel('document');
69
-		if($obj->status != $oDocumentModel->getConfigStatus('temp'))
69
+		if ($obj->status != $oDocumentModel->getConfigStatus('temp'))
70 70
 		{
71 71
 			$module_srl = $obj->module_srl;
72 72
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new Object();
73
+			if (!$module_srl || !$member_srl) return new Object();
74 74
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new Object();
75
+			if ($module_srl == $member_srl) return new Object();
76 76
 			// Get the point module information
77 77
 			$oModuleModel = getModel('module');
78 78
 			$config = $oModuleModel->getModuleConfig('point');
79
-			$module_config = $oModuleModel->getModulePartConfig('point',$module_srl);
79
+			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
80 80
 			// Get the points of the member
81 81
 			$oPointModel = getModel('point');
82 82
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 83
 
84 84
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
85
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
86 86
 			$cur_point += $point;
87 87
 			// Add points for attaching a file
88 88
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
89
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
91 91
 			// Increase the point
92
-			$this->setPoint($member_srl,$cur_point);
92
+			$this->setPoint($member_srl, $cur_point);
93 93
 		}
94 94
 
95 95
 		return new Object();
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
 		$oDocument = $oDocumentModel->getDocument($document_srl);
107 107
 
108 108
 		// if status is TEMP or PUBLIC... give not point, only status is empty
109
-		if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
109
+		if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
110 110
 		{
111 111
 			$oModuleModel = getModel('module');
112 112
 
113 113
 			// Get the point module information
114 114
 			$config = $oModuleModel->getModuleConfig('point');
115
-			$module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl);
115
+			$module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl);
116 116
 			// Get the points of the member
117 117
 			$oPointModel = getModel('point');
118 118
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 119
 
120 120
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
121
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
122 122
 			$cur_point += $point;
123 123
 			// Add points for attaching a file
124 124
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
125
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
127 127
 			// Increase the point
128 128
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 129
 		}
@@ -141,42 +141,42 @@  discard block
 block discarded – undo
141 141
 
142 142
 		$oDocumentModel = getModel('document');
143 143
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new Object();
144
+		if (!$oDocument->isExists()) return new Object();
145 145
 		// Get the point module information
146 146
 		$oModuleModel = getModel('module');
147 147
 		$config = $oModuleModel->getModuleConfig('point');
148
-		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
148
+		$module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl'));
149 149
 		// The process related to clearing the post comments
150 150
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
151
+		if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
152 152
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new Object();
153
+		if ($comment_point > 0) return new Object();
154 154
 		// Get all the comments related to this post
155 155
 		$cp_args = new stdClass();
156 156
 		$cp_args->document_srl = $document_srl;
157 157
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 158
 		// Return if there is no object
159
-		if(!$output->data) return new Object();
159
+		if (!$output->data) return new Object();
160 160
 		// Organize the member number
161 161
 		$member_srls = array();
162 162
 		$cnt = count($output->data);
163
-		for($i=0;$i<$cnt;$i++)
163
+		for ($i = 0; $i < $cnt; $i++)
164 164
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
165
+			if ($output->data[$i]->member_srl < 1) continue;
166 166
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 167
 		}
168 168
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new Object();
169
+		if ($member_srl) unset($member_srls[abs($member_srl)]);
170
+		if (!count($member_srls)) return new Object();
171 171
 		// Remove all the points for each member
172 172
 		$oPointModel = getModel('point');
173 173
 		// Get the points
174 174
 		$point = $module_config['download_file'];
175
-		foreach($member_srls as $member_srl => $cnt)
175
+		foreach ($member_srls as $member_srl => $cnt)
176 176
 		{
177 177
 			$cur_point = $oPointModel->getPoint($member_srl, true);
178 178
 			$cur_point -= $cnt * $comment_point;
179
-			$this->setPoint($member_srl,$cur_point);
179
+			$this->setPoint($member_srl, $cur_point);
180 180
 		}
181 181
 
182 182
 		return new Object();
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 		$module_srl = $obj->module_srl;
191 191
 		$member_srl = $obj->member_srl;
192 192
 		// The process related to clearing the post object
193
-		if(!$module_srl || !$member_srl) return new Object();
193
+		if (!$module_srl || !$member_srl) return new Object();
194 194
 		// Run only when logged in
195 195
 		$logged_info = Context::get('logged_info');
196
-		if(!$logged_info->member_srl) return new Object();
196
+		if (!$logged_info->member_srl) return new Object();
197 197
 		// Get the points of the member
198 198
 		$oPointModel = getModel('point');
199 199
 		$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
204 204
 
205 205
 		$point = $module_config['insert_document'];
206
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
206
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
207 207
 		// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
208
-		if($point < 0) return new Object();
208
+		if ($point < 0) return new Object();
209 209
 		$cur_point -= $point;
210 210
 		// Add points related to deleting an attachment
211 211
 		$point = $module_config['upload_file'];
212
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
-		if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
212
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
+		if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
214 214
 		// Increase the point
215
-		$this->setPoint($member_srl,$cur_point);
215
+		$this->setPoint($member_srl, $cur_point);
216 216
 
217 217
 		return new Object();
218 218
 	}
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	{
225 225
 		$module_srl = $obj->module_srl;
226 226
 		$member_srl = $obj->member_srl;
227
-		if(!$module_srl || !$member_srl) return new Object();
227
+		if (!$module_srl || !$member_srl) return new Object();
228 228
 		// Do not increase the points if the member is the author of the post
229 229
 		$document_srl = $obj->document_srl;
230 230
 		$oDocumentModel = getModel('document');
231 231
 		$oDocument = $oDocumentModel->getDocument($document_srl);
232
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
232
+		if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object();
233 233
 		// Get the point module information
234 234
 		$oModuleModel = getModel('module');
235 235
 		$config = $oModuleModel->getModuleConfig('point');
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 		$cur_point = $oPointModel->getPoint($member_srl, true);
240 240
 
241 241
 		$point = $module_config['insert_comment'];
242
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
242
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
243 243
 		// Increase the point
244 244
 		$cur_point += $point;
245
-		$this->setPoint($member_srl,$cur_point);
245
+		$this->setPoint($member_srl, $cur_point);
246 246
 
247 247
 		return new Object();
248 248
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 		$module_srl = $obj->module_srl;
260 260
 		$member_srl = abs($obj->member_srl);
261 261
 		$document_srl = $obj->document_srl;
262
-		if(!$module_srl || !$member_srl) return new Object();
262
+		if (!$module_srl || !$member_srl) return new Object();
263 263
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
264 264
 		$oDocument = $oDocumentModel->getDocument($document_srl);
265
-		if(!$oDocument->isExists()) return new Object();
266
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
265
+		if (!$oDocument->isExists()) return new Object();
266
+		if ($oDocument->get('member_srl') == $member_srl) return new Object();
267 267
 		// Get the point module information
268 268
 		$config = $oModuleModel->getModuleConfig('point');
269 269
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
 		$cur_point = $oPointModel->getPoint($member_srl, true);
272 272
 
273 273
 		$point = $module_config['insert_comment'];
274
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
274
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
275 275
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
276
-		if($point < 0) return new Object();
276
+		if ($point < 0) return new Object();
277 277
 		// Increase the point
278 278
 		$cur_point -= $point;
279
-		$this->setPoint($member_srl,$cur_point);
279
+		$this->setPoint($member_srl, $cur_point);
280 280
 
281 281
 		return new Object();
282 282
 	}
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	function triggerDeleteFile(&$obj)
298 298
 	{
299
-		if($obj->isvalid != 'Y') return new Object();
299
+		if ($obj->isvalid != 'Y') return new Object();
300 300
 
301 301
 		$module_srl = $obj->module_srl;
302 302
 		$member_srl = $obj->member_srl;
303
-		if(!$module_srl || !$member_srl) return new Object();
303
+		if (!$module_srl || !$member_srl) return new Object();
304 304
 		// Get the point module information
305 305
 		$oModuleModel = getModel('module');
306 306
 		$config = $oModuleModel->getModuleConfig('point');
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 		$cur_point = $oPointModel->getPoint($member_srl, true);
311 311
 
312 312
 		$point = $module_config['upload_file'];
313
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
313
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
314 314
 		// Increase the point
315 315
 		$cur_point -= $point;
316
-		$this->setPoint($member_srl,$cur_point);
316
+		$this->setPoint($member_srl, $cur_point);
317 317
 
318 318
 		return new Object();
319 319
 	}
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
 		$logged_info = Context::get('logged_info');
327 327
 		$member_srl = $logged_info->member_srl;
328 328
 		$module_srl = $obj->module_srl;
329
-		if(!$module_srl) return new Object();
329
+		if (!$module_srl) return new Object();
330 330
 		// Pass if it is your file
331
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
331
+		if (abs($obj->member_srl) == abs($member_srl)) return new Object();
332 332
 
333 333
 		$oModuleModel = getModel('module');
334 334
 		$config = $oModuleModel->getModuleConfig('point');
335 335
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
336 336
 		// If it is set not to allow downloading for non-logged in users, do not permit
337
-		if(!Context::get('is_logged'))
337
+		if (!Context::get('is_logged'))
338 338
 		{
339
-			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
339
+			if ($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1, 'msg_not_permitted_download');
340 340
 			else return new Object();
341 341
 		}
342 342
 		// Get the points of the member
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
 		$cur_point = $oPointModel->getPoint($member_srl, true);
345 345
 		// Get the points
346 346
 		$point = $module_config['download_file'];
347
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
347
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
348 348
 		// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
349
-		if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
349
+		if ($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1, 'msg_cannot_download');
350 350
 
351 351
 		return new Object();
352 352
 	}
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 	{
359 359
 		// Run only when logged in
360 360
 		$logged_info = Context::get('logged_info');
361
-		if(!$logged_info->member_srl) return new Object();
361
+		if (!$logged_info->member_srl) return new Object();
362 362
 		$module_srl = $obj->module_srl;
363 363
 		$member_srl = $logged_info->member_srl;
364
-		if(!$module_srl) return new Object();
364
+		if (!$module_srl) return new Object();
365 365
 		// Pass if it is your file
366
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
366
+		if (abs($obj->member_srl) == abs($member_srl)) return new Object();
367 367
 		// Get the point module information
368 368
 		$oModuleModel = getModel('module');
369 369
 		$config = $oModuleModel->getModuleConfig('point');
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 		$cur_point = $oPointModel->getPoint($member_srl, true);
374 374
 		// Get the points
375 375
 		$point = $module_config['download_file'];
376
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
376
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
377 377
 		// Increase the point
378 378
 		$cur_point += $point;
379
-		$this->setPoint($member_srl,$cur_point);
379
+		$this->setPoint($member_srl, $cur_point);
380 380
 
381 381
 		return new Object();
382 382
 	}
@@ -395,22 +395,22 @@  discard block
 block discarded – undo
395 395
 		// Get the original author number
396 396
 		$target_member_srl = abs($obj->get('member_srl'));
397 397
 		// Pass without increasing the hits if the viewer is the same as the author
398
-		if($target_member_srl == $member_srl) return new Object();
398
+		if ($target_member_srl == $member_srl) return new Object();
399 399
 		// Get the point information for each module
400 400
 		$config = $oModuleModel->getModuleConfig('point');
401 401
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
402 402
 		// Get hits points
403 403
 		$point = $module_config['read_document'];
404
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
404
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
405 405
 		// Pass if there are no requested points
406
-		if(!$point) return new Object();
406
+		if (!$point) return new Object();
407 407
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
408
-		if($member_srl)
408
+		if ($member_srl)
409 409
 		{
410 410
 			$args->member_srl = $member_srl;
411 411
 			$args->document_srl = $obj->document_srl;
412 412
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
413
-			if($output->data->count) return new Object();
413
+			if ($output->data->count) return new Object();
414 414
 			$cur_point = $oPointModel->getPoint($member_srl, true);
415 415
 		}
416 416
 		else
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		$config = $oModuleModel->getModuleConfig('point');
422 422
 		// When the requested points are negative, compared it with the current point
423 423
 		$_SESSION['banned_document'][$obj->document_srl] = false;
424
-		if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
424
+		if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point)
425 425
 		{
426 426
 			$message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point);
427 427
 			$obj->add('content', $message);
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
 			return new Object(-1, $message);
430 430
 		}
431 431
 		// If not logged in, pass
432
-		if(!$logged_info->member_srl) return new Object();
432
+		if (!$logged_info->member_srl) return new Object();
433 433
 		// Pass, if there are no requested points
434
-		if(!$point) return new Object();
434
+		if (!$point) return new Object();
435 435
 		// If the read record is missing, leave it
436 436
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
437 437
 		// Increase the point
438 438
 		$cur_point += $point;
439
-		$this->setPoint($member_srl,$cur_point);
439
+		$this->setPoint($member_srl, $cur_point);
440 440
 
441 441
 		return new Object();
442 442
 	}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	{
449 449
 		$module_srl = $obj->module_srl;
450 450
 		$member_srl = $obj->member_srl;
451
-		if(!$module_srl || !$member_srl) return new Object();
451
+		if (!$module_srl || !$member_srl) return new Object();
452 452
 
453 453
 		$oModuleModel = getModel('module');
454 454
 		$config = $oModuleModel->getModuleConfig('point');
@@ -457,21 +457,21 @@  discard block
 block discarded – undo
457 457
 		$oPointModel = getModel('point');
458 458
 		$cur_point = $oPointModel->getPoint($member_srl, true);
459 459
 
460
-		if( $obj->point > 0 )
460
+		if ($obj->point > 0)
461 461
 		{
462 462
 			$point = $module_config['voted'];
463
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
463
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->voted;
464 464
 		}
465 465
 		else
466 466
 		{
467 467
 			$point = $module_config['blamed'];
468
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
468
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
469 469
 		}
470 470
 
471
-		if(!$point) return new Object();
471
+		if (!$point) return new Object();
472 472
 		// Increase the point
473 473
 		$cur_point += $point;
474
-		$this->setPoint($member_srl,$cur_point);
474
+		$this->setPoint($member_srl, $cur_point);
475 475
 
476 476
 		return new Object();
477 477
 	}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		$member_srl = abs($member_srl);
485 485
 		$mode_arr = array('add', 'minus', 'update', 'signup');
486
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
486
+		if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update';
487 487
 
488 488
 		// Get configuration information
489 489
 		$oMemberModel = getModel('member');
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		$args->member_srl = $member_srl;
501 501
 		$args->point = $current_point;
502 502
 
503
-		switch($mode)
503
+		switch ($mode)
504 504
 		{
505 505
 			case 'add' :
506 506
 				$args->point += $point;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				$args->point = $point;
514 514
 				break;
515 515
 		}
516
-		if($args->point < 0) $args->point = 0;
516
+		if ($args->point < 0) $args->point = 0;
517 517
 		$point = $args->point;
518 518
 
519 519
 		// Call a trigger (before)
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		$trigger_obj->current_level = $current_level;
525 525
 		$trigger_obj->set_point = $point;
526 526
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj);
527
-		if(!$trigger_output->toBool())
527
+		if (!$trigger_output->toBool())
528 528
 		{
529 529
 			return $trigger_output;
530 530
 		}
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
 
536 536
 		// If there are points, update, if no, insert
537 537
 		$oPointModel = getModel('point');
538
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
538
+		if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
539 539
 		else executeQuery("point.insertPoint", $args);
540 540
 
541 541
 		// Get a new level
542 542
 		$level = $oPointModel->getLevel($point, $config->level_step);
543 543
 
544 544
 		// If existing level and a new one are different attempt to set a point group
545
-		if($level != $current_level)
545
+		if ($level != $current_level)
546 546
 		{
547 547
 			// Check if the level, for which the current points are prepared, is calculate and set the correct group
548 548
 			$point_group = $config->point_group;
549 549
 			// If the point group exists
550
-			if($point_group && is_array($point_group) && count($point_group) )
550
+			if ($point_group && is_array($point_group) && count($point_group))
551 551
 			{
552 552
 				// Get the default group
553 553
 				$default_group = $oMemberModel->getDefaultGroup();
@@ -557,29 +557,29 @@  discard block
 block discarded – undo
557 557
 
558 558
 				asort($point_group);
559 559
 				// Reset group after initialization
560
-				if($config->group_reset != 'N')
560
+				if ($config->group_reset != 'N')
561 561
 				{
562 562
 					// If the new level is in the right group
563
-					if(in_array($level, $point_group))
563
+					if (in_array($level, $point_group))
564 564
 					{
565 565
 						// Delete all groups except the one which the current level belongs to
566
-						foreach($point_group as $group_srl => $target_level)
566
+						foreach ($point_group as $group_srl => $target_level)
567 567
 						{
568 568
 							$del_group_list[] = $group_srl;
569
-							if($target_level == $level) $new_group_list[] = $group_srl;
569
+							if ($target_level == $level) $new_group_list[] = $group_srl;
570 570
 						}
571 571
 					}
572 572
 					// Otherwise, in case the level is reduced, add the recent group
573 573
 					else
574 574
 					{
575 575
 						$i = $level;
576
-						while($i > 0)
576
+						while ($i > 0)
577 577
 						{
578
-							if(in_array($i, $point_group))
578
+							if (in_array($i, $point_group))
579 579
 							{
580
-								foreach($point_group as $group_srl => $target_level)
580
+								foreach ($point_group as $group_srl => $target_level)
581 581
 								{
582
-									if($target_level == $i)
582
+									if ($target_level == $i)
583 583
 									{
584 584
 										$new_group_list[] = $group_srl;
585 585
 									}
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
 						}
591 591
 					}
592 592
 					// Delete the group of a level which is higher than the current level
593
-					foreach($point_group as $group_srl => $target_level)
593
+					foreach ($point_group as $group_srl => $target_level)
594 594
 					{
595
-						if($target_level > $level) $del_group_list[] = $group_srl;
595
+						if ($target_level > $level) $del_group_list[] = $group_srl;
596 596
 					}
597 597
 					$del_group_list[] = $default_group->group_srl;
598 598
 				}
@@ -600,16 +600,16 @@  discard block
 block discarded – undo
600 600
 				else
601 601
 				{
602 602
 					// Check until the current level by rotating setting the configurations of the point groups
603
-					foreach($point_group as $group_srl => $target_level)
603
+					foreach ($point_group as $group_srl => $target_level)
604 604
 					{
605 605
 						$del_group_list[] = $group_srl;
606
-						if($target_level <= $level) $new_group_list[] = $group_srl;
606
+						if ($target_level <= $level) $new_group_list[] = $group_srl;
607 607
 					}
608 608
 				}
609 609
 				// If there is no a new group, granted the default group
610
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
610
+				if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
611 611
 				// Remove linkage group
612
-				if($del_group_list && count($del_group_list))
612
+				if ($del_group_list && count($del_group_list))
613 613
 				{
614 614
 					$del_group_args = new stdClass;
615 615
 					$del_group_args->member_srl = $member_srl;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 					$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
618 618
 				}
619 619
 				// Grant a new group
620
-				foreach($new_group_list as $group_srl)
620
+				foreach ($new_group_list as $group_srl)
621 621
 				{
622 622
 					$new_group_args = new stdClass;
623 623
 					$new_group_args->member_srl = $member_srl;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$trigger_obj->del_group_list = $del_group_list;
633 633
 		$trigger_obj->new_level = $level;
634 634
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj);
635
-		if(!$trigger_output->toBool())
635
+		if (!$trigger_output->toBool())
636 636
 		{
637 637
 			$oDB->rollback();
638 638
 			return $trigger_output;
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 		FileHandler::writeFile($cache_filename, $point);
649 649
 
650 650
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
651
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
651
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
652 652
 		{
653 653
 			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
654 654
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 		}
657 657
 
658 658
 		$oCacheHandler = CacheHandler::getInstance('object');
659
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
659
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
660 660
 		{
661 661
 			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
662 662
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 		$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
673 673
 
674 674
 		$oModuleController = getController('module');
675
-		if(is_array($obj->moduleSrlList))
675
+		if (is_array($obj->moduleSrlList))
676 676
 		{
677
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
677
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
678 678
 			{
679 679
 				$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
680 680
 			}
Please login to merge, or discard this patch.
Braces   +186 added lines, -66 removed lines patch added patch discarded remove patch
@@ -42,9 +42,13 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new Object();
45
+		if(!$member_srl) {
46
+			return new Object();
47
+		}
46 48
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
49
+		if(substr($obj->last_login,0,8)==date("Ymd")) {
50
+			return new Object();
51
+		}
48 52
 		// Get the point module information
49 53
 		$oModuleModel = getModel('module');
50 54
 		$config = $oModuleModel->getModuleConfig('point');
@@ -70,9 +74,13 @@  discard block
 block discarded – undo
70 74
 		{
71 75
 			$module_srl = $obj->module_srl;
72 76
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new Object();
77
+			if(!$module_srl || !$member_srl) {
78
+				return new Object();
79
+			}
74 80
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new Object();
81
+			if($module_srl == $member_srl) {
82
+				return new Object();
83
+			}
76 84
 			// Get the point module information
77 85
 			$oModuleModel = getModel('module');
78 86
 			$config = $oModuleModel->getModuleConfig('point');
@@ -82,12 +90,18 @@  discard block
 block discarded – undo
82 90
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 91
 
84 92
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
93
+			if(strlen($point) == 0 && !is_int($point)) {
94
+				$point = $config->insert_document;
95
+			}
86 96
 			$cur_point += $point;
87 97
 			// Add points for attaching a file
88 98
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
99
+			if(strlen($point) == 0 && !is_int($point)) {
100
+				$point = $config->upload_file;
101
+			}
102
+			if($obj->uploaded_count) {
103
+				$cur_point += $point * $obj->uploaded_count;
104
+			}
91 105
 			// Increase the point
92 106
 			$this->setPoint($member_srl,$cur_point);
93 107
 		}
@@ -118,12 +132,18 @@  discard block
 block discarded – undo
118 132
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 133
 
120 134
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
135
+			if(strlen($point) == 0 && !is_int($point)) {
136
+				$point = $config->insert_document;
137
+			}
122 138
 			$cur_point += $point;
123 139
 			// Add points for attaching a file
124 140
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
141
+			if(strlen($point) == 0 && !is_int($point)) {
142
+				$point = $config->upload_file;
143
+			}
144
+			if($obj->uploaded_count) {
145
+				$cur_point += $point * $obj->uploaded_count;
146
+			}
127 147
 			// Increase the point
128 148
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 149
 		}
@@ -141,33 +161,47 @@  discard block
 block discarded – undo
141 161
 
142 162
 		$oDocumentModel = getModel('document');
143 163
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new Object();
164
+		if(!$oDocument->isExists()) {
165
+			return new Object();
166
+		}
145 167
 		// Get the point module information
146 168
 		$oModuleModel = getModel('module');
147 169
 		$config = $oModuleModel->getModuleConfig('point');
148 170
 		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
149 171
 		// The process related to clearing the post comments
150 172
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
173
+		if(strlen($comment_point) == 0 && !is_int($comment_point)) {
174
+			$comment_point = $config->insert_comment;
175
+		}
152 176
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new Object();
177
+		if($comment_point>0) {
178
+			return new Object();
179
+		}
154 180
 		// Get all the comments related to this post
155 181
 		$cp_args = new stdClass();
156 182
 		$cp_args->document_srl = $document_srl;
157 183
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 184
 		// Return if there is no object
159
-		if(!$output->data) return new Object();
185
+		if(!$output->data) {
186
+			return new Object();
187
+		}
160 188
 		// Organize the member number
161 189
 		$member_srls = array();
162 190
 		$cnt = count($output->data);
163 191
 		for($i=0;$i<$cnt;$i++)
164 192
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
193
+			if($output->data[$i]->member_srl<1) {
194
+				continue;
195
+			}
166 196
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 197
 		}
168 198
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new Object();
199
+		if($member_srl) {
200
+			unset($member_srls[abs($member_srl)]);
201
+		}
202
+		if(!count($member_srls)) {
203
+			return new Object();
204
+		}
171 205
 		// Remove all the points for each member
172 206
 		$oPointModel = getModel('point');
173 207
 		// Get the points
@@ -190,10 +224,14 @@  discard block
 block discarded – undo
190 224
 		$module_srl = $obj->module_srl;
191 225
 		$member_srl = $obj->member_srl;
192 226
 		// The process related to clearing the post object
193
-		if(!$module_srl || !$member_srl) return new Object();
227
+		if(!$module_srl || !$member_srl) {
228
+			return new Object();
229
+		}
194 230
 		// Run only when logged in
195 231
 		$logged_info = Context::get('logged_info');
196
-		if(!$logged_info->member_srl) return new Object();
232
+		if(!$logged_info->member_srl) {
233
+			return new Object();
234
+		}
197 235
 		// Get the points of the member
198 236
 		$oPointModel = getModel('point');
199 237
 		$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -203,14 +241,22 @@  discard block
 block discarded – undo
203 241
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
204 242
 
205 243
 		$point = $module_config['insert_document'];
206
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
244
+		if(strlen($point) == 0 && !is_int($point)) {
245
+			$point = $config->insert_document;
246
+		}
207 247
 		// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
208
-		if($point < 0) return new Object();
248
+		if($point < 0) {
249
+			return new Object();
250
+		}
209 251
 		$cur_point -= $point;
210 252
 		// Add points related to deleting an attachment
211 253
 		$point = $module_config['upload_file'];
212
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
213
-		if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
254
+		if(strlen($point) == 0 && !is_int($point)) {
255
+			$point = $config->upload_file;
256
+		}
257
+		if($obj->uploaded_count) {
258
+			$cur_point -= $point * $obj->uploaded_count;
259
+		}
214 260
 		// Increase the point
215 261
 		$this->setPoint($member_srl,$cur_point);
216 262
 
@@ -224,12 +270,16 @@  discard block
 block discarded – undo
224 270
 	{
225 271
 		$module_srl = $obj->module_srl;
226 272
 		$member_srl = $obj->member_srl;
227
-		if(!$module_srl || !$member_srl) return new Object();
273
+		if(!$module_srl || !$member_srl) {
274
+			return new Object();
275
+		}
228 276
 		// Do not increase the points if the member is the author of the post
229 277
 		$document_srl = $obj->document_srl;
230 278
 		$oDocumentModel = getModel('document');
231 279
 		$oDocument = $oDocumentModel->getDocument($document_srl);
232
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
280
+		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) {
281
+			return new Object();
282
+		}
233 283
 		// Get the point module information
234 284
 		$oModuleModel = getModel('module');
235 285
 		$config = $oModuleModel->getModuleConfig('point');
@@ -239,7 +289,9 @@  discard block
 block discarded – undo
239 289
 		$cur_point = $oPointModel->getPoint($member_srl, true);
240 290
 
241 291
 		$point = $module_config['insert_comment'];
242
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
292
+		if(strlen($point) == 0 && !is_int($point)) {
293
+			$point = $config->insert_comment;
294
+		}
243 295
 		// Increase the point
244 296
 		$cur_point += $point;
245 297
 		$this->setPoint($member_srl,$cur_point);
@@ -259,11 +311,17 @@  discard block
 block discarded – undo
259 311
 		$module_srl = $obj->module_srl;
260 312
 		$member_srl = abs($obj->member_srl);
261 313
 		$document_srl = $obj->document_srl;
262
-		if(!$module_srl || !$member_srl) return new Object();
314
+		if(!$module_srl || !$member_srl) {
315
+			return new Object();
316
+		}
263 317
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
264 318
 		$oDocument = $oDocumentModel->getDocument($document_srl);
265
-		if(!$oDocument->isExists()) return new Object();
266
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
319
+		if(!$oDocument->isExists()) {
320
+			return new Object();
321
+		}
322
+		if($oDocument->get('member_srl')==$member_srl) {
323
+			return new Object();
324
+		}
267 325
 		// Get the point module information
268 326
 		$config = $oModuleModel->getModuleConfig('point');
269 327
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -271,9 +329,13 @@  discard block
 block discarded – undo
271 329
 		$cur_point = $oPointModel->getPoint($member_srl, true);
272 330
 
273 331
 		$point = $module_config['insert_comment'];
274
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
332
+		if(strlen($point) == 0 && !is_int($point)) {
333
+			$point = $config->insert_comment;
334
+		}
275 335
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
276
-		if($point < 0) return new Object();
336
+		if($point < 0) {
337
+			return new Object();
338
+		}
277 339
 		// Increase the point
278 340
 		$cur_point -= $point;
279 341
 		$this->setPoint($member_srl,$cur_point);
@@ -296,11 +358,15 @@  discard block
 block discarded – undo
296 358
 	 */
297 359
 	function triggerDeleteFile(&$obj)
298 360
 	{
299
-		if($obj->isvalid != 'Y') return new Object();
361
+		if($obj->isvalid != 'Y') {
362
+			return new Object();
363
+		}
300 364
 
301 365
 		$module_srl = $obj->module_srl;
302 366
 		$member_srl = $obj->member_srl;
303
-		if(!$module_srl || !$member_srl) return new Object();
367
+		if(!$module_srl || !$member_srl) {
368
+			return new Object();
369
+		}
304 370
 		// Get the point module information
305 371
 		$oModuleModel = getModel('module');
306 372
 		$config = $oModuleModel->getModuleConfig('point');
@@ -310,7 +376,9 @@  discard block
 block discarded – undo
310 376
 		$cur_point = $oPointModel->getPoint($member_srl, true);
311 377
 
312 378
 		$point = $module_config['upload_file'];
313
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
379
+		if(strlen($point) == 0 && !is_int($point)) {
380
+			$point = $config->upload_file;
381
+		}
314 382
 		// Increase the point
315 383
 		$cur_point -= $point;
316 384
 		$this->setPoint($member_srl,$cur_point);
@@ -326,9 +394,13 @@  discard block
 block discarded – undo
326 394
 		$logged_info = Context::get('logged_info');
327 395
 		$member_srl = $logged_info->member_srl;
328 396
 		$module_srl = $obj->module_srl;
329
-		if(!$module_srl) return new Object();
397
+		if(!$module_srl) {
398
+			return new Object();
399
+		}
330 400
 		// Pass if it is your file
331
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
401
+		if(abs($obj->member_srl) == abs($member_srl)) {
402
+			return new Object();
403
+		}
332 404
 
333 405
 		$oModuleModel = getModel('module');
334 406
 		$config = $oModuleModel->getModuleConfig('point');
@@ -336,17 +408,24 @@  discard block
 block discarded – undo
336 408
 		// If it is set not to allow downloading for non-logged in users, do not permit
337 409
 		if(!Context::get('is_logged'))
338 410
 		{
339
-			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
340
-			else return new Object();
411
+			if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) {
412
+				return new Object(-1,'msg_not_permitted_download');
413
+			} else {
414
+				return new Object();
415
+			}
341 416
 		}
342 417
 		// Get the points of the member
343 418
 		$oPointModel = getModel('point');
344 419
 		$cur_point = $oPointModel->getPoint($member_srl, true);
345 420
 		// Get the points
346 421
 		$point = $module_config['download_file'];
347
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
422
+		if(strlen($point) == 0 && !is_int($point)) {
423
+			$point = $config->download_file;
424
+		}
348 425
 		// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
349
-		if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
426
+		if($cur_point + $point < 0 && $config->disable_download == 'Y') {
427
+			return new Object(-1,'msg_cannot_download');
428
+		}
350 429
 
351 430
 		return new Object();
352 431
 	}
@@ -358,12 +437,18 @@  discard block
 block discarded – undo
358 437
 	{
359 438
 		// Run only when logged in
360 439
 		$logged_info = Context::get('logged_info');
361
-		if(!$logged_info->member_srl) return new Object();
440
+		if(!$logged_info->member_srl) {
441
+			return new Object();
442
+		}
362 443
 		$module_srl = $obj->module_srl;
363 444
 		$member_srl = $logged_info->member_srl;
364
-		if(!$module_srl) return new Object();
445
+		if(!$module_srl) {
446
+			return new Object();
447
+		}
365 448
 		// Pass if it is your file
366
-		if(abs($obj->member_srl) == abs($member_srl)) return new Object();
449
+		if(abs($obj->member_srl) == abs($member_srl)) {
450
+			return new Object();
451
+		}
367 452
 		// Get the point module information
368 453
 		$oModuleModel = getModel('module');
369 454
 		$config = $oModuleModel->getModuleConfig('point');
@@ -373,7 +458,9 @@  discard block
 block discarded – undo
373 458
 		$cur_point = $oPointModel->getPoint($member_srl, true);
374 459
 		// Get the points
375 460
 		$point = $module_config['download_file'];
376
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
461
+		if(strlen($point) == 0 && !is_int($point)) {
462
+			$point = $config->download_file;
463
+		}
377 464
 		// Increase the point
378 465
 		$cur_point += $point;
379 466
 		$this->setPoint($member_srl,$cur_point);
@@ -395,25 +482,32 @@  discard block
 block discarded – undo
395 482
 		// Get the original author number
396 483
 		$target_member_srl = abs($obj->get('member_srl'));
397 484
 		// Pass without increasing the hits if the viewer is the same as the author
398
-		if($target_member_srl == $member_srl) return new Object();
485
+		if($target_member_srl == $member_srl) {
486
+			return new Object();
487
+		}
399 488
 		// Get the point information for each module
400 489
 		$config = $oModuleModel->getModuleConfig('point');
401 490
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
402 491
 		// Get hits points
403 492
 		$point = $module_config['read_document'];
404
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
493
+		if(strlen($point) == 0 && !is_int($point)) {
494
+			$point = $config->read_document;
495
+		}
405 496
 		// Pass if there are no requested points
406
-		if(!$point) return new Object();
497
+		if(!$point) {
498
+			return new Object();
499
+		}
407 500
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
408 501
 		if($member_srl)
409 502
 		{
410 503
 			$args->member_srl = $member_srl;
411 504
 			$args->document_srl = $obj->document_srl;
412 505
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
413
-			if($output->data->count) return new Object();
506
+			if($output->data->count) {
507
+				return new Object();
508
+			}
414 509
 			$cur_point = $oPointModel->getPoint($member_srl, true);
415
-		}
416
-		else
510
+		} else
417 511
 		{
418 512
 			$cur_point = 0;
419 513
 		}
@@ -429,9 +523,13 @@  discard block
 block discarded – undo
429 523
 			return new Object(-1, $message);
430 524
 		}
431 525
 		// If not logged in, pass
432
-		if(!$logged_info->member_srl) return new Object();
526
+		if(!$logged_info->member_srl) {
527
+			return new Object();
528
+		}
433 529
 		// Pass, if there are no requested points
434
-		if(!$point) return new Object();
530
+		if(!$point) {
531
+			return new Object();
532
+		}
435 533
 		// If the read record is missing, leave it
436 534
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
437 535
 		// Increase the point
@@ -448,7 +546,9 @@  discard block
 block discarded – undo
448 546
 	{
449 547
 		$module_srl = $obj->module_srl;
450 548
 		$member_srl = $obj->member_srl;
451
-		if(!$module_srl || !$member_srl) return new Object();
549
+		if(!$module_srl || !$member_srl) {
550
+			return new Object();
551
+		}
452 552
 
453 553
 		$oModuleModel = getModel('module');
454 554
 		$config = $oModuleModel->getModuleConfig('point');
@@ -460,15 +560,20 @@  discard block
 block discarded – undo
460 560
 		if( $obj->point > 0 )
461 561
 		{
462 562
 			$point = $module_config['voted'];
463
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
464
-		}
465
-		else
563
+			if(strlen($point) == 0 && !is_int($point)) {
564
+				$point = $config->voted;
565
+			}
566
+		} else
466 567
 		{
467 568
 			$point = $module_config['blamed'];
468
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
569
+			if(strlen($point) == 0 && !is_int($point)) {
570
+				$point = $config->blamed;
571
+			}
469 572
 		}
470 573
 
471
-		if(!$point) return new Object();
574
+		if(!$point) {
575
+			return new Object();
576
+		}
472 577
 		// Increase the point
473 578
 		$cur_point += $point;
474 579
 		$this->setPoint($member_srl,$cur_point);
@@ -483,7 +588,9 @@  discard block
 block discarded – undo
483 588
 	{
484 589
 		$member_srl = abs($member_srl);
485 590
 		$mode_arr = array('add', 'minus', 'update', 'signup');
486
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
591
+		if(!$mode || !in_array($mode,$mode_arr)) {
592
+			$mode = 'update';
593
+		}
487 594
 
488 595
 		// Get configuration information
489 596
 		$oMemberModel = getModel('member');
@@ -513,7 +620,9 @@  discard block
 block discarded – undo
513 620
 				$args->point = $point;
514 621
 				break;
515 622
 		}
516
-		if($args->point < 0) $args->point = 0;
623
+		if($args->point < 0) {
624
+			$args->point = 0;
625
+		}
517 626
 		$point = $args->point;
518 627
 
519 628
 		// Call a trigger (before)
@@ -535,8 +644,11 @@  discard block
 block discarded – undo
535 644
 
536 645
 		// If there are points, update, if no, insert
537 646
 		$oPointModel = getModel('point');
538
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
539
-		else executeQuery("point.insertPoint", $args);
647
+		if($oPointModel->isExistsPoint($member_srl)) {
648
+			executeQuery("point.updatePoint", $args);
649
+		} else {
650
+			executeQuery("point.insertPoint", $args);
651
+		}
540 652
 
541 653
 		// Get a new level
542 654
 		$level = $oPointModel->getLevel($point, $config->level_step);
@@ -566,7 +678,9 @@  discard block
 block discarded – undo
566 678
 						foreach($point_group as $group_srl => $target_level)
567 679
 						{
568 680
 							$del_group_list[] = $group_srl;
569
-							if($target_level == $level) $new_group_list[] = $group_srl;
681
+							if($target_level == $level) {
682
+								$new_group_list[] = $group_srl;
683
+							}
570 684
 						}
571 685
 					}
572 686
 					// Otherwise, in case the level is reduced, add the recent group
@@ -592,7 +706,9 @@  discard block
 block discarded – undo
592 706
 					// Delete the group of a level which is higher than the current level
593 707
 					foreach($point_group as $group_srl => $target_level)
594 708
 					{
595
-						if($target_level > $level) $del_group_list[] = $group_srl;
709
+						if($target_level > $level) {
710
+							$del_group_list[] = $group_srl;
711
+						}
596 712
 					}
597 713
 					$del_group_list[] = $default_group->group_srl;
598 714
 				}
@@ -603,11 +719,15 @@  discard block
 block discarded – undo
603 719
 					foreach($point_group as $group_srl => $target_level)
604 720
 					{
605 721
 						$del_group_list[] = $group_srl;
606
-						if($target_level <= $level) $new_group_list[] = $group_srl;
722
+						if($target_level <= $level) {
723
+							$new_group_list[] = $group_srl;
724
+						}
607 725
 					}
608 726
 				}
609 727
 				// If there is no a new group, granted the default group
610
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
728
+				if(!$new_group_list[0]) {
729
+					$new_group_list[0] = $default_group->group_srl;
730
+				}
611 731
 				// Remove linkage group
612 732
 				if($del_group_list && count($del_group_list))
613 733
 				{
Please login to merge, or discard this patch.
modules/poll/poll.admin.controller.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
 
86 86
 	/**
87 87
 	 * @brief Delete the poll (when several questions are registered in one poll, delete this question)
88
+	 * @param string $poll_index_srl
88 89
 	 */
89 90
 	function deletePollTitle($poll_index_srl) 
90 91
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  pollAdminController
5
- * @author NAVER ([email protected])
6
- * @brief The admin controller class of the poll module
7
- */
4
+	 * @class  pollAdminController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief The admin controller class of the poll module
7
+	 */
8 8
 class pollAdminController extends poll
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 		// Display an error no post is selected
41 41
 		$cart = Context::get('cart');
42 42
 
43
-		if(is_array($cart)) $poll_srl_list = $cart;
44
-		else $poll_srl_list= explode('|@|', $cart);
43
+		if (is_array($cart)) $poll_srl_list = $cart;
44
+		else $poll_srl_list = explode('|@|', $cart);
45 45
 
46 46
 		$poll_count = count($poll_srl_list);
47
-		if(!$poll_count) return $this->stop('msg_cart_is_null');
47
+		if (!$poll_count) return $this->stop('msg_cart_is_null');
48 48
 		// Delete the post
49
-		for($i=0;$i<$poll_count;$i++)
49
+		for ($i = 0; $i < $poll_count; $i++)
50 50
 		{
51 51
 			$poll_index_srl = trim($poll_srl_list[$i]);
52
-			if(!$poll_index_srl) continue;
52
+			if (!$poll_index_srl) continue;
53 53
 
54 54
 			$output = $this->deletePollTitle($poll_index_srl, true);
55
-			if(!$output->toBool()) return $output;
55
+			if (!$output->toBool()) return $output;
56 56
 		}
57 57
 
58
-		$this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
58
+		$this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count));
59 59
 
60 60
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList');
61 61
 		$this->setRedirectUrl($returnUrl);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	function procPollAdminAddCart()
65 65
 	{
66
-		$poll_index_srl = (int)Context::get('poll_index_srl');
66
+		$poll_index_srl = (int) Context::get('poll_index_srl');
67 67
 
68 68
 		$oPollAdminModel = getAdminModel('poll');
69 69
 		//$columnList = array('comment_srl');
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 
74 74
 		$output = $oPollAdminModel->getPollList($args);
75 75
 
76
-		if(is_array($output->data))
76
+		if (is_array($output->data))
77 77
 		{
78
-			foreach($output->data AS $key=>$value)
78
+			foreach ($output->data AS $key=>$value)
79 79
 			{
80
-				if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
80
+				if ($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
81 81
 				else $_SESSION['poll_management'][$value->poll_index_srl] = true;
82 82
 			}
83 83
 		}
@@ -97,36 +97,36 @@  discard block
 block discarded – undo
97 97
 		$oDB->begin();
98 98
 
99 99
 		$output = executeQueryArray('poll.getPollByDeletePollTitle', $args);
100
-		if($output->toBool() && $output->data && $output->data[0]->count == 1)
100
+		if ($output->toBool() && $output->data && $output->data[0]->count == 1)
101 101
 		{
102 102
 			$dargs->poll_srl = $output->data[0]->poll_srl;
103 103
 		}
104 104
 
105 105
 		$output = $oDB->executeQuery('poll.deletePollTitle', $args);
106
-		if(!$output)
106
+		if (!$output)
107 107
 		{
108 108
 			$oDB->rollback();
109 109
 			return $output;
110 110
 		}
111 111
 
112 112
 		$output = $oDB->executeQuery('poll.deletePollItem', $args);
113
-		if(!$output)
113
+		if (!$output)
114 114
 		{
115 115
 			$oDB->rollback();
116 116
 			return $output;
117 117
 		}
118 118
 
119
-		if($dargs->poll_srl)
119
+		if ($dargs->poll_srl)
120 120
 		{
121 121
 			$output = executeQuery('poll.deletePoll', $dargs);
122
-			if(!$output)
122
+			if (!$output)
123 123
 			{
124 124
 				$oDB->rollback();
125 125
 				return $output;
126 126
 			}
127 127
 
128 128
 			$output = executeQuery('poll.deletePollLog', $dargs);
129
-			if(!$output)
129
+			if (!$output)
130 130
 			{
131 131
 				$oDB->rollback();
132 132
 				return $output;
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 		$oDB->begin();
150 150
 
151 151
 		$output = $oDB->executeQuery('poll.deletePoll', $args);
152
-		if(!$output)
152
+		if (!$output)
153 153
 		{
154 154
 			$oDB->rollback();
155 155
 			return $output;
156 156
 		}
157 157
 
158 158
 		$output = $oDB->executeQuery('poll.deletePollTitle', $args);
159
-		if(!$output)
159
+		if (!$output)
160 160
 		{
161 161
 			$oDB->rollback();
162 162
 			return $output;
163 163
 		}
164 164
 
165 165
 		$output = $oDB->executeQuery('poll.deletePollItem', $args);
166
-		if(!$output)
166
+		if (!$output)
167 167
 		{
168 168
 			$oDB->rollback();
169 169
 			return $output;
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,19 +40,28 @@  discard block
 block discarded – undo
40 40
 		// Display an error no post is selected
41 41
 		$cart = Context::get('cart');
42 42
 
43
-		if(is_array($cart)) $poll_srl_list = $cart;
44
-		else $poll_srl_list= explode('|@|', $cart);
43
+		if(is_array($cart)) {
44
+			$poll_srl_list = $cart;
45
+		} else {
46
+			$poll_srl_list= explode('|@|', $cart);
47
+		}
45 48
 
46 49
 		$poll_count = count($poll_srl_list);
47
-		if(!$poll_count) return $this->stop('msg_cart_is_null');
50
+		if(!$poll_count) {
51
+			return $this->stop('msg_cart_is_null');
52
+		}
48 53
 		// Delete the post
49 54
 		for($i=0;$i<$poll_count;$i++)
50 55
 		{
51 56
 			$poll_index_srl = trim($poll_srl_list[$i]);
52
-			if(!$poll_index_srl) continue;
57
+			if(!$poll_index_srl) {
58
+				continue;
59
+			}
53 60
 
54 61
 			$output = $this->deletePollTitle($poll_index_srl, true);
55
-			if(!$output->toBool()) return $output;
62
+			if(!$output->toBool()) {
63
+				return $output;
64
+			}
56 65
 		}
57 66
 
58 67
 		$this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
@@ -77,8 +86,11 @@  discard block
 block discarded – undo
77 86
 		{
78 87
 			foreach($output->data AS $key=>$value)
79 88
 			{
80
-				if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
81
-				else $_SESSION['poll_management'][$value->poll_index_srl] = true;
89
+				if($_SESSION['poll_management'][$value->poll_index_srl]) {
90
+					unset($_SESSION['poll_management'][$value->poll_index_srl]);
91
+				} else {
92
+					$_SESSION['poll_management'][$value->poll_index_srl] = true;
93
+				}
82 94
 			}
83 95
 		}
84 96
 	}
Please login to merge, or discard this patch.
modules/rss/rss.admin.controller.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * RSS Module configurations
112 112
 	 *
113
-	 * @return void
113
+	 * @return Object|null
114 114
 	 */
115 115
 	function procRssAdminInsertModuleConfig()
116 116
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * The admin controller class of the rss module
5
- *
6
- * @author NAVER ([email protected])
7
- */
4
+	 * The admin controller class of the rss module
5
+	 *
6
+	 * @author NAVER ([email protected])
7
+	 */
8 8
 class rssAdminController extends rss
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,41 +27,41 @@  discard block
 block discarded – undo
27 27
 		$total_config = $oModuleModel->getModuleConfig('rss');
28 28
 
29 29
 		$config_vars = Context::getRequestVars();
30
-		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
30
+		$config_vars->feed_document_count = (int) $config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
+		if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y';
34 34
 
35
-		if($config_vars->image || $config_vars->del_image)
35
+		if ($config_vars->image || $config_vars->del_image)
36 36
 		{
37 37
 			$image_obj = $config_vars->image;
38 38
 			$config_vars->image = $total_config->image;
39 39
 			// Get a variable for the delete request
40
-			if($config_vars->del_image == 'Y' || $image_obj)
40
+			if ($config_vars->del_image == 'Y' || $image_obj)
41 41
 			{
42 42
 				FileHandler::removeFile($config_vars->image);
43 43
 				$config_vars->image = '';
44 44
 				$total_config->image = '';
45 45
 			}
46 46
 			// Ignore if the file is not the one which has been successfully uploaded
47
-			if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
47
+			if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
48 48
 			{
49 49
 				// Ignore if the file is not an image (swf is accepted ~)
50 50
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 51
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
52
+				if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53 53
 				else
54 54
 				{
55 55
 					// Upload the file to a path
56 56
 					$path = './files/attach/images/rss/';
57 57
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
58
+					if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59 59
 					else
60 60
 					{
61
-						$filename = $path.$image_obj['name'];
61
+						$filename = $path . $image_obj['name'];
62 62
 
63 63
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
64
+						if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65 65
 						else
66 66
 						{
67 67
 							$config_vars->image = $filename;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 				}
71 71
 			}
72 72
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
73
+		if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
74 74
 
75 75
 		$output = $this->setFeedConfig($config_vars);
76 76
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
77
+		if (!$alt_message) $alt_message = 'success_updated';
78 78
 
79 79
 		$alt_message = Context::getLang($alt_message);
80 80
 		$this->setMessage($alt_message, 'info');
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$originConfig = $oModuleModel->getModuleConfig('rss');
97 97
 
98 98
 		// Get a variable for the delete request
99
-		if($delImage == 'Y')
99
+		if ($delImage == 'Y')
100 100
 		{
101 101
 			FileHandler::removeFile($originConfig->image);
102 102
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$feedCopyrightList = $config_vars->feed_copyright;
123 123
 		$targetModuleSrl = $config_vars->target_module_srl;
124 124
 
125
-		if($targetModuleSrl && !is_array($openRssList))
125
+		if ($targetModuleSrl && !is_array($openRssList))
126 126
 		{
127 127
 			$openRssList = array($targetModuleSrl => $openRssList);
128 128
 			$openTotalFeedList = array($targetModuleSrl => $openTotalFeedList);
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 			$feedCopyrightList = array($targetModuleSrl => $feedCopyrightList);
131 131
 		}
132 132
 
133
-		if(is_array($openRssList))
133
+		if (is_array($openRssList))
134 134
 		{
135
-			foreach($openRssList AS $module_srl=>$open_rss)
135
+			foreach ($openRssList AS $module_srl=>$open_rss)
136 136
 			{
137
-				if(!$module_srl || !$open_rss)
137
+				if (!$module_srl || !$open_rss)
138 138
 				{
139 139
 					return new Object(-1, 'msg_invalid_request');
140 140
 				}
141 141
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
142
+				if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N';
143 143
 
144 144
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 145
 			}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	function setFeedConfig($config)
162 162
 	{
163 163
 		$oModuleController = getController('module');
164
-		$oModuleController->insertModuleConfig('rss',$config);
164
+		$oModuleController->insertModuleConfig('rss', $config);
165 165
 		return new Object();
166 166
 	}
167 167
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 		$config = new stdClass;
182 182
 		$config->open_rss = $open_rss;
183 183
 		$config->open_total_feed = $open_total_feed;
184
-		if($feed_description != 'N') { $config->feed_description = $feed_description; }
185
-		if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
-		$oModuleController->insertModulePartConfig('rss',$module_srl,$config);
184
+		if ($feed_description != 'N') { $config->feed_description = $feed_description; }
185
+		if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
+		$oModuleController->insertModulePartConfig('rss', $module_srl, $config);
187 187
 		return new Object();
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,8 +29,12 @@  discard block
 block discarded – undo
29 29
 		$config_vars = Context::getRequestVars();
30 30
 		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if(!$config_vars->use_total_feed) {
33
+			$alt_message = 'msg_invalid_request';
34
+		}
35
+		if(!in_array($config_vars->use_total_feed, array('Y','N'))) {
36
+			$config_vars->open_rss = 'Y';
37
+		}
34 38
 
35 39
 		if($config_vars->image || $config_vars->del_image)
36 40
 		{
@@ -49,20 +53,23 @@  discard block
 block discarded – undo
49 53
 				// Ignore if the file is not an image (swf is accepted ~)
50 54
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 55
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53
-				else
56
+				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
57
+					$alt_message = 'msg_rss_invalid_image_format';
58
+				} else
54 59
 				{
55 60
 					// Upload the file to a path
56 61
 					$path = './files/attach/images/rss/';
57 62
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59
-					else
63
+					if(!FileHandler::makeDir($path)) {
64
+						$alt_message = 'msg_error_occured';
65
+					} else
60 66
 					{
61 67
 						$filename = $path.$image_obj['name'];
62 68
 
63 69
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65
-						else
70
+						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
71
+							$alt_message = 'msg_error_occured';
72
+						} else
66 73
 						{
67 74
 							$config_vars->image = $filename;
68 75
 						}
@@ -70,11 +77,15 @@  discard block
 block discarded – undo
70 77
 				}
71 78
 			}
72 79
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
80
+		if(!$config_vars->image && $config_vars->del_image != 'Y') {
81
+			$config_vars->image = $total_config->image;
82
+		}
74 83
 
75 84
 		$output = $this->setFeedConfig($config_vars);
76 85
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
86
+		if(!$alt_message) {
87
+			$alt_message = 'success_updated';
88
+		}
78 89
 
79 90
 		$alt_message = Context::getLang($alt_message);
80 91
 		$this->setMessage($alt_message, 'info');
@@ -139,7 +150,9 @@  discard block
 block discarded – undo
139 150
 					return new Object(-1, 'msg_invalid_request');
140 151
 				}
141 152
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
153
+				if(!in_array($open_rss, array('Y','H','N'))) {
154
+					$open_rss = 'N';
155
+				}
143 156
 
144 157
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 158
 			}
Please login to merge, or discard this patch.
modules/spamfilter/spamfilter.admin.controller.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * @brief Delete IP
100 100
 	 * Remove the IP address which was previously registered as a spammers
101
+	 * @param string $ipaddress
101 102
 	 */
102 103
 	function deleteIP($ipaddress)
103 104
 	{
@@ -111,6 +112,7 @@  discard block
 block discarded – undo
111 112
 	/**
112 113
 	 * @brief Register the spam word
113 114
 	 * The post, which contains the newly registered spam word, should be considered as a spam
115
+	 * @param string $word_list
114 116
 	 */
115 117
 	function insertWord($word_list)
116 118
 	{
@@ -141,6 +143,7 @@  discard block
 block discarded – undo
141 143
 	/**
142 144
 	 * @brief Remove the spam word
143 145
 	 * Remove the word which was previously registered as a spam word
146
+	 * @param string $word
144 147
 	 */
145 148
 	function deleteWord($word)
146 149
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  spamfilterAdminController
5
- * @author NAVER ([email protected])
6
- * @brief The admin controller class of the spamfilter module
7
- */
4
+	 * @class  spamfilterAdminController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief The admin controller class of the spamfilter module
7
+	 */
8 8
 class spamfilterAdminController extends spamfilter
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	function procSpamfilterAdminInsertConfig()
18 18
 	{
19 19
 		// Get the default information
20
-		$argsConfig = Context::gets('limits','check_trackback');
20
+		$argsConfig = Context::gets('limits', 'check_trackback');
21 21
 		$flag = Context::get('flag');
22 22
 		//interval, limit_count
23
-		if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
24
-		if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
23
+		if ($argsConfig->check_trackback != 'Y') $argsConfig->check_trackback = 'N';
24
+		if ($argsConfig->limits != 'Y') $argsConfig->limits = 'N';
25 25
 		// Create and insert the module Controller object
26 26
 		$oModuleController = getController('module');
27
-		$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
28
-		if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
27
+		$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $argsConfig);
28
+		if (!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
29 29
 
30 30
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
31 31
 		$this->setRedirectUrl($returnUrl);
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 		//스팸IP  추가
37 37
 		$ipaddress_list = Context::get('ipaddress_list');
38 38
 		$oSpamfilterController = getController('spamfilter');
39
-		if($ipaddress_list)
39
+		if ($ipaddress_list)
40 40
 		{
41 41
 			$output = $oSpamfilterController->insertIP($ipaddress_list);
42
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
42
+			if (!$output->toBool() && !$output->get('fail_list')) return $output;
43 43
 
44
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
45
-			$this->setMessage(Context::getLang('success_registed').$message_fail);
44
+			if ($output->get('fail_list')) $message_fail = '<em>' . sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')) . '</em>';
45
+			$this->setMessage(Context::getLang('success_registed') . $message_fail);
46 46
 		}
47 47
 
48 48
 
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		//스팸 키워드 추가
56 56
 		$word_list = Context::get('word_list');
57
-		if($word_list)
57
+		if ($word_list)
58 58
 		{
59 59
 			$output = $this->insertWord($word_list);
60
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
60
+			if (!$output->toBool() && !$output->get('fail_list')) return $output;
61 61
 
62
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
63
-			$this->setMessage(Context::getLang('success_registed').$message_fail);
62
+			if ($output->get('fail_list')) $message_fail = '<em>' . sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')) . '</em>';
63
+			$this->setMessage(Context::getLang('success_registed') . $message_fail);
64 64
 		}
65 65
 
66 66
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	function procSpamfilterAdminDeleteDeniedIP()
74 74
 	{
75 75
 		$ipAddressList = Context::get('ipaddress');
76
-		if($ipAddressList) $this->deleteIP($ipAddressList);
76
+		if ($ipAddressList) $this->deleteIP($ipAddressList);
77 77
 
78 78
 		$this->setMessage(Context::getLang('success_deleted'));
79 79
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$this->setMessage(Context::getLang('success_deleted'));
93 93
 
94
-		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
94
+		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList', 'active', 'word');
95 95
 		return $this->setRedirectUrl($returnUrl);
96 96
 	}
97 97
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	function deleteIP($ipaddress)
103 103
 	{
104
-		if(!$ipaddress) return;
104
+		if (!$ipaddress) return;
105 105
 
106 106
 		$args = new stdClass;
107 107
 		$args->ipaddress = $ipaddress;
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
 	function insertWord($word_list)
116 116
 	{
117 117
 
118
-		$word_list = str_replace("\r","",$word_list);
119
-		$word_list = explode("\n",$word_list);
118
+		$word_list = str_replace("\r", "", $word_list);
119
+		$word_list = explode("\n", $word_list);
120 120
 
121
-		foreach($word_list as $word)
121
+		foreach ($word_list as $word)
122 122
 		{
123
-			if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
123
+			if (!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
124 124
 			{
125 125
 				return new Object(-1, 'msg_invalid');
126 126
 			}
127 127
 		}
128 128
 
129 129
 		$fail_word = '';
130
-		foreach($word_list as $word)
130
+		foreach ($word_list as $word)
131 131
 		{
132 132
 			$args = new stdClass;
133
-			if(trim($word)) $args->word = $word;
133
+			if (trim($word)) $args->word = $word;
134 134
 			$output = executeQuery('spamfilter.insertDeniedWord', $args);
135
-			if(!$output->toBool()) $fail_word .= $word.'<br />';
135
+			if (!$output->toBool()) $fail_word .= $word . '<br />';
136 136
 		}
137
-		$output->add('fail_list',$fail_word);
137
+		$output->add('fail_list', $fail_word);
138 138
 		return $output;
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	function deleteWord($word)
146 146
 	{
147
-		if(!$word) return;
147
+		if (!$word) return;
148 148
 		$args = new stdClass;
149 149
 		$args->word = $word;
150 150
 		return executeQuery('spamfilter.deleteDeniedWord', $args);
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,12 +20,18 @@  discard block
 block discarded – undo
20 20
 		$argsConfig = Context::gets('limits','check_trackback');
21 21
 		$flag = Context::get('flag');
22 22
 		//interval, limit_count
23
-		if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
24
-		if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
23
+		if($argsConfig->check_trackback!='Y') {
24
+			$argsConfig->check_trackback = 'N';
25
+		}
26
+		if($argsConfig->limits!='Y') {
27
+			$argsConfig->limits = 'N';
28
+		}
25 29
 		// Create and insert the module Controller object
26 30
 		$oModuleController = getController('module');
27 31
 		$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
28
-		if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
32
+		if(!$moduleConfigOutput->toBool()) {
33
+			return $moduleConfigOutput;
34
+		}
29 35
 
30 36
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
31 37
 		$this->setRedirectUrl($returnUrl);
@@ -39,9 +45,13 @@  discard block
 block discarded – undo
39 45
 		if($ipaddress_list)
40 46
 		{
41 47
 			$output = $oSpamfilterController->insertIP($ipaddress_list);
42
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
48
+			if(!$output->toBool() && !$output->get('fail_list')) {
49
+				return $output;
50
+			}
43 51
 
44
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
52
+			if($output->get('fail_list')) {
53
+				$message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
54
+			}
45 55
 			$this->setMessage(Context::getLang('success_registed').$message_fail);
46 56
 		}
47 57
 
@@ -57,9 +67,13 @@  discard block
 block discarded – undo
57 67
 		if($word_list)
58 68
 		{
59 69
 			$output = $this->insertWord($word_list);
60
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
70
+			if(!$output->toBool() && !$output->get('fail_list')) {
71
+				return $output;
72
+			}
61 73
 
62
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
74
+			if($output->get('fail_list')) {
75
+				$message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
76
+			}
63 77
 			$this->setMessage(Context::getLang('success_registed').$message_fail);
64 78
 		}
65 79
 
@@ -73,7 +87,9 @@  discard block
 block discarded – undo
73 87
 	function procSpamfilterAdminDeleteDeniedIP()
74 88
 	{
75 89
 		$ipAddressList = Context::get('ipaddress');
76
-		if($ipAddressList) $this->deleteIP($ipAddressList);
90
+		if($ipAddressList) {
91
+			$this->deleteIP($ipAddressList);
92
+		}
77 93
 
78 94
 		$this->setMessage(Context::getLang('success_deleted'));
79 95
 
@@ -101,7 +117,9 @@  discard block
 block discarded – undo
101 117
 	 */
102 118
 	function deleteIP($ipaddress)
103 119
 	{
104
-		if(!$ipaddress) return;
120
+		if(!$ipaddress) {
121
+			return;
122
+		}
105 123
 
106 124
 		$args = new stdClass;
107 125
 		$args->ipaddress = $ipaddress;
@@ -130,9 +148,13 @@  discard block
 block discarded – undo
130 148
 		foreach($word_list as $word)
131 149
 		{
132 150
 			$args = new stdClass;
133
-			if(trim($word)) $args->word = $word;
151
+			if(trim($word)) {
152
+				$args->word = $word;
153
+			}
134 154
 			$output = executeQuery('spamfilter.insertDeniedWord', $args);
135
-			if(!$output->toBool()) $fail_word .= $word.'<br />';
155
+			if(!$output->toBool()) {
156
+				$fail_word .= $word.'<br />';
157
+			}
136 158
 		}
137 159
 		$output->add('fail_list',$fail_word);
138 160
 		return $output;
@@ -144,7 +166,9 @@  discard block
 block discarded – undo
144 166
 	 */
145 167
 	function deleteWord($word)
146 168
 	{
147
-		if(!$word) return;
169
+		if(!$word) {
170
+			return;
171
+		}
148 172
 		$args = new stdClass;
149 173
 		$args->word = $word;
150 174
 		return executeQuery('spamfilter.deleteDeniedWord', $args);
Please login to merge, or discard this patch.
modules/spamfilter/spamfilter.controller.php 4 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -161,6 +161,8 @@
 block discarded – undo
161 161
 	/**
162 162
 	 * @brief IP registration
163 163
 	 * The registered IP address is considered as a spammer
164
+	 * @param string $ipaddress_list
165
+	 * @param string $description
164 166
 	 */
165 167
 	function insertIP($ipaddress_list, $description = null)
166 168
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  spamfilterController
5
- * @author NAVER ([email protected])
6
- * @brief The controller class for the spamfilter module
7
- */
4
+	 * @class  spamfilterController
5
+	 * @author NAVER ([email protected])
6
+	 * @brief The controller class for the spamfilter module
7
+	 */
8 8
 class spamfilterController extends spamfilter
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function triggerInsertDocument(&$obj)
29 29
 	{
30
-		if($_SESSION['avoid_log']) return new Object();
30
+		if ($_SESSION['avoid_log']) return new Object();
31 31
 		// Check the login status, login information, and permission
32 32
 		$is_logged = Context::get('is_logged');
33 33
 		$logged_info = Context::get('logged_info');
34 34
 		$grant = Context::get('grant');
35 35
 		// In case logged in, check if it is an administrator
36
-		if($is_logged)
36
+		if ($is_logged)
37 37
 		{
38
-			if($logged_info->is_admin == 'Y') return new Object();
39
-			if($grant->manager) return new Object();
38
+			if ($logged_info->is_admin == 'Y') return new Object();
39
+			if ($grant->manager) return new Object();
40 40
 		}
41 41
 
42 42
 		$oFilterModel = getModel('spamfilter');
43 43
 		// Check if the IP is prohibited
44 44
 		$output = $oFilterModel->isDeniedIP();
45
-		if(!$output->toBool()) return $output;
45
+		if (!$output->toBool()) return $output;
46 46
 		// Check if there is a ban on the word
47 47
 		$text = '';
48
-		if($is_logged)
48
+		if ($is_logged)
49 49
 		{
50 50
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags;
51 51
 		}
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags;	
55 55
 		}
56 56
 		$output = $oFilterModel->isDeniedWord($text);
57
-		if(!$output->toBool()) return $output;
57
+		if (!$output->toBool()) return $output;
58 58
 		// Check the specified time beside the modificaiton time
59
-		if($obj->document_srl == 0)
59
+		if ($obj->document_srl == 0)
60 60
 		{
61 61
 			$output = $oFilterModel->checkLimited();
62
-			if(!$output->toBool()) return $output;
62
+			if (!$output->toBool()) return $output;
63 63
 		}
64 64
 		// Save a log
65 65
 		$this->insertLog();
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	function triggerInsertComment(&$obj)
74 74
 	{
75
-		if($_SESSION['avoid_log']) return new Object();
75
+		if ($_SESSION['avoid_log']) return new Object();
76 76
 		// Check the login status, login information, and permission
77 77
 		$is_logged = Context::get('is_logged');
78 78
 		$logged_info = Context::get('logged_info');
79 79
 		$grant = Context::get('grant');
80 80
 		// In case logged in, check if it is an administrator
81
-		if($is_logged)
81
+		if ($is_logged)
82 82
 		{
83
-			if($logged_info->is_admin == 'Y') return new Object();
84
-			if($grant->manager) return new Object();
83
+			if ($logged_info->is_admin == 'Y') return new Object();
84
+			if ($grant->manager) return new Object();
85 85
 		}
86 86
 
87 87
 		$oFilterModel = getModel('spamfilter');
88 88
 		// Check if the IP is prohibited
89 89
 		$output = $oFilterModel->isDeniedIP();
90
-		if(!$output->toBool()) return $output;
90
+		if (!$output->toBool()) return $output;
91 91
 		// Check if there is a ban on the word
92 92
 		$text = '';
93
-		if($is_logged)
93
+		if ($is_logged)
94 94
 		{
95 95
 			$text = $obj->content;
96 96
 		}
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 			$text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage;	
100 100
 		}
101 101
 		$output = $oFilterModel->isDeniedWord($text);
102
-		if(!$output->toBool()) return $output;
102
+		if (!$output->toBool()) return $output;
103 103
 		// If the specified time check is not modified
104
-		if(!$obj->__isupdate)
104
+		if (!$obj->__isupdate)
105 105
 		{
106 106
 			$output = $oFilterModel->checkLimited();
107
-			if(!$output->toBool()) return $output;
107
+			if (!$output->toBool()) return $output;
108 108
 		}
109 109
 		unset($obj->__isupdate);
110 110
 		// Save a log
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function triggerInsertTrackback(&$obj)
120 120
 	{
121
-		if($_SESSION['avoid_log']) return new Object();
121
+		if ($_SESSION['avoid_log']) return new Object();
122 122
 
123 123
 		$oFilterModel = getModel('spamfilter');
124 124
 		// Confirm if the trackbacks have been added more than once to your document
125 125
 		$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
126
-		if(!$output->toBool()) return $output;
126
+		if (!$output->toBool()) return $output;
127 127
 
128 128
 		// Check if the IP is prohibited
129 129
 		$output = $oFilterModel->isDeniedIP();
130
-		if(!$output->toBool()) return $output;
130
+		if (!$output->toBool()) return $output;
131 131
 		// Check if there is a ban on the word
132 132
 		$text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url;
133 133
 		$output = $oFilterModel->isDeniedWord($text);
134
-		if(!$output->toBool()) return $output;
134
+		if (!$output->toBool()) return $output;
135 135
 		// Start Filtering
136 136
 		$oTrackbackModel = getModel('trackback');
137 137
 		$oTrackbackController = getController('trackback');
138 138
 
139
-		list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
140
-		$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
139
+		list($ipA, $ipB, $ipC, $ipD) = explode('.', $_SERVER['REMOTE_ADDR']);
140
+		$ipaddress = $ipA . '.' . $ipB . '.' . $ipC;
141 141
 		// In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it.
142
-		if($obj->title == $obj->excerpt)
142
+		if ($obj->title == $obj->excerpt)
143 143
 		{
144
-			$oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
145
-			$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
146
-			return new Object(-1,'msg_alert_trackback_denied');
144
+			$oTrackbackController->deleteTrackbackSender(60 * 60 * 6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
145
+			$this->insertIP($ipaddress . '.*', 'AUTO-DENIED : trackback.insertTrackback');
146
+			return new Object(-1, 'msg_alert_trackback_denied');
147 147
 		}
148 148
 		// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
149 149
 		/* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 	function insertIP($ipaddress_list, $description = null)
166 166
 	{
167 167
 		$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
168
-		if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
169
-		$ipaddress_list = str_replace("\r","",$ipaddress_list);
170
-		$ipaddress_list = explode("\n",$ipaddress_list);
171
-		foreach($ipaddress_list as $ipaddressValue)
168
+		if (!preg_match($regExr, $ipaddress_list)) return new Object(-1, 'msg_invalid');
169
+		$ipaddress_list = str_replace("\r", "", $ipaddress_list);
170
+		$ipaddress_list = explode("\n", $ipaddress_list);
171
+		foreach ($ipaddress_list as $ipaddressValue)
172 172
 		{
173 173
 			$args = new stdClass();
174
-			preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
175
-			if($ipaddress=trim($matches[1]))
174
+			preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/", $ipaddressValue, $matches);
175
+			if ($ipaddress = trim($matches[1]))
176 176
 			{
177 177
 				$args->ipaddress = $ipaddress;
178
-				if(!$description && $matches[4]) $args->description = $matches[4];
178
+				if (!$description && $matches[4]) $args->description = $matches[4];
179 179
 				else $args->description = $description;
180 180
 			}
181 181
 			$output = executeQuery('spamfilter.insertDeniedIP', $args);
182
-			if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
182
+			if (!$output->toBool()) $fail_list .= $ipaddress . '<br/>';
183 183
 		}
184 184
 
185
-		$output->add('fail_list',$fail_list);
185
+		$output->add('fail_list', $fail_list);
186 186
 		return $output;
187 187
 	}
188 188
 
@@ -191,22 +191,22 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	function triggerSendMessage(&$obj)
193 193
 	{
194
-		if($_SESSION['avoid_log']) return new Object();
194
+		if ($_SESSION['avoid_log']) return new Object();
195 195
 
196 196
 		$logged_info = Context::get('logged_info');
197
-		if($logged_info->is_admin == 'Y') return new Object();
197
+		if ($logged_info->is_admin == 'Y') return new Object();
198 198
 
199 199
 		$oFilterModel = getModel('spamfilter');
200 200
 		// Check if the IP is prohibited
201 201
 		$output = $oFilterModel->isDeniedIP();
202
-		if(!$output->toBool()) return $output;
202
+		if (!$output->toBool()) return $output;
203 203
 		// Check if there is a ban on the word
204 204
 		$text = $obj->title . ' ' . $obj->content;
205 205
 		$output = $oFilterModel->isDeniedWord($text);
206
-		if(!$output->toBool()) return $output;
206
+		if (!$output->toBool()) return $output;
207 207
 		// Check the specified time
208 208
 		$output = $oFilterModel->checkLimited(TRUE);
209
-		if(!$output->toBool()) return $output;
209
+		if (!$output->toBool()) return $output;
210 210
 		// Save a log
211 211
 		$this->insertLog();
212 212
 
Please login to merge, or discard this patch.
Braces   +76 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function triggerInsertDocument(&$obj)
29 29
 	{
30
-		if($_SESSION['avoid_log']) return new Object();
30
+		if($_SESSION['avoid_log']) {
31
+			return new Object();
32
+		}
31 33
 		// Check the login status, login information, and permission
32 34
 		$is_logged = Context::get('is_logged');
33 35
 		$logged_info = Context::get('logged_info');
@@ -35,31 +37,40 @@  discard block
 block discarded – undo
35 37
 		// In case logged in, check if it is an administrator
36 38
 		if($is_logged)
37 39
 		{
38
-			if($logged_info->is_admin == 'Y') return new Object();
39
-			if($grant->manager) return new Object();
40
+			if($logged_info->is_admin == 'Y') {
41
+				return new Object();
42
+			}
43
+			if($grant->manager) {
44
+				return new Object();
45
+			}
40 46
 		}
41 47
 
42 48
 		$oFilterModel = getModel('spamfilter');
43 49
 		// Check if the IP is prohibited
44 50
 		$output = $oFilterModel->isDeniedIP();
45
-		if(!$output->toBool()) return $output;
51
+		if(!$output->toBool()) {
52
+			return $output;
53
+		}
46 54
 		// Check if there is a ban on the word
47 55
 		$text = '';
48 56
 		if($is_logged)
49 57
 		{
50 58
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags;
51
-		}
52
-		else
59
+		} else
53 60
 		{
54 61
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags;	
55 62
 		}
56 63
 		$output = $oFilterModel->isDeniedWord($text);
57
-		if(!$output->toBool()) return $output;
64
+		if(!$output->toBool()) {
65
+			return $output;
66
+		}
58 67
 		// Check the specified time beside the modificaiton time
59 68
 		if($obj->document_srl == 0)
60 69
 		{
61 70
 			$output = $oFilterModel->checkLimited();
62
-			if(!$output->toBool()) return $output;
71
+			if(!$output->toBool()) {
72
+				return $output;
73
+			}
63 74
 		}
64 75
 		// Save a log
65 76
 		$this->insertLog();
@@ -72,7 +83,9 @@  discard block
 block discarded – undo
72 83
 	 */
73 84
 	function triggerInsertComment(&$obj)
74 85
 	{
75
-		if($_SESSION['avoid_log']) return new Object();
86
+		if($_SESSION['avoid_log']) {
87
+			return new Object();
88
+		}
76 89
 		// Check the login status, login information, and permission
77 90
 		$is_logged = Context::get('is_logged');
78 91
 		$logged_info = Context::get('logged_info');
@@ -80,31 +93,40 @@  discard block
 block discarded – undo
80 93
 		// In case logged in, check if it is an administrator
81 94
 		if($is_logged)
82 95
 		{
83
-			if($logged_info->is_admin == 'Y') return new Object();
84
-			if($grant->manager) return new Object();
96
+			if($logged_info->is_admin == 'Y') {
97
+				return new Object();
98
+			}
99
+			if($grant->manager) {
100
+				return new Object();
101
+			}
85 102
 		}
86 103
 
87 104
 		$oFilterModel = getModel('spamfilter');
88 105
 		// Check if the IP is prohibited
89 106
 		$output = $oFilterModel->isDeniedIP();
90
-		if(!$output->toBool()) return $output;
107
+		if(!$output->toBool()) {
108
+			return $output;
109
+		}
91 110
 		// Check if there is a ban on the word
92 111
 		$text = '';
93 112
 		if($is_logged)
94 113
 		{
95 114
 			$text = $obj->content;
96
-		}
97
-		else
115
+		} else
98 116
 		{
99 117
 			$text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage;	
100 118
 		}
101 119
 		$output = $oFilterModel->isDeniedWord($text);
102
-		if(!$output->toBool()) return $output;
120
+		if(!$output->toBool()) {
121
+			return $output;
122
+		}
103 123
 		// If the specified time check is not modified
104 124
 		if(!$obj->__isupdate)
105 125
 		{
106 126
 			$output = $oFilterModel->checkLimited();
107
-			if(!$output->toBool()) return $output;
127
+			if(!$output->toBool()) {
128
+				return $output;
129
+			}
108 130
 		}
109 131
 		unset($obj->__isupdate);
110 132
 		// Save a log
@@ -118,20 +140,28 @@  discard block
 block discarded – undo
118 140
 	 */
119 141
 	function triggerInsertTrackback(&$obj)
120 142
 	{
121
-		if($_SESSION['avoid_log']) return new Object();
143
+		if($_SESSION['avoid_log']) {
144
+			return new Object();
145
+		}
122 146
 
123 147
 		$oFilterModel = getModel('spamfilter');
124 148
 		// Confirm if the trackbacks have been added more than once to your document
125 149
 		$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
126
-		if(!$output->toBool()) return $output;
150
+		if(!$output->toBool()) {
151
+			return $output;
152
+		}
127 153
 
128 154
 		// Check if the IP is prohibited
129 155
 		$output = $oFilterModel->isDeniedIP();
130
-		if(!$output->toBool()) return $output;
156
+		if(!$output->toBool()) {
157
+			return $output;
158
+		}
131 159
 		// Check if there is a ban on the word
132 160
 		$text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url;
133 161
 		$output = $oFilterModel->isDeniedWord($text);
134
-		if(!$output->toBool()) return $output;
162
+		if(!$output->toBool()) {
163
+			return $output;
164
+		}
135 165
 		// Start Filtering
136 166
 		$oTrackbackModel = getModel('trackback');
137 167
 		$oTrackbackController = getController('trackback');
@@ -165,7 +195,9 @@  discard block
 block discarded – undo
165 195
 	function insertIP($ipaddress_list, $description = null)
166 196
 	{
167 197
 		$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
168
-		if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
198
+		if(!preg_match($regExr,$ipaddress_list)) {
199
+			return new Object(-1, 'msg_invalid');
200
+		}
169 201
 		$ipaddress_list = str_replace("\r","",$ipaddress_list);
170 202
 		$ipaddress_list = explode("\n",$ipaddress_list);
171 203
 		foreach($ipaddress_list as $ipaddressValue)
@@ -175,11 +207,16 @@  discard block
 block discarded – undo
175 207
 			if($ipaddress=trim($matches[1]))
176 208
 			{
177 209
 				$args->ipaddress = $ipaddress;
178
-				if(!$description && $matches[4]) $args->description = $matches[4];
179
-				else $args->description = $description;
210
+				if(!$description && $matches[4]) {
211
+					$args->description = $matches[4];
212
+				} else {
213
+					$args->description = $description;
214
+				}
180 215
 			}
181 216
 			$output = executeQuery('spamfilter.insertDeniedIP', $args);
182
-			if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
217
+			if(!$output->toBool()) {
218
+				$fail_list .= $ipaddress.'<br/>';
219
+			}
183 220
 		}
184 221
 
185 222
 		$output->add('fail_list',$fail_list);
@@ -191,22 +228,32 @@  discard block
 block discarded – undo
191 228
 	 */
192 229
 	function triggerSendMessage(&$obj)
193 230
 	{
194
-		if($_SESSION['avoid_log']) return new Object();
231
+		if($_SESSION['avoid_log']) {
232
+			return new Object();
233
+		}
195 234
 
196 235
 		$logged_info = Context::get('logged_info');
197
-		if($logged_info->is_admin == 'Y') return new Object();
236
+		if($logged_info->is_admin == 'Y') {
237
+			return new Object();
238
+		}
198 239
 
199 240
 		$oFilterModel = getModel('spamfilter');
200 241
 		// Check if the IP is prohibited
201 242
 		$output = $oFilterModel->isDeniedIP();
202
-		if(!$output->toBool()) return $output;
243
+		if(!$output->toBool()) {
244
+			return $output;
245
+		}
203 246
 		// Check if there is a ban on the word
204 247
 		$text = $obj->title . ' ' . $obj->content;
205 248
 		$output = $oFilterModel->isDeniedWord($text);
206
-		if(!$output->toBool()) return $output;
249
+		if(!$output->toBool()) {
250
+			return $output;
251
+		}
207 252
 		// Check the specified time
208 253
 		$output = $oFilterModel->checkLimited(TRUE);
209
-		if(!$output->toBool()) return $output;
254
+		if(!$output->toBool()) {
255
+			return $output;
256
+		}
210 257
 		// Save a log
211 258
 		$this->insertLog();
212 259
 
Please login to merge, or discard this patch.
modules/tag/tag.model.php 4 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * @brief document_srl the import tag
52
+	 * @param stdClass $obj
52 53
 	 */
53 54
 	function getDocumentSrlByTag($obj)
54 55
 	{
@@ -70,6 +71,7 @@  discard block
 block discarded – undo
70 71
 
71 72
 	/**
72 73
 	 * @brief document used in the import tag
74
+	 * @param stdClass $obj
73 75
 	 */
74 76
 	function getDocumentsTagList($obj)
75 77
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  tagModel
5
- * @author NAVER ([email protected])
6
- * @brief tag model class of the module
7
- */
4
+	 * @class  tagModel
5
+	 * @author NAVER ([email protected])
6
+	 * @brief tag model class of the module
7
+	 */
8 8
 class tagModel extends tag
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	function getTagList($obj)
22 22
 	{
23
-		if($obj->mid)
23
+		if ($obj->mid)
24 24
 		{
25 25
 			$oModuleModel = getModel('module');
26 26
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 		// Module_srl passed the array may be a check whether the array
31 31
 		$args = new stdClass;
32
-		if(is_array($obj->module_srl))
32
+		if (is_array($obj->module_srl))
33 33
 		{
34 34
 			$args->module_srl = implode(',', $obj->module_srl);
35 35
 		}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$args->count = $obj->sort_index;
43 43
 
44 44
 		$output = executeQueryArray('tag.getTagList', $args);
45
-		if(!$output->toBool()) return $output;
45
+		if (!$output->toBool()) return $output;
46 46
 
47 47
 		return $output;
48 48
 	}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	function getDocumentSrlByTag($obj)
54 54
 	{
55 55
 		$args = new stdClass;
56
-		if(is_array($obj->module_srl))
56
+		if (is_array($obj->module_srl))
57 57
 		{
58 58
 			$args->module_srl = implode(',', $obj->module_srl);
59 59
 		}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	function getDocumentsTagList($obj)
75 75
 	{
76 76
 		$args = new stdClass;
77
-		if(is_array($obj->document_srl))
77
+		if (is_array($obj->document_srl))
78 78
 		{
79 79
 			$args->document_srl = implode(',', $obj->document_srl);
80 80
 		}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 
86 86
 		$output = executeQueryArray('tag.getDocumentsTagList', $args);
87
-		if(!$output->toBool()) return $output;
87
+		if (!$output->toBool()) return $output;
88 88
 
89 89
 		return $output;
90 90
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	function getTagWithUsedList($obj)
96 96
 	{
97 97
 		$args = new stdClass;
98
-		if(is_array($obj->module_srl))
98
+		if (is_array($obj->module_srl))
99 99
 		{
100 100
 			$args->module_srl = implode(',', $obj->module_srl);
101 101
 		}
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 		$output = $this->getDocumentSrlByTag($args);
109 109
 		$document_srl = array();
110 110
 
111
-		if($output->data)
111
+		if ($output->data)
112 112
 		{
113
-			foreach($output->data as $k => $v) $document_srl[] = $v->document_srl;
113
+			foreach ($output->data as $k => $v) $document_srl[] = $v->document_srl;
114 114
 		}
115 115
 		unset($args);
116 116
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 		if(is_array($obj->module_srl))
33 33
 		{
34 34
 			$args->module_srl = implode(',', $obj->module_srl);
35
-		}
36
-		else
35
+		} else
37 36
 		{
38 37
 			$args->module_srl = $obj->module_srl;
39 38
 		}
@@ -42,7 +41,9 @@  discard block
 block discarded – undo
42 41
 		$args->count = $obj->sort_index;
43 42
 
44 43
 		$output = executeQueryArray('tag.getTagList', $args);
45
-		if(!$output->toBool()) return $output;
44
+		if(!$output->toBool()) {
45
+			return $output;
46
+		}
46 47
 
47 48
 		return $output;
48 49
 	}
@@ -56,8 +57,7 @@  discard block
 block discarded – undo
56 57
 		if(is_array($obj->module_srl))
57 58
 		{
58 59
 			$args->module_srl = implode(',', $obj->module_srl);
59
-		}
60
-		else
60
+		} else
61 61
 		{
62 62
 			$args->module_srl = $obj->module_srl;
63 63
 		}
@@ -77,14 +77,15 @@  discard block
 block discarded – undo
77 77
 		if(is_array($obj->document_srl))
78 78
 		{
79 79
 			$args->document_srl = implode(',', $obj->document_srl);
80
-		}
81
-		else
80
+		} else
82 81
 		{
83 82
 			$args->document_srl = $obj->document_srl;
84 83
 		}
85 84
 
86 85
 		$output = executeQueryArray('tag.getDocumentsTagList', $args);
87
-		if(!$output->toBool()) return $output;
86
+		if(!$output->toBool()) {
87
+			return $output;
88
+		}
88 89
 
89 90
 		return $output;
90 91
 	}
@@ -98,8 +99,7 @@  discard block
 block discarded – undo
98 99
 		if(is_array($obj->module_srl))
99 100
 		{
100 101
 			$args->module_srl = implode(',', $obj->module_srl);
101
-		}
102
-		else
102
+		} else
103 103
 		{
104 104
 			$args->module_srl = $obj->module_srl;
105 105
 		}
@@ -110,7 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
 		if($output->data)
112 112
 		{
113
-			foreach($output->data as $k => $v) $document_srl[] = $v->document_srl;
113
+			foreach($output->data as $k => $v) {
114
+				$document_srl[] = $v->document_srl;
115
+			}
114 116
 		}
115 117
 		unset($args);
116 118
 
Please login to merge, or discard this patch.