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 (#2172)
by
unknown
25:47 queued 17:56
created
modules/menu/menu.admin.controller.php 3 patches
Doc Comments   +23 added lines, -3 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 	/**
247 247
 	 * Delete menu process method
248
-	 * @return void|Object
248
+	 * @return Object|null
249 249
 	 */
250 250
 	function procMenuAdminDelete()
251 251
 	{
@@ -304,6 +304,7 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * Delete menu
306 306
 	 * Delete menu_item and xml cache files
307
+	 * @param string $menu_srl
307 308
 	 * @return Object
308 309
 	 */
309 310
 	function deleteMenu($menu_srl)
@@ -380,6 +381,7 @@  discard block
 block discarded – undo
380 381
 
381 382
 	/**
382 383
 	 * Add an item to the menu, simple version
384
+	 * @param stdClass $request
383 385
 	 * @return void
384 386
 	 */
385 387
 	public function procMenuAdminInsertItem($request = NULL)
@@ -519,6 +521,9 @@  discard block
 block discarded – undo
519 521
 		$this->setMessage('success_registed', 'info');
520 522
 	}
521 523
 
524
+	/**
525
+	 * @param boolean $isProc
526
+	 */
522 527
 	private function _insertMenu(&$request, $isProc)
523 528
 	{
524 529
 		$oDB = DB::getInstance();
@@ -584,6 +589,7 @@  discard block
 block discarded – undo
584 589
 	 * insert module by men create value
585 590
 	 * @request value of client request
586 591
 	 * @args value for menu create
592
+	 * @param stdClass $args
587 593
 	 * @return bool result of create module
588 594
 	 */
589 595
 	private function _insertModule(&$request, &$args)
@@ -641,7 +647,7 @@  discard block
 block discarded – undo
641 647
 
642 648
 	/**
643 649
 	 * Update an item to the menu, simple version
644
-	 * @return void
650
+	 * @return Object|null
645 651
 	 */
646 652
 	public function procMenuAdminUpdateItem()
647 653
 	{
@@ -842,6 +848,7 @@  discard block
 block discarded – undo
842 848
 	/**
843 849
 	 * Delete menu item ( Only include BO )
844 850
 	 * @args menu_srl, menu_item_srl, is_force
851
+	 * @param stdClass $args
845 852
 	 * @return void|Object
846 853
 	 */
847 854
 	public function deleteItem($args)
@@ -990,6 +997,9 @@  discard block
 block discarded – undo
990 997
 		return new Object(0, 'success');
991 998
 	}
992 999
 
1000
+	/**
1001
+	 * @param DB $oDB
1002
+	 */
993 1003
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 1004
 	{
995 1005
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
@@ -1009,7 +1019,7 @@  discard block
 block discarded – undo
1009 1019
 
1010 1020
 	/**
1011 1021
 	 * Move menu items
1012
-	 * @return void
1022
+	 * @return Object|null
1013 1023
 	 */
1014 1024
 	function procMenuAdminMoveItem()
1015 1025
 	{
@@ -1174,6 +1184,9 @@  discard block
 block discarded – undo
1174 1184
 		}
1175 1185
 	}
1176 1186
 
1187
+	/**
1188
+	 * @param string $parentSrl
1189
+	 */
1177 1190
 	private function _copyMenu($menuSrl, $parentSrl, &$originMenu)
1178 1191
 	{
1179 1192
 		$oMenuAdminModel = getAdminModel('menu');
@@ -2182,6 +2195,7 @@  discard block
 block discarded – undo
2182 2195
 	/**
2183 2196
 	 * When copy a menu, button copied also.
2184 2197
 	 * @param $args menuItemInfo with button values
2198
+	 * @param string $insertedMenuItemSrl
2185 2199
 	 */
2186 2200
 	private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo)
2187 2201
 	{
@@ -2222,6 +2236,9 @@  discard block
 block discarded – undo
2222 2236
 		return $copied_info;
2223 2237
 	}
2224 2238
 
2239
+	/**
2240
+	 * @param string $mode
2241
+	 */
2225 2242
 	private function _changeMenuItemSrlInButtonPath($buttonPath, $menuSrl, $menuItemSrl, $mode)
2226 2243
 	{
2227 2244
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
@@ -2231,6 +2248,9 @@  discard block
 block discarded – undo
2231 2248
 		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2232 2249
 	}
2233 2250
 
2251
+	/**
2252
+	 * @param integer $menuSrl
2253
+	 */
2234 2254
 	public function makeHomemenuCacheFile($menuSrl)
2235 2255
 	{
2236 2256
 		$cacheBuff .= sprintf('<?php if(!defined("__XE__")) exit();');
Please login to merge, or discard this patch.
Spacing   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	function __construct() {
59
-		$this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile;
59
+		$this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile;
60 60
 	}
61 61
 
62 62
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new Object(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new Object(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new Object(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new Object(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368 368
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new Object(0,'success_deleted');
378
+		return new Object(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new Object(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new Object(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new Object($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -464,27 +464,27 @@  discard block
 block discarded – undo
464 464
 			$args->is_shortcut = $request->is_shortcut;
465 465
 			$args->url = $request->shortcut_target;
466 466
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
467
+			if (!$args->open_window) $args->open_window = 'N';
468
+			if (!$args->expand) $args->expand = 'N';
469
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
470 470
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
471
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
472 472
 			else $args->name = $request->menu_name;
473 473
 		}
474 474
 		// type is module short cut
475
-		else if(is_numeric($request->shortcut_target))
475
+		else if (is_numeric($request->shortcut_target))
476 476
 		{
477 477
 			// Get original information
478 478
 			$oMenuAdminModel = getAdminModel('menu');
479 479
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
480
-			if(!$itemInfo->menu_item_srl)
480
+			if (!$itemInfo->menu_item_srl)
481 481
 			{
482 482
 				return new Object(-1, 'msg_invalid_request');
483 483
 			}
484 484
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
485 485
 
486 486
 			$args = $itemInfo;
487
-			if(count($args->group_srls) == 0)
487
+			if (count($args->group_srls) == 0)
488 488
 			{
489 489
 				unset($args->group_srls);
490 490
 			}
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
 			$args->url = '#';
505 505
 		}
506 506
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
507
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
508 508
 		else $args->desc = '';
509 509
 
510 510
 		$args->menu_item_srl = getNextSequence();
511
-		$args->listorder = -1*$args->menu_item_srl;
511
+		$args->listorder = -1 * $args->menu_item_srl;
512 512
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
513
+		if (!$output->toBool()) return $output;
514 514
 
515 515
 		$oDB->commit();
516 516
 
@@ -532,46 +532,46 @@  discard block
 block discarded – undo
532 532
 		$args->expand = $request->menu_expand;
533 533
 		$args->is_shortcut = $request->is_shortcut;
534 534
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
535
+		if (!$args->open_window) $args->open_window = 'N';
536
+		if (!$args->expand) $args->expand = 'N';
537
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
538 538
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
539
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
540 540
 		else $args->name = $request->menu_name;
541 541
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
542
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
543 543
 		else $args->desc = '';
544 544
 
545
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
545
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 546
 		{
547 547
 			return new Object(-1, 'msg_invalid_request');
548 548
 		}
549 549
 
550 550
 		// when menu copy, module already copied
551
-		if($isProc)
551
+		if ($isProc)
552 552
 		{
553 553
 			$result = $this->_insertModule($request, $args);
554
-			if(!$result->toBool())
554
+			if (!$result->toBool())
555 555
 			{
556 556
 				return new Object(-1, $result->message);
557 557
 			}
558 558
 		}
559 559
 
560 560
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
561
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
564 564
 
565
-		if(!$request->module_id)
565
+		if (!$request->module_id)
566 566
 		{
567 567
 			return new Object(-1, 'msg_invalid_request');
568 568
 		}
569 569
 
570 570
 		$args->url = $request->module_id;
571 571
 		$args->menu_item_srl = getNextSequence();
572
-		$args->listorder = -1*$args->menu_item_srl;
572
+		$args->listorder = -1 * $args->menu_item_srl;
573 573
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
574
+		if (!$output->toBool()) return $output;
575 575
 
576 576
 		$oDB->commit();
577 577
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		//module create
605 605
 		$site_module_info = Context::get('site_module_info');
606
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
606
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
607 607
 		$cmArgs->browser_title = $args->name;
608 608
 		$cmArgs->menu_srl = $request->menu_srl;
609 609
 		$cmArgs->layout_srl = -1;
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
 		$cmArgs->is_skin_fix = 'N';
612 612
 		$cmArgs->is_mskin_fix = 'N';
613 613
 
614
-		if(Mobile::isMobileEnabled() === true)
614
+		if (Mobile::isMobileEnabled() === true)
615 615
 		{
616 616
 			$cmArgs->use_mobile = 'Y';
617 617
 		}
618 618
 
619 619
 		// if mid is empty, auto create mid
620
-		if(!$request->module_id)
620
+		if (!$request->module_id)
621 621
 		{
622 622
 			$randomMid = $this->_makeRandomMid();
623 623
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		// check already created module instance
628 628
 		$oModuleModel = getModel('module');
629 629
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
630
-		if($output->module_srl)
630
+		if ($output->module_srl)
631 631
 		{
632 632
 			return new Object(-1, 'msg_module_name_exists');
633 633
 		}
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 	{
647 647
 		$request = Context::getRequestVars();
648 648
 
649
-		if(!$request->menu_item_srl || !$request->menu_name)
649
+		if (!$request->menu_item_srl || !$request->menu_name)
650 650
 		{
651 651
 			return new Object(-1, 'msg_invalid_request');
652 652
 		}
653 653
 
654 654
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
655
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
657 657
 
658 658
 		// Get original information
659 659
 		$oMenuAdminModel = getAdminModel('menu');
@@ -661,19 +661,19 @@  discard block
 block discarded – undo
661 661
 		$args = $itemInfo;
662 662
 
663 663
 		// if menu type is module, check exists module and update
664
-		if($itemInfo->is_shortcut == 'Y')
664
+		if ($itemInfo->is_shortcut == 'Y')
665 665
 		{
666 666
 			// type is url
667
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
667
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668 668
 			{
669 669
 				$args->url = $request->shortcut_target;
670 670
 			}
671 671
 			// type is module short cut
672
-			else if(is_numeric($request->shortcut_target))
672
+			else if (is_numeric($request->shortcut_target))
673 673
 			{
674 674
 				// Get new original information
675 675
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
676
-				if(!$newItemInfo->menu_item_srl)
676
+				if (!$newItemInfo->menu_item_srl)
677 677
 				{
678 678
 					return new Object(-1, 'msg_invalid_request');
679 679
 				}
@@ -690,10 +690,10 @@  discard block
 block discarded – undo
690 690
 		{
691 691
 			// check already created module instance
692 692
 			$oModuleModel = getModel('module');
693
-			if($request->module_id != $itemInfo->url)
693
+			if ($request->module_id != $itemInfo->url)
694 694
 			{
695 695
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
696
-				if($output->module_srl)
696
+				if ($output->module_srl)
697 697
 				{
698 698
 					return new Object(-1, 'msg_module_name_exists');
699 699
 				}
@@ -701,13 +701,13 @@  discard block
 block discarded – undo
701 701
 
702 702
 			// if not exist module, return error
703 703
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
704
-			if(!$moduleInfo)
704
+			if (!$moduleInfo)
705 705
 			{
706 706
 				return new Object(-1, 'msg_invalid_request');
707 707
 			}
708 708
 
709 709
 			$moduleInfo->mid = $request->module_id;
710
-			if($request->browser_title)
710
+			if ($request->browser_title)
711 711
 			{
712 712
 				$moduleInfo->browser_title = $request->browser_title;
713 713
 			}
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$args->url = $request->module_id;
717 717
 		}
718 718
 
719
-		if($request->menu_name_key)
719
+		if ($request->menu_name_key)
720 720
 		{
721 721
 			$args->name = $request->menu_name_key;
722 722
 		}
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			$args->name = $request->menu_name;
726 726
 		}
727 727
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
728
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
729 729
 		else $args->desc = '';
730 730
 
731 731
 		unset($args->group_srls);
@@ -753,38 +753,38 @@  discard block
 block discarded – undo
753 753
 
754 754
 		$btnOutput = $this->_uploadButton($args);
755 755
 
756
-		if($btnOutput['normal_btn'])
756
+		if ($btnOutput['normal_btn'])
757 757
 		{
758 758
 			$this->add('normal_btn', $btnOutput['normal_btn']);
759 759
 			$item_info->normal_btn = $btnOutput['normal_btn'];
760 760
 		}
761
-		if($btnOutput['hover_btn'])
761
+		if ($btnOutput['hover_btn'])
762 762
 		{
763 763
 			$this->add('hover_btn', $btnOutput['hover_btn']);
764 764
 			$item_info->hover_btn = $btnOutput['hover_btn'];
765 765
 		}
766
-		if($btnOutput['active_btn'])
766
+		if ($btnOutput['active_btn'])
767 767
 		{
768 768
 			$this->add('active_btn', $btnOutput['active_btn']);
769 769
 			$item_info->active_btn = $btnOutput['active_btn'];
770 770
 		}
771 771
 
772 772
 		// group_srls check
773
-		if(count($item_info->group_srls) == 0)
773
+		if (count($item_info->group_srls) == 0)
774 774
 		{
775 775
 			unset($item_info->group_srls);
776 776
 		}
777 777
 
778 778
 		// Button delete check
779
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
779
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780 780
 		{
781 781
 			$item_info->normal_btn = '';
782 782
 		}
783
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
783
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784 784
 		{
785 785
 			$item_info->hover_btn = '';
786 786
 		}
787
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
787
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788 788
 		{
789 789
 			$item_info->active_btn = '';
790 790
 		}
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		$args->is_force = Context::get('is_force');
825 825
 
826 826
 		$returnObj = $this->deleteItem($args);
827
-		if(is_object($returnObj))
827
+		if (is_object($returnObj))
828 828
 		{
829 829
 			$this->setError($returnObj->error);
830 830
 			$this->setMessage($returnObj->message);
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
 		$args->menu_srl = $itemInfo->menu_srl;
854 854
 
855 855
 		// Display an error that the category cannot be deleted if it has a child node	603
856
-		if($args->is_force != 'Y')
856
+		if ($args->is_force != 'Y')
857 857
 		{
858 858
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
860
-			if($output->data->count > 0)
859
+			if (!$output->toBool()) return $output;
860
+			if ($output->data->count > 0)
861 861
 			{
862 862
 				return new Object(-1001, 'msg_cannot_delete_for_child');
863 863
 			}
@@ -869,22 +869,22 @@  discard block
 block discarded – undo
869 869
 
870 870
 		// check admin menu delete
871 871
 		$oAdmin = getClass('admin');
872
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
872
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873 873
 		{
874 874
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 875
 		}
876 876
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
877
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878 878
 
879 879
 		// get menu properies with child menu
880 880
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
881 881
 		$originMenu = NULL;
882 882
 
883
-		if(is_readable(FileHandler::getRealPath($phpFile)))
883
+		if (is_readable(FileHandler::getRealPath($phpFile)))
884 884
 		{
885 885
 			include(FileHandler::getRealPath($phpFile));
886 886
 
887
-			if(is_array($menu->list))
887
+			if (is_array($menu->list))
888 888
 			{
889 889
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
890 890
 			}
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
895 895
 		$isStartmenuInclude = false;
896 896
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
897
-		if($isStartmenuInclude)
897
+		if ($isStartmenuInclude)
898 898
 		{
899 899
 			return new Object(-1, 'msg_cannot_delete_homemenu');
900 900
 		}
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 
919 919
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
920 920
 	{
921
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
921
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922 922
 		{
923 923
 			$isStartmenuInclude = true;
924 924
 		}
925 925
 
926
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
926
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
927 927
 		{
928
-			foreach($originMenu['list'] AS $key=>$value)
928
+			foreach ($originMenu['list'] AS $key=>$value)
929 929
 			{
930 930
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
931 931
 			}
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		$args->menu_srl = $menuSrl;
940 940
 		$args->menu_item_srl = $node['node_srl'];
941 941
 		$output = executeQuery("menu.deleteMenuItem", $args);
942
-		if(!$output->toBool())
942
+		if (!$output->toBool())
943 943
 		{
944 944
 			$oDB->rollback();
945 945
 			return $output;
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 		// Update the xml file and get its location
949 949
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 950
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
951
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
954 954
 
955 955
 		// Delete module
956
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
956
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957 957
 		{
958 958
 			$oModuleController = getController('module');
959 959
 			$oModuleModel = getModel('module');
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 			$args->site_srl = $menuInfo->site_srl;
964 964
 			$args->is_shortcut = 'Y';
965 965
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
966
-			if($output->data->menu_item_srl)
966
+			if ($output->data->menu_item_srl)
967 967
 			{
968 968
 				$output->data->url = '';
969 969
 				$referenceItem = $output->data;
970 970
 				$output = $this->_updateMenuItem($referenceItem);
971
-				if(!$output->toBool())
971
+				if (!$output->toBool())
972 972
 				{
973 973
 					$oDB->rollback();
974 974
 					return $output;
@@ -976,10 +976,10 @@  discard block
 block discarded – undo
976 976
 			}
977 977
 
978 978
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
979
-			if($moduleInfo->module_srl)
979
+			if ($moduleInfo->module_srl)
980 980
 			{
981 981
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
982
-				if(!$output->toBool())
982
+				if (!$output->toBool())
983 983
 				{
984 984
 					$oDB->rollback();
985 985
 					return $output;
@@ -992,14 +992,14 @@  discard block
 block discarded – undo
992 992
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
993 993
 	{
994 994
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
995
-		if(!$output->toBool())
995
+		if (!$output->toBool())
996 996
 		{
997 997
 			return new Object(-1, $output->message);
998 998
 		}
999 999
 
1000
-		if(is_array($node['list']))
1000
+		if (is_array($node['list']))
1001 1001
 		{
1002
-			foreach($node['list'] AS $key=>$value)
1002
+			foreach ($node['list'] AS $key=>$value)
1003 1003
 			{
1004 1004
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1005 1005
 			}
@@ -1012,31 +1012,31 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	function procMenuAdminMoveItem()
1014 1014
 	{
1015
-		$mode = Context::get('mode');	//move
1016
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1017
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1015
+		$mode = Context::get('mode'); //move
1016
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1017
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1018
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1019 1019
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1020
+		if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request');
1021 1021
 
1022 1022
 		$oMenuAdminModel = getAdminModel('menu');
1023 1023
 
1024 1024
 		// get original menu item info for cache file recreate
1025 1025
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1026
-		if(!$originalItemInfo->menu_item_srl)
1026
+		if (!$originalItemInfo->menu_item_srl)
1027 1027
 		{
1028 1028
 			return new Object(-1, 'msg_empty_menu_item');
1029 1029
 		}
1030 1030
 
1031 1031
 		// get menu properies with child menu
1032
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1032
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033 1033
 		$originMenu = NULL;
1034 1034
 
1035
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1035
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1036 1036
 		{
1037 1037
 			include(FileHandler::getRealPath($phpFile));
1038 1038
 
1039
-			if(is_array($menu->list))
1039
+			if (is_array($menu->list))
1040 1040
 			{
1041 1041
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1042 1042
 			}
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 		// get target menu info for move
1046 1046
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1047 1047
 		// if move in same sitemap
1048
-		if($targetMenuItemInfo->menu_item_srl)
1048
+		if ($targetMenuItemInfo->menu_item_srl)
1049 1049
 		{
1050 1050
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1051 1051
 		}
@@ -1057,20 +1057,20 @@  discard block
 block discarded – undo
1057 1057
 			$parent_srl = 0;
1058 1058
 		}
1059 1059
 
1060
-		if(!$this->homeModuleMid)
1060
+		if (!$this->homeModuleMid)
1061 1061
 		{
1062 1062
 			$oModuleModel = getModel('module');
1063 1063
 			$oMenuAdminController = getAdminController('menu');
1064 1064
 			$columnList = array('modules.mid',);
1065 1065
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1066
-			if($output->mid)
1066
+			if ($output->mid)
1067 1067
 			{
1068 1068
 				$this->homeModuleMid = $output->mid;
1069 1069
 			}
1070 1070
 		}
1071 1071
 
1072 1072
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1073
-		if(count($originMenu['list']) > 0)
1073
+		if (count($originMenu['list']) > 0)
1074 1074
 		{
1075 1075
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1076 1076
 		}
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1086 1086
 	{
1087
-		if(is_array($node))
1087
+		if (is_array($node))
1088 1088
 		{
1089
-			foreach($node AS $key=>$node)
1089
+			foreach ($node AS $key=>$node)
1090 1090
 			{
1091 1091
 				$args = new stdClass();
1092 1092
 				$args->menu_srl = $menu_srl;
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
 				$output = $this->_updateMenuItem($args);
1095 1095
 
1096 1096
 				//module's menu_srl move also
1097
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1097
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1098 1098
 				{
1099 1099
 					$oModuleModel = getModel('module');
1100 1100
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1101
-					if($menu_srl != $moduleInfo->menu_srl)
1101
+					if ($menu_srl != $moduleInfo->menu_srl)
1102 1102
 					{
1103 1103
 						$moduleInfo->menu_srl = $menu_srl;
1104 1104
 						$oModuleController = getController('module');
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 					}
1107 1107
 				}
1108 1108
 
1109
-				if(count($node['list']) > 0)
1109
+				if (count($node['list']) > 0)
1110 1110
 				{
1111 1111
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1112 1112
 				}
@@ -1128,21 +1128,21 @@  discard block
 block discarded – undo
1128 1128
 		$menuSrl = $itemInfo->menu_srl;
1129 1129
 
1130 1130
 		// get menu properies with child menu
1131
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1131
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1132 1132
 		$originMenu = NULL;
1133 1133
 
1134
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1134
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1135 1135
 		{
1136 1136
 			include(FileHandler::getRealPath($phpFile));
1137 1137
 
1138
-			if(is_array($menu->list))
1138
+			if (is_array($menu->list))
1139 1139
 			{
1140 1140
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1141 1141
 			}
1142 1142
 		}
1143 1143
 
1144 1144
 		// copy the menu item with recursively
1145
-		if(is_array($originMenu))
1145
+		if (is_array($originMenu))
1146 1146
 		{
1147 1147
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1148 1148
 		}
@@ -1158,15 +1158,15 @@  discard block
 block discarded – undo
1158 1158
 	 */
1159 1159
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1160 1160
 	{
1161
-		if(array_key_exists($menuItemSrl, $menuList))
1161
+		if (array_key_exists($menuItemSrl, $menuList))
1162 1162
 		{
1163 1163
 			$originMenu = $menuList[$menuItemSrl];
1164 1164
 			return;
1165 1165
 		}
1166 1166
 
1167
-		foreach($menuList AS $key=>$value)
1167
+		foreach ($menuList AS $key=>$value)
1168 1168
 		{
1169
-			if(count($value['list']) > 0)
1169
+			if (count($value['list']) > 0)
1170 1170
 			{
1171 1171
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1172 1172
 			}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		// default argument setting
1182 1182
 		$args = new stdClass();
1183 1183
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1184
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1185 1185
 		else $args->parent_srl = $parentSrl;
1186 1186
 		$args->menu_name_key = $originMenu['text'];
1187 1187
 		$args->menu_name = $originMenu['text'];
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
 		$isModuleCopySuccess = false;
1196 1196
 		// if menu have a reference of module instance
1197
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1197
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1198 1198
 		{
1199 1199
 			$oModuleModel = getModel('module');
1200 1200
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1214,22 +1214,22 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 			$args->module_srl = $copiedModuleSrl;
1216 1216
 
1217
-			if($copiedModuleSrl)
1217
+			if ($copiedModuleSrl)
1218 1218
 			{
1219 1219
 				$isModuleCopySuccess = true;
1220 1220
 			}
1221 1221
 		}
1222 1222
 		// if menu type is shortcut
1223
-		else if($menuItemInfo->is_shortcut == 'Y')
1223
+		else if ($menuItemInfo->is_shortcut == 'Y')
1224 1224
 		{
1225 1225
 			$args->shortcut_target = $originMenu['url'];
1226 1226
 			$isModuleCopySuccess = true;
1227 1227
 		}
1228 1228
 
1229
-		if($isModuleCopySuccess)
1229
+		if ($isModuleCopySuccess)
1230 1230
 		{
1231 1231
 			// if have a group permission
1232
-			if($menuItemInfo->group_srls)
1232
+			if ($menuItemInfo->group_srls)
1233 1233
 			{
1234 1234
 				$args->group_srls = $menuItemInfo->group_srls;
1235 1235
 			}
@@ -1243,12 +1243,12 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 			// if have a button, copy a button image also
1245 1245
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1246
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1246
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247 1247
 			{
1248 1248
 				// copy & upate
1249 1249
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1250
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1251
-				if(count($update_item_info->group_srls) == 0)
1250
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1251
+				if (count($update_item_info->group_srls) == 0)
1252 1252
 				{
1253 1253
 					unset($update_item_info->group_srls);
1254 1254
 				}
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
 		// if have a child menu, copy child menu also
1264 1264
 		$childMenu = array_shift($originMenu['list']);
1265
-		if(count($childMenu) > 0)
1265
+		if (count($childMenu) > 0)
1266 1266
 		{
1267 1267
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1268 1268
 		}
@@ -1272,10 +1272,10 @@  discard block
 block discarded – undo
1272 1272
 	{
1273 1273
 		$time = $_SERVER['REQUEST_TIME'];
1274 1274
 		$randomString = "";
1275
-		for($i=0;$i<4;$i++)
1275
+		for ($i = 0; $i < 4; $i++)
1276 1276
 		{
1277 1277
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1278
+			if ($case) $doc = rand(65, 90);
1279 1279
 			else $doc = rand(97, 122);
1280 1280
 
1281 1281
 			$randomString .= chr($doc);
@@ -1299,32 +1299,32 @@  discard block
 block discarded – undo
1299 1299
 		// menu name update
1300 1300
 		$args->menu_srl = $this->menuSrl;
1301 1301
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1302
+		if (!$output->toBool()) return $output;
1303 1303
 
1304 1304
 		$this->map = array();
1305
-		if(is_array($parentKeyList))
1305
+		if (is_array($parentKeyList))
1306 1306
 		{
1307
-			foreach($parentKeyList as $no=>$srl)
1307
+			foreach ($parentKeyList as $no=>$srl)
1308 1308
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1309
+				if ($srl === 0) continue;
1310
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1311 1311
 				$this->map[$srl][] = $no;
1312 1312
 			}
1313 1313
 		}
1314 1314
 
1315 1315
 		$result = array();
1316
-		if(is_array($this->itemKeyList))
1316
+		if (is_array($this->itemKeyList))
1317 1317
 		{
1318
-			foreach($this->itemKeyList as $srl)
1318
+			foreach ($this->itemKeyList as $srl)
1319 1319
 			{
1320
-				if(!$this->checked[$srl])
1320
+				if (!$this->checked[$srl])
1321 1321
 				{
1322 1322
 					$target = new stdClass();
1323 1323
 					$this->checked[$srl] = 1;
1324 1324
 					$target->node = $srl;
1325
-					$target->child= array();
1325
+					$target->child = array();
1326 1326
 
1327
-					while(count($this->map[$srl]))
1327
+					while (count($this->map[$srl]))
1328 1328
 					{
1329 1329
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1330 1330
 					}
@@ -1333,13 +1333,13 @@  discard block
 block discarded – undo
1333 1333
 			}
1334 1334
 		}
1335 1335
 
1336
-		if(is_array($result))
1336
+		if (is_array($result))
1337 1337
 		{
1338 1338
 			$i = 0;
1339
-			foreach($result AS $key=>$node)
1339
+			foreach ($result AS $key=>$node)
1340 1340
 			{
1341
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1342
-				$this->_recursiveMoveMenuItem($node);	//move child node
1341
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1342
+				$this->_recursiveMoveMenuItem($node); //move child node
1343 1343
 				$i = $node->node;
1344 1344
 			}
1345 1345
 		}
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 		$child_node->child = array();
1369 1369
 		$target->child[] = $child_node;
1370 1370
 
1371
-		while(count($this->map[$child_srl]))
1371
+		while (count($this->map[$child_srl]))
1372 1372
 		{
1373 1373
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1374 1374
 		}
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	function _recursiveMoveMenuItem($result)
1384 1384
 	{
1385 1385
 		$i = 0;
1386
-		while(count($result->child))
1386
+		while (count($result->child))
1387 1387
 		{
1388 1388
 			unset($node);
1389 1389
 			$node = array_shift($result->child);
@@ -1403,48 +1403,48 @@  discard block
 block discarded – undo
1403 1403
 	 * @param string $mode 'move' or 'insert'
1404 1404
 	 * @return void
1405 1405
 	 */
1406
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1406
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1407 1407
 	{
1408 1408
 		// Get the original menus
1409 1409
 		$oMenuAdminModel = getAdminModel('menu');
1410 1410
 
1411 1411
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1412
+		if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request');
1413 1413
 		// Move the menu location(change the order menu appears)
1414
-		if($mode == 'move')
1414
+		if ($mode == 'move')
1415 1415
 		{
1416 1416
 			$args = new stdClass();
1417 1417
 			$args->parent_srl = $parent_srl;
1418 1418
 			$args->menu_srl = $menu_srl;
1419 1419
 
1420
-			if($source_srl)
1420
+			if ($source_srl)
1421 1421
 			{
1422 1422
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1424
-				$args->listorder = $source_item->listorder-1;
1423
+				if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request');
1424
+				$args->listorder = $source_item->listorder - 1;
1425 1425
 			}
1426 1426
 			else
1427 1427
 			{
1428 1428
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1430
-				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1429
+				if (!$output->toBool()) return $output;
1430
+				$args->listorder = (int) $output->data->listorder;
1431
+				if (!$args->listorder) $args->listorder = 0;
1432 1432
 			}
1433 1433
 			$args->parent_srl = $parent_srl;
1434 1434
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1435
+			if (!$output->toBool()) return $output;
1436 1436
 
1437 1437
 			$args->parent_srl = $parent_srl;
1438 1438
 			$args->menu_item_srl = $target_srl;
1439 1439
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1440
+			if (!$output->toBool()) return $output;
1441 1441
 
1442 1442
 			//module's menu_srl move also
1443
-			if($isShortcut == 'N' && !empty($url))
1443
+			if ($isShortcut == 'N' && !empty($url))
1444 1444
 			{
1445 1445
 				$oModuleModel = getModel('module');
1446 1446
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1447
-				if($menu_srl != $moduleInfo->menu_srl)
1447
+				if ($menu_srl != $moduleInfo->menu_srl)
1448 1448
 				{
1449 1449
 					$moduleInfo->menu_srl = $menu_srl;
1450 1450
 					$oModuleController = getController('module');
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
 				}
1453 1453
 
1454 1454
 				// change home menu cache file
1455
-				if($url == $this->homeModuleMid)
1455
+				if ($url == $this->homeModuleMid)
1456 1456
 				{
1457
-					if(file_exists($this->homeMenuCacheFile))
1457
+					if (file_exists($this->homeMenuCacheFile))
1458 1458
 					{
1459 1459
 						include($this->homeMenuCacheFile);
1460 1460
 					}
1461
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1461
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462 1462
 					{
1463 1463
 						$this->makeHomemenuCacheFile($menu_srl);
1464 1464
 					}
@@ -1466,13 +1466,13 @@  discard block
 block discarded – undo
1466 1466
 			}
1467 1467
 			// Add a child
1468 1468
 		}
1469
-		elseif($mode == 'insert')
1469
+		elseif ($mode == 'insert')
1470 1470
 		{
1471 1471
 			$args->menu_item_srl = $target_srl;
1472 1472
 			$args->parent_srl = $parent_srl;
1473
-			$args->listorder = -1*getNextSequence();
1473
+			$args->listorder = -1 * getNextSequence();
1474 1474
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1475
+			if (!$output->toBool()) return $output;
1476 1476
 		}
1477 1477
 
1478 1478
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 		// Re-generate the xml file
1498 1498
 		$xml_file = $this->makeXmlFile($menu_srl);
1499 1499
 		// Set return value
1500
-		$this->add('menu_title',$menu_title);
1501
-		$this->add('xml_file',$xml_file);
1500
+		$this->add('menu_title', $menu_title);
1501
+		$this->add('xml_file', $xml_file);
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1512,12 +1512,12 @@  discard block
 block discarded – undo
1512 1512
 		$target = Context::get('target');
1513 1513
 		$target_file = Context::get($target);
1514 1514
 		// Error occurs when the target is neither a uploaded file nor a valid file
1515
-		if(!$menu_srl || !$menu_item_srl)
1515
+		if (!$menu_srl || !$menu_item_srl)
1516 1516
 		{
1517 1517
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1518
 
1519 1519
 		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1520
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1521 1521
 		{
1522 1522
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1523
 		}
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
 		// Move the file to a specific director if the uploaded file meets requirement
1526 1526
 		else
1527 1527
 		{
1528
-			$tmp_arr = explode('.',$target_file['name']);
1529
-			$ext = $tmp_arr[count($tmp_arr)-1];
1528
+			$tmp_arr = explode('.', $target_file['name']);
1529
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1530 1530
 
1531 1531
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1532
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1533
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1534
+			if (!is_dir($path)) FileHandler::makeDir($path);
1535 1535
 
1536 1536
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1537
 			Context::set('filename', $filename);
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
 	{
1565 1565
 		$oModuleModel = getModel('module');
1566 1566
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1567
-		if(is_array($installed_module_list))
1567
+		if (is_array($installed_module_list))
1568 1568
 		{
1569 1569
 			$currentLang = Context::getLangType();
1570 1570
 			$menuList = array();
1571
-			foreach($installed_module_list AS $key=>$value)
1571
+			foreach ($installed_module_list AS $key=>$value)
1572 1572
 			{
1573 1573
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1574
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1575 1575
 				unset($info->menu);
1576 1576
 			}
1577 1577
 		}
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1604
 
1605 1605
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1606
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1608 1608
 		$dbInfo = Context::getDBInfo();
1609 1609
 
1610 1610
 		$args = new stdClass();
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$args->menu_srl = $requestArgs->menu_srl;
1614 1614
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1615 1615
 		//if now page is https...
1616
-		if(strpos($url, 'https') !== false)
1616
+		if (strpos($url, 'https') !== false)
1617 1617
 		{
1618 1618
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619 1619
 		}
@@ -1627,23 +1627,23 @@  discard block
 block discarded – undo
1627 1627
 		$args->hover_btn = '';
1628 1628
 		$args->active_btn = '';
1629 1629
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1630
-		$args->listorder = -1*$args->menu_item_srl;
1630
+		$args->listorder = -1 * $args->menu_item_srl;
1631 1631
 
1632 1632
 		// Check if already exists
1633 1633
 		$oMenuModel = getAdminModel('menu');
1634 1634
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1635 1635
 		// Update if exists
1636
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1636
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1637 1637
 		{
1638 1638
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1639
+			if (!$output->toBool()) return $output;
1640 1640
 		}
1641 1641
 		// Insert if not exist
1642 1642
 		else
1643 1643
 		{
1644
-			$args->listorder = -1*$args->menu_item_srl;
1644
+			$args->listorder = -1 * $args->menu_item_srl;
1645 1645
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1646
+			if (!$output->toBool()) return $output;
1647 1647
 		}
1648 1648
 		// Get information of the menu
1649 1649
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1671,23 +1671,23 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 		// Menu Exposure update
1673 1673
 		// if exposure target is only login user...
1674
-		if(!$exposure)
1674
+		if (!$exposure)
1675 1675
 		{
1676 1676
 			$args->group_srls = '';
1677 1677
 		}
1678 1678
 		else
1679 1679
 		{
1680 1680
 			$exposure = explode(',', $exposure);
1681
-			if(in_array($exposure, array('-1','-3')))
1681
+			if (in_array($exposure, array('-1', '-3')))
1682 1682
 			{
1683 1683
 				$args->group_srls = $exposure;
1684 1684
 			}
1685 1685
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1686
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1687 1687
 		}
1688 1688
 
1689 1689
 		$output = $this->_updateMenuItem($args);
1690
-		if(!$output->toBool())
1690
+		if (!$output->toBool())
1691 1691
 		{
1692 1692
 			return $output;
1693 1693
 		}
@@ -1701,21 +1701,21 @@  discard block
 block discarded – undo
1701 1701
 		$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
1702 1702
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1703 1703
 
1704
-		if($itemInfo->is_shortcut === 'Y')
1704
+		if ($itemInfo->is_shortcut === 'Y')
1705 1705
 		{
1706 1706
 			$moduleGrnatsArgs = new stdClass;
1707 1707
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1708
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1709
+			if (!$output->data) $output->data = array();
1710 1710
 			$moduleGrnats = new stdClass();
1711
-			foreach($output->data as $grant)
1711
+			foreach ($output->data as $grant)
1712 1712
 			{
1713 1713
 				$moduleGrnats->{$grant->name}[] = $grant->group_srl;
1714 1714
 			}
1715 1715
 		}
1716 1716
 
1717 1717
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1718
+		if (!$grantList) $grantList = new stdClass;
1719 1719
 
1720 1720
 		$grantList->access = new stdClass();
1721 1721
 		$grantList->access->default = 'guest';
@@ -1723,14 +1723,14 @@  discard block
 block discarded – undo
1723 1723
 		$grantList->manager->default = 'manager';
1724 1724
 
1725 1725
 		$grant = new stdClass();
1726
-		foreach($grantList AS $grantName=>$grantInfo)
1726
+		foreach ($grantList AS $grantName=>$grantInfo)
1727 1727
 		{
1728
-			if($htPerm[$grantName])
1728
+			if ($htPerm[$grantName])
1729 1729
 			{
1730 1730
 				$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1731 1731
 
1732 1732
 				// users in a particular group
1733
-				if(is_array($htPerm[$grantName]))
1733
+				if (is_array($htPerm[$grantName]))
1734 1734
 				{
1735 1735
 					$grant->{$grantName} = $htPerm[$grantName];
1736 1736
 					continue;
@@ -1742,13 +1742,13 @@  discard block
 block discarded – undo
1742 1742
 					continue;
1743 1743
 				}
1744 1744
 			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1745
+			else if ($itemInfo->is_shortcut === 'Y')
1746 1746
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1747
+				if (isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1748 1748
 			}
1749 1749
 		}
1750 1750
 
1751
-		if(count($grant))
1751
+		if (count($grant))
1752 1752
 		{
1753 1753
 			$oModuleController = getController('module');
1754 1754
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	function makeXmlFile($menu_srl)
1767 1767
 	{
1768 1768
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1769
+		if (!$menu_srl) return;
1770 1770
 		// Get menu informaton
1771 1771
 		$args = new stdClass();
1772 1772
 		$args->menu_srl = $menu_srl;
1773 1773
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1775
-		$site_srl = (int)$output->data->site_srl;
1774
+		if (!$output->toBool() || !$output->data) return $output;
1775
+		$site_srl = (int) $output->data->site_srl;
1776 1776
 
1777
-		if($site_srl)
1777
+		if ($site_srl)
1778 1778
 		{
1779 1779
 			$oModuleModel = getModel('module');
1780 1780
 			$columnList = array('sites.domain');
@@ -1785,13 +1785,13 @@  discard block
 block discarded – undo
1785 1785
 		$args->menu_srl = $menu_srl;
1786 1786
 		$args->sort_index = 'listorder';
1787 1787
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1788
+		if (!$output->toBool()) return;
1789 1789
 		// Specify the name of the cache file
1790
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1790
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1791
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1792 1792
 		// If no data found, generate an XML file without node data
1793 1793
 		$list = $output->data;
1794
-		if(!$list)
1794
+		if (!$list)
1795 1795
 		{
1796 1796
 			$xml_buff = "<root />";
1797 1797
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1799,10 +1799,10 @@  discard block
 block discarded – undo
1799 1799
 			return $xml_file;
1800 1800
 		}
1801 1801
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1802
+		if (!is_array($list)) $list = array($list);
1803 1803
 		// Create a tree for loop
1804 1804
 		$list_count = count($list);
1805
-		for($i=0;$i<$list_count;$i++)
1805
+		for ($i = 0; $i < $list_count; $i++)
1806 1806
 		{
1807 1807
 			$node = $list[$i];
1808 1808
 			$menu_item_srl = $node->menu_item_srl;
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
 		$php_buff = sprintf(
1859 1859
 			'<?php '.
1860 1860
 			'if(!defined("__XE__")) exit(); '.
1861
-			'$menu = new stdClass();' .
1861
+			'$menu = new stdClass();'.
1862 1862
 			'%s; '.
1863 1863
 			'%s; '.
1864 1864
 			'$menu->list = array(%s); '.
@@ -1887,26 +1887,26 @@  discard block
 block discarded – undo
1887 1887
 	 */
1888 1888
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1889
 	{
1890
-		if(!$source_node) return;
1890
+		if (!$source_node) return;
1891 1891
 
1892 1892
 		$oMenuAdminModel = getAdminModel('menu');
1893 1893
 
1894
-		foreach($source_node as $menu_item_srl => $node)
1894
+		foreach ($source_node as $menu_item_srl => $node)
1895 1895
 		{
1896 1896
 			$child_buff = "";
1897 1897
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1898
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1899 1899
 			// List variables
1900 1900
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901
-			foreach($names as $key => $val)
1901
+			foreach ($names as $key => $val)
1902 1902
 			{
1903
-				$name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1903
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1904 1904
 			}
1905 1905
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1906 1906
 
1907
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1908
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1909
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1907
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1908
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1909
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 1910
 			{
1911 1911
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1912 1912
 			}
@@ -1916,21 +1916,21 @@  discard block
 block discarded – undo
1916 1916
 			$expand = $node->expand;
1917 1917
 
1918 1918
 			$normal_btn = $node->normal_btn;
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1919
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1920 1920
 			else $normal_btn = '';
1921 1921
 			$hover_btn = $node->hover_btn;
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1922
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1923 1923
 			else $hover_btn = '';
1924 1924
 			$active_btn = $node->active_btn;
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1925
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1926 1926
 			else $active_btn = '';
1927 1927
 
1928 1928
 			$group_srls = $node->group_srls;
1929 1929
 
1930
-			if($normal_btn)
1930
+			if ($normal_btn)
1931 1931
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1932
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1934 1934
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935 1935
 			}
1936 1936
 			else
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
 				$link = '<?php print $_names[$lang_type]; ?>';
1939 1939
 			}
1940 1940
 			// If the value of node->group_srls exists
1941
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1941
+			if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1942 1942
 			else $group_check_code = "true";
1943 1943
 			$attribute = sprintf(
1944 1944
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
@@ -1962,8 +1962,8 @@  discard block
 block discarded – undo
1962 1962
 				$link
1963 1963
 			);
1964 1964
 
1965
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
-			else $buff .=  sprintf('<node %s />', $attribute);
1965
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
+			else $buff .= sprintf('<node %s />', $attribute);
1967 1967
 		}
1968 1968
 		return $buff;
1969 1969
 	}
@@ -1982,84 +1982,84 @@  discard block
 block discarded – undo
1982 1982
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1983 1983
 	{
1984 1984
 		$output = array("buff"=>"", "url_list"=>array());
1985
-		if(!$source_node) return $output;
1985
+		if (!$source_node) return $output;
1986 1986
 
1987 1987
 		$oMenuAdminModel = getAdminModel('menu');
1988 1988
 
1989
-		foreach($source_node as $menu_item_srl => $node)
1989
+		foreach ($source_node as $menu_item_srl => $node)
1990 1990
 		{
1991 1991
 			// Get data from child nodes if exist.
1992
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1992
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1993 1993
 			else $child_output = array("buff"=>"", "url_list"=>array());
1994 1994
 
1995 1995
 			// List variables
1996 1996
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1997 1997
 			unset($name_arr_str);
1998
-			foreach($names as $key => $val)
1998
+			foreach ($names as $key => $val)
1999 1999
 			{
2000
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2000
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2001 2001
 				{
2002 2002
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2003 2003
 				}
2004 2004
 				else
2005 2005
 				{
2006
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2006
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val)));
2007 2007
 				}
2008 2008
 			}
2009 2009
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2010 2010
 
2011 2011
 			// If url value is not empty in the current node, put the value into an array url_list
2012
-			if($node->url) $child_output['url_list'][] = $node->url;
2012
+			if ($node->url) $child_output['url_list'][] = $node->url;
2013 2013
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2014 2014
 			// If node->group_srls value exists
2015
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2015
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
2016 2016
 			else $group_check_code = "true";
2017 2017
 
2018 2018
 			// List variables
2019
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2020
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2021
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2022
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2019
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2020
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2021
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2022
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2023 2023
 			{
2024 2024
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2025 2025
 			}
2026 2026
 			else $href = sprintf('"%s"', $url);
2027 2027
 			$is_shortcut = $node->is_shortcut;
2028 2028
 			$open_window = $node->open_window;
2029
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2030
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2031
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2029
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2030
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2031
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2032 2032
 
2033
-			foreach($child_output['url_list'] as $key =>$val)
2033
+			foreach ($child_output['url_list'] as $key =>$val)
2034 2034
 			{
2035 2035
 				$child_output['url_list'][$key] = addslashes($val);
2036 2036
 			}
2037 2037
 
2038
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2038
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2039 2039
 			$child_buff = $child_output['buff'];
2040 2040
 			$expand = $node->expand;
2041 2041
 
2042 2042
 			$normal_btn = $node->normal_btn;
2043
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2043
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2044 2044
 			else $normal_btn = '';
2045 2045
 
2046 2046
 			$hover_btn = $node->hover_btn;
2047
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2047
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2048 2048
 			else $hover_btn = '';
2049 2049
 
2050 2050
 			$active_btn = $node->active_btn;
2051
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2051
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2052 2052
 			else $active_btn = '';
2053 2053
 
2054 2054
 
2055 2055
 			$group_srls = $node->group_srls;
2056 2056
 
2057
-			if($normal_btn)
2057
+			if ($normal_btn)
2058 2058
 			{
2059
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2059
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2061 2061
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2062
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2062
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2063 2063
 				else $link_active = $link;
2064 2064
 			}
2065 2065
 			else
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 			);
2098 2098
 
2099 2099
 			// Generate buff data
2100
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2100
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2101 2101
 			$output['name'] .= $name_str;
2102 2102
 		}
2103 2103
 		return $output;
@@ -2111,19 +2111,19 @@  discard block
 block discarded – undo
2111 2111
 	 */
2112 2112
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2113 2113
 	{
2114
-		if(!count($menu_srl_list)) return;
2114
+		if (!count($menu_srl_list)) return;
2115 2115
 		// Delete the value of menu_srls
2116
-		$args->menu_srls = implode(',',$menu_srl_list);
2116
+		$args->menu_srls = implode(',', $menu_srl_list);
2117 2117
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2118
-		if(!$output->toBool()) return $output;
2118
+		if (!$output->toBool()) return $output;
2119 2119
 
2120 2120
 		$args->layout_srl = $layout_srl;
2121 2121
 		// Mapping menu_srls, layout_srl
2122
-		for($i=0;$i<count($menu_srl_list);$i++)
2122
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2123 2123
 		{
2124 2124
 			$args->menu_srl = $menu_srl_list[$i];
2125 2125
 			$output = executeQuery('menu.insertMenuLayout', $args);
2126
-			if(!$output->toBool()) return $output;
2126
+			if (!$output->toBool()) return $output;
2127 2127
 		}
2128 2128
 	}
2129 2129
 
@@ -2136,47 +2136,47 @@  discard block
 block discarded – undo
2136 2136
 	{
2137 2137
 		// path setting
2138 2138
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2139
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2139
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2140 2140
 		{
2141 2141
 			FileHandler::makeDir($path);
2142 2142
 		}
2143 2143
 
2144
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2144
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2145 2145
 		{
2146 2146
 			$oMenuModel = getAdminModel('menu');
2147 2147
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2148 2148
 
2149
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2149
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2152 2152
 		}
2153 2153
 
2154 2154
 		$returnArray = array();
2155 2155
 		$date = date('YmdHis');
2156 2156
 		// normal button
2157
-		if($args->menu_normal_btn)
2157
+		if ($args->menu_normal_btn)
2158 2158
 		{
2159
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2160
-			$ext = $tmp_arr[count($tmp_arr)-1];
2159
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2160
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2161 2161
 
2162 2162
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2163 2163
 
2164
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2164
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2165 2165
 			{
2166
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2166
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2167 2167
 				$returnArray ['normal_btn'] = $filename;
2168 2168
 			}
2169 2169
 		}
2170 2170
 
2171 2171
 		// hover button
2172
-		if($args->menu_hover_btn)
2172
+		if ($args->menu_hover_btn)
2173 2173
 		{
2174
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2175
-			$ext = $tmp_arr[count($tmp_arr)-1];
2174
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2175
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2176 2176
 
2177 2177
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2178 2178
 
2179
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2179
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2180 2180
 			{
2181 2181
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2182 2182
 				$returnArray['hover_btn'] = $filename;
@@ -2184,14 +2184,14 @@  discard block
 block discarded – undo
2184 2184
 		}
2185 2185
 
2186 2186
 		// active button
2187
-		if($args->menu_active_btn)
2187
+		if ($args->menu_active_btn)
2188 2188
 		{
2189
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2190
-			$ext = $tmp_arr[count($tmp_arr)-1];
2189
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2190
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2191 2191
 
2192 2192
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2193 2193
 
2194
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2194
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2195 2195
 			{
2196 2196
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2197 2197
 				$returnArray['active_btn'] = $filename;
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
 			"active_btn"=>"",
2214 2214
 		);
2215 2215
 		//normal_btn
2216
-		if($menuItemInfo->normal_btn)
2216
+		if ($menuItemInfo->normal_btn)
2217 2217
 		{
2218 2218
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2219 2219
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2223,7 +2223,7 @@  discard block
 block discarded – undo
2223 2223
 		}
2224 2224
 
2225 2225
 		//hover_btn
2226
-		if($menuItemInfo->hover_btn)
2226
+		if ($menuItemInfo->hover_btn)
2227 2227
 		{
2228 2228
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2229 2229
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 		}
2234 2234
 
2235 2235
 		//active_btn
2236
-		if($menuItemInfo->active_btn)
2236
+		if ($menuItemInfo->active_btn)
2237 2237
 		{
2238 2238
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2239 2239
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2248,9 +2248,9 @@  discard block
 block discarded – undo
2248 2248
 	{
2249 2249
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2250 2250
 		$tmp_arr = explode('.', $buttonPath);
2251
-		$ext = $tmp_arr[count($tmp_arr)-1];
2251
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2252 2252
 		$date = date("YmdHis");
2253
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2253
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2254 2254
 	}
2255 2255
 
2256 2256
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +304 added lines, -134 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new Object(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new Object(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -464,12 +469,21 @@  discard block
 block discarded – undo
464 469
 			$args->is_shortcut = $request->is_shortcut;
465 470
 			$args->url = $request->shortcut_target;
466 471
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
472
+			if(!$args->open_window) {
473
+				$args->open_window = 'N';
474
+			}
475
+			if(!$args->expand) {
476
+				$args->expand = 'N';
477
+			}
478
+			if(!$args->is_shortcut) {
479
+				$args->is_shortcut = 'Y';
480
+			}
470 481
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
-			else $args->name = $request->menu_name;
482
+			if($request->menu_name_key) {
483
+				$args->name = $request->menu_name_key;
484
+			} else {
485
+				$args->name = $request->menu_name;
486
+			}
473 487
 		}
474 488
 		// type is module short cut
475 489
 		else if(is_numeric($request->shortcut_target))
@@ -504,13 +518,18 @@  discard block
 block discarded – undo
504 518
 			$args->url = '#';
505 519
 		}
506 520
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
-		else $args->desc = '';
521
+		if($request->menu_desc) {
522
+			$args->desc = $request->menu_desc;
523
+		} else {
524
+			$args->desc = '';
525
+		}
509 526
 
510 527
 		$args->menu_item_srl = getNextSequence();
511 528
 		$args->listorder = -1*$args->menu_item_srl;
512 529
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
530
+		if(!$output->toBool()) {
531
+			return $output;
532
+		}
514 533
 
515 534
 		$oDB->commit();
516 535
 
@@ -532,15 +551,27 @@  discard block
 block discarded – undo
532 551
 		$args->expand = $request->menu_expand;
533 552
 		$args->is_shortcut = $request->is_shortcut;
534 553
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
554
+		if(!$args->open_window) {
555
+			$args->open_window = 'N';
556
+		}
557
+		if(!$args->expand) {
558
+			$args->expand = 'N';
559
+		}
560
+		if(!$args->is_shortcut) {
561
+			$args->is_shortcut = 'N';
562
+		}
538 563
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
-		else $args->name = $request->menu_name;
564
+		if($request->menu_name_key) {
565
+			$args->name = $request->menu_name_key;
566
+		} else {
567
+			$args->name = $request->menu_name;
568
+		}
541 569
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
-		else $args->desc = '';
570
+		if($request->menu_desc) {
571
+			$args->desc = $request->menu_desc;
572
+		} else {
573
+			$args->desc = '';
574
+		}
544 575
 
545 576
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 577
 		{
@@ -558,9 +589,15 @@  discard block
 block discarded – undo
558 589
 		}
559 590
 
560 591
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
592
+		if($request->normal_btn) {
593
+			$args->normal_btn = $request->normal_btn;
594
+		}
595
+		if($request->hover_btn) {
596
+			$args->hover_btn = $request->hover_btn;
597
+		}
598
+		if($request->active_btn) {
599
+			$args->active_btn = $request->active_btn;
600
+		}
564 601
 
565 602
 		if(!$request->module_id)
566 603
 		{
@@ -571,7 +608,9 @@  discard block
 block discarded – undo
571 608
 		$args->menu_item_srl = getNextSequence();
572 609
 		$args->listorder = -1*$args->menu_item_srl;
573 610
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
611
+		if(!$output->toBool()) {
612
+			return $output;
613
+		}
575 614
 
576 615
 		$oDB->commit();
577 616
 
@@ -652,8 +691,12 @@  discard block
 block discarded – undo
652 691
 		}
653 692
 
654 693
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
694
+		if($request->menu_open_window != "Y") {
695
+			$request->menu_open_window = "N";
696
+		}
697
+		if($request->menu_expand != "Y") {
698
+			$request->menu_expand = "N";
699
+		}
657 700
 
658 701
 		// Get original information
659 702
 		$oMenuAdminModel = getAdminModel('menu');
@@ -680,13 +723,11 @@  discard block
 block discarded – undo
680 723
 
681 724
 				$args->url = $newItemInfo->url;
682 725
 				$args->is_shortcut = 'Y';
683
-			}
684
-			else
726
+			} else
685 727
 			{
686 728
 				$args->url = '#';
687 729
 			}
688
-		}
689
-		else
730
+		} else
690 731
 		{
691 732
 			// check already created module instance
692 733
 			$oModuleModel = getModel('module');
@@ -719,14 +760,16 @@  discard block
 block discarded – undo
719 760
 		if($request->menu_name_key)
720 761
 		{
721 762
 			$args->name = $request->menu_name_key;
722
-		}
723
-		else
763
+		} else
724 764
 		{
725 765
 			$args->name = $request->menu_name;
726 766
 		}
727 767
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
-		else $args->desc = '';
768
+		if($request->menu_desc) {
769
+			$args->desc = $request->menu_desc;
770
+		} else {
771
+			$args->desc = '';
772
+		}
730 773
 
731 774
 		unset($args->group_srls);
732 775
 		$args->open_window = $request->menu_open_window;
@@ -828,8 +871,7 @@  discard block
 block discarded – undo
828 871
 		{
829 872
 			$this->setError($returnObj->error);
830 873
 			$this->setMessage($returnObj->message);
831
-		}
832
-		else
874
+		} else
833 875
 		{
834 876
 			$this->setMessage('success_deleted');
835 877
 		}
@@ -856,7 +898,9 @@  discard block
 block discarded – undo
856 898
 		if($args->is_force != 'Y')
857 899
 		{
858 900
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
901
+			if(!$output->toBool()) {
902
+				return $output;
903
+			}
860 904
 			if($output->data->count > 0)
861 905
 			{
862 906
 				return new Object(-1001, 'msg_cannot_delete_for_child');
@@ -874,7 +918,9 @@  discard block
 block discarded – undo
874 918
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 919
 		}
876 920
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
921
+		if($itemInfo->parent_srl) {
922
+			$parent_srl = $itemInfo->parent_srl;
923
+		}
878 924
 
879 925
 		// get menu properies with child menu
880 926
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -948,9 +994,15 @@  discard block
 block discarded – undo
948 994
 		// Update the xml file and get its location
949 995
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 996
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
997
+		if($node['normal_btn']) {
998
+			FileHandler::removeFile($node['normal_btn']);
999
+		}
1000
+		if($node['hover_btn']) {
1001
+			FileHandler::removeFile($node['hover_btn']);
1002
+		}
1003
+		if($node['active_btn']) {
1004
+			FileHandler::removeFile($node['active_btn']);
1005
+		}
954 1006
 
955 1007
 		// Delete module
956 1008
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1017,7 +1069,9 @@  discard block
 block discarded – undo
1017 1069
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018 1070
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1019 1071
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1072
+		if(!$mode || !$parent_srl || !$target_srl) {
1073
+			return new Object(-1,'msg_invalid_request');
1074
+		}
1021 1075
 
1022 1076
 		$oMenuAdminModel = getAdminModel('menu');
1023 1077
 
@@ -1181,8 +1235,11 @@  discard block
 block discarded – undo
1181 1235
 		// default argument setting
1182 1236
 		$args = new stdClass();
1183 1237
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
-		else $args->parent_srl = $parentSrl;
1238
+		if($parentSrl == 0) {
1239
+			$args->parent_srl = $menuSrl;
1240
+		} else {
1241
+			$args->parent_srl = $parentSrl;
1242
+		}
1186 1243
 		$args->menu_name_key = $originMenu['text'];
1187 1244
 		$args->menu_name = $originMenu['text'];
1188 1245
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1275,8 +1332,11 @@  discard block
 block discarded – undo
1275 1332
 		for($i=0;$i<4;$i++)
1276 1333
 		{
1277 1334
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1279
-			else $doc = rand(97, 122);
1335
+			if($case) {
1336
+				$doc = rand(65, 90);
1337
+			} else {
1338
+				$doc = rand(97, 122);
1339
+			}
1280 1340
 
1281 1341
 			$randomString .= chr($doc);
1282 1342
 		}
@@ -1299,15 +1359,21 @@  discard block
 block discarded – undo
1299 1359
 		// menu name update
1300 1360
 		$args->menu_srl = $this->menuSrl;
1301 1361
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1362
+		if(!$output->toBool()) {
1363
+			return $output;
1364
+		}
1303 1365
 
1304 1366
 		$this->map = array();
1305 1367
 		if(is_array($parentKeyList))
1306 1368
 		{
1307 1369
 			foreach($parentKeyList as $no=>$srl)
1308 1370
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1371
+				if($srl === 0) {
1372
+					continue;
1373
+				}
1374
+				if(!is_array($this->map[$srl])) {
1375
+					$this->map[$srl] = array();
1376
+				}
1311 1377
 				$this->map[$srl][] = $no;
1312 1378
 			}
1313 1379
 		}
@@ -1409,7 +1475,9 @@  discard block
 block discarded – undo
1409 1475
 		$oMenuAdminModel = getAdminModel('menu');
1410 1476
 
1411 1477
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1478
+		if($target_item->menu_item_srl != $target_srl) {
1479
+			return new Object(-1,'msg_invalid_request');
1480
+		}
1413 1481
 		// Move the menu location(change the order menu appears)
1414 1482
 		if($mode == 'move')
1415 1483
 		{
@@ -1420,24 +1488,33 @@  discard block
 block discarded – undo
1420 1488
 			if($source_srl)
1421 1489
 			{
1422 1490
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1491
+				if($source_item->menu_item_srl != $source_srl) {
1492
+					return new Object(-1,'msg_invalid_request');
1493
+				}
1424 1494
 				$args->listorder = $source_item->listorder-1;
1425
-			}
1426
-			else
1495
+			} else
1427 1496
 			{
1428 1497
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1498
+				if(!$output->toBool()) {
1499
+					return $output;
1500
+				}
1430 1501
 				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1502
+				if(!$args->listorder) {
1503
+					$args->listorder= 0;
1504
+				}
1432 1505
 			}
1433 1506
 			$args->parent_srl = $parent_srl;
1434 1507
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1508
+			if(!$output->toBool()) {
1509
+				return $output;
1510
+			}
1436 1511
 
1437 1512
 			$args->parent_srl = $parent_srl;
1438 1513
 			$args->menu_item_srl = $target_srl;
1439 1514
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1515
+			if(!$output->toBool()) {
1516
+				return $output;
1517
+			}
1441 1518
 
1442 1519
 			//module's menu_srl move also
1443 1520
 			if($isShortcut == 'N' && !empty($url))
@@ -1465,14 +1542,15 @@  discard block
 block discarded – undo
1465 1542
 				}
1466 1543
 			}
1467 1544
 			// Add a child
1468
-		}
1469
-		elseif($mode == 'insert')
1545
+		} elseif($mode == 'insert')
1470 1546
 		{
1471 1547
 			$args->menu_item_srl = $target_srl;
1472 1548
 			$args->parent_srl = $parent_srl;
1473 1549
 			$args->listorder = -1*getNextSequence();
1474 1550
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1551
+			if(!$output->toBool()) {
1552
+				return $output;
1553
+			}
1476 1554
 		}
1477 1555
 
1478 1556
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1516,8 +1594,7 @@  discard block
 block discarded – undo
1516 1594
 		{
1517 1595
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1596
 
1519
-		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1597
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521 1598
 		{
1522 1599
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1600
 		}
@@ -1531,7 +1608,9 @@  discard block
 block discarded – undo
1531 1608
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1609
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1610
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1611
+			if(!is_dir($path)) {
1612
+				FileHandler::makeDir($path);
1613
+			}
1535 1614
 
1536 1615
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1616
 			Context::set('filename', $filename);
@@ -1571,7 +1650,9 @@  discard block
 block discarded – undo
1571 1650
 			foreach($installed_module_list AS $key=>$value)
1572 1651
 			{
1573 1652
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1653
+				if($info->menu) {
1654
+					$menuList[$value->module] = $info->menu;
1655
+				}
1575 1656
 				unset($info->menu);
1576 1657
 			}
1577 1658
 		}
@@ -1603,8 +1684,12 @@  discard block
 block discarded – undo
1603 1684
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1685
 
1605 1686
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1687
+		if(empty($url)) {
1688
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1689
+		}
1690
+		if(empty($url)) {
1691
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1692
+		}
1608 1693
 		$dbInfo = Context::getDBInfo();
1609 1694
 
1610 1695
 		$args = new stdClass();
@@ -1616,8 +1701,7 @@  discard block
 block discarded – undo
1616 1701
 		if(strpos($url, 'https') !== false)
1617 1702
 		{
1618 1703
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619
-		}
1620
-		else
1704
+		} else
1621 1705
 		{
1622 1706
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1623 1707
 		}
@@ -1636,14 +1720,18 @@  discard block
 block discarded – undo
1636 1720
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1637 1721
 		{
1638 1722
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1723
+			if(!$output->toBool()) {
1724
+				return $output;
1725
+			}
1640 1726
 		}
1641 1727
 		// Insert if not exist
1642 1728
 		else
1643 1729
 		{
1644 1730
 			$args->listorder = -1*$args->menu_item_srl;
1645 1731
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1732
+			if(!$output->toBool()) {
1733
+				return $output;
1734
+			}
1647 1735
 		}
1648 1736
 		// Get information of the menu
1649 1737
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1674,8 +1762,7 @@  discard block
 block discarded – undo
1674 1762
 		if(!$exposure)
1675 1763
 		{
1676 1764
 			$args->group_srls = '';
1677
-		}
1678
-		else
1765
+		} else
1679 1766
 		{
1680 1767
 			$exposure = explode(',', $exposure);
1681 1768
 			if(in_array($exposure, array('-1','-3')))
@@ -1683,7 +1770,9 @@  discard block
 block discarded – undo
1683 1770
 				$args->group_srls = $exposure;
1684 1771
 			}
1685 1772
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1773
+			if($exposure) {
1774
+				$args->group_srls = implode(',', $exposure);
1775
+			}
1687 1776
 		}
1688 1777
 
1689 1778
 		$output = $this->_updateMenuItem($args);
@@ -1706,7 +1795,9 @@  discard block
 block discarded – undo
1706 1795
 			$moduleGrnatsArgs = new stdClass;
1707 1796
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1797
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1798
+			if(!$output->data) {
1799
+				$output->data = array();
1800
+			}
1710 1801
 			$moduleGrnats = new stdClass();
1711 1802
 			foreach($output->data as $grant)
1712 1803
 			{
@@ -1715,7 +1806,9 @@  discard block
 block discarded – undo
1715 1806
 		}
1716 1807
 
1717 1808
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1809
+		if(!$grantList) {
1810
+			$grantList = new stdClass;
1811
+		}
1719 1812
 
1720 1813
 		$grantList->access = new stdClass();
1721 1814
 		$grantList->access->default = 'guest';
@@ -1741,10 +1834,11 @@  discard block
 block discarded – undo
1741 1834
 					$grant->{$grantName}[] = $htPerm[$grantName];
1742 1835
 					continue;
1743 1836
 				}
1744
-			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1837
+			} else if($itemInfo->is_shortcut === 'Y')
1746 1838
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1839
+				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) {
1840
+					$grant->{$grantName} = $moduleGrnats->{$grantName};
1841
+				}
1748 1842
 			}
1749 1843
 		}
1750 1844
 
@@ -1766,12 +1860,16 @@  discard block
 block discarded – undo
1766 1860
 	function makeXmlFile($menu_srl)
1767 1861
 	{
1768 1862
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1863
+		if(!$menu_srl) {
1864
+			return;
1865
+		}
1770 1866
 		// Get menu informaton
1771 1867
 		$args = new stdClass();
1772 1868
 		$args->menu_srl = $menu_srl;
1773 1869
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1870
+		if(!$output->toBool() || !$output->data) {
1871
+			return $output;
1872
+		}
1775 1873
 		$site_srl = (int)$output->data->site_srl;
1776 1874
 
1777 1875
 		if($site_srl)
@@ -1785,7 +1883,9 @@  discard block
 block discarded – undo
1785 1883
 		$args->menu_srl = $menu_srl;
1786 1884
 		$args->sort_index = 'listorder';
1787 1885
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1886
+		if(!$output->toBool()) {
1887
+			return;
1888
+		}
1789 1889
 		// Specify the name of the cache file
1790 1890
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791 1891
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1799,7 +1899,9 @@  discard block
 block discarded – undo
1799 1899
 			return $xml_file;
1800 1900
 		}
1801 1901
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1902
+		if(!is_array($list)) {
1903
+			$list = array($list);
1904
+		}
1803 1905
 		// Create a tree for loop
1804 1906
 		$list_count = count($list);
1805 1907
 		for($i=0;$i<$list_count;$i++)
@@ -1887,7 +1989,9 @@  discard block
 block discarded – undo
1887 1989
 	 */
1888 1990
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1991
 	{
1890
-		if(!$source_node) return;
1992
+		if(!$source_node) {
1993
+			return;
1994
+		}
1891 1995
 
1892 1996
 		$oMenuAdminModel = getAdminModel('menu');
1893 1997
 
@@ -1895,7 +1999,9 @@  discard block
 block discarded – undo
1895 1999
 		{
1896 2000
 			$child_buff = "";
1897 2001
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2002
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2003
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2004
+			}
1899 2005
 			// List variables
1900 2006
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901 2007
 			foreach($names as $key => $val)
@@ -1909,37 +2015,57 @@  discard block
 block discarded – undo
1909 2015
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 2016
 			{
1911 2017
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2018
+			} else {
2019
+				$href = sprintf('"%s"', $url);
1912 2020
 			}
1913
-			else $href = sprintf('"%s"', $url);
1914 2021
 			$is_shortcut = $node->is_shortcut;
1915 2022
 			$open_window = $node->open_window;
1916 2023
 			$expand = $node->expand;
1917 2024
 
1918 2025
 			$normal_btn = $node->normal_btn;
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1920
-			else $normal_btn = '';
2026
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2027
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2028
+			} else {
2029
+				$normal_btn = '';
2030
+			}
1921 2031
 			$hover_btn = $node->hover_btn;
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1923
-			else $hover_btn = '';
2032
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2033
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2034
+			} else {
2035
+				$hover_btn = '';
2036
+			}
1924 2037
 			$active_btn = $node->active_btn;
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1926
-			else $active_btn = '';
2038
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2039
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2040
+			} else {
2041
+				$active_btn = '';
2042
+			}
1927 2043
 
1928 2044
 			$group_srls = $node->group_srls;
1929 2045
 
1930 2046
 			if($normal_btn)
1931 2047
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2048
+				if($hover_btn) {
2049
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2050
+				} else {
2051
+					$hover_str = '';
2052
+				}
2053
+				if($active_btn) {
2054
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2055
+				} else {
2056
+					$active_str = '';
2057
+				}
1934 2058
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935
-			}
1936
-			else
2059
+			} else
1937 2060
 			{
1938 2061
 				$link = '<?php print $_names[$lang_type]; ?>';
1939 2062
 			}
1940 2063
 			// If the value of node->group_srls exists
1941
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1942
-			else $group_check_code = "true";
2064
+			if($group_srls) {
2065
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
2066
+			} else {
2067
+				$group_check_code = "true";
2068
+			}
1943 2069
 			$attribute = sprintf(
1944 2070
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
1945 2071
 				$menu_item_srl,
@@ -1962,8 +2088,11 @@  discard block
 block discarded – undo
1962 2088
 				$link
1963 2089
 			);
1964 2090
 
1965
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
-			else $buff .=  sprintf('<node %s />', $attribute);
2091
+			if($child_buff) {
2092
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2093
+			} else {
2094
+				$buff .=  sprintf('<node %s />', $attribute);
2095
+			}
1967 2096
 		}
1968 2097
 		return $buff;
1969 2098
 	}
@@ -1982,15 +2111,20 @@  discard block
 block discarded – undo
1982 2111
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1983 2112
 	{
1984 2113
 		$output = array("buff"=>"", "url_list"=>array());
1985
-		if(!$source_node) return $output;
2114
+		if(!$source_node) {
2115
+			return $output;
2116
+		}
1986 2117
 
1987 2118
 		$oMenuAdminModel = getAdminModel('menu');
1988 2119
 
1989 2120
 		foreach($source_node as $menu_item_srl => $node)
1990 2121
 		{
1991 2122
 			// Get data from child nodes if exist.
1992
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1993
-			else $child_output = array("buff"=>"", "url_list"=>array());
2123
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2124
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2125
+			} else {
2126
+				$child_output = array("buff"=>"", "url_list"=>array());
2127
+			}
1994 2128
 
1995 2129
 			// List variables
1996 2130
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -2000,8 +2134,7 @@  discard block
 block discarded – undo
2000 2134
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2001 2135
 				{
2002 2136
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2003
-				}
2004
-				else
2137
+				} else
2005 2138
 				{
2006 2139
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2007 2140
 				}
@@ -2009,11 +2142,16 @@  discard block
 block discarded – undo
2009 2142
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2010 2143
 
2011 2144
 			// If url value is not empty in the current node, put the value into an array url_list
2012
-			if($node->url) $child_output['url_list'][] = $node->url;
2145
+			if($node->url) {
2146
+				$child_output['url_list'][] = $node->url;
2147
+			}
2013 2148
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2014 2149
 			// If node->group_srls value exists
2015
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2016
-			else $group_check_code = "true";
2150
+			if($node->group_srls) {
2151
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2152
+			} else {
2153
+				$group_check_code = "true";
2154
+			}
2017 2155
 
2018 2156
 			// List variables
2019 2157
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2022,8 +2160,9 @@  discard block
 block discarded – undo
2022 2160
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2023 2161
 			{
2024 2162
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2163
+			} else {
2164
+				$href = sprintf('"%s"', $url);
2025 2165
 			}
2026
-			else $href = sprintf('"%s"', $url);
2027 2166
 			$is_shortcut = $node->is_shortcut;
2028 2167
 			$open_window = $node->open_window;
2029 2168
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2040,29 +2179,48 @@  discard block
 block discarded – undo
2040 2179
 			$expand = $node->expand;
2041 2180
 
2042 2181
 			$normal_btn = $node->normal_btn;
2043
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2044
-			else $normal_btn = '';
2182
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2183
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2184
+			} else {
2185
+				$normal_btn = '';
2186
+			}
2045 2187
 
2046 2188
 			$hover_btn = $node->hover_btn;
2047
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2048
-			else $hover_btn = '';
2189
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2190
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2191
+			} else {
2192
+				$hover_btn = '';
2193
+			}
2049 2194
 
2050 2195
 			$active_btn = $node->active_btn;
2051
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2052
-			else $active_btn = '';
2196
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2197
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2198
+			} else {
2199
+				$active_btn = '';
2200
+			}
2053 2201
 
2054 2202
 
2055 2203
 			$group_srls = $node->group_srls;
2056 2204
 
2057 2205
 			if($normal_btn)
2058 2206
 			{
2059
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2207
+				if($hover_btn) {
2208
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2209
+				} else {
2210
+					$hover_str = '';
2211
+				}
2212
+				if($active_btn) {
2213
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2214
+				} else {
2215
+					$active_str = '';
2216
+				}
2061 2217
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2062
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2063
-				else $link_active = $link;
2064
-			}
2065
-			else
2218
+				if($active_btn) {
2219
+					$link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2220
+				} else {
2221
+					$link_active = $link;
2222
+				}
2223
+			} else
2066 2224
 			{
2067 2225
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2068 2226
 			}
@@ -2111,11 +2269,15 @@  discard block
 block discarded – undo
2111 2269
 	 */
2112 2270
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2113 2271
 	{
2114
-		if(!count($menu_srl_list)) return;
2272
+		if(!count($menu_srl_list)) {
2273
+			return;
2274
+		}
2115 2275
 		// Delete the value of menu_srls
2116 2276
 		$args->menu_srls = implode(',',$menu_srl_list);
2117 2277
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2118
-		if(!$output->toBool()) return $output;
2278
+		if(!$output->toBool()) {
2279
+			return $output;
2280
+		}
2119 2281
 
2120 2282
 		$args->layout_srl = $layout_srl;
2121 2283
 		// Mapping menu_srls, layout_srl
@@ -2123,7 +2285,9 @@  discard block
 block discarded – undo
2123 2285
 		{
2124 2286
 			$args->menu_srl = $menu_srl_list[$i];
2125 2287
 			$output = executeQuery('menu.insertMenuLayout', $args);
2126
-			if(!$output->toBool()) return $output;
2288
+			if(!$output->toBool()) {
2289
+				return $output;
2290
+			}
2127 2291
 		}
2128 2292
 	}
2129 2293
 
@@ -2146,9 +2310,15 @@  discard block
 block discarded – undo
2146 2310
 			$oMenuModel = getAdminModel('menu');
2147 2311
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2148 2312
 
2149
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2313
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2314
+				FileHandler::removeFile($itemInfo->normal_btn);
2315
+			}
2316
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2317
+				FileHandler::removeFile($itemInfo->hover_btn);
2318
+			}
2319
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2320
+				FileHandler::removeFile($itemInfo->active_btn);
2321
+			}
2152 2322
 		}
2153 2323
 
2154 2324
 		$returnArray = array();
Please login to merge, or discard this patch.
modules/menu/menu.admin.model.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -579,7 +579,7 @@
 block discarded – undo
579 579
 
580 580
 	/**
581 581
 	 * Get module's detail setup contents
582
-	 * @return void
582
+	 * @return Object|null
583 583
 	 */
584 584
 	public function getMenuAdminDetailSetup()
585 585
 	{
Please login to merge, or discard this patch.
Braces   +72 added lines, -45 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 		// document.getDocumentList query execution
42 42
 		$output = executeQuery('menu.getMenuList', $args);
43 43
 		// Return if no result or an error occurs
44
-		if(!$output->toBool()||!count($output->data)) return $output;
44
+		if(!$output->toBool()||!count($output->data)) {
45
+			return $output;
46
+		}
45 47
 
46 48
 		return $output;
47 49
 	}
@@ -63,7 +65,9 @@  discard block
 block discarded – undo
63 65
 		$args->site_srl = $site_srl ;
64 66
 		$args->menu_srl = $menu_srl;
65 67
 		$output = executeQueryArray('menu.getMenus', $args);
66
-		if(!$output->data) return;
68
+		if(!$output->data) {
69
+			return;
70
+		}
67 71
 		$menus = $output->data;
68 72
 		return $menus;
69 73
 	}
@@ -80,7 +84,9 @@  discard block
 block discarded – undo
80 84
 		$args = new stdClass();
81 85
 		$args->menu_srl = $menu_srl;
82 86
 		$output = executeQuery('menu.getMenu', $args);
83
-		if(!$output->data) return;
87
+		if(!$output->data) {
88
+			return;
89
+		}
84 90
 
85 91
 		$menu_info = $output->data;
86 92
 		$menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_srl);
@@ -105,10 +111,15 @@  discard block
 block discarded – undo
105 111
 		$args->title = $title;
106 112
 		$args->site_srl = $site_srl;
107 113
 		$output = executeQuery('menu.getMenuByTitle', $args);
108
-		if(!$output->data) return;
114
+		if(!$output->data) {
115
+			return;
116
+		}
109 117
 
110
-		if(is_array($output->data)) $menu_info = $output->data[0];
111
-		else $menu_info = $output->data;
118
+		if(is_array($output->data)) {
119
+			$menu_info = $output->data[0];
120
+		} else {
121
+			$menu_info = $output->data;
122
+		}
112 123
 
113 124
 		if($menu_info->menu_srl)
114 125
 		{
@@ -152,15 +163,20 @@  discard block
 block discarded – undo
152 163
 		$output = executeQuery('menu.getMenuItem', $args);
153 164
 		$node = $output->data;
154 165
 		settype($node,'object');
155
-		if($node->group_srls) $node->group_srls = explode(',',$node->group_srls);
156
-		else $node->group_srls = array();
166
+		if($node->group_srls) {
167
+			$node->group_srls = explode(',',$node->group_srls);
168
+		} else {
169
+			$node->group_srls = array();
170
+		}
157 171
 
158 172
 		$tmp_name = unserialize($node->name);
159 173
 		if($tmp_name && count($tmp_name))
160 174
 		{
161 175
 			$selected_lang = array();
162 176
 			$rand_name = $tmp_name[Context::getLangType()];
163
-			if(!$rand_name) $rand_name = array_shift($tmp_name);
177
+			if(!$rand_name) {
178
+				$rand_name = array_shift($tmp_name);
179
+			}
164 180
 			$node->name = $rand_name;
165 181
 		}
166 182
 		return $node;
@@ -178,13 +194,13 @@  discard block
 block discarded – undo
178 194
 		if(!$menuItem->url)
179 195
 		{
180 196
 			$menuItem->moduleType = null;
181
-		}
182
-		else if(strncasecmp('http', $menuItem->url, 4) !== 0)
197
+		} else if(strncasecmp('http', $menuItem->url, 4) !== 0)
183 198
 		{
184 199
 			$oModuleModel = getModel('module');
185 200
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($menuItem->url, 0);
186
-			if(!$moduleInfo) $menuItem->moduleType = 'url';
187
-			else
201
+			if(!$moduleInfo) {
202
+				$menuItem->moduleType = 'url';
203
+			} else
188 204
 			{
189 205
 				if($moduleInfo->mid == $menuItem->url)
190 206
 				{
@@ -193,8 +209,9 @@  discard block
 block discarded – undo
193 209
 					$menuItem->layoutSrl = $moduleInfo->layout_srl;
194 210
 				}
195 211
 			}
212
+		} else {
213
+			$menuItem->moduleType = 'url';
196 214
 		}
197
-		else $menuItem->moduleType = 'url';
198 215
 
199 216
 		// grant setting
200 217
 		if(is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0)
@@ -202,12 +219,10 @@  discard block
 block discarded – undo
202 219
 			if($menuItem->group_srls[0] == -1)
203 220
 			{
204 221
 				$menuItem->grant = 'member';
205
-			}
206
-			else if($menuItem->group_srls[0] == -3)
222
+			} else if($menuItem->group_srls[0] == -3)
207 223
 			{
208 224
 				$menuItem->grant = 'manager';
209
-			}
210
-			else
225
+			} else
211 226
 			{
212 227
 				$menuItem->grant = 'group';
213 228
 			}
@@ -228,11 +243,15 @@  discard block
 block discarded – undo
228 243
 				{
229 244
 					$tmp = $oModuleAdminModel->getLangCode(0, $value->title);
230 245
 					$groupList[$value->group_srl]->title = $tmp[Context::getLangType()];
246
+				} else {
247
+					$groupList[$value->group_srl]->title = $value->title;
231 248
 				}
232
-				else $groupList[$value->group_srl]->title = $value->title;
233 249
 
234
-				if(in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true;
235
-				else $groupList[$value->group_srl]->isChecked = false;
250
+				if(in_array($key, $menuItem->group_srls)) {
251
+					$groupList[$value->group_srl]->isChecked = true;
252
+				} else {
253
+					$groupList[$value->group_srl]->isChecked = false;
254
+				}
236 255
 			}
237 256
 		}
238 257
 		$menuItem->groupList = $groupList;
@@ -305,11 +324,12 @@  discard block
 block discarded – undo
305 324
 			$item_info->parent_srl = $parent_srl;
306 325
 			$item_info->parent_menu_name = $parent_info->name;
307 326
 			// In case of modifying the existing menu or addting a new menu to the root
308
-		}
309
-		else
327
+		} else
310 328
 		{
311 329
 			// Get information of the menu if menu_item_srl exists
312
-			if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl);
330
+			if($menu_item_srl) {
331
+				$item_info = $this->getMenuItemInfo($menu_item_srl);
332
+			}
313 333
 			// Get only menu_item_srl if no values found, considering it as adding a new menu
314 334
 			if(!$item_info->menu_item_srl)
315 335
 			{
@@ -349,7 +369,9 @@  discard block
 block discarded – undo
349 369
 		foreach($_allModules as $module_name)
350 370
 		{
351 371
 			$module = $oModuleModel->getModuleInfoXml($module_name);
352
-			if(!isset($module)) continue;
372
+			if(!isset($module)) {
373
+				continue;
374
+			}
353 375
 			$defaultSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'P');
354 376
 			$defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M');
355 377
 			$skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin);
@@ -379,8 +401,7 @@  discard block
 block discarded – undo
379 401
 				$oModuleInfo->title = $pageTypeName['OUTSIDE'];
380 402
 				$oModuleInfo->no_skin = 'Y';
381 403
 				$allModules['OUTSIDE'] = $oModuleInfo;
382
-			}
383
-			else
404
+			} else
384 405
 			{
385 406
 				$allModules[$module_name] = $module;
386 407
 			}
@@ -414,7 +435,9 @@  discard block
 block discarded – undo
414 435
 
415 436
 		// after trigger
416 437
 		$output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
417
-		if(!$output->toBool()) return $output;
438
+		if(!$output->toBool()) {
439
+			return $output;
440
+		}
418 441
 
419 442
 		$localModuleList = array_unique($moduleList);
420 443
 
@@ -425,7 +448,9 @@  discard block
 block discarded – undo
425 448
 		$remoteModuleList = array();
426 449
 		foreach($remotePackageList as $package)
427 450
 		{
428
-			if(strpos($package->path, './modules/') !== 0) continue;
451
+			if(strpos($package->path, './modules/') !== 0) {
452
+				continue;
453
+			}
429 454
 
430 455
 			$pathInfo = explode('/', $package->path);
431 456
 			$remoteModuleList[] = $pathInfo[2];
@@ -464,8 +489,7 @@  discard block
 block discarded – undo
464 489
 					$oModuleInfo->title = $pageTypeName['OUTSIDE'];
465 490
 					$oModuleInfo->no_skin = 'Y';
466 491
 					$moduleInfoList['OUTSIDE'] = $oModuleInfo;
467
-				}
468
-				else
492
+				} else
469 493
 				{
470 494
 					$moduleInfoList[$value] = $moduleInfo;
471 495
 				}
@@ -497,8 +521,11 @@  discard block
 block discarded – undo
497 521
 			$isMenuFixed = false;
498 522
 			$output = $this->getMenu($menuSrl);
499 523
 			$php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$output->menu_srl);
500
-			if(file_exists($php_file)) include($php_file);
501
-			else $oMenuAdminController->makeXmlFile($menuSrl);
524
+			if(file_exists($php_file)) {
525
+				include($php_file);
526
+			} else {
527
+				$oMenuAdminController->makeXmlFile($menuSrl);
528
+			}
502 529
 
503 530
 			if(count($menu->list)>0)
504 531
 			{
@@ -518,8 +545,7 @@  discard block
 block discarded – undo
518 545
 			$menuItems->title = $output->title;
519 546
 			$menuItems->menuItems = $menu;
520 547
 			$menuList[] = $menuItems;
521
-		}
522
-		else
548
+		} else
523 549
 		{
524 550
 			$menuListFromDB = $this->getMenus($siteSrl);
525 551
 			if(is_array($menuListFromDB))
@@ -527,8 +553,9 @@  discard block
 block discarded – undo
527 553
 				$oAdmin = getClass('admin');
528 554
 				foreach($menuListFromDB AS $key=>$value)
529 555
 				{
530
-					if($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]);
531
-					else
556
+					if($value->title == $oAdmin->getAdminMenuName()) {
557
+						unset($output[$key]);
558
+					} else
532 559
 					{
533 560
 						unset($menu);
534 561
 						unset($menuItems);
@@ -564,8 +591,7 @@  discard block
 block discarded – undo
564 591
 						if($value->menu_srl == $this->menuSrlWithinHome)
565 592
 						{
566 593
 							$menuList[-1] = $menuItems;
567
-						}
568
-						else
594
+						} else
569 595
 						{
570 596
 							$menuList[] = $menuItems;
571 597
 						}
@@ -639,8 +665,11 @@  discard block
 block discarded – undo
639 665
 			$args = new stdClass;
640 666
 			$args->menu_item_srl = $menu['node_srl'];
641 667
 			$args->is_shortcut = 'Y';
642
-			if($menu['menu_name_key']) $args->name = $menu['menu_name_key'];
643
-			else $args->name = $menu['menu_name'];
668
+			if($menu['menu_name_key']) {
669
+				$args->name = $menu['menu_name_key'];
670
+			} else {
671
+				$args->name = $menu['menu_name'];
672
+			}
644 673
 			$output = executeQuery('menu.updateMenuItem', $args);
645 674
 
646 675
 			$isMenuFixed = true;
@@ -661,8 +690,7 @@  discard block
 block discarded – undo
661 690
 				if($midInfo->page_type)
662 691
 				{
663 692
 					$menu['module_type'] = $midInfo->page_type;
664
-				}
665
-				else
693
+				} else
666 694
 				{
667 695
 					$menu['module_type'] = $midInfo->module;
668 696
 				}
@@ -671,8 +699,7 @@  discard block
 block discarded – undo
671 699
 			if($moduleInfo->setup_index_act)
672 700
 			{
673 701
 				$menu['setup_index_act'] = $moduleInfo->setup_index_act;
674
-			}
675
-			else if($moduleInfo->default_index_act)
702
+			} else if($moduleInfo->default_index_act)
676 703
 			{
677 704
 				$menu['setup_index_act'] = $moduleInfo->default_index_act;
678 705
 			}
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function getMenuList($obj)
29 29
 	{
30
-		if(!$obj->site_srl)
30
+		if (!$obj->site_srl)
31 31
 		{
32 32
 			$site_module_info = Context::get('site_module_info');
33
-			$obj->site_srl = (int)$site_module_info->site_srl;
33
+			$obj->site_srl = (int) $site_module_info->site_srl;
34 34
 		}
35 35
 		$args = new stdClass;
36 36
 		$args->site_srl = $obj->site_srl;
37 37
 		$args->sort_index = $obj->sort_index;
38
-		$args->page = $obj->page?$obj->page:1;
39
-		$args->list_count = $obj->list_count?$obj->list_count:20;
40
-		$args->page_count = $obj->page_count?$obj->page_count:10;
38
+		$args->page = $obj->page ? $obj->page : 1;
39
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
40
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
41 41
 		// document.getDocumentList query execution
42 42
 		$output = executeQuery('menu.getMenuList', $args);
43 43
 		// Return if no result or an error occurs
44
-		if(!$output->toBool()||!count($output->data)) return $output;
44
+		if (!$output->toBool() || !count($output->data)) return $output;
45 45
 
46 46
 		return $output;
47 47
 	}
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	function getMenus($site_srl = null)
55 55
 	{
56
-		if(!isset($site_srl))
56
+		if (!isset($site_srl))
57 57
 		{
58 58
 			$site_module_info = Context::get('site_module_info');
59
-			$site_srl = (int)$site_module_info->site_srl;
59
+			$site_srl = (int) $site_module_info->site_srl;
60 60
 		}
61 61
 		// Get information from the DB
62 62
 		$args = new stdClass();
63
-		$args->site_srl = $site_srl ;
63
+		$args->site_srl = $site_srl;
64 64
 		$args->menu_srl = $menu_srl;
65 65
 		$output = executeQueryArray('menu.getMenus', $args);
66
-		if(!$output->data) return;
66
+		if (!$output->data) return;
67 67
 		$menus = $output->data;
68 68
 		return $menus;
69 69
 	}
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		$args = new stdClass();
81 81
 		$args->menu_srl = $menu_srl;
82 82
 		$output = executeQuery('menu.getMenu', $args);
83
-		if(!$output->data) return;
83
+		if (!$output->data) return;
84 84
 
85 85
 		$menu_info = $output->data;
86
-		$menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_srl);
87
-		$menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_srl);
86
+		$menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_srl);
87
+		$menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_srl);
88 88
 		return $menu_info;
89 89
 	}
90 90
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	function getMenuByTitle($title, $site_srl = 0)
98 98
 	{
99 99
 		// Get information from the DB
100
-		if(!is_array($title))
100
+		if (!is_array($title))
101 101
 		{
102 102
 			$title = array($title);
103 103
 		}
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 		$args->title = $title;
106 106
 		$args->site_srl = $site_srl;
107 107
 		$output = executeQuery('menu.getMenuByTitle', $args);
108
-		if(!$output->data) return;
108
+		if (!$output->data) return;
109 109
 
110
-		if(is_array($output->data)) $menu_info = $output->data[0];
110
+		if (is_array($output->data)) $menu_info = $output->data[0];
111 111
 		else $menu_info = $output->data;
112 112
 
113
-		if($menu_info->menu_srl)
113
+		if ($menu_info->menu_srl)
114 114
 		{
115
-			$menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_info->menu_srl);
116
-			$menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_info->menu_srl);
115
+			$menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_info->menu_srl);
116
+			$menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_info->menu_srl);
117 117
 		}
118 118
 		return $menu_info;
119 119
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$args = new stdClass();
131 131
 		$args->title = $title;
132 132
 		$output = executeQueryArray('menu.getMenuByTitle', $args);
133
-		if(!$output->data)
133
+		if (!$output->data)
134 134
 		{
135 135
 			return array();
136 136
 		}
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 		$args->menu_item_srl = $menu_item_srl;
152 152
 		$output = executeQuery('menu.getMenuItem', $args);
153 153
 		$node = $output->data;
154
-		settype($node,'object');
155
-		if($node->group_srls) $node->group_srls = explode(',',$node->group_srls);
154
+		settype($node, 'object');
155
+		if ($node->group_srls) $node->group_srls = explode(',', $node->group_srls);
156 156
 		else $node->group_srls = array();
157 157
 
158 158
 		$tmp_name = unserialize($node->name);
159
-		if($tmp_name && count($tmp_name))
159
+		if ($tmp_name && count($tmp_name))
160 160
 		{
161 161
 			$selected_lang = array();
162 162
 			$rand_name = $tmp_name[Context::getLangType()];
163
-			if(!$rand_name) $rand_name = array_shift($tmp_name);
163
+			if (!$rand_name) $rand_name = array_shift($tmp_name);
164 164
 			$node->name = $rand_name;
165 165
 		}
166 166
 		return $node;
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
 		$menuItemSrl = Context::get('menu_item_srl');
176 176
 		$menuItem = $this->getMenuItemInfo($menuItemSrl);
177 177
 
178
-		if(!$menuItem->url)
178
+		if (!$menuItem->url)
179 179
 		{
180 180
 			$menuItem->moduleType = null;
181 181
 		}
182
-		else if(strncasecmp('http', $menuItem->url, 4) !== 0)
182
+		else if (strncasecmp('http', $menuItem->url, 4) !== 0)
183 183
 		{
184 184
 			$oModuleModel = getModel('module');
185 185
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($menuItem->url, 0);
186
-			if(!$moduleInfo) $menuItem->moduleType = 'url';
186
+			if (!$moduleInfo) $menuItem->moduleType = 'url';
187 187
 			else
188 188
 			{
189
-				if($moduleInfo->mid == $menuItem->url)
189
+				if ($moduleInfo->mid == $menuItem->url)
190 190
 				{
191 191
 					$menuItem->moduleType = $moduleInfo->module;
192 192
 					$menuItem->pageType = $moduleInfo->page_type;
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 		else $menuItem->moduleType = 'url';
198 198
 
199 199
 		// grant setting
200
-		if(is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0)
200
+		if (is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0)
201 201
 		{
202
-			if($menuItem->group_srls[0] == -1)
202
+			if ($menuItem->group_srls[0] == -1)
203 203
 			{
204 204
 				$menuItem->grant = 'member';
205 205
 			}
206
-			else if($menuItem->group_srls[0] == -3)
206
+			else if ($menuItem->group_srls[0] == -3)
207 207
 			{
208 208
 				$menuItem->grant = 'manager';
209 209
 			}
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
 		$oMemberModel = getModel('member');
218 218
 		$oModuleAdminModel = getAdminModel('module');
219 219
 		$output = $oMemberModel->getGroups();
220
-		if(is_array($output))
220
+		if (is_array($output))
221 221
 		{
222 222
 			$groupList = array();
223
-			foreach($output AS $key=>$value)
223
+			foreach ($output AS $key=>$value)
224 224
 			{
225 225
 				$groupList[$value->group_srl] = new stdClass();
226 226
 				$groupList[$value->group_srl]->group_srl = $value->group_srl;
227
-				if(substr($value->title,0,12)=='$user_lang->')
227
+				if (substr($value->title, 0, 12) == '$user_lang->')
228 228
 				{
229 229
 					$tmp = $oModuleAdminModel->getLangCode(0, $value->title);
230 230
 					$groupList[$value->group_srl]->title = $tmp[Context::getLangType()];
231 231
 				}
232 232
 				else $groupList[$value->group_srl]->title = $value->title;
233 233
 
234
-				if(in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true;
234
+				if (in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true;
235 235
 				else $groupList[$value->group_srl]->isChecked = false;
236 236
 			}
237 237
 		}
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	function getMenuItemNames($source_name, $site_srl = null)
271 271
 	{
272
-		if(!$site_srl)
272
+		if (!$site_srl)
273 273
 		{
274 274
 			$site_module_info = Context::get('site_module_info');
275
-			$site_srl = (int)$site_module_info->site_srl;
275
+			$site_srl = (int) $site_module_info->site_srl;
276 276
 		}
277 277
 		// Get language code
278 278
 		$oModuleAdminModel = getAdminModel('module');
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
 		// Add a sub-menu if there is parent_srl but not menu_item_srl
298 298
 		$item_info = new stdClass;
299
-		if(!$menu_item_srl && $parent_srl)
299
+		if (!$menu_item_srl && $parent_srl)
300 300
 		{
301 301
 			// Get information of the parent menu
302 302
 			$parent_info = $this->getMenuItemInfo($parent_srl);
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 		else
310 310
 		{
311 311
 			// Get information of the menu if menu_item_srl exists
312
-			if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl);
312
+			if ($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl);
313 313
 			// Get only menu_item_srl if no values found, considering it as adding a new menu
314
-			if(!$item_info->menu_item_srl)
314
+			if (!$item_info->menu_item_srl)
315 315
 			{
316 316
 				$item_info->menu_item_srl = getNextSequence();
317 317
 			}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		$oTemplate = &TemplateHandler::getInstance();
328 328
 		$tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info');
329 329
 
330
-		$this->add('tpl', str_replace("\n"," ",$tpl));
330
+		$this->add('tpl', str_replace("\n", " ", $tpl));
331 331
 	}
332 332
 
333 333
 	/**
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
 
347 347
 		Context::loadLang('modules/page/lang');
348 348
 
349
-		foreach($_allModules as $module_name)
349
+		foreach ($_allModules as $module_name)
350 350
 		{
351 351
 			$module = $oModuleModel->getModuleInfoXml($module_name);
352
-			if(!isset($module)) continue;
352
+			if (!isset($module)) continue;
353 353
 			$defaultSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'P');
354 354
 			$defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M');
355 355
 			$skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin);
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 			$module->defaultMobileSkin->skin = $defaultMobileSkin;
362 362
 			$module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin;
363 363
 
364
-			$module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name);
365
-			$module->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $module->package_srl;
364
+			$module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/'.$module_name);
365
+			$module->url = _XE_LOCATION_SITE_.'?mid=download&package_srl='.$module->package_srl;
366 366
 
367
-			if($module_name == 'page')
367
+			if ($module_name == 'page')
368 368
 			{
369 369
 				$pageTypeName = Context::getLang('page_type_name');
370 370
 				$module->title = $pageTypeName['ARTICLE'];
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		$moduleList = array('page');
402 402
 
403 403
 		$output = $oModuleModel->getModuleListByInstance($site_srl);
404
-		if(is_array($output->data))
404
+		if (is_array($output->data))
405 405
 		{
406
-			foreach($output->data as $value)
406
+			foreach ($output->data as $value)
407 407
 			{
408
-				if($value->instanceCount > 1)
408
+				if ($value->instanceCount > 1)
409 409
 				{
410 410
 					$moduleList[] = $value->module;
411 411
 				}
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 		// after trigger
416 416
 		$output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
417
-		if(!$output->toBool()) return $output;
417
+		if (!$output->toBool()) return $output;
418 418
 
419 419
 		$localModuleList = array_unique($moduleList);
420 420
 
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 		// get have instance
424 424
 		$remotePackageList = $oAutoinstallModel->getHaveInstance(array('path'));
425 425
 		$remoteModuleList = array();
426
-		foreach($remotePackageList as $package)
426
+		foreach ($remotePackageList as $package)
427 427
 		{
428
-			if(strpos($package->path, './modules/') !== 0) continue;
428
+			if (strpos($package->path, './modules/') !== 0) continue;
429 429
 
430 430
 			$pathInfo = explode('/', $package->path);
431 431
 			$remoteModuleList[] = $pathInfo[2];
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
 
444 444
 		$moduleInfoList = array();
445 445
 		Context::loadLang('modules/page/lang');
446
-		if(is_array($moduleList))
446
+		if (is_array($moduleList))
447 447
 		{
448
-			foreach($moduleList as $value)
448
+			foreach ($moduleList as $value)
449 449
 			{
450 450
 				$moduleInfo = $oModuleModel->getModuleInfoXml($value);
451 451
 
452
-				if($value == 'page')
452
+				if ($value == 'page')
453 453
 				{
454 454
 					$pageTypeName = Context::getLang('page_type_name');
455 455
 					$moduleInfo->title = $pageTypeName['ARTICLE'];
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 		$siteSrl = Context::get('site_srl');
481 481
 		$menuSrl = Context::get('menu_srl');
482 482
 
483
-		if(!isset($siteSrl))
483
+		if (!isset($siteSrl))
484 484
 		{
485 485
 			$site_module_info = Context::get('site_module_info');
486
-			$siteSrl = (int)$site_module_info->site_srl;
486
+			$siteSrl = (int) $site_module_info->site_srl;
487 487
 		}
488 488
 
489 489
 		$oModuleModel = getModel('module');
@@ -492,24 +492,24 @@  discard block
 block discarded – undo
492 492
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
493 493
 
494 494
 		$menuList = array();
495
-		if($menuSrl)
495
+		if ($menuSrl)
496 496
 		{
497 497
 			$isMenuFixed = false;
498 498
 			$output = $this->getMenu($menuSrl);
499
-			$php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$output->menu_srl);
500
-			if(file_exists($php_file)) include($php_file);
499
+			$php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $output->menu_srl);
500
+			if (file_exists($php_file)) include($php_file);
501 501
 			else $oMenuAdminController->makeXmlFile($menuSrl);
502 502
 
503
-			if(count($menu->list)>0)
503
+			if (count($menu->list) > 0)
504 504
 			{
505
-				foreach($menu->list AS $key=>$value)
505
+				foreach ($menu->list AS $key=>$value)
506 506
 				{
507
-					$this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl,$siteSrl);
507
+					$this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl);
508 508
 				}
509 509
 			}
510 510
 
511 511
 			// menu recreate
512
-			if($isMenuFixed)
512
+			if ($isMenuFixed)
513 513
 			{
514 514
 				$oMenuAdminController->makeXmlFile($menuSrl);
515 515
 			}
@@ -522,18 +522,18 @@  discard block
 block discarded – undo
522 522
 		else
523 523
 		{
524 524
 			$menuListFromDB = $this->getMenus($siteSrl);
525
-			if(is_array($menuListFromDB))
525
+			if (is_array($menuListFromDB))
526 526
 			{
527 527
 				$oAdmin = getClass('admin');
528
-				foreach($menuListFromDB AS $key=>$value)
528
+				foreach ($menuListFromDB AS $key=>$value)
529 529
 				{
530
-					if($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]);
530
+					if ($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]);
531 531
 					else
532 532
 					{
533 533
 						unset($menu);
534 534
 						unset($menuItems);
535
-						$value->php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$value->menu_srl);
536
-						if(!file_exists($value->php_file))
535
+						$value->php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $value->menu_srl);
536
+						if (!file_exists($value->php_file))
537 537
 						{
538 538
 							$oMenuAdminController->makeXmlFile($value->menu_srl);
539 539
 						}
@@ -541,16 +541,16 @@  discard block
 block discarded – undo
541 541
 						include($value->php_file);
542 542
 
543 543
 						$isMenuFixed = false;
544
-						if(count($menu->list) > 0)
544
+						if (count($menu->list) > 0)
545 545
 						{
546
-							foreach($menu->list AS $key2=>$value2)
546
+							foreach ($menu->list AS $key2=>$value2)
547 547
 							{
548
-								$this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl,$siteSrl);
548
+								$this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl, $siteSrl);
549 549
 							}
550 550
 						}
551 551
 
552 552
 						// menu recreate
553
-						if($isMenuFixed)
553
+						if ($isMenuFixed)
554 554
 						{
555 555
 							$oMenuAdminController->makeXmlFile($value->menu_srl);
556 556
 						}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 						$menuItems->menuItems = $menu;
562 562
 
563 563
 						// If include home menu, move first
564
-						if($value->menu_srl == $this->menuSrlWithinHome)
564
+						if ($value->menu_srl == $this->menuSrlWithinHome)
565 565
 						{
566 566
 							$menuList[-1] = $menuItems;
567 567
 						}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	public function getMenuAdminDetailSetup()
585 585
 	{
586 586
 		$menuItemSrl = Context::get('menu_item_srl');
587
-		if(!$menuItemSrl)
587
+		if (!$menuItemSrl)
588 588
 		{
589 589
 			return new Object(-1, 'msg_invalid_request');
590 590
 		}
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		$menuItemInfo = $this->getMenuItemInfo($menuItemSrl);
593 593
 
594 594
 		// if menu is shortcut
595
-		if($menuItemInfo->is_shortcut == 'Y')
595
+		if ($menuItemInfo->is_shortcut == 'Y')
596 596
 		{
597 597
 			return new Object(-1, 'msg_invalid_request');
598 598
 		}
@@ -604,18 +604,18 @@  discard block
 block discarded – undo
604 604
 		// get xml info
605 605
 		$moduleConfInfo = $oModuleModel->getModuleInfoXml($moduleInfo->module);
606 606
 
607
-		if($moduleConfInfo->setup_index_act)
607
+		if ($moduleConfInfo->setup_index_act)
608 608
 		{
609 609
 			$setupUrl = getNotEncodedUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl, 'isLayoutDrop', '1');
610 610
 		}
611 611
 
612
-		if($moduleConfInfo->simple_setup_index_act)
612
+		if ($moduleConfInfo->simple_setup_index_act)
613 613
 		{
614 614
 			$oTargetmoduleAdminModel = getAdminModel($moduleInfo->module);
615 615
 			$advancedSetupUrl = getUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl);
616 616
 			$simpleSetupHtml = $oTargetmoduleAdminModel->{$moduleConfInfo->simple_setup_index_act}($moduleInfo->module_srl, $advancedSetupUrl);
617 617
 
618
-			if($simpleSetupHtml)
618
+			if ($simpleSetupHtml)
619 619
 			{
620 620
 				$this->add('simpleSetupHtml', $simpleSetupHtml);
621 621
 			}
@@ -628,18 +628,18 @@  discard block
 block discarded – undo
628 628
 	 * @param array $menu
629 629
 	 * @return void
630 630
 	 */
631
-	private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl,$siteSrl = 0)
631
+	private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl, $siteSrl = 0)
632 632
 	{
633 633
 		$oModuleModel = getModel('module');
634 634
 		// if url is empty and is_shortcut is 'N', change to is_shortcut 'Y'
635
-		if(!$menu['url'] && $menu['is_shortcut'] == 'N')
635
+		if (!$menu['url'] && $menu['is_shortcut'] == 'N')
636 636
 		{
637 637
 			$menu['is_shortcut'] = 'Y';
638 638
 
639 639
 			$args = new stdClass;
640 640
 			$args->menu_item_srl = $menu['node_srl'];
641 641
 			$args->is_shortcut = 'Y';
642
-			if($menu['menu_name_key']) $args->name = $menu['menu_name_key'];
642
+			if ($menu['menu_name_key']) $args->name = $menu['menu_name_key'];
643 643
 			else $args->name = $menu['menu_name'];
644 644
 			$output = executeQuery('menu.updateMenuItem', $args);
645 645
 
@@ -648,17 +648,17 @@  discard block
 block discarded – undo
648 648
 
649 649
 		//if menu type is module menu
650 650
 		//if(!empty($menu['url']) && !preg_match('/^http/i', $menu['url']))
651
-		if($menu['is_shortcut'] != 'Y')
651
+		if ($menu['is_shortcut'] != 'Y')
652 652
 		{
653 653
 			unset($midInfo, $moduleInfo);
654 654
 			$midInfo = $oModuleModel->getModuleInfoByMid($menu['url'], $siteSrl);
655 655
 			$moduleInfo = $oModuleModel->getModuleInfoXml($midInfo->module);
656 656
 
657
-			if($midInfo)
657
+			if ($midInfo)
658 658
 			{
659 659
 				$menu['module_srl'] = $midInfo->module_srl;
660 660
 				$menu['module'] = $midInfo->module;
661
-				if($midInfo->page_type)
661
+				if ($midInfo->page_type)
662 662
 				{
663 663
 					$menu['module_type'] = $midInfo->page_type;
664 664
 				}
@@ -668,16 +668,16 @@  discard block
 block discarded – undo
668 668
 				}
669 669
 			}
670 670
 
671
-			if($moduleInfo->setup_index_act)
671
+			if ($moduleInfo->setup_index_act)
672 672
 			{
673 673
 				$menu['setup_index_act'] = $moduleInfo->setup_index_act;
674 674
 			}
675
-			else if($moduleInfo->default_index_act)
675
+			else if ($moduleInfo->default_index_act)
676 676
 			{
677 677
 				$menu['setup_index_act'] = $moduleInfo->default_index_act;
678 678
 			}
679 679
 
680
-			if($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid)
680
+			if ($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid)
681 681
 			{
682 682
 				$menu['is_start_module'] = true;
683 683
 				$this->menuSrlWithinHome = $menuSrl;
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 			$menu['layout_srl'] = $midInfo->layout_srl;
687 687
 			$menu['browser_title'] = $midInfo->browser_title;
688 688
 		}
689
-		if(count($menu['list']) > 0)
689
+		if (count($menu['list']) > 0)
690 690
 		{
691
-			foreach($menu['list'] as $key=>$value)
691
+			foreach ($menu['list'] as $key=>$value)
692 692
 			{
693 693
 				$this->_menuInfoSetting($menu['list'][$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl);
694 694
 			}
Please login to merge, or discard this patch.
modules/menu/menu.mobile.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@
 block discarded – undo
18 18
 
19 19
 	/**
20 20
 	 * Menu depth arrange
21
+	 * @param integer $depth
21 22
 	 * @return void
22 23
 	 */
23 24
 	function straightenMenu($menu_item, $depth)
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,14 +22,18 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if(!$menu_item['link']) {
26
+			return;
27
+		}
26 28
 		$obj = new stdClass;
27 29
 		$obj->href = $menu_item['href'];
28 30
 		$obj->depth = $depth;
29 31
 		$obj->text = $menu_item['text'];
30 32
 		$obj->open_window = $menu_item['open_window'];
31 33
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
34
+		if(!$menu_item['list']) {
35
+			return;
36
+		}
33 37
 		foreach($menu_item['list'] as $item)
34 38
 		{
35 39
 			$this->straightenMenu($item, $depth+1);
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
59 63
 		}
60 64
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
65
+		if(file_exists($menu_info->php_file)) {
66
+			@include($menu_info->php_file);
67
+		}
62 68
 		if(is_array($menu->list))
63 69
 		{
64 70
 			foreach($menu->list as $menu_item)
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if (!$menu_item['link']) return;
26 26
 		$obj = new stdClass;
27 27
 		$obj->href = $menu_item['href'];
28 28
 		$obj->depth = $depth;
29 29
 		$obj->text = $menu_item['text'];
30 30
 		$obj->open_window = $menu_item['open_window'];
31 31
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
33
-		foreach($menu_item['list'] as $item)
32
+		if (!$menu_item['list']) return;
33
+		foreach ($menu_item['list'] as $item)
34 34
 		{
35
-			$this->straightenMenu($item, $depth+1);
35
+			$this->straightenMenu($item, $depth + 1);
36 36
 		}
37 37
 	}
38 38
 
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 	function dispMenuMenu()
44 44
 	{
45 45
 		$menu_srl = Context::get('menu_srl');
46
-		$oAdminModel =& getAdminModel('menu');
46
+		$oAdminModel = & getAdminModel('menu');
47 47
 		$menu_info = $oAdminModel->getMenu($menu_srl);
48 48
 
49
-		if(!$menu_srl)
49
+		if (!$menu_srl)
50 50
 		{
51 51
 			$oMenuAdminController = getAdminController('menu');
52 52
 			$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
53 53
 
54
-			if(file_exists($homeMenuCacheFile))
54
+			if (file_exists($homeMenuCacheFile))
55 55
 			{
56 56
 				@include($homeMenuCacheFile);
57 57
 			}
58 58
 			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
59 59
 		}
60 60
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
-		if(is_array($menu->list))
61
+		if (file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
+		if (is_array($menu->list))
63 63
 		{
64
-			foreach($menu->list as $menu_item)
64
+			foreach ($menu->list as $menu_item)
65 65
 			{
66 66
 				$this->straightenMenu($menu_item, 0);
67 67
 			}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 		Context::set('menu', $this->result);	
71 71
 
72
-		$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
72
+		$this->setTemplatePath(sprintf("%stpl/", $this->module_path));
73 73
 		$this->setTemplateFile('menu.html');
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
modules/module/module.admin.controller.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -260,6 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
+	/**
264
+	 * @param boolean $isProc
265
+	 */
263 266
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 267
 	{
265 268
 		if(!$isProc)
@@ -938,6 +941,9 @@  discard block
 block discarded – undo
938 941
 
939 942
 	}
940 943
 
944
+	/**
945
+	 * @param string $skinVars
946
+	 */
941 947
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
942 948
 	{
943 949
 		if(!$moduleSrl && !$mid)
Please login to merge, or discard this patch.
Braces   +155 added lines, -79 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if(!$output->toBool()) {
26
+			return $output;
27
+		}
26 28
 
27 29
 		$this->setMessage("success_registed");
28 30
 
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 	function procModuleAdminUpdateCategory()
37 39
 	{
38 40
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
41
+		if(!$output->toBool()) {
42
+			return $output;
43
+		}
40 44
 
41 45
 		$this->setMessage('success_updated');
42 46
 
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
 	function procModuleAdminDeleteCategory()
51 55
 	{
52 56
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
57
+		if(!$output->toBool()) {
58
+			return $output;
59
+		}
54 60
 
55 61
 		$this->setMessage('success_deleted');
56 62
 
@@ -91,8 +97,7 @@  discard block
 block discarded – undo
91 97
 			// Get information of the target module to copy
92 98
 			$module_srl = Context::get('module_srl');
93 99
 			$args = Context::getRequestVars();
94
-		}
95
-		else
100
+		} else
96 101
 		{
97 102
 			$module_srl = $args->module_srl;
98 103
 		}
@@ -107,11 +112,19 @@  discard block
 block discarded – undo
107 112
 		for($i=1;$i<=10;$i++)
108 113
 		{
109 114
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
115
+			if(!$mid) {
116
+				continue;
117
+			}
118
+			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) {
119
+				return new Object(-1, 'msg_limit_mid');
120
+			}
112 121
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
122
+			if(!$mid) {
123
+				continue;
124
+			}
125
+			if($mid && !$browser_title) {
126
+				$browser_title = $mid;
127
+			}
115 128
 			$clones[$mid] = $browser_title;
116 129
 		}
117 130
 		if(count($clones) < 1)
@@ -131,7 +144,9 @@  discard block
 block discarded – undo
131 144
 		$grant = array();
132 145
 		if($output->data)
133 146
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
147
+			foreach($output->data as $val) {
148
+				$grant[$val->name][] = $val->group_srl;
149
+			}
135 150
 		}
136 151
 
137 152
 		// get Extra Vars
@@ -218,11 +233,19 @@  discard block
 block discarded – undo
218 233
 			}
219 234
 
220 235
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
236
+			if(count($grant) > 0) {
237
+				$oModuleController->insertModuleGrants($module_srl, $grant);
238
+			}
239
+			if($extra_vars) {
240
+				$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
241
+			}
223 242
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
243
+			if($moduleSkinVars) {
244
+				$oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
245
+			}
246
+			if($moduleMobileSkinVars) {
247
+				$oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
248
+			}
226 249
 
227 250
 			$triggerObj->moduleSrlList[] = $module_srl;
228 251
 		}
@@ -235,8 +258,7 @@  discard block
 block discarded – undo
235 258
 		{
236 259
 			$message = implode('\n', $errorLog);
237 260
 			$this->setMessage($message);
238
-		}
239
-		else
261
+		} else
240 262
 		{
241 263
 			$message = $lang->success_registed;
242 264
 			$this->setMessage('success_registed');
@@ -262,9 +284,9 @@  discard block
 block discarded – undo
262 284
 
263 285
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 286
 	{
265
-		if(!$isProc)
266
-			return;
267
-		else
287
+		if(!$isProc) {
288
+					return;
289
+		} else
268 290
 		{
269 291
 			return new Object(-1, $msg);
270 292
 		}
@@ -282,7 +304,9 @@  discard block
 block discarded – undo
282 304
 		// Get information of the module
283 305
 		$columnList = array('module_srl', 'module');
284 306
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new Object(-1,'msg_invalid_request');
307
+		if(!$module_info) {
308
+			return new Object(-1,'msg_invalid_request');
309
+		}
286 310
 		// Register Admin ID
287 311
 		$oModuleController->deleteAdminId($module_srl);
288 312
 		$admin_member = Context::get('admin_member');
@@ -292,7 +316,9 @@  discard block
 block discarded – undo
292 316
 			foreach($admin_members as $admin_id)
293 317
 			{
294 318
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
319
+				if(!$admin_id) {
320
+					continue;
321
+				}
296 322
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 323
 			}
298 324
 		}
@@ -318,15 +344,18 @@  discard block
 block discarded – undo
318 344
 				$grant->{$grant_name}[] = $default;
319 345
 				continue;
320 346
 				// users in a particular group
321
-			}
322
-			else
347
+			} else
323 348
 			{
324 349
 				$group_srls = Context::get($grant_name);
325 350
 				if($group_srls)
326 351
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
329
-					else $group_srls = array($group_srls);
352
+					if(strpos($group_srls,'|@|')!==false) {
353
+						$group_srls = explode('|@|',$group_srls);
354
+					} elseif(strpos($group_srls,',')!==false) {
355
+						$group_srls = explode(',',$group_srls);
356
+					} else {
357
+						$group_srls = array($group_srls);
358
+					}
330 359
 					$grant->{$grant_name} = $group_srls;
331 360
 				}
332 361
 				continue;
@@ -338,7 +367,9 @@  discard block
 block discarded – undo
338 367
 		$args = new stdClass();
339 368
 		$args->module_srl = $module_srl;
340 369
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
370
+		if(!$output->toBool()) {
371
+			return $output;
372
+		}
342 373
 		// Permissions stored in the DB
343 374
 		foreach($grant as $grant_name => $group_srls)
344 375
 		{
@@ -349,7 +380,9 @@  discard block
 block discarded – undo
349 380
 				$args->name = $grant_name;
350 381
 				$args->group_srl = $val;
351 382
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
383
+				if(!$output->toBool()) {
384
+					return $output;
385
+				}
353 386
 			}
354 387
 		}
355 388
 		$this->setMessage('success_registed');
@@ -375,19 +408,16 @@  discard block
 block discarded – undo
375 408
 				if($module_info->is_mskin_fix == 'Y')
376 409
 				{
377 410
 					$skin = $module_info->mskin;
378
-				}
379
-				else
411
+				} else
380 412
 				{
381 413
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M');
382 414
 				}
383
-			}
384
-			else
415
+			} else
385 416
 			{
386 417
 				if($module_info->is_skin_fix == 'Y')
387 418
 				{
388 419
 					$skin = $module_info->skin;
389
-				}
390
-				else
420
+				} else
391 421
 				{
392 422
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P');
393 423
 				}
@@ -400,8 +430,7 @@  discard block
 block discarded – undo
400 430
 			{
401 431
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 432
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
403
-			}
404
-			else
433
+			} else
405 434
 			{
406 435
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
407 436
 				$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -421,7 +450,9 @@  discard block
 block discarded – undo
421 450
 			{
422 451
 				foreach($skin_info->extra_vars as $vars)
423 452
 				{
424
-					if($vars->type!='image') continue;
453
+					if($vars->type!='image') {
454
+						continue;
455
+					}
425 456
 
426 457
 					$image_obj = $obj->{$vars->name};
427 458
 					// Get a variable to delete
@@ -453,7 +484,9 @@  discard block
 block discarded – undo
453 484
 					// Upload the file to a path
454 485
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 486
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
487
+					if(!FileHandler::makeDir($path)) {
488
+						return false;
489
+					}
457 490
 
458 491
 					$filename = $path.$image_obj['name'];
459 492
 					// Move the file
@@ -484,8 +517,7 @@  discard block
 block discarded – undo
484 517
 			if($mode === 'M')
485 518
 			{
486 519
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487
-			}
488
-			else
520
+			} else
489 521
 			{
490 522
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 523
 			}
@@ -506,10 +538,14 @@  discard block
 block discarded – undo
506 538
 	{
507 539
 		$vars = Context::getRequestVars();
508 540
 
509
-		if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
541
+		if(!$vars->module_srls) {
542
+			return new Object(-1,'msg_invalid_request');
543
+		}
510 544
 
511 545
 		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request');
546
+		if(count($module_srls) < 1) {
547
+			return new Object(-1,'msg_invalid_request');
548
+		}
513 549
 
514 550
 		$oModuleModel = getModel('module');
515 551
 		$oModuleController= getController('module');
@@ -541,8 +577,7 @@  discard block
 block discarded – undo
541 577
 			if(Context::get('success_return_url'))
542 578
 			{
543 579
 				$this->setRedirectUrl(Context::get('success_return_url'));
544
-			}
545
-			else
580
+			} else
546 581
 			{
547 582
 				global $lang;
548 583
 				htmlHeader();
@@ -561,10 +596,14 @@  discard block
 block discarded – undo
561 596
 	function procModuleAdminModuleGrantSetup()
562 597
 	{
563 598
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new Object(-1,'msg_invalid_request');
599
+		if(!$module_srls) {
600
+			return new Object(-1,'msg_invalid_request');
601
+		}
565 602
 
566 603
 		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new Object(-1,'msg_invalid_request');
604
+		if(count($modules) < 1) {
605
+			return new Object(-1,'msg_invalid_request');
606
+		}
568 607
 
569 608
 		$oModuleController = getController('module');
570 609
 		$oModuleModel = getModel('module');
@@ -592,17 +631,20 @@  discard block
 block discarded – undo
592 631
 				$grant->{$grant_name}[] = $default;
593 632
 				continue;
594 633
 				// Users in a particular group
595
-			}
596
-			else
634
+			} else
597 635
 			{
598 636
 				$group_srls = Context::get($grant_name);
599 637
 				if($group_srls)
600 638
 				{
601 639
 					if(!is_array($group_srls))
602 640
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
605
-						else $group_srls = array($group_srls);
641
+						if(strpos($group_srls,'|@|')!==false) {
642
+							$group_srls = explode('|@|',$group_srls);
643
+						} elseif(strpos($group_srls,',')!==false) {
644
+							$group_srls = explode(',',$group_srls);
645
+						} else {
646
+							$group_srls = array($group_srls);
647
+						}
606 648
 					}
607 649
 					$grant->{$grant_name} = $group_srls;
608 650
 				}
@@ -617,7 +659,9 @@  discard block
 block discarded – undo
617 659
 			$args = new stdClass();
618 660
 			$args->module_srl = $module_srl;
619 661
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
662
+			if(!$output->toBool()) {
663
+				continue;
664
+			}
621 665
 			// Permissions stored in the DB
622 666
 			foreach($grant as $grant_name => $group_srls)
623 667
 			{
@@ -628,7 +672,9 @@  discard block
 block discarded – undo
628 672
 					$args->name = $grant_name;
629 673
 					$args->group_srl = $val;
630 674
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
675
+					if(!$output->toBool()) {
676
+						return $output;
677
+					}
632 678
 				}
633 679
 			}
634 680
 		}
@@ -638,8 +684,7 @@  discard block
 block discarded – undo
638 684
 			if(Context::get('success_return_url'))
639 685
 			{
640 686
 				$this->setRedirectUrl(Context::get('success_return_url'));
641
-			}
642
-			else
687
+			} else
643 688
 			{
644 689
 				global $lang;
645 690
 				htmlHeader();
@@ -665,18 +710,30 @@  discard block
 block discarded – undo
665 710
 		$args->site_srl = (int)$site_module_info->site_srl;
666 711
 		$args->name = str_replace(' ','_',Context::get('lang_code'));
667 712
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
713
+		if(!empty($args->lang_name)) {
714
+			$args->name = $args->lang_name;
715
+		}
669 716
 
670 717
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
718
+		if(empty($args->name)) {
719
+			$args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
720
+		}
672 721
 
673
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
722
+		if(!$args->name) {
723
+			return new Object(-1,'msg_invalid_request');
724
+		}
674 725
 		// Check whether a language code exists
675 726
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
727
+		if(!$output->toBool()) {
728
+			return $output;
729
+		}
677 730
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
731
+		if($output->data) {
732
+			$output = executeQuery('module.deleteLang', $args);
733
+		}
734
+		if(!$output->toBool()) {
735
+			return $output;
736
+		}
680 737
 		// Enter
681 738
 		$lang_supported = Context::get('lang_supported');
682 739
 		foreach($lang_supported as $key => $val)
@@ -693,7 +750,9 @@  discard block
 block discarded – undo
693 750
 			if($args->value)
694 751
 			{
695 752
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
753
+				if(!$output->toBool()) {
754
+					return $output;
755
+				}
697 756
 			}
698 757
 		}
699 758
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -716,11 +775,17 @@  discard block
 block discarded – undo
716 775
 		$args->site_srl = (int)$site_module_info->site_srl;
717 776
 		$args->name = str_replace(' ','_',Context::get('name'));
718 777
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
778
+		if(!empty($args->lang_name)) {
779
+			$args->name = $args->lang_name;
780
+		}
781
+		if(!$args->name) {
782
+			return new Object(-1,'msg_invalid_request');
783
+		}
721 784
 
722 785
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
786
+		if(!$output->toBool()) {
787
+			return $output;
788
+		}
724 789
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 790
 
726 791
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +796,9 @@  discard block
 block discarded – undo
731 796
 
732 797
 	function procModuleAdminGetList()
733 798
 	{
734
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
799
+		if(!Context::get('is_logged')) {
800
+			return new Object(-1, 'msg_not_permitted');
801
+		}
735 802
 
736 803
 		$oModuleController = getController('module');
737 804
 		$oModuleModel = getModel('module');
@@ -744,14 +811,20 @@  discard block
 block discarded – undo
744 811
 		$args = new stdClass;
745 812
 		$logged_info = Context::get('logged_info');
746 813
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
814
+		if($site_keyword) {
815
+			$args->site_keyword = $site_keyword;
816
+		}
748 817
 
749 818
 		if(!$site_srl)
750 819
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
820
+			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) {
821
+				$args->site_srl = 0;
822
+			} else {
823
+				$args->site_srl = (int)$site_module_info->site_srl;
824
+			}
825
+		} else {
826
+			$args->site_srl = $site_srl;
753 827
 		}
754
-		else $args->site_srl = $site_srl;
755 828
 
756 829
 		$args->sort_index1 = 'sites.domain';
757 830
 
@@ -764,7 +837,9 @@  discard block
 block discarded – undo
764 837
 			foreach($output->data as $val)
765 838
 			{
766 839
 				$module = trim($val->module);
767
-				if(!$module) continue;
840
+				if(!$module) {
841
+					continue;
842
+				}
768 843
 
769 844
 				// replace user defined lang.
770 845
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -800,7 +875,9 @@  discard block
 block discarded – undo
800 875
 		{
801 876
 			foreach($mid_list as $module => $val)
802 877
 			{
803
-				if(!$selected_module) $selected_module = $module;
878
+				if(!$selected_module) {
879
+					$selected_module = $module;
880
+				}
804 881
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 882
 
806 883
 				if(!$xml_info)
@@ -823,8 +900,7 @@  discard block
 block discarded – undo
823 900
 							{
824 901
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 902
 							}
826
-						}
827
-						else
903
+						} else
828 904
 						{
829 905
 							$mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category');
830 906
 						}
@@ -851,13 +927,14 @@  discard block
 block discarded – undo
851 927
 		{
852 928
 			$site_module_info = Context::get('site_module_info');
853 929
 			$args->site_srl = (int)$site_module_info->site_srl;
854
-		}
855
-		else
930
+		} else
856 931
 		{
857 932
 			$args->site_srl = $site_srl;
858 933
 		}
859 934
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
935
+		if(!$output->toBool() || !$output->data) {
936
+			return;
937
+		}
861 938
 		// Set the cache directory
862 939
 		$cache_path = _XE_PATH_.'files/cache/lang_defined/';
863 940
 		FileHandler::makeDir($cache_path);
@@ -950,8 +1027,7 @@  discard block
 block discarded – undo
950 1027
 		if($mid)
951 1028
 		{
952 1029
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
953
-		}
954
-		else
1030
+		} else
955 1031
 		{
956 1032
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
957 1033
 		}
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if (!$output->toBool()) return $output;
26 26
 
27 27
 		$this->setMessage("success_registed");
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	function procModuleAdminUpdateCategory()
37 37
 	{
38 38
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
39
+		if (!$output->toBool()) return $output;
40 40
 
41 41
 		$this->setMessage('success_updated');
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function procModuleAdminDeleteCategory()
51 51
 	{
52 52
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
53
+		if (!$output->toBool()) return $output;
54 54
 
55 55
 		$this->setMessage('success_deleted');
56 56
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	function procModuleAdminCopyModule($args = NULL)
86 86
 	{
87 87
 		$isProc = false;
88
-		if(!$args)
88
+		if (!$args)
89 89
 		{
90 90
 			$isProc = true;
91 91
 			// Get information of the target module to copy
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 			$module_srl = $args->module_srl;
98 98
 		}
99 99
 
100
-		if(!$module_srl)
100
+		if (!$module_srl)
101 101
 		{
102 102
 			return $this->_returnByProc($isProc);
103 103
 		}
104 104
 
105 105
 		// Get module name to create and browser title
106 106
 		$clones = array();
107
-		for($i=1;$i<=10;$i++)
107
+		for ($i = 1; $i <= 10; $i++)
108 108
 		{
109 109
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
110
+			if (!$mid) continue;
111
+			if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
112 112
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
113
+			if (!$mid) continue;
114
+			if ($mid && !$browser_title) $browser_title = $mid;
115 115
 			$clones[$mid] = $browser_title;
116 116
 		}
117
-		if(count($clones) < 1)
117
+		if (count($clones) < 1)
118 118
 		{
119 119
 			return $this->_returnByProc($isProc);
120 120
 		}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$module_args->module_srl = $module_srl;
130 130
 		$output = executeQueryArray('module.getModuleGrants', $module_args);
131 131
 		$grant = array();
132
-		if($output->data)
132
+		if ($output->data)
133 133
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
134
+			foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl;
135 135
 		}
136 136
 
137 137
 		// get Extra Vars
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		$extra_args->module_srl = $module_srl;
140 140
 		$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
141 141
 		$extra_vars = new stdClass();
142
-		if($extra_output->toBool() && is_array($extra_output->data))
142
+		if ($extra_output->toBool() && is_array($extra_output->data))
143 143
 		{
144
-			foreach($extra_output->data as $info)
144
+			foreach ($extra_output->data as $info)
145 145
 			{
146 146
 				$extra_vars->{$info->name} = $info->value;
147 147
 			}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		$tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl);
151 151
 		$tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl);
152 152
 
153
-		if($tmpModuleSkinVars)
153
+		if ($tmpModuleSkinVars)
154 154
 		{
155
-			foreach($tmpModuleSkinVars as $key=>$value)
155
+			foreach ($tmpModuleSkinVars as $key=>$value)
156 156
 			{
157 157
 				$moduleSkinVars->{$key} = $value->value;
158 158
 			}
159 159
 		}
160 160
 
161
-		if($tmpModuleMobileSkinVars)
161
+		if ($tmpModuleMobileSkinVars)
162 162
 		{
163
-			foreach($tmpModuleMobileSkinVars as $key=>$value)
163
+			foreach ($tmpModuleMobileSkinVars as $key=>$value)
164 164
 			{
165 165
 				$moduleMobileSkinVars->{$key} = $value->value;
166 166
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$triggerObj->moduleSrlList = array();
175 175
 
176 176
 		$errorLog = array();
177
-		foreach($clones as $mid => $browser_title)
177
+		foreach ($clones as $mid => $browser_title)
178 178
 		{
179 179
 			$clone_args = new stdClass;
180 180
 			$clone_args = clone $module_info;
@@ -188,29 +188,29 @@  discard block
 block discarded – undo
188 188
 			// Create a module
189 189
 			$output = $oModuleController->insertModule($clone_args);
190 190
 
191
-			if(!$output->toBool())
191
+			if (!$output->toBool())
192 192
 			{
193
-				$errorLog[] = $mid . ' : '. $output->message;
193
+				$errorLog[] = $mid.' : '.$output->message;
194 194
 				continue;
195 195
 			}
196 196
 			$module_srl = $output->get('module_srl');
197 197
 
198
-			if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
198
+			if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
199 199
 			{
200 200
 				// copy document
201 201
 				$oDocumentAdminController = getAdminController('document');
202 202
 				$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl);
203 203
 				$document_srls = $copyOutput->get('copied_srls');
204
-				if($document_srls && count($document_srls) > 0)
204
+				if ($document_srls && count($document_srls) > 0)
205 205
 				{
206 206
 					$extra_vars->document_srl = array_pop($document_srls);
207 207
 				}
208 208
 
209
-				if($extra_vars->mdocument_srl)
209
+				if ($extra_vars->mdocument_srl)
210 210
 				{
211 211
 					$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl);
212 212
 					$copiedSrls = $copyOutput->get('copied_srls');
213
-					if($copiedSrls && count($copiedSrls) > 0)
213
+					if ($copiedSrls && count($copiedSrls) > 0)
214 214
 					{
215 215
 						$extra_vars->mdocument_srl = array_pop($copiedSrls);
216 216
 					}
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 			}
219 219
 
220 220
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
221
+			if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
+			if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
223 223
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
224
+			if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
+			if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
226 226
 
227 227
 			$triggerObj->moduleSrlList[] = $module_srl;
228 228
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$oDB->commit();
233 233
 
234
-		if(count($errorLog) > 0)
234
+		if (count($errorLog) > 0)
235 235
 		{
236 236
 			$message = implode('\n', $errorLog);
237 237
 			$this->setMessage($message);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 			$this->setMessage('success_registed');
243 243
 		}
244 244
 
245
-		if($isProc)
245
+		if ($isProc)
246 246
 		{
247
-			if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
247
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
248 248
 			{
249 249
 				global $lang;
250 250
 				htmlHeader();
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
-	private function _returnByProc($isProc, $msg='msg_invalid_request')
263
+	private function _returnByProc($isProc, $msg = 'msg_invalid_request')
264 264
 	{
265
-		if(!$isProc)
265
+		if (!$isProc)
266 266
 			return;
267 267
 		else
268 268
 		{
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
 		// Get information of the module
283 283
 		$columnList = array('module_srl', 'module');
284 284
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new Object(-1,'msg_invalid_request');
285
+		if (!$module_info) return new Object(-1, 'msg_invalid_request');
286 286
 		// Register Admin ID
287 287
 		$oModuleController->deleteAdminId($module_srl);
288 288
 		$admin_member = Context::get('admin_member');
289
-		if($admin_member)
289
+		if ($admin_member)
290 290
 		{
291
-			$admin_members = explode(',',$admin_member);
292
-			foreach($admin_members as $admin_id)
291
+			$admin_members = explode(',', $admin_member);
292
+			foreach ($admin_members as $admin_id)
293 293
 			{
294 294
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
295
+				if (!$admin_id) continue;
296 296
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 297
 			}
298 298
 		}
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		$grant_list->manager->default = 'manager';
308 308
 
309 309
 		$grant = new stdClass();
310
-		foreach($grant_list as $grant_name => $grant_info)
310
+		foreach ($grant_list as $grant_name => $grant_info)
311 311
 		{
312 312
 			// Get the default value
313 313
 			$default = Context::get($grant_name.'_default');
314 314
 			// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
315 315
 			$grant->{$grant_name} = array();
316
-			if(strlen($default))
316
+			if (strlen($default))
317 317
 			{
318 318
 				$grant->{$grant_name}[] = $default;
319 319
 				continue;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 			else
323 323
 			{
324 324
 				$group_srls = Context::get($grant_name);
325
-				if($group_srls)
325
+				if ($group_srls)
326 326
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
327
+					if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
328
+					elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
329 329
 					else $group_srls = array($group_srls);
330 330
 					$grant->{$grant_name} = $group_srls;
331 331
 				}
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		$args = new stdClass();
339 339
 		$args->module_srl = $module_srl;
340 340
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
341
+		if (!$output->toBool()) return $output;
342 342
 		// Permissions stored in the DB
343
-		foreach($grant as $grant_name => $group_srls)
343
+		foreach ($grant as $grant_name => $group_srls)
344 344
 		{
345
-			foreach($group_srls as $val)
345
+			foreach ($group_srls as $val)
346 346
 			{
347 347
 				$args = new stdClass();
348 348
 				$args->module_srl = $module_srl;
349 349
 				$args->name = $grant_name;
350 350
 				$args->group_srl = $val;
351 351
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
352
+				if (!$output->toBool()) return $output;
353 353
 			}
354 354
 		}
355 355
 		$this->setMessage('success_registed');
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 		$oModuleModel = getModel('module');
369 369
 		$columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix');
370 370
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
371
-		if($module_info->module_srl)
371
+		if ($module_info->module_srl)
372 372
 		{
373
-			if($mode === 'M')
373
+			if ($mode === 'M')
374 374
 			{
375
-				if($module_info->is_mskin_fix == 'Y')
375
+				if ($module_info->is_mskin_fix == 'Y')
376 376
 				{
377 377
 					$skin = $module_info->mskin;
378 378
 				}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 			else
385 385
 			{
386
-				if($module_info->is_skin_fix == 'Y')
386
+				if ($module_info->is_skin_fix == 'Y')
387 387
 				{
388 388
 					$skin = $module_info->skin;
389 389
 				}
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 			}
395 395
 
396 396
 			// Get skin information (to check extra_vars)
397
-			$module_path = _XE_PATH_ . 'modules/'.$module_info->module;
397
+			$module_path = _XE_PATH_.'modules/'.$module_info->module;
398 398
 
399
-			if($mode === 'M')
399
+			if ($mode === 'M')
400 400
 			{
401 401
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 402
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -417,35 +417,35 @@  discard block
 block discarded – undo
417 417
 			unset($obj->module);
418 418
 			unset($obj->_mode);
419 419
 			// Separately handle if a type of extra_vars is an image in the original skin_info
420
-			if($skin_info->extra_vars)
420
+			if ($skin_info->extra_vars)
421 421
 			{
422
-				foreach($skin_info->extra_vars as $vars)
422
+				foreach ($skin_info->extra_vars as $vars)
423 423
 				{
424
-					if($vars->type!='image') continue;
424
+					if ($vars->type != 'image') continue;
425 425
 
426 426
 					$image_obj = $obj->{$vars->name};
427 427
 					// Get a variable to delete
428 428
 					$del_var = $obj->{"del_".$vars->name};
429 429
 					unset($obj->{"del_".$vars->name});
430
-					if($del_var == 'Y')
430
+					if ($del_var == 'Y')
431 431
 					{
432 432
 						FileHandler::removeFile($skin_vars[$vars->name]->value);
433 433
 						continue;
434 434
 					}
435 435
 					// Use the previous data if not uploaded
436
-					if(!$image_obj['tmp_name'])
436
+					if (!$image_obj['tmp_name'])
437 437
 					{
438 438
 						$obj->{$vars->name} = $skin_vars[$vars->name]->value;
439 439
 						continue;
440 440
 					}
441 441
 					// Ignore if the file is not successfully uploaded
442
-					if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
442
+					if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
443 443
 					{
444 444
 						unset($obj->{$vars->name});
445 445
 						continue;
446 446
 					}
447 447
 					// Ignore if the file is not an image
448
-					if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
448
+					if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
449 449
 					{
450 450
 						unset($obj->{$vars->name});
451 451
 						continue;
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 					// Upload the file to a path
454 454
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 455
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
456
+					if (!FileHandler::makeDir($path)) return false;
457 457
 
458 458
 					$filename = $path.$image_obj['name'];
459 459
 					// Move the file
460
-					if(!move_uploaded_file($image_obj['tmp_name'], $filename))
460
+					if (!move_uploaded_file($image_obj['tmp_name'], $filename))
461 461
 					{
462 462
 						unset($obj->{$vars->name});
463 463
 						continue;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			*/
482 482
 			$oModuleController = getController('module');
483 483
 
484
-			if($mode === 'M')
484
+			if ($mode === 'M')
485 485
 			{
486 486
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487 487
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			{
490 490
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 491
 			}
492
-			if(!$output->toBool())
492
+			if (!$output->toBool())
493 493
 			{
494 494
 				return $output;
495 495
 			}
@@ -506,29 +506,29 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$vars = Context::getRequestVars();
508 508
 
509
-		if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
509
+		if (!$vars->module_srls) return new Object(-1, 'msg_invalid_request');
510 510
 
511
-		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request');
511
+		$module_srls = explode(',', $vars->module_srls);
512
+		if (count($module_srls) < 1) return new Object(-1, 'msg_invalid_request');
513 513
 
514 514
 		$oModuleModel = getModel('module');
515
-		$oModuleController= getController('module');
515
+		$oModuleController = getController('module');
516 516
 		$columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate');
517
-		$updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile');
518
-		foreach($updateList as $key=>$val)
517
+		$updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile');
518
+		foreach ($updateList as $key=>$val)
519 519
 		{
520
-			if(!strlen($vars->{$val}))
520
+			if (!strlen($vars->{$val}))
521 521
 			{
522 522
 				unset($updateList[$key]);
523 523
 				$columnList[] = $val;
524 524
 			}
525 525
 		}
526 526
 
527
-		foreach($module_srls as $module_srl)
527
+		foreach ($module_srls as $module_srl)
528 528
 		{
529 529
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
530 530
 
531
-			foreach($updateList as $val)
531
+			foreach ($updateList as $val)
532 532
 			{
533 533
 				$module_info->{$val} = $vars->{$val};
534 534
 			}
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->setMessage('success_registed');
539
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
539
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
540 540
 		{
541
-			if(Context::get('success_return_url'))
541
+			if (Context::get('success_return_url'))
542 542
 			{
543 543
 				$this->setRedirectUrl(Context::get('success_return_url'));
544 544
 			}
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
 	function procModuleAdminModuleGrantSetup()
562 562
 	{
563 563
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new Object(-1,'msg_invalid_request');
564
+		if (!$module_srls) return new Object(-1, 'msg_invalid_request');
565 565
 
566
-		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new Object(-1,'msg_invalid_request');
566
+		$modules = explode(',', $module_srls);
567
+		if (count($modules) < 1) return new Object(-1, 'msg_invalid_request');
568 568
 
569 569
 		$oModuleController = getController('module');
570 570
 		$oModuleModel = getModel('module');
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$grant = new stdClass;
583 583
 
584
-		foreach($grant_list as $grant_name => $grant_info)
584
+		foreach ($grant_list as $grant_name => $grant_info)
585 585
 		{
586 586
 			// Get the default value
587 587
 			$default = Context::get($grant_name.'_default');
588 588
 			// -1 = Sign only, 0 = all users
589 589
 			$grant->{$grant_name} = array();
590
-			if(strlen($default))
590
+			if (strlen($default))
591 591
 			{
592 592
 				$grant->{$grant_name}[] = $default;
593 593
 				continue;
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 			else
597 597
 			{
598 598
 				$group_srls = Context::get($grant_name);
599
-				if($group_srls)
599
+				if ($group_srls)
600 600
 				{
601
-					if(!is_array($group_srls))
601
+					if (!is_array($group_srls))
602 602
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
603
+						if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
604
+						elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
605 605
 						else $group_srls = array($group_srls);
606 606
 					}
607 607
 					$grant->{$grant_name} = $group_srls;
@@ -612,30 +612,30 @@  discard block
 block discarded – undo
612 612
 		}
613 613
 
614 614
 		// Stored in the DB
615
-		foreach($modules as $module_srl)
615
+		foreach ($modules as $module_srl)
616 616
 		{
617 617
 			$args = new stdClass();
618 618
 			$args->module_srl = $module_srl;
619 619
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
620
+			if (!$output->toBool()) continue;
621 621
 			// Permissions stored in the DB
622
-			foreach($grant as $grant_name => $group_srls)
622
+			foreach ($grant as $grant_name => $group_srls)
623 623
 			{
624
-				foreach($group_srls as $val)
624
+				foreach ($group_srls as $val)
625 625
 				{
626 626
 					$args = new stdClass();
627 627
 					$args->module_srl = $module_srl;
628 628
 					$args->name = $grant_name;
629 629
 					$args->group_srl = $val;
630 630
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
631
+					if (!$output->toBool()) return $output;
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 		$this->setMessage('success_registed');
636
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
636
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
637 637
 		{
638
-			if(Context::get('success_return_url'))
638
+			if (Context::get('success_return_url'))
639 639
 			{
640 640
 				$this->setRedirectUrl(Context::get('success_return_url'));
641 641
 			}
@@ -662,38 +662,38 @@  discard block
 block discarded – undo
662 662
 		$target = Context::get('target');
663 663
 		$module = Context::get('module');
664 664
 		$args = new stdClass();
665
-		$args->site_srl = (int)$site_module_info->site_srl;
666
-		$args->name = str_replace(' ','_',Context::get('lang_code'));
667
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
665
+		$args->site_srl = (int) $site_module_info->site_srl;
666
+		$args->name = str_replace(' ', '_', Context::get('lang_code'));
667
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
668
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
669 669
 
670 670
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
671
+		if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
672 672
 
673
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
673
+		if (!$args->name) return new Object(-1, 'msg_invalid_request');
674 674
 		// Check whether a language code exists
675 675
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
676
+		if (!$output->toBool()) return $output;
677 677
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
678
+		if ($output->data) $output = executeQuery('module.deleteLang', $args);
679
+		if (!$output->toBool()) return $output;
680 680
 		// Enter
681 681
 		$lang_supported = Context::get('lang_supported');
682
-		foreach($lang_supported as $key => $val)
682
+		foreach ($lang_supported as $key => $val)
683 683
 		{
684 684
 			$args->lang_code = $key;
685 685
 			$args->value = trim(Context::get($key));
686 686
 
687 687
 			// if request method is json, strip slashes
688
-			if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
688
+			if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
689 689
 			{
690 690
 				$args->value = stripslashes($args->value);
691 691
 			}
692 692
 
693
-			if($args->value)
693
+			if ($args->value)
694 694
 			{
695 695
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
696
+				if (!$output->toBool()) return $output;
697 697
 			}
698 698
 		}
699 699
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 		// Get language code
714 714
 		$site_module_info = Context::get('site_module_info');
715 715
 		$args = new stdClass();
716
-		$args->site_srl = (int)$site_module_info->site_srl;
717
-		$args->name = str_replace(' ','_',Context::get('name'));
718
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new Object(-1,'msg_invalid_request');
716
+		$args->site_srl = (int) $site_module_info->site_srl;
717
+		$args->name = str_replace(' ', '_', Context::get('name'));
718
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
719
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
720
+		if (!$args->name) return new Object(-1, 'msg_invalid_request');
721 721
 
722 722
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
723
+		if (!$output->toBool()) return $output;
724 724
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 725
 
726 726
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
 	function procModuleAdminGetList()
733 733
 	{
734
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
734
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
735 735
 
736 736
 		$oModuleController = getController('module');
737 737
 		$oModuleModel = getModel('module');
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 		$args = new stdClass;
745 745
 		$logged_info = Context::get('logged_info');
746 746
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
747
+		if ($site_keyword) $args->site_keyword = $site_keyword;
748 748
 
749
-		if(!$site_srl)
749
+		if (!$site_srl)
750 750
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
751
+			if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
+			else $args->site_srl = (int) $site_module_info->site_srl;
753 753
 		}
754 754
 		else $args->site_srl = $site_srl;
755 755
 
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 		// Get a list of modules at the site
760 760
 		$output = executeQueryArray('module.getSiteModules', $args);
761 761
 		$mid_list = array();
762
-		if(count($output->data) > 0)
762
+		if (count($output->data) > 0)
763 763
 		{
764
-			foreach($output->data as $val)
764
+			foreach ($output->data as $val)
765 765
 			{
766 766
 				$module = trim($val->module);
767
-				if(!$module) continue;
767
+				if (!$module) continue;
768 768
 
769 769
 				// replace user defined lang.
770 770
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 				$obj->browser_title = $val->browser_title;
776 776
 				$obj->mid = $val->mid;
777 777
 				$obj->module_category_srl = $val->module_category_srl;
778
-				if($val->module_category_srl > 0)
778
+				if ($val->module_category_srl > 0)
779 779
 				{
780 780
 					$moduleCategorySrl[] = $val->module_category_srl;
781 781
 				}
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		$moduleCategorySrl = array_unique($moduleCategorySrl);
788 788
 		$output = $oModuleModel->getModuleCategories($moduleCategorySrl);
789 789
 		$categoryNameList = array();
790
-		if(is_array($output))
790
+		if (is_array($output))
791 791
 		{
792
-			foreach($output as $value)
792
+			foreach ($output as $value)
793 793
 			{
794 794
 				$categoryNameList[$value->module_category_srl] = $value->title;
795 795
 			}
796 796
 		}
797 797
 
798 798
 		$selected_module = Context::get('selected_module');
799
-		if(count($mid_list) > 0)
799
+		if (count($mid_list) > 0)
800 800
 		{
801
-			foreach($mid_list as $module => $val)
801
+			foreach ($mid_list as $module => $val)
802 802
 			{
803
-				if(!$selected_module) $selected_module = $module;
803
+				if (!$selected_module) $selected_module = $module;
804 804
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 805
 
806
-				if(!$xml_info)
806
+				if (!$xml_info)
807 807
 				{
808 808
 					unset($mid_list[$module]);
809 809
 					continue;
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
 				$mid_list[$module]->title = $xml_info->title;
813 813
 
814 814
 				// change module category srl to title
815
-				if(is_array($val->list))
815
+				if (is_array($val->list))
816 816
 				{
817
-					foreach($val->list as $key=>$value)
817
+					foreach ($val->list as $key=>$value)
818 818
 					{
819
-						if($value->module_category_srl > 0)
819
+						if ($value->module_category_srl > 0)
820 820
 						{
821 821
 							$categorySrl = $mid_list[$module]->list[$key]->module_category_srl;
822
-							if(isset($categoryNameList[$categorySrl]))
822
+							if (isset($categoryNameList[$categorySrl]))
823 823
 							{
824 824
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 825
 							}
@@ -847,23 +847,23 @@  discard block
 block discarded – undo
847 847
 		$args = new stdClass();
848 848
 
849 849
 		// Get the language file of the current site
850
-		if(!$site_srl)
850
+		if (!$site_srl)
851 851
 		{
852 852
 			$site_module_info = Context::get('site_module_info');
853
-			$args->site_srl = (int)$site_module_info->site_srl;
853
+			$args->site_srl = (int) $site_module_info->site_srl;
854 854
 		}
855 855
 		else
856 856
 		{
857 857
 			$args->site_srl = $site_srl;
858 858
 		}
859 859
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
860
+		if (!$output->toBool() || !$output->data) return;
861 861
 		// Set the cache directory
862 862
 		$cache_path = _XE_PATH_.'files/cache/lang_defined/';
863 863
 		FileHandler::makeDir($cache_path);
864 864
 
865 865
 		$langMap = array();
866
-		foreach($output->data as $val)
866
+		foreach ($output->data as $val)
867 867
 		{
868 868
 			$langMap[$val->lang_code][$val->name] = $val->value;
869 869
 		}
@@ -872,27 +872,27 @@  discard block
 block discarded – undo
872 872
 		$dbInfo = Context::getDBInfo();
873 873
 		$defaultLang = $dbInfo->lang_type;
874 874
 
875
-		if(!is_array($langMap[$defaultLang]))
875
+		if (!is_array($langMap[$defaultLang]))
876 876
 		{
877 877
 			$langMap[$defaultLang] = array();
878 878
 		}
879 879
 
880
-		foreach($lang_supported as $langCode => $langName)
880
+		foreach ($lang_supported as $langCode => $langName)
881 881
 		{
882
-			if(!is_array($langMap[$langCode]))
882
+			if (!is_array($langMap[$langCode]))
883 883
 			{
884 884
 				$langMap[$langCode] = array();
885 885
 			}
886 886
 
887 887
 			$langMap[$langCode] += $langMap[$defaultLang];
888
-			foreach($lang_supported as $targetLangCode => $targetLangName)
888
+			foreach ($lang_supported as $targetLangCode => $targetLangName)
889 889
 			{
890
-				if($langCode == $targetLangCode || $langCode == $defaultLang)
890
+				if ($langCode == $targetLangCode || $langCode == $defaultLang)
891 891
 				{
892 892
 					continue;
893 893
 				}
894 894
 
895
-				if(!is_array($langMap[$targetLangCode]))
895
+				if (!is_array($langMap[$targetLangCode]))
896 896
 				{
897 897
 					$langMap[$targetLangCode] = array();
898 898
 				}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 			}
902 902
 
903 903
 			$buff = array("<?php if(!defined('__XE__')) exit();");
904
-			foreach($langMap[$langCode] as $code => $value)
904
+			foreach ($langMap[$langCode] as $code => $value)
905 905
 			{
906 906
 				$buff[] = sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes(stripcslashes($value), "'"));
907 907
 			}
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 
925 925
 		$isSkinFix = Context::get('is_skin_fix');
926 926
 
927
-		if($isSkinFix)
927
+		if ($isSkinFix)
928 928
 		{
929 929
 			$isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y';
930 930
 		}
@@ -940,14 +940,14 @@  discard block
 block discarded – undo
940 940
 
941 941
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
942 942
 	{
943
-		if(!$moduleSrl && !$mid)
943
+		if (!$moduleSrl && !$mid)
944 944
 		{
945 945
 			return $this->stop(-1, 'msg_invalid_request');
946 946
 		}
947 947
 
948 948
 		$oModuleModel = getModel('module');
949 949
 
950
-		if($mid)
950
+		if ($mid)
951 951
 		{
952 952
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
953 953
 		}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
957 957
 		}
958 958
 
959
-		if(!$moduleInfo)
959
+		if (!$moduleInfo)
960 960
 		{
961 961
 			return $this->stop(-1, 'msg_module_not_exists');
962 962
 		}
@@ -965,26 +965,26 @@  discard block
 block discarded – undo
965 965
 		$layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl';
966 966
 		$skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix';
967 967
 
968
-		if(strlen($layoutSrl))
968
+		if (strlen($layoutSrl))
969 969
 		{
970 970
 			$moduleInfo->{$layoutTargetValue} = $layoutSrl;
971 971
 		}
972 972
 
973
-		if(strlen($isSkinFix))
973
+		if (strlen($isSkinFix))
974 974
 		{
975 975
 			$moduleInfo->{$skinFixTargetValue} = $isSkinFix;
976 976
 		}
977 977
 
978
-		if($isSkinFix == 'Y')
978
+		if ($isSkinFix == 'Y')
979 979
 		{
980 980
 			$moduleInfo->{$skinTargetValue} = $skinName;
981 981
 			$skinVars = json_decode($skinVars);
982 982
 
983
-			if(is_array($skinVars))
983
+			if (is_array($skinVars))
984 984
 			{
985
-				foreach($skinVars as $key => $val)
985
+				foreach ($skinVars as $key => $val)
986 986
 				{
987
-					if(empty($val))
987
+					if (empty($val))
988 988
 					{
989 989
 						continue;
990 990
 					}
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 		$menuItemSrl = Context::get('menu_item_srl');
1006 1006
 		$useMobile = Context::get('use_mobile');
1007 1007
 
1008
-		if(!$menuItemSrl)
1008
+		if (!$menuItemSrl)
1009 1009
 		{
1010 1010
 			return $this->stop(-1, 'msg_invalid_request');
1011 1011
 		}
Please login to merge, or discard this patch.
modules/module/module.admin.model.php 3 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 		return $output;
57 57
 	}
58 58
 
59
+	/**
60
+	 * @param string $modulePath
61
+	 */
59 62
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 63
 	{
61 64
 		if($modulePath)
@@ -306,7 +309,7 @@  discard block
 block discarded – undo
306 309
 	 * Skin setting page for the module
307 310
 	 *
308 311
 	 * @param $module_srl sequence of module
309
-	 * @param $mode P or M
312
+	 * @param string $mode P or M
310 313
 	 * @return string The HTML code
311 314
 	 */
312 315
 	function _getModuleSkinHTML($module_srl, $mode)
@@ -395,6 +398,7 @@  discard block
 block discarded – undo
395 398
 	/**
396 399
 	 * @brief Get values for a particular language code
397 400
 	 * Return its corresponding value if lang_code is specified. Otherwise return $name.
401
+	 * @param string $name
398 402
 	 */
399 403
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 404
 	{
@@ -513,6 +517,7 @@  discard block
 block discarded – undo
513 517
 
514 518
 	/**
515 519
 	 * @brief Return current lang list
520
+	 * @param stdClass $args
516 521
 	 */
517 522
 	function getLangListByLangcode($args)
518 523
 	{
Please login to merge, or discard this patch.
Braces   +78 added lines, -44 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new Object();
29
+		if(!$output->toBool() || !$output->data) {
30
+			return new Object();
31
+		}
30 32
 
31 33
 		foreach($output->data as $key => $val)
32 34
 		{
@@ -49,7 +51,9 @@  discard block
 block discarded – undo
49 51
 		$args->list_count = 20;
50 52
 		$args->page_count = 10;
51 53
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
54
+		if(!$output->toBool()) {
55
+			return $output;
56
+		}
53 57
 
54 58
 		ModuleModel::syncModuleToSite($output->data);
55 59
 
@@ -96,8 +100,12 @@  discard block
 block discarded – undo
96 100
 		{
97 101
 			foreach($grantList as $key => $val)
98 102
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
103
+				if(!$val->default) {
104
+					$val->default = 'guest';
105
+				}
106
+				if($val->default == 'root') {
107
+					$val->default = 'manager';
108
+				}
101 109
 				$grant_list->{$key} = $val;
102 110
 			}
103 111
 		}
@@ -158,8 +166,12 @@  discard block
 block discarded – undo
158 166
 		{
159 167
 			foreach($source_grant_list as $key => $val)
160 168
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
169
+				if(!$val->default) {
170
+					$val->default = 'guest';
171
+				}
172
+				if($val->default == 'root') {
173
+					$val->default = 'manager';
174
+				}
163 175
 				$grant_list->{$key} = $val;
164 176
 			}
165 177
 		}
@@ -176,11 +188,15 @@  discard block
 block discarded – undo
176 188
 		{
177 189
 			foreach($output->data as $val)
178 190
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183
-				else
191
+				if($val->group_srl == 0) {
192
+					$default_grant[$val->name] = 'all';
193
+				} else if($val->group_srl == -1) {
194
+					$default_grant[$val->name] = 'member';
195
+				} else if($val->group_srl == -2) {
196
+					$default_grant[$val->name] = 'site';
197
+				} else if($val->group_srl == -3) {
198
+					$default_grant[$val->name] = 'manager';
199
+				} else
184 200
 				{
185 201
 					$selected_group[$val->name][] = $val->group_srl;
186 202
 					$default_grant[$val->name] = 'group';
@@ -235,8 +251,12 @@  discard block
 block discarded – undo
235 251
 		{
236 252
 			foreach($xmlInfo->grant as $key => $val)
237 253
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
254
+				if(!$val->default) {
255
+					$val->default = 'guest';
256
+				}
257
+				if($val->default == 'root') {
258
+					$val->default = 'manager';
259
+				}
240 260
 				$grantList->{$key} = $val;
241 261
 			}
242 262
 		}
@@ -253,11 +273,15 @@  discard block
 block discarded – undo
253 273
 		{
254 274
 			foreach($output->data as $val)
255 275
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260
-				else
276
+				if($val->group_srl == 0) {
277
+					$defaultGrant->{$val->name} = 'all';
278
+				} else if($val->group_srl == -1) {
279
+					$defaultGrant->{$val->name} = 'member';
280
+				} else if($val->group_srl == -2) {
281
+					$defaultGrant->{$val->name} = 'site';
282
+				} else if($val->group_srl == -3) {
283
+					$defaultGrant->{$val->name} = 'manager';
284
+				} else
261 285
 				{
262 286
 					$selectedGroup->{$val->name}[] = $val->group_srl;
263 287
 					$defaultGrant->{$val->name} = 'group';
@@ -315,26 +339,25 @@  discard block
 block discarded – undo
315 339
 
316 340
 		$oModuleModel = getModel('module');
317 341
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
342
+		if(!$module_info) {
343
+			return;
344
+		}
319 345
 
320 346
 		if($mode === 'P')
321 347
 		{
322 348
 			if($module_info->is_skin_fix == 'N')
323 349
 			{
324 350
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325
-			}
326
-			else
351
+			} else
327 352
 			{
328 353
 				$skin = $module_info->skin;
329 354
 			}
330
-		}
331
-		else
355
+		} else
332 356
 		{
333 357
 			if($module_info->is_mskin_fix == 'N')
334 358
 			{
335 359
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336
-			}
337
-			else
360
+			} else
338 361
 			{
339 362
 				$skin = $module_info->mskin;
340 363
 			}
@@ -347,8 +370,7 @@  discard block
 block discarded – undo
347 370
 		{
348 371
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 372
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
350
-		}
351
-		else
373
+		} else
352 374
 		{
353 375
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
354 376
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -364,8 +386,9 @@  discard block
 block discarded – undo
364 386
 				if($skin_vars[$name]) 
365 387
 				{
366 388
 					$value = $skin_vars[$name]->value;
389
+				} else {
390
+					$value = '';
367 391
 				}
368
-				else $value = '';
369 392
 				if($type=="checkbox")
370 393
 				{
371 394
 					$value = $value?unserialize($value):array();
@@ -401,8 +424,7 @@  discard block
 block discarded – undo
401 424
 		if($isFullLanguage)
402 425
 		{
403 426
 			$lang_supported = Context::loadLangSupported();
404
-		}
405
-		else
427
+		} else
406 428
 		{
407 429
 			$lang_supported = Context::get('lang_supported');
408 430
 		}
@@ -420,19 +442,21 @@  discard block
 block discarded – undo
420 442
 					$selected_lang[$val->lang_code] = $val->value;
421 443
 				}
422 444
 			}
423
-		}
424
-		else
445
+		} else
425 446
 		{
426 447
 			$tmp = unserialize($name);
427 448
 			if($tmp)
428 449
 			{
429 450
 				$selected_lang = array();
430 451
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
452
+				if(!$rand_name) {
453
+					$rand_name = array_shift($tmp);
454
+				}
432 455
 				if(is_array($lang_supported))
433 456
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
457
+					foreach($lang_supported as $key => $val) {
458
+											$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
459
+					}
436 460
 				}
437 461
 			}
438 462
 		}
@@ -440,8 +464,9 @@  discard block
 block discarded – undo
440 464
 		$output = array();
441 465
 		if(is_array($lang_supported))
442 466
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
467
+			foreach($lang_supported as $key => $val) {
468
+							$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
469
+			}
445 470
 		}
446 471
 		return $output;
447 472
 	}
@@ -452,7 +477,9 @@  discard block
 block discarded – undo
452 477
 	function getModuleAdminLangCode()
453 478
 	{
454 479
 		$name = Context::get('name');
455
-		if(!$name) return new Object(-1,'msg_invalid_request');
480
+		if(!$name) {
481
+			return new Object(-1,'msg_invalid_request');
482
+		}
456 483
 		$site_module_info = Context::get('site_module_info');
457 484
 		$this->add('name', $name);
458 485
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -465,7 +492,9 @@  discard block
 block discarded – undo
465 492
 	function getModuleAdminLangListByName()
466 493
 	{
467 494
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
495
+		if(!$args->site_srl) {
496
+			$args->site_srl = 0;
497
+		}
469 498
 
470 499
 		$columnList = array('lang_code', 'name', 'value');
471 500
 
@@ -473,7 +502,9 @@  discard block
 block discarded – undo
473 502
 
474 503
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 504
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
505
+		if($output->toBool()) {
506
+			$langList = $output->data;
507
+		}
477 508
 
478 509
 		$this->add('lang_list', $langList);
479 510
 		$this->add('lang_name', $args->langName);
@@ -485,7 +516,9 @@  discard block
 block discarded – undo
485 516
 	function getModuleAdminLangListByValue()
486 517
 	{
487 518
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
519
+		if(!$args->site_srl) {
520
+			$args->site_srl = 0;
521
+		}
489 522
 
490 523
 		$langList = array();
491 524
 
@@ -517,7 +550,9 @@  discard block
 block discarded – undo
517 550
 	function getLangListByLangcode($args)
518 551
 	{
519 552
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
553
+		if(!$output->toBool()) {
554
+			return array();
555
+		}
521 556
 
522 557
 		return $output;
523 558
 	}
@@ -592,8 +627,7 @@  discard block
 block discarded – undo
592 627
 		if(Context::get('search_module_srl'))
593 628
 		{
594 629
 			$module_srl = Context::get('search_module_srl');
595
-		}
596
-		else
630
+		} else
597 631
 		{
598 632
 			$module_srl = Context::get('module_srl');
599 633
 		}
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new Object();
29
+		if (!$output->toBool() || !$output->data) return new Object();
30 30
 
31
-		foreach($output->data as $key => $val)
31
+		foreach ($output->data as $key => $val)
32 32
 		{
33 33
 			$info_xml = $oModuleModel->getModuleInfoXml($val->module);
34 34
 			$oModuleController->replaceDefinedLangCode($val->browser_title);
35
-			$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
35
+			$list[$val->module_srl] = array('module_srl'=>$val->module_srl, 'mid'=>$val->mid, 'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
36 36
 		}
37
-		$modules = explode(',',$args->module_srls);
38
-		for($i=0;$i<count($modules);$i++)
37
+		$modules = explode(',', $args->module_srls);
38
+		for ($i = 0; $i < count($modules); $i++)
39 39
 		{
40 40
 			$module_list[$modules[$i]] = $list[$modules[$i]];
41 41
 		}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$args->list_count = 20;
50 50
 		$args->page_count = 10;
51 51
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
52
+		if (!$output->toBool()) return $output;
53 53
 
54 54
 		ModuleModel::syncModuleToSite($output->data);
55 55
 
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 60
 	{
61
-		if($modulePath)
61
+		if ($modulePath)
62 62
 		{
63 63
 			// get the skins path
64 64
 			$oModuleModel = getModel('module');
65 65
 			$skin_list = $oModuleModel->getSkins($modulePath);
66
-			Context::set('skin_list',$skin_list);
66
+			Context::set('skin_list', $skin_list);
67 67
 
68 68
 			$mskin_list = $oModuleModel->getSkins($modulePath, "m.skins");
69 69
 			Context::set('mskin_list', $mskin_list);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$layout_list = $oLayoutModel->getLayoutList();
75 75
 		Context::set('layout_list', $layout_list);
76 76
 
77
-		$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
77
+		$mobile_layout_list = $oLayoutModel->getLayoutList(0, "M");
78 78
 		Context::set('mlayout_list', $mobile_layout_list);
79 79
 
80 80
 		$security = new Security();
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 		$security->encodeHTML('skin_list..title');
84 84
 		$security->encodeHTML('mskin_list..title');
85 85
 
86
-		$grant_list =new stdClass();
86
+		$grant_list = new stdClass();
87 87
 		// Grant virtual permission for access and manager
88
-		if(!$grantList)
88
+		if (!$grantList)
89 89
 		{
90
-			$grantList =new stdClass();
90
+			$grantList = new stdClass();
91 91
 		}
92 92
 		$grantList->access = new stdClass();
93 93
 		$grantList->access->title = Context::getLang('grant_access');
94 94
 		$grantList->access->default = 'guest';
95
-		if(count($grantList))
95
+		if (count($grantList))
96 96
 		{
97
-			foreach($grantList as $key => $val)
97
+			foreach ($grantList as $key => $val)
98 98
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
99
+				if (!$val->default) $val->default = 'guest';
100
+				if ($val->default == 'root') $val->default = 'manager';
101 101
 				$grant_list->{$key} = $val;
102 102
 			}
103 103
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
120 120
 		Context::set('setup_content', $content);
121 121
 
122
-		if(count($tabChoice) == 0)
122
+		if (count($tabChoice) == 0)
123 123
 		{
124 124
 			$tabChoice = array('tab1'=>1, 'tab2'=>1, 'tab3'=>1);
125 125
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	function getModuleGrantHTML($module_srl, $source_grant_list)
138 138
 	{
139
-		if(!$module_srl)
139
+		if (!$module_srl)
140 140
 		{
141 141
 			return;
142 142
 		}
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		$grant_list->access = new stdClass();
155 155
 		$grant_list->access->title = Context::getLang('grant_access');
156 156
 		$grant_list->access->default = 'guest';
157
-		if(count($source_grant_list))
157
+		if (count($source_grant_list))
158 158
 		{
159
-			foreach($source_grant_list as $key => $val)
159
+			foreach ($source_grant_list as $key => $val)
160 160
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
161
+				if (!$val->default) $val->default = 'guest';
162
+				if ($val->default == 'root') $val->default = 'manager';
163 163
 				$grant_list->{$key} = $val;
164 164
 			}
165 165
 		}
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 		$args = new stdClass();
173 173
 		$args->module_srl = $module_srl;
174 174
 		$output = executeQueryArray('module.getModuleGrants', $args);
175
-		if($output->data)
175
+		if ($output->data)
176 176
 		{
177
-			foreach($output->data as $val)
177
+			foreach ($output->data as $val)
178 178
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
179
+				if ($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
+				else if ($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
+				else if ($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
+				else if ($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183 183
 				else
184 184
 				{
185 185
 					$selected_group[$val->name][] = $val->group_srl;
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		$targetModule = Context::get('target_module');
215 215
 		$moduleSrl = Context::get('module_srl');
216
-		if(!$targetModule || !$moduleSrl)
216
+		if (!$targetModule || !$moduleSrl)
217 217
 		{
218 218
 			return new Object(-1, 'msg_invalid_request');
219 219
 		}
220 220
 
221
-		if($targetModule == '_SHORTCUT')
221
+		if ($targetModule == '_SHORTCUT')
222 222
 		{
223 223
 			return new Object(0);
224 224
 		}
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		$grantList->access = new stdClass();
232 232
 		$grantList->access->title = Context::getLang('grant_access');
233 233
 		$grantList->access->default = 'guest';
234
-		if(count($xmlInfo->grant))
234
+		if (count($xmlInfo->grant))
235 235
 		{
236
-			foreach($xmlInfo->grant as $key => $val)
236
+			foreach ($xmlInfo->grant as $key => $val)
237 237
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
238
+				if (!$val->default) $val->default = 'guest';
239
+				if ($val->default == 'root') $val->default = 'manager';
240 240
 				$grantList->{$key} = $val;
241 241
 			}
242 242
 		}
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 		$args = new stdClass();
250 250
 		$args->module_srl = $moduleSrl;
251 251
 		$output = executeQueryArray('module.getModuleGrants', $args);
252
-		if($output->data)
252
+		if ($output->data)
253 253
 		{
254
-			foreach($output->data as $val)
254
+			foreach ($output->data as $val)
255 255
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
256
+				if ($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
+				else if ($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
+				else if ($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
+				else if ($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260 260
 				else
261 261
 				{
262 262
 					$selectedGroup->{$val->name}[] = $val->group_srl;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 		}
267 267
 
268
-		if(is_object($grantList))
268
+		if (is_object($grantList))
269 269
 		{
270
-			foreach($grantList AS $key=>$value)
270
+			foreach ($grantList AS $key=>$value)
271 271
 			{
272
-				if(isset($defaultGrant->{$key}))
272
+				if (isset($defaultGrant->{$key}))
273 273
 				{
274 274
 					$grantList->{$key}->grant = $defaultGrant->{$key};
275 275
 				}
276
-				if(isset($selectedGroup->{$key}))
276
+				if (isset($selectedGroup->{$key}))
277 277
 				{
278 278
 					$grantList->{$key}->group_srls = $selectedGroup->{$key};
279 279
 				}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
 		$oModuleModel = getModel('module');
317 317
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
318
+		if (!$module_info) return;
319 319
 
320
-		if($mode === 'P')
320
+		if ($mode === 'P')
321 321
 		{
322
-			if($module_info->is_skin_fix == 'N')
322
+			if ($module_info->is_skin_fix == 'N')
323 323
 			{
324 324
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325 325
 			}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		}
331 331
 		else
332 332
 		{
333
-			if($module_info->is_mskin_fix == 'N')
333
+			if ($module_info->is_mskin_fix == 'N')
334 334
 			{
335 335
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336 336
 			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$module_path = './modules/'.$module_info->module;
344 344
 
345 345
 		// Get XML information of the skin and skin sinformation set in DB
346
-		if($mode === 'P')
346
+		if ($mode === 'P')
347 347
 		{
348 348
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 349
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -354,25 +354,25 @@  discard block
 block discarded – undo
354 354
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
355 355
 		}
356 356
 
357
-		if(count($skin_info->extra_vars)) 
357
+		if (count($skin_info->extra_vars)) 
358 358
 		{
359
-			foreach($skin_info->extra_vars as $key => $val) 
359
+			foreach ($skin_info->extra_vars as $key => $val) 
360 360
 			{
361 361
 				$group = $val->group;
362 362
 				$name = $val->name;
363 363
 				$type = $val->type;
364
-				if($skin_vars[$name]) 
364
+				if ($skin_vars[$name]) 
365 365
 				{
366 366
 					$value = $skin_vars[$name]->value;
367 367
 				}
368 368
 				else $value = '';
369
-				if($type=="checkbox")
369
+				if ($type == "checkbox")
370 370
 				{
371
-					$value = $value?unserialize($value):array();
371
+					$value = $value ?unserialize($value) : array();
372 372
 				}
373 373
 
374 374
 				$value = empty($value) ? $val->default : $value;
375
-				$skin_info->extra_vars[$key]->value= $value;
375
+				$skin_info->extra_vars[$key]->value = $value;
376 376
 			}
377 377
 		}
378 378
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 400
 	{
401
-		if($isFullLanguage)
401
+		if ($isFullLanguage)
402 402
 		{
403 403
 			$lang_supported = Context::loadLangSupported();
404 404
 		}
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
 			$lang_supported = Context::get('lang_supported');
408 408
 		}
409 409
 
410
-		if(substr($name,0,12)=='$user_lang->')
410
+		if (substr($name, 0, 12) == '$user_lang->')
411 411
 		{
412 412
 			$args = new stdClass();
413
-			$args->site_srl = (int)$site_srl;
414
-			$args->name = substr($name,12);
413
+			$args->site_srl = (int) $site_srl;
414
+			$args->name = substr($name, 12);
415 415
 			$output = executeQueryArray('module.getLang', $args);
416
-			if($output->data)
416
+			if ($output->data)
417 417
 			{
418
-				foreach($output->data as $key => $val)
418
+				foreach ($output->data as $key => $val)
419 419
 				{
420 420
 					$selected_lang[$val->lang_code] = $val->value;
421 421
 				}
@@ -424,24 +424,24 @@  discard block
 block discarded – undo
424 424
 		else
425 425
 		{
426 426
 			$tmp = unserialize($name);
427
-			if($tmp)
427
+			if ($tmp)
428 428
 			{
429 429
 				$selected_lang = array();
430 430
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
432
-				if(is_array($lang_supported))
431
+				if (!$rand_name) $rand_name = array_shift($tmp);
432
+				if (is_array($lang_supported))
433 433
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
434
+					foreach ($lang_supported as $key => $val)
435
+						$selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name;
436 436
 				}
437 437
 			}
438 438
 		}
439 439
 
440 440
 		$output = array();
441
-		if(is_array($lang_supported))
441
+		if (is_array($lang_supported))
442 442
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
443
+			foreach ($lang_supported as $key => $val)
444
+				$output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name;
445 445
 		}
446 446
 		return $output;
447 447
 	}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	function getModuleAdminLangCode()
453 453
 	{
454 454
 		$name = Context::get('name');
455
-		if(!$name) return new Object(-1,'msg_invalid_request');
455
+		if (!$name) return new Object(-1, 'msg_invalid_request');
456 456
 		$site_module_info = Context::get('site_module_info');
457 457
 		$this->add('name', $name);
458 458
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	function getModuleAdminLangListByName()
466 466
 	{
467 467
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
468
+		if (!$args->site_srl) $args->site_srl = 0;
469 469
 
470 470
 		$columnList = array('lang_code', 'name', 'value');
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 475
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
476
+		if ($output->toBool()) $langList = $output->data;
477 477
 
478 478
 		$this->add('lang_list', $langList);
479 479
 		$this->add('lang_name', $args->langName);
@@ -485,23 +485,23 @@  discard block
 block discarded – undo
485 485
 	function getModuleAdminLangListByValue()
486 486
 	{
487 487
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
488
+		if (!$args->site_srl) $args->site_srl = 0;
489 489
 
490 490
 		$langList = array();
491 491
 
492 492
 		// search value
493 493
 		$output = executeQueryArray('module.getLangNameByValue', $args);
494
-		if($output->toBool() && is_array($output->data))
494
+		if ($output->toBool() && is_array($output->data))
495 495
 		{
496 496
 			unset($args->value);
497 497
 
498
-			foreach($output->data as $data)
498
+			foreach ($output->data as $data)
499 499
 			{
500 500
 				$args->langName = $data->name;
501 501
 				$columnList = array('lang_code', 'name', 'value');
502 502
 				$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
503 503
 
504
-				if($outputByName->toBool())
504
+				if ($outputByName->toBool())
505 505
 				{
506 506
 					$langList = array_merge($langList, $outputByName->data);
507 507
 				}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	function getLangListByLangcode($args)
518 518
 	{
519 519
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
520
+		if (!$output->toBool()) return array();
521 521
 
522 522
 		return $output;
523 523
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	function getModuleAdminMultilingualHtml()
529 529
 	{
530 530
 		$oTemplate = TemplateHandler::getInstance();
531
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17.html');
531
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17.html');
532 532
 
533 533
 		$this->add('html', $tpl);
534 534
 	}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	{
541 541
 		$site_module_info = Context::get('site_module_info');
542 542
 		$args = new stdClass();
543
-		$args->site_srl = (int)$site_module_info->site_srl;
543
+		$args->site_srl = (int) $site_module_info->site_srl;
544 544
 		$args->langCode = Context::get('lang_code');
545 545
 		$args->page = Context::get('page');
546 546
 		$args->sort_index = 'name';
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$args->list_count = Context::get('list_count');
551 551
 		$args->page_count = 5;
552 552
 
553
-		if(!$args->langCode)
553
+		if (!$args->langCode)
554 554
 		{
555 555
 			$args->langCode = Context::get('lang_type');
556 556
 		}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		$oSecurity->encodeHTML('lang_code_list..');
568 568
 
569 569
 		$oTemplate = TemplateHandler::getInstance();
570
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17_list.html');
570
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17_list.html');
571 571
 
572 572
 		$this->add('html', $tpl);
573 573
 	}
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	function getModuleAdminModuleSearcherHtml()
579 579
 	{
580
-		Context::loadLang(_XE_PATH_ . 'modules/admin/lang');
580
+		Context::loadLang(_XE_PATH_.'modules/admin/lang');
581 581
 		$oTemplate = TemplateHandler::getInstance();
582
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html');
582
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'module_searcher_v17.html');
583 583
 
584 584
 		$this->add('html', $tpl);
585 585
 	}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	function getModuleAdminModuleInfo()
591 591
 	{
592
-		if(Context::get('search_module_srl'))
592
+		if (Context::get('search_module_srl'))
593 593
 		{
594 594
 			$module_srl = Context::get('search_module_srl');
595 595
 		}
Please login to merge, or discard this patch.
modules/module/module.controller.php 3 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.
Spacing   +161 added lines, -161 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
 		}
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		$args->update_id = $update_id;
626 626
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
627 627
 
628
-		if(!!$output->error) return false;
628
+		if (!!$output->error) return false;
629 629
 
630 630
 		return true;
631 631
 	}
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
 		$args->site_srl = $site_srl;
641 641
 		$args->layout_srl = $layout_srl;
642 642
 		$output = executeQuery('module.updateModuleSite', $args);
643
-		if(!$output->toBool()) return $output;
643
+		if (!$output->toBool()) return $output;
644 644
 
645 645
 		//remove from cache
646 646
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
647
-		if($oCacheHandler->isSupport())
647
+		if ($oCacheHandler->isSupport())
648 648
 		{
649 649
 			$oCacheHandler->invalidateGroupKey('site_and_module');
650 650
 		}
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	function deleteModule($module_srl, $site_srl = 0)
661 661
 	{
662
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
662
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
663 663
 
664 664
 		$site_module_info = Context::get('site_module_info');
665 665
 
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 		$args = new stdClass();
670 670
 		$args->url = $output->mid;
671 671
 		$args->is_shortcut = 'N';
672
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
672
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
673 673
 		else $args->site_srl = $site_srl;
674 674
 
675 675
 		unset($output);
@@ -678,9 +678,9 @@  discard block
 block discarded – undo
678 678
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
679 679
 
680 680
 		// get menu_srl by site_srl
681
-		if(is_array($menuOutput->data))
681
+		if (is_array($menuOutput->data))
682 682
 		{
683
-			foreach($menuOutput->data AS $key=>$value)
683
+			foreach ($menuOutput->data AS $key=>$value)
684 684
 			{
685 685
 				$args->menu_srl = $value->menu_srl;
686 686
 				break;
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 
690 690
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
691 691
 		// menu delete
692
-		if($output->data)
692
+		if ($output->data)
693 693
 		{
694 694
 			unset($args);
695 695
 			$args = new stdClass;
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 			$oMenuAdminController = getAdminController('menu');
701 701
 			$output = $oMenuAdminController->deleteItem($args);
702 702
 
703
-			if($output->isSuccess)
703
+			if ($output->isSuccess)
704 704
 			{
705 705
 				return new Object(0, 'success_deleted');
706 706
 			}
@@ -722,19 +722,19 @@  discard block
 block discarded – undo
722 722
 	 */
723 723
 	public function onlyDeleteModule($module_srl)
724 724
 	{
725
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
725
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
726 726
 
727 727
 		// check start module
728 728
 		$oModuleModel = getModel('module');
729 729
 		$columnList = array('sites.index_module_srl');
730 730
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
731
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
731
+		if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
732 732
 
733 733
 		// Call a trigger (before)
734 734
 		$trigger_obj = new stdClass();
735 735
 		$trigger_obj->module_srl = $module_srl;
736 736
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
737
-		if(!$output->toBool()) return $output;
737
+		if (!$output->toBool()) return $output;
738 738
 
739 739
 		// begin transaction
740 740
 		$oDB = &DB::getInstance();
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 		$args->module_srl = $module_srl;
745 745
 		// Delete module information from the DB
746 746
 		$output = executeQuery('module.deleteModule', $args);
747
-		if(!$output->toBool())
747
+		if (!$output->toBool())
748 748
 		{
749 749
 			$oDB->rollback();
750 750
 			return $output;
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 		// Remove the module manager
759 759
 		$this->deleteAdminId($module_srl);
760 760
 		// Call a trigger (after)
761
-		if($output->toBool())
761
+		if ($output->toBool())
762 762
 		{
763 763
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
764
-			if(!$trigger_output->toBool())
764
+			if (!$trigger_output->toBool())
765 765
 			{
766 766
 				$oDB->rollback();
767 767
 				return $trigger_output;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 
774 774
 		//remove from cache
775 775
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
776
-		if($oCacheHandler->isSupport())
776
+		if ($oCacheHandler->isSupport())
777 777
 		{
778 778
 			$oCacheHandler->invalidateGroupKey('site_and_module');
779 779
 		}
@@ -795,10 +795,10 @@  discard block
 block discarded – undo
795 795
 	function clearDefaultModule()
796 796
 	{
797 797
 		$output = executeQuery('module.clearDefaultModule');
798
-		if(!$output->toBool()) return $output;
798
+		if (!$output->toBool()) return $output;
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
 		}
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 		$output = executeQuery('module.updateModuleMenu', $args);
815 815
 
816 816
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
817
-		if($oCacheHandler->isSupport())
817
+		if ($oCacheHandler->isSupport())
818 818
 		{
819 819
 			$oCacheHandler->invalidateGroupKey('site_and_module');
820 820
 		}
@@ -827,15 +827,15 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function updateModuleLayout($layout_srl, $menu_srl_list)
829 829
 	{
830
-		if(!count($menu_srl_list)) return;
830
+		if (!count($menu_srl_list)) return;
831 831
 
832 832
 		$args = new stdClass;
833 833
 		$args->layout_srl = $layout_srl;
834
-		$args->menu_srls = implode(',',$menu_srl_list);
834
+		$args->menu_srls = implode(',', $menu_srl_list);
835 835
 		$output = executeQuery('module.updateModuleLayout', $args);
836 836
 
837 837
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
838
-		if($oCacheHandler->isSupport())
838
+		if ($oCacheHandler->isSupport())
839 839
 		{
840 840
 			$oCacheHandler->invalidateGroupKey('site_and_module');
841 841
 		}
@@ -854,37 +854,37 @@  discard block
 block discarded – undo
854 854
 
855 855
 		$output = executeQuery('module.deleteSiteAdmin', $args);
856 856
 
857
-		if(!$output->toBool()) return $output;
857
+		if (!$output->toBool()) return $output;
858 858
 		// Get user id of an administrator
859
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
860
-		foreach($arr_admins as $key => $user_id)
859
+		if (!is_array($arr_admins) || !count($arr_admins)) return new Object();
860
+		foreach ($arr_admins as $key => $user_id)
861 861
 		{
862
-			if(!trim($user_id)) continue;
862
+			if (!trim($user_id)) continue;
863 863
 			$admins[] = trim($user_id);
864 864
 		}
865
-		if(!count($admins)) return new Object();
865
+		if (!count($admins)) return new Object();
866 866
 
867 867
 		$oMemberModel = getModel('member');
868 868
 		$member_config = $oMemberModel->getMemberConfig();
869
-		if($member_config->identifier == 'email_address')
869
+		if ($member_config->identifier == 'email_address')
870 870
 		{
871
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
871
+			$args->email_address = '\''.implode('\',\'', $admins).'\'';
872 872
 		}
873 873
 		else
874 874
 		{
875
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
875
+			$args->user_ids = '\''.implode('\',\'', $admins).'\'';
876 876
 		}
877 877
 		$output = executeQueryArray('module.getAdminSrls', $args);
878
-		if(!$output->toBool()||!$output->data) return $output;
878
+		if (!$output->toBool() || !$output->data) return $output;
879 879
 
880
-		foreach($output->data as $key => $val)
880
+		foreach ($output->data as $key => $val)
881 881
 		{
882 882
 			unset($args);
883 883
 			$args = new stdClass;
884 884
 			$args->site_srl = $site_srl;
885 885
 			$args->member_srl = $val->member_srl;
886 886
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
887
-			if(!$output->toBool()) return $output;
887
+			if (!$output->toBool()) return $output;
888 888
 		}
889 889
 		return new Object();
890 890
 	}
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
 		$oMemberModel = getModel('member');
898 898
 		$member_config = $oMemberModel->getMemberConfig();
899 899
 
900
-		if($member_config->identifier == 'email_address')
900
+		if ($member_config->identifier == 'email_address')
901 901
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
902 902
 		else
903 903
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
904 904
 
905
-		if(!$member_info->member_srl) return;
905
+		if (!$member_info->member_srl) return;
906 906
 		$args = new stdClass();
907 907
 		$args->module_srl = $module_srl;
908 908
 		$args->member_srl = $member_info->member_srl;
@@ -917,11 +917,11 @@  discard block
 block discarded – undo
917 917
 		$args = new stdClass();
918 918
 		$args->module_srl = $module_srl;
919 919
 
920
-		if($admin_id)
920
+		if ($admin_id)
921 921
 		{
922 922
 			$oMemberModel = getModel('member');
923 923
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
924
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
924
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
925 925
 		}
926 926
 		return executeQuery('module.deleteAdminId', $args);
927 927
 	}
@@ -958,18 +958,18 @@  discard block
 block discarded – undo
958 958
 		$oDB->begin();
959 959
 
960 960
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
961
-		if(!$output->toBool())
961
+		if (!$output->toBool())
962 962
 		{
963 963
 			$oDB->rollback();
964 964
 			return $output;
965 965
 		}
966 966
 
967 967
 		getDestroyXeVars($obj);
968
-		if(!$obj || !count($obj)) return new Object();
968
+		if (!$obj || !count($obj)) return new Object();
969 969
 
970 970
 		$args = new stdClass;
971 971
 		$args->module_srl = $module_srl;
972
-		foreach($obj as $key => $val)
972
+		foreach ($obj as $key => $val)
973 973
 		{
974 974
 			// #17927989 For an old board which used the old blog module
975 975
 			// it often saved menu item(stdClass) on the skin info column
@@ -980,9 +980,9 @@  discard block
 block discarded – undo
980 980
 
981 981
 			$args->name = trim($key);
982 982
 			$args->value = trim($val);
983
-			if(!$args->name || !$args->value) continue;
983
+			if (!$args->name || !$args->value) continue;
984 984
 
985
-			if($mode === 'P')
985
+			if ($mode === 'P')
986 986
 			{
987 987
 				$output = executeQuery('module.insertModuleSkinVars', $args);
988 988
 			}
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 			{
991 991
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
992 992
 			}
993
-			if(!$output->toBool())
993
+			if (!$output->toBool())
994 994
 			{
995 995
 				return $output;
996 996
 				$oDB->rollback();
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 		$args->module_srl = $module_srl;
1030 1030
 		$mode = $mode === 'P' ? 'P' : 'M';
1031 1031
 
1032
-		if($mode === 'P')
1032
+		if ($mode === 'P')
1033 1033
 		{
1034 1034
 			$object_key = 'module_skin_vars:'.$module_srl;
1035 1035
 			$query = 'module.deleteModuleSkinVars';
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		//remove from cache
1044 1044
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1045 1045
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1046
-		if($oCacheHandler->isSupport())
1046
+		if ($oCacheHandler->isSupport())
1047 1047
 		{
1048 1048
 			$oCacheHandler->delete($cache_key);
1049 1049
 		}
@@ -1058,22 +1058,22 @@  discard block
 block discarded – undo
1058 1058
 	{
1059 1059
 		$this->deleteModuleExtraVars($module_srl);
1060 1060
 		getDestroyXeVars($obj);
1061
-		if(!$obj || !count($obj)) return;
1061
+		if (!$obj || !count($obj)) return;
1062 1062
 
1063
-		foreach($obj as $key => $val)
1063
+		foreach ($obj as $key => $val)
1064 1064
 		{
1065
-			if(is_object($val) || is_array($val)) continue;
1065
+			if (is_object($val) || is_array($val)) continue;
1066 1066
 
1067 1067
 			$args = new stdClass();
1068 1068
 			$args->module_srl = $module_srl;
1069 1069
 			$args->name = trim($key);
1070 1070
 			$args->value = trim($val);
1071
-			if(!$args->name || !$args->value) continue;
1071
+			if (!$args->name || !$args->value) continue;
1072 1072
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1073 1073
 		}
1074 1074
 
1075 1075
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1076
-		if($oCacheHandler->isSupport())
1076
+		if ($oCacheHandler->isSupport())
1077 1077
 		{
1078 1078
 			$object_key = 'module_extra_vars:'.$module_srl;
1079 1079
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 
1093 1093
 		//remove from cache
1094 1094
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1095
-		if($oCacheHandler->isSupport())
1095
+		if ($oCacheHandler->isSupport())
1096 1096
 		{
1097 1097
 			$object_key = 'module_extra_vars:'.$module_srl;
1098 1098
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1108,19 +1108,19 @@  discard block
 block discarded – undo
1108 1108
 	function insertModuleGrants($module_srl, $obj)
1109 1109
 	{
1110 1110
 		$this->deleteModuleGrants($module_srl);
1111
-		if(!$obj || !count($obj)) return;
1111
+		if (!$obj || !count($obj)) return;
1112 1112
 
1113
-		foreach($obj as $name => $val)
1113
+		foreach ($obj as $name => $val)
1114 1114
 		{
1115
-			if(!$val || !count($val)) continue;
1115
+			if (!$val || !count($val)) continue;
1116 1116
 
1117
-			foreach($val as $group_srl)
1117
+			foreach ($val as $group_srl)
1118 1118
 			{
1119 1119
 				$args = new stdClass();
1120 1120
 				$args->module_srl = $module_srl;
1121 1121
 				$args->name = $name;
1122 1122
 				$args->group_srl = trim($group_srl);
1123
-				if(!$args->name || !$args->group_srl) continue;
1123
+				if (!$args->name || !$args->group_srl) continue;
1124 1124
 				executeQuery('module.insertModuleGrant', $args);
1125 1125
 			}
1126 1126
 		}
@@ -1141,9 +1141,9 @@  discard block
 block discarded – undo
1141 1141
 	 */
1142 1142
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1143 1143
 	{
1144
-		if($isReplaceLangCode)
1144
+		if ($isReplaceLangCode)
1145 1145
 		{
1146
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1146
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1147 1147
 		}
1148 1148
 	}
1149 1149
 
@@ -1151,27 +1151,27 @@  discard block
 block discarded – undo
1151 1151
 	{
1152 1152
 		static $lang = null;
1153 1153
 
1154
-		if(is_null($lang))
1154
+		if (is_null($lang))
1155 1155
 		{
1156 1156
 			$site_module_info = Context::get('site_module_info');
1157
-			if(!$site_module_info)
1157
+			if (!$site_module_info)
1158 1158
 			{
1159 1159
 				$oModuleModel = getModel('module');
1160 1160
 				$site_module_info = $oModuleModel->getDefaultMid();
1161 1161
 				Context::set('site_module_info', $site_module_info);
1162 1162
 			}
1163 1163
 			$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
1164
-			if(!file_exists($cache_file))
1164
+			if (!file_exists($cache_file))
1165 1165
 			{
1166 1166
 				$oModuleAdminController = getAdminController('module');
1167 1167
 				$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1168 1168
 			}
1169 1169
 
1170
-			if(file_exists($cache_file))
1170
+			if (file_exists($cache_file))
1171 1171
 			{
1172
-				$moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php');
1172
+				$moduleAdminControllerMtime = filemtime(_XE_PATH_.'modules/module/module.admin.controller.php');
1173 1173
 				$cacheFileMtime = filemtime($cache_file);
1174
-				if($cacheFileMtime < $moduleAdminControllerMtime)
1174
+				if ($cacheFileMtime < $moduleAdminControllerMtime)
1175 1175
 				{
1176 1176
 					$oModuleAdminController = getAdminController('module');
1177 1177
 					$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
@@ -1180,9 +1180,9 @@  discard block
 block discarded – undo
1180 1180
 				require_once($cache_file);
1181 1181
 			}
1182 1182
 		}
1183
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1183
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1184 1184
 
1185
-		return str_replace('$user_lang->','',$matches[0]);
1185
+		return str_replace('$user_lang->', '', $matches[0]);
1186 1186
 	}
1187 1187
 
1188 1188
 
@@ -1195,17 +1195,17 @@  discard block
 block discarded – undo
1195 1195
 		if ($ajax) Context::setRequestMethod('JSON');
1196 1196
 
1197 1197
 		$logged_info = Context::get('logged_info');
1198
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1198
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1199 1199
 
1200
-		$vars = Context::gets('addfile','filter');
1200
+		$vars = Context::gets('addfile', 'filter');
1201 1201
 		$attributeNames = Context::get('attribute_name');
1202 1202
 		$attributeValues = Context::get('attribute_value');
1203
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1203
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1204 1204
 		{
1205 1205
 			$attributes = array();
1206
-			foreach($attributeNames as $no => $name)
1206
+			foreach ($attributeNames as $no => $name)
1207 1207
 			{
1208
-				if(empty($name))
1208
+				if (empty($name))
1209 1209
 				{
1210 1210
 					continue;
1211 1211
 				}
@@ -1217,16 +1217,16 @@  discard block
 block discarded – undo
1217 1217
 		$vars->comment = $attributes;
1218 1218
 		$module_filebox_srl = Context::get('module_filebox_srl');
1219 1219
 
1220
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1220
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1221 1221
 		$vars->ext = $ext;
1222
-		if($vars->filter) $filter = explode(',',$vars->filter);
1223
-		else $filter = array('jpg','jpeg','gif','png');
1224
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1222
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1223
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1224
+		if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured');
1225 1225
 
1226 1226
 		$vars->member_srl = $logged_info->member_srl;
1227 1227
 
1228 1228
 		// update
1229
-		if($module_filebox_srl > 0)
1229
+		if ($module_filebox_srl > 0)
1230 1230
 		{
1231 1231
 			$vars->module_filebox_srl = $module_filebox_srl;
1232 1232
 			$output = $this->updateModuleFileBox($vars);
@@ -1234,10 +1234,10 @@  discard block
 block discarded – undo
1234 1234
 		// insert
1235 1235
 		else
1236 1236
 		{
1237
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1237
+			if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1238 1238
 			$addfile = Context::get('addfile');
1239
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1240
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1239
+			if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1240
+			if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1241 1241
 			$output = $this->insertModuleFileBox($vars);
1242 1242
 		}
1243 1243
 
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 		}
1252 1252
 		else
1253 1253
 		{
1254
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1254
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1255 1255
 			else $this->add('save_filename', '');
1256 1256
 		}
1257 1257
 	}
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 	{
1264 1264
 		$args = new stdClass;
1265 1265
 		// have file
1266
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1266
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1267 1267
 		{
1268 1268
 			$oModuleModel = getModel('module');
1269 1269
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1272,18 +1272,18 @@  discard block
 block discarded – undo
1272 1272
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1273 1273
 			FileHandler::makeDir($path);
1274 1274
 
1275
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1275
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1276 1276
 			$tmp = $vars->addfile['tmp_name'];
1277 1277
 
1278 1278
 			// Check uploaded file
1279
-			if(!checkUploadedFile($tmp)) return false;
1279
+			if (!checkUploadedFile($tmp)) return false;
1280 1280
 
1281
-			if(!@move_uploaded_file($tmp, $save_filename))
1281
+			if (!@move_uploaded_file($tmp, $save_filename))
1282 1282
 			{
1283 1283
 				return false;
1284 1284
 			}
1285 1285
 
1286
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1286
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1287 1287
 			$args->filename = $save_filename;
1288 1288
 			$args->filesize = $vars->addfile['size'];
1289 1289
 		}
@@ -1309,14 +1309,14 @@  discard block
 block discarded – undo
1309 1309
 		$oModuleModel = getModel('module');
1310 1310
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1311 1311
 		FileHandler::makeDir($path);
1312
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1312
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1313 1313
 		$tmp = $vars->addfile['tmp_name'];
1314 1314
 
1315 1315
 		// Check uploaded file
1316
-		if(!checkUploadedFile($tmp)) return false;
1316
+		if (!checkUploadedFile($tmp)) return false;
1317 1317
 
1318 1318
 		// upload
1319
-		if(!@move_uploaded_file($tmp, $save_filename))
1319
+		if (!@move_uploaded_file($tmp, $save_filename))
1320 1320
 		{
1321 1321
 			return false;
1322 1322
 		}
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 		$args->member_srl = $vars->member_srl;
1328 1328
 		$args->comment = $vars->comment;
1329 1329
 		$args->filename = $save_filename;
1330
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1330
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1331 1331
 		$args->filesize = $vars->addfile['size'];
1332 1332
 
1333 1333
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1342,14 +1342,14 @@  discard block
 block discarded – undo
1342 1342
 	function procModuleFileBoxDelete()
1343 1343
 	{
1344 1344
 		$logged_info = Context::get('logged_info');
1345
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1345
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1346 1346
 
1347 1347
 		$module_filebox_srl = Context::get('module_filebox_srl');
1348
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1348
+		if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1349 1349
 		$vars = new stdClass();
1350 1350
 		$vars->module_filebox_srl = $module_filebox_srl;
1351 1351
 		$output = $this->deleteModuleFileBox($vars);
1352
-		if(!$output->toBool()) return $output;
1352
+		if (!$output->toBool()) return $output;
1353 1353
 	}
1354 1354
 
1355 1355
 	function deleteModuleFileBox($vars)
@@ -1372,11 +1372,11 @@  discard block
 block discarded – undo
1372 1372
 		$this->unlockTimeoutPassed();
1373 1373
 		$args = new stdClass;
1374 1374
 		$args->lock_name = $lock_name;
1375
-		if(!$timeout) $timeout = 60;
1375
+		if (!$timeout) $timeout = 60;
1376 1376
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1377
-		if($member_srl) $args->member_srl = $member_srl;
1377
+		if ($member_srl) $args->member_srl = $member_srl;
1378 1378
 		$output = executeQuery('module.insertLock', $args);
1379
-		if($output->toBool())
1379
+		if ($output->toBool())
1380 1380
 		{
1381 1381
 			$output->add('lock_name', $lock_name);
1382 1382
 			$output->add('deadline', $args->deadline);
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 		$output = executeQuery('module.updateModuleInSites', $args);
1406 1406
 
1407 1407
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1408
-		if($oCacheHandler->isSupport())
1408
+		if ($oCacheHandler->isSupport())
1409 1409
 		{
1410 1410
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1411 1411
 		}
Please login to merge, or discard this patch.
Braces   +220 added lines, -102 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
 			}
@@ -625,7 +658,9 @@  discard block
 block discarded – undo
625 658
 		$args->update_id = $update_id;
626 659
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
627 660
 
628
-		if(!!$output->error) return false;
661
+		if(!!$output->error) {
662
+			return false;
663
+		}
629 664
 
630 665
 		return true;
631 666
 	}
@@ -640,7 +675,9 @@  discard block
 block discarded – undo
640 675
 		$args->site_srl = $site_srl;
641 676
 		$args->layout_srl = $layout_srl;
642 677
 		$output = executeQuery('module.updateModuleSite', $args);
643
-		if(!$output->toBool()) return $output;
678
+		if(!$output->toBool()) {
679
+			return $output;
680
+		}
644 681
 
645 682
 		//remove from cache
646 683
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -659,7 +696,9 @@  discard block
 block discarded – undo
659 696
 	 */
660 697
 	function deleteModule($module_srl, $site_srl = 0)
661 698
 	{
662
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
699
+		if(!$module_srl) {
700
+			return new Object(-1,'msg_invalid_request');
701
+		}
663 702
 
664 703
 		$site_module_info = Context::get('site_module_info');
665 704
 
@@ -669,8 +708,11 @@  discard block
 block discarded – undo
669 708
 		$args = new stdClass();
670 709
 		$args->url = $output->mid;
671 710
 		$args->is_shortcut = 'N';
672
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
673
-		else $args->site_srl = $site_srl;
711
+		if(!$site_srl) {
712
+			$args->site_srl = $site_module_info->site_srl;
713
+		} else {
714
+			$args->site_srl = $site_srl;
715
+		}
674 716
 
675 717
 		unset($output);
676 718
 
@@ -703,8 +745,7 @@  discard block
 block discarded – undo
703 745
 			if($output->isSuccess)
704 746
 			{
705 747
 				return new Object(0, 'success_deleted');
706
-			}
707
-			else
748
+			} else
708 749
 			{
709 750
 				return new Object($output->error, $output->message);
710 751
 			}
@@ -722,19 +763,25 @@  discard block
 block discarded – undo
722 763
 	 */
723 764
 	public function onlyDeleteModule($module_srl)
724 765
 	{
725
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
766
+		if(!$module_srl) {
767
+			return new Object(-1,'msg_invalid_request');
768
+		}
726 769
 
727 770
 		// check start module
728 771
 		$oModuleModel = getModel('module');
729 772
 		$columnList = array('sites.index_module_srl');
730 773
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
731
-		if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule');
774
+		if($module_srl == $start_module->index_module_srl) {
775
+			return new Object(-1, 'msg_cannot_delete_startmodule');
776
+		}
732 777
 
733 778
 		// Call a trigger (before)
734 779
 		$trigger_obj = new stdClass();
735 780
 		$trigger_obj->module_srl = $module_srl;
736 781
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
737
-		if(!$output->toBool()) return $output;
782
+		if(!$output->toBool()) {
783
+			return $output;
784
+		}
738 785
 
739 786
 		// begin transaction
740 787
 		$oDB = &DB::getInstance();
@@ -795,7 +842,9 @@  discard block
 block discarded – undo
795 842
 	function clearDefaultModule()
796 843
 	{
797 844
 		$output = executeQuery('module.clearDefaultModule');
798
-		if(!$output->toBool()) return $output;
845
+		if(!$output->toBool()) {
846
+			return $output;
847
+		}
799 848
 
800 849
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
801 850
 		if($oCacheHandler->isSupport())
@@ -827,7 +876,9 @@  discard block
 block discarded – undo
827 876
 	 */
828 877
 	function updateModuleLayout($layout_srl, $menu_srl_list)
829 878
 	{
830
-		if(!count($menu_srl_list)) return;
879
+		if(!count($menu_srl_list)) {
880
+			return;
881
+		}
831 882
 
832 883
 		$args = new stdClass;
833 884
 		$args->layout_srl = $layout_srl;
@@ -854,28 +905,37 @@  discard block
 block discarded – undo
854 905
 
855 906
 		$output = executeQuery('module.deleteSiteAdmin', $args);
856 907
 
857
-		if(!$output->toBool()) return $output;
908
+		if(!$output->toBool()) {
909
+			return $output;
910
+		}
858 911
 		// Get user id of an administrator
859
-		if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
912
+		if(!is_array($arr_admins) || !count($arr_admins)) {
913
+			return new Object();
914
+		}
860 915
 		foreach($arr_admins as $key => $user_id)
861 916
 		{
862
-			if(!trim($user_id)) continue;
917
+			if(!trim($user_id)) {
918
+				continue;
919
+			}
863 920
 			$admins[] = trim($user_id);
864 921
 		}
865
-		if(!count($admins)) return new Object();
922
+		if(!count($admins)) {
923
+			return new Object();
924
+		}
866 925
 
867 926
 		$oMemberModel = getModel('member');
868 927
 		$member_config = $oMemberModel->getMemberConfig();
869 928
 		if($member_config->identifier == 'email_address')
870 929
 		{
871 930
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
872
-		}
873
-		else
931
+		} else
874 932
 		{
875 933
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
876 934
 		}
877 935
 		$output = executeQueryArray('module.getAdminSrls', $args);
878
-		if(!$output->toBool()||!$output->data) return $output;
936
+		if(!$output->toBool()||!$output->data) {
937
+			return $output;
938
+		}
879 939
 
880 940
 		foreach($output->data as $key => $val)
881 941
 		{
@@ -884,7 +944,9 @@  discard block
 block discarded – undo
884 944
 			$args->site_srl = $site_srl;
885 945
 			$args->member_srl = $val->member_srl;
886 946
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
887
-			if(!$output->toBool()) return $output;
947
+			if(!$output->toBool()) {
948
+				return $output;
949
+			}
888 950
 		}
889 951
 		return new Object();
890 952
 	}
@@ -897,12 +959,15 @@  discard block
 block discarded – undo
897 959
 		$oMemberModel = getModel('member');
898 960
 		$member_config = $oMemberModel->getMemberConfig();
899 961
 
900
-		if($member_config->identifier == 'email_address')
901
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
902
-		else
903
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
962
+		if($member_config->identifier == 'email_address') {
963
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
964
+		} else {
965
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
966
+		}
904 967
 
905
-		if(!$member_info->member_srl) return;
968
+		if(!$member_info->member_srl) {
969
+			return;
970
+		}
906 971
 		$args = new stdClass();
907 972
 		$args->module_srl = $module_srl;
908 973
 		$args->member_srl = $member_info->member_srl;
@@ -921,7 +986,9 @@  discard block
 block discarded – undo
921 986
 		{
922 987
 			$oMemberModel = getModel('member');
923 988
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
924
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
989
+			if($member_info->member_srl) {
990
+				$args->member_srl = $member_info->member_srl;
991
+			}
925 992
 		}
926 993
 		return executeQuery('module.deleteAdminId', $args);
927 994
 	}
@@ -965,7 +1032,9 @@  discard block
 block discarded – undo
965 1032
 		}
966 1033
 
967 1034
 		getDestroyXeVars($obj);
968
-		if(!$obj || !count($obj)) return new Object();
1035
+		if(!$obj || !count($obj)) {
1036
+			return new Object();
1037
+		}
969 1038
 
970 1039
 		$args = new stdClass;
971 1040
 		$args->module_srl = $module_srl;
@@ -975,18 +1044,23 @@  discard block
 block discarded – undo
975 1044
 			// it often saved menu item(stdClass) on the skin info column
976 1045
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
977 1046
 			// fixed the error
978
-			if (is_object($val)) continue;
979
-			if (is_array($val)) $val = serialize($val);
1047
+			if (is_object($val)) {
1048
+				continue;
1049
+			}
1050
+			if (is_array($val)) {
1051
+				$val = serialize($val);
1052
+			}
980 1053
 
981 1054
 			$args->name = trim($key);
982 1055
 			$args->value = trim($val);
983
-			if(!$args->name || !$args->value) continue;
1056
+			if(!$args->name || !$args->value) {
1057
+				continue;
1058
+			}
984 1059
 
985 1060
 			if($mode === 'P')
986 1061
 			{
987 1062
 				$output = executeQuery('module.insertModuleSkinVars', $args);
988
-			}
989
-			else
1063
+			} else
990 1064
 			{
991 1065
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
992 1066
 			}
@@ -1033,8 +1107,7 @@  discard block
 block discarded – undo
1033 1107
 		{
1034 1108
 			$object_key = 'module_skin_vars:'.$module_srl;
1035 1109
 			$query = 'module.deleteModuleSkinVars';
1036
-		}
1037
-		else
1110
+		} else
1038 1111
 		{
1039 1112
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1040 1113
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1058,17 +1131,23 @@  discard block
 block discarded – undo
1058 1131
 	{
1059 1132
 		$this->deleteModuleExtraVars($module_srl);
1060 1133
 		getDestroyXeVars($obj);
1061
-		if(!$obj || !count($obj)) return;
1134
+		if(!$obj || !count($obj)) {
1135
+			return;
1136
+		}
1062 1137
 
1063 1138
 		foreach($obj as $key => $val)
1064 1139
 		{
1065
-			if(is_object($val) || is_array($val)) continue;
1140
+			if(is_object($val) || is_array($val)) {
1141
+				continue;
1142
+			}
1066 1143
 
1067 1144
 			$args = new stdClass();
1068 1145
 			$args->module_srl = $module_srl;
1069 1146
 			$args->name = trim($key);
1070 1147
 			$args->value = trim($val);
1071
-			if(!$args->name || !$args->value) continue;
1148
+			if(!$args->name || !$args->value) {
1149
+				continue;
1150
+			}
1072 1151
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1073 1152
 		}
1074 1153
 
@@ -1108,11 +1187,15 @@  discard block
 block discarded – undo
1108 1187
 	function insertModuleGrants($module_srl, $obj)
1109 1188
 	{
1110 1189
 		$this->deleteModuleGrants($module_srl);
1111
-		if(!$obj || !count($obj)) return;
1190
+		if(!$obj || !count($obj)) {
1191
+			return;
1192
+		}
1112 1193
 
1113 1194
 		foreach($obj as $name => $val)
1114 1195
 		{
1115
-			if(!$val || !count($val)) continue;
1196
+			if(!$val || !count($val)) {
1197
+				continue;
1198
+			}
1116 1199
 
1117 1200
 			foreach($val as $group_srl)
1118 1201
 			{
@@ -1120,7 +1203,9 @@  discard block
 block discarded – undo
1120 1203
 				$args->module_srl = $module_srl;
1121 1204
 				$args->name = $name;
1122 1205
 				$args->group_srl = trim($group_srl);
1123
-				if(!$args->name || !$args->group_srl) continue;
1206
+				if(!$args->name || !$args->group_srl) {
1207
+					continue;
1208
+				}
1124 1209
 				executeQuery('module.insertModuleGrant', $args);
1125 1210
 			}
1126 1211
 		}
@@ -1180,7 +1265,9 @@  discard block
 block discarded – undo
1180 1265
 				require_once($cache_file);
1181 1266
 			}
1182 1267
 		}
1183
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1268
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1269
+			return $lang[$matches[1]];
1270
+		}
1184 1271
 
1185 1272
 		return str_replace('$user_lang->','',$matches[0]);
1186 1273
 	}
@@ -1192,10 +1279,14 @@  discard block
 block discarded – undo
1192 1279
 	function procModuleFileBoxAdd()
1193 1280
 	{
1194 1281
 		$ajax = Context::get('ajax');
1195
-		if ($ajax) Context::setRequestMethod('JSON');
1282
+		if ($ajax) {
1283
+			Context::setRequestMethod('JSON');
1284
+		}
1196 1285
 
1197 1286
 		$logged_info = Context::get('logged_info');
1198
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1287
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1288
+			return new Object(-1, 'msg_not_permitted');
1289
+		}
1199 1290
 
1200 1291
 		$vars = Context::gets('addfile','filter');
1201 1292
 		$attributeNames = Context::get('attribute_name');
@@ -1219,9 +1310,14 @@  discard block
 block discarded – undo
1219 1310
 
1220 1311
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1221 1312
 		$vars->ext = $ext;
1222
-		if($vars->filter) $filter = explode(',',$vars->filter);
1223
-		else $filter = array('jpg','jpeg','gif','png');
1224
-		if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured');
1313
+		if($vars->filter) {
1314
+			$filter = explode(',',$vars->filter);
1315
+		} else {
1316
+			$filter = array('jpg','jpeg','gif','png');
1317
+		}
1318
+		if(!in_array($ext,$filter)) {
1319
+			return new Object(-1, 'msg_error_occured');
1320
+		}
1225 1321
 
1226 1322
 		$vars->member_srl = $logged_info->member_srl;
1227 1323
 
@@ -1234,10 +1330,16 @@  discard block
 block discarded – undo
1234 1330
 		// insert
1235 1331
 		else
1236 1332
 		{
1237
-			if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
1333
+			if(!Context::isUploaded()) {
1334
+				return new Object(-1, 'msg_error_occured');
1335
+			}
1238 1336
 			$addfile = Context::get('addfile');
1239
-			if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
1240
-			if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured');
1337
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1338
+				return new Object(-1, 'msg_error_occured');
1339
+			}
1340
+			if($vars->addfile['error'] != 0) {
1341
+				return new Object(-1, 'msg_error_occured');
1342
+			}
1241 1343
 			$output = $this->insertModuleFileBox($vars);
1242 1344
 		}
1243 1345
 
@@ -1248,11 +1350,13 @@  discard block
 block discarded – undo
1248 1350
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1249 1351
 			$this->setRedirectUrl($returnUrl);
1250 1352
 			return;
1251
-		}
1252
-		else
1353
+		} else
1253 1354
 		{
1254
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1255
-			else $this->add('save_filename', '');
1355
+			if($output) {
1356
+				$this->add('save_filename', $output->get('save_filename'));
1357
+			} else {
1358
+				$this->add('save_filename', '');
1359
+			}
1256 1360
 		}
1257 1361
 	}
1258 1362
 
@@ -1276,7 +1380,9 @@  discard block
 block discarded – undo
1276 1380
 			$tmp = $vars->addfile['tmp_name'];
1277 1381
 
1278 1382
 			// Check uploaded file
1279
-			if(!checkUploadedFile($tmp)) return false;
1383
+			if(!checkUploadedFile($tmp)) {
1384
+				return false;
1385
+			}
1280 1386
 
1281 1387
 			if(!@move_uploaded_file($tmp, $save_filename))
1282 1388
 			{
@@ -1313,7 +1419,9 @@  discard block
 block discarded – undo
1313 1419
 		$tmp = $vars->addfile['tmp_name'];
1314 1420
 
1315 1421
 		// Check uploaded file
1316
-		if(!checkUploadedFile($tmp)) return false;
1422
+		if(!checkUploadedFile($tmp)) {
1423
+			return false;
1424
+		}
1317 1425
 
1318 1426
 		// upload
1319 1427
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1342,14 +1450,20 @@  discard block
 block discarded – undo
1342 1450
 	function procModuleFileBoxDelete()
1343 1451
 	{
1344 1452
 		$logged_info = Context::get('logged_info');
1345
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
1453
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1454
+			return new Object(-1, 'msg_not_permitted');
1455
+		}
1346 1456
 
1347 1457
 		$module_filebox_srl = Context::get('module_filebox_srl');
1348
-		if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request');
1458
+		if(!$module_filebox_srl) {
1459
+			return new Object(-1, 'msg_invalid_request');
1460
+		}
1349 1461
 		$vars = new stdClass();
1350 1462
 		$vars->module_filebox_srl = $module_filebox_srl;
1351 1463
 		$output = $this->deleteModuleFileBox($vars);
1352
-		if(!$output->toBool()) return $output;
1464
+		if(!$output->toBool()) {
1465
+			return $output;
1466
+		}
1353 1467
 	}
1354 1468
 
1355 1469
 	function deleteModuleFileBox($vars)
@@ -1372,9 +1486,13 @@  discard block
 block discarded – undo
1372 1486
 		$this->unlockTimeoutPassed();
1373 1487
 		$args = new stdClass;
1374 1488
 		$args->lock_name = $lock_name;
1375
-		if(!$timeout) $timeout = 60;
1489
+		if(!$timeout) {
1490
+			$timeout = 60;
1491
+		}
1376 1492
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1377
-		if($member_srl) $args->member_srl = $member_srl;
1493
+		if($member_srl) {
1494
+			$args->member_srl = $member_srl;
1495
+		}
1378 1496
 		$output = executeQuery('module.insertLock', $args);
1379 1497
 		if($output->toBool())
1380 1498
 		{
Please login to merge, or discard this patch.
modules/page/page.view.php 3 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.
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.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@  discard block
 block discarded – undo
22 22
 		// Get a template path (page in the administrative template tpl putting together)
23 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
-		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
52
+		$method = '_get'.ucfirst($page_type_name).'Content';
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);
@@ -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,32 +171,32 @@  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();
190 190
 			include(FileHandler::getRealPath($target_file));
191 191
 			$content = ob_get_clean();
192 192
 			// Replace relative path to the absolute path 
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);
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);
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.
modules/point/point.controller.php 3 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.
Spacing   +103 added lines, -103 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();
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		$oDocumentModel = getModel('document');
191 191
 
192
-		if($obj->status != $oDocumentModel->getConfigStatus('temp'))
192
+		if ($obj->status != $oDocumentModel->getConfigStatus('temp'))
193 193
 		{
194 194
 			$module_srl = $obj->module_srl;
195 195
 			$member_srl = $obj->member_srl;
196 196
 			// The process related to clearing the post object
197
-			if(!$module_srl || !$member_srl) return new Object();
197
+			if (!$module_srl || !$member_srl) return new Object();
198 198
 			// Run only when logged in
199 199
 			$logged_info = Context::get('logged_info');
200
-			if(!$logged_info->member_srl) return new Object();
200
+			if (!$logged_info->member_srl) return new Object();
201 201
 			// Get the points of the member
202 202
 			$oPointModel = getModel('point');
203 203
 			$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
208 208
 
209 209
 			$point = $module_config['insert_document'];
210
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
210
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
211 211
 			// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
212
-			if($point < 0) return new Object();
212
+			if ($point < 0) return new Object();
213 213
 			$cur_point -= $point;
214 214
 			// Add points related to deleting an attachment
215 215
 			$point = $module_config['upload_file'];
216
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
217
-			if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
216
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
217
+			if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
218 218
 			// Increase the point
219
-			$this->setPoint($member_srl,$cur_point);
219
+			$this->setPoint($member_srl, $cur_point);
220 220
 		}
221 221
 
222 222
 		return new Object();
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 	{
230 230
 		$module_srl = $obj->module_srl;
231 231
 		$member_srl = $obj->member_srl;
232
-		if(!$module_srl || !$member_srl) return new Object();
232
+		if (!$module_srl || !$member_srl) return new Object();
233 233
 		// Do not increase the points if the member is the author of the post
234 234
 		$document_srl = $obj->document_srl;
235 235
 		$oDocumentModel = getModel('document');
236 236
 		$oDocument = $oDocumentModel->getDocument($document_srl);
237
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
237
+		if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object();
238 238
 		// Get the point module information
239 239
 		$oModuleModel = getModel('module');
240 240
 		$config = $oModuleModel->getModuleConfig('point');
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 		$cur_point = $oPointModel->getPoint($member_srl, true);
245 245
 
246 246
 		$point = $module_config['insert_comment'];
247
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
247
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
248 248
 		// Increase the point
249 249
 		$cur_point += $point;
250
-		$this->setPoint($member_srl,$cur_point);
250
+		$this->setPoint($member_srl, $cur_point);
251 251
 
252 252
 		return new Object();
253 253
 	}
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 		$module_srl = $obj->module_srl;
265 265
 		$member_srl = abs($obj->member_srl);
266 266
 		$document_srl = $obj->document_srl;
267
-		if(!$module_srl || !$member_srl) return new Object();
267
+		if (!$module_srl || !$member_srl) return new Object();
268 268
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
269 269
 		$oDocument = $oDocumentModel->getDocument($document_srl);
270
-		if(!$oDocument->isExists()) return new Object();
271
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
270
+		if (!$oDocument->isExists()) return new Object();
271
+		if ($oDocument->get('member_srl') == $member_srl) return new Object();
272 272
 		// Get the point module information
273 273
 		$config = $oModuleModel->getModuleConfig('point');
274 274
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 		$cur_point = $oPointModel->getPoint($member_srl, true);
277 277
 
278 278
 		$point = $module_config['insert_comment'];
279
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
279
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
280 280
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
281
-		if($point < 0) return new Object();
281
+		if ($point < 0) return new Object();
282 282
 		// Increase the point
283 283
 		$cur_point -= $point;
284
-		$this->setPoint($member_srl,$cur_point);
284
+		$this->setPoint($member_srl, $cur_point);
285 285
 
286 286
 		return new Object();
287 287
 	}
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	function triggerDeleteFile(&$obj)
303 303
 	{
304
-		if($obj->isvalid != 'Y') return new Object();
304
+		if ($obj->isvalid != 'Y') return new Object();
305 305
 
306 306
 		$module_srl = $obj->module_srl;
307 307
 		$member_srl = $obj->member_srl;
308
-		if(!$module_srl || !$member_srl) return new Object();
308
+		if (!$module_srl || !$member_srl) return new Object();
309 309
 		// Get the point module information
310 310
 		$oModuleModel = getModel('module');
311 311
 		$config = $oModuleModel->getModuleConfig('point');
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 		$cur_point = $oPointModel->getPoint($member_srl, true);
316 316
 
317 317
 		$point = $module_config['upload_file'];
318
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
318
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
319 319
 		// Increase the point
320 320
 		$cur_point -= $point;
321
-		$this->setPoint($member_srl,$cur_point);
321
+		$this->setPoint($member_srl, $cur_point);
322 322
 
323 323
 		return new Object();
324 324
 	}
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 		$logged_info = Context::get('logged_info');
332 332
 		$member_srl = $logged_info->member_srl;
333 333
 		$module_srl = $obj->module_srl;
334
-		if(!$module_srl) return new Object();
334
+		if (!$module_srl) return new Object();
335 335
 
336 336
 		// Pass if it is your file
337
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
337
+		if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
338 338
 		$oModuleModel = getModel('module');
339 339
 		$config = $oModuleModel->getModuleConfig('point');
340 340
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 
350 350
 		// If the user is not logged in and download requires points, deny access.
351
-		if(!Context::get('is_logged'))
351
+		if (!Context::get('is_logged'))
352 352
 		{
353
-			if($config->disable_download == 'Y' && $point)
353
+			if ($config->disable_download == 'Y' && $point)
354 354
 			{
355
-				return new Object(-1,'msg_not_permitted_download');
355
+				return new Object(-1, 'msg_not_permitted_download');
356 356
 			}
357 357
 			else
358 358
 			{
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		// If the member does not have enough points, deny access.
368 368
 		if ($config->disable_download == 'Y' && $cur_point + $point < 0)
369 369
 		{
370
-			return new Object(-1,'msg_cannot_download');
370
+			return new Object(-1, 'msg_cannot_download');
371 371
 		}
372 372
 
373 373
 		// Otherwise, points will be adjusted after downloading (triggerDownloadFile).
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 	{
382 382
 		// Run only when logged in
383 383
 		$logged_info = Context::get('logged_info');
384
-		if(!$logged_info->member_srl) return new Object();
384
+		if (!$logged_info->member_srl) return new Object();
385 385
 		$module_srl = $obj->module_srl;
386 386
 		$member_srl = $logged_info->member_srl;
387
-		if(!$module_srl) return new Object();
387
+		if (!$module_srl) return new Object();
388 388
 
389 389
 		// Pass if it is your file
390
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
390
+		if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
391 391
 
392 392
 		// Get the point module information
393 393
 		$oModuleModel = getModel('module');
@@ -428,22 +428,22 @@  discard block
 block discarded – undo
428 428
 		// Get the original author number
429 429
 		$target_member_srl = abs($obj->get('member_srl'));
430 430
 		// Pass without increasing the hits if the viewer is the same as the author
431
-		if($target_member_srl == $member_srl) return new Object();
431
+		if ($target_member_srl == $member_srl) return new Object();
432 432
 		// Get the point information for each module
433 433
 		$config = $oModuleModel->getModuleConfig('point');
434 434
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
435 435
 		// Get hits points
436 436
 		$point = $module_config['read_document'];
437
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
437
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
438 438
 		// Pass if there are no requested points
439
-		if(!$point) return new Object();
439
+		if (!$point) return new Object();
440 440
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
441
-		if($member_srl)
441
+		if ($member_srl)
442 442
 		{
443 443
 			$args->member_srl = $member_srl;
444 444
 			$args->document_srl = $obj->document_srl;
445 445
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
446
-			if($output->data->count) return new Object();
446
+			if ($output->data->count) return new Object();
447 447
 			$cur_point = $oPointModel->getPoint($member_srl, true);
448 448
 		}
449 449
 		else
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		$config = $oModuleModel->getModuleConfig('point');
455 455
 		// When the requested points are negative, compared it with the current point
456 456
 		$_SESSION['banned_document'][$obj->document_srl] = false;
457
-		if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
457
+		if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point)
458 458
 		{
459 459
 			$message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point);
460 460
 			$obj->add('content', $message);
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 			return new Object(-1, $message);
463 463
 		}
464 464
 		// If not logged in, pass
465
-		if(!$logged_info->member_srl) return new Object();
465
+		if (!$logged_info->member_srl) return new Object();
466 466
 		// Pass, if there are no requested points
467
-		if(!$point) return new Object();
467
+		if (!$point) return new Object();
468 468
 		// If the read record is missing, leave it
469 469
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
470 470
 		// Increase the point
471 471
 		$cur_point += $point;
472
-		$this->setPoint($member_srl,$cur_point);
472
+		$this->setPoint($member_srl, $cur_point);
473 473
 
474 474
 		return new Object();
475 475
 	}
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	{
482 482
 		$module_srl = $obj->module_srl;
483 483
 		$member_srl = $obj->member_srl;
484
-		if(!$module_srl || !$member_srl) return new Object();
484
+		if (!$module_srl || !$member_srl) return new Object();
485 485
 
486 486
 		$oModuleModel = getModel('module');
487 487
 		$config = $oModuleModel->getModuleConfig('point');
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
 		$oPointModel = getModel('point');
491 491
 		$cur_point = $oPointModel->getPoint($member_srl, true);
492 492
 
493
-		if( $obj->point > 0 )
493
+		if ($obj->point > 0)
494 494
 		{
495 495
 			$point = $module_config['voted'];
496
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
496
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->voted;
497 497
 		}
498 498
 		else
499 499
 		{
500 500
 			$point = $module_config['blamed'];
501
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
501
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
502 502
 		}
503 503
 
504
-		if(!$point) return new Object();
504
+		if (!$point) return new Object();
505 505
 		// Increase the point
506 506
 		$cur_point += $point;
507
-		$this->setPoint($member_srl,$cur_point);
507
+		$this->setPoint($member_srl, $cur_point);
508 508
 
509 509
 		return new Object();
510 510
 	}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	{
517 517
 		$member_srl = abs($member_srl);
518 518
 		$mode_arr = array('add', 'minus', 'update', 'signup');
519
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
519
+		if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update';
520 520
 
521 521
 		// Get configuration information
522 522
 		$oMemberModel = getModel('member');
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 		$args->member_srl = $member_srl;
534 534
 		$args->point = $current_point;
535 535
 
536
-		switch($mode)
536
+		switch ($mode)
537 537
 		{
538 538
 			case 'add' :
539 539
 				$args->point += $point;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 				$args->point = $point;
547 547
 				break;
548 548
 		}
549
-		if($args->point < 0) $args->point = 0;
549
+		if ($args->point < 0) $args->point = 0;
550 550
 		$point = $args->point;
551 551
 
552 552
 		// Call a trigger (before)
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		$trigger_obj->current_level = $current_level;
558 558
 		$trigger_obj->set_point = $point;
559 559
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj);
560
-		if(!$trigger_output->toBool())
560
+		if (!$trigger_output->toBool())
561 561
 		{
562 562
 			return $trigger_output;
563 563
 		}
@@ -568,19 +568,19 @@  discard block
 block discarded – undo
568 568
 
569 569
 		// If there are points, update, if no, insert
570 570
 		$oPointModel = getModel('point');
571
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
571
+		if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
572 572
 		else executeQuery("point.insertPoint", $args);
573 573
 
574 574
 		// Get a new level
575 575
 		$level = $oPointModel->getLevel($point, $config->level_step);
576 576
 
577 577
 		// If existing level and a new one are different attempt to set a point group
578
-		if($level != $current_level)
578
+		if ($level != $current_level)
579 579
 		{
580 580
 			// Check if the level, for which the current points are prepared, is calculate and set the correct group
581 581
 			$point_group = $config->point_group;
582 582
 			// If the point group exists
583
-			if($point_group && is_array($point_group) && count($point_group) )
583
+			if ($point_group && is_array($point_group) && count($point_group))
584 584
 			{
585 585
 				// Get the default group
586 586
 				$default_group = $oMemberModel->getDefaultGroup();
@@ -590,29 +590,29 @@  discard block
 block discarded – undo
590 590
 
591 591
 				asort($point_group);
592 592
 				// Reset group after initialization
593
-				if($config->group_reset != 'N')
593
+				if ($config->group_reset != 'N')
594 594
 				{
595 595
 					// If the new level is in the right group
596
-					if(in_array($level, $point_group))
596
+					if (in_array($level, $point_group))
597 597
 					{
598 598
 						// Delete all groups except the one which the current level belongs to
599
-						foreach($point_group as $group_srl => $target_level)
599
+						foreach ($point_group as $group_srl => $target_level)
600 600
 						{
601 601
 							$del_group_list[] = $group_srl;
602
-							if($target_level == $level) $new_group_list[] = $group_srl;
602
+							if ($target_level == $level) $new_group_list[] = $group_srl;
603 603
 						}
604 604
 					}
605 605
 					// Otherwise, in case the level is reduced, add the recent group
606 606
 					else
607 607
 					{
608 608
 						$i = $level;
609
-						while($i > 0)
609
+						while ($i > 0)
610 610
 						{
611
-							if(in_array($i, $point_group))
611
+							if (in_array($i, $point_group))
612 612
 							{
613
-								foreach($point_group as $group_srl => $target_level)
613
+								foreach ($point_group as $group_srl => $target_level)
614 614
 								{
615
-									if($target_level == $i)
615
+									if ($target_level == $i)
616 616
 									{
617 617
 										$new_group_list[] = $group_srl;
618 618
 									}
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 						}
624 624
 					}
625 625
 					// Delete the group of a level which is higher than the current level
626
-					foreach($point_group as $group_srl => $target_level)
626
+					foreach ($point_group as $group_srl => $target_level)
627 627
 					{
628
-						if($target_level > $level) $del_group_list[] = $group_srl;
628
+						if ($target_level > $level) $del_group_list[] = $group_srl;
629 629
 					}
630 630
 					$del_group_list[] = $default_group->group_srl;
631 631
 				}
@@ -633,16 +633,16 @@  discard block
 block discarded – undo
633 633
 				else
634 634
 				{
635 635
 					// Check until the current level by rotating setting the configurations of the point groups
636
-					foreach($point_group as $group_srl => $target_level)
636
+					foreach ($point_group as $group_srl => $target_level)
637 637
 					{
638 638
 						$del_group_list[] = $group_srl;
639
-						if($target_level <= $level) $new_group_list[] = $group_srl;
639
+						if ($target_level <= $level) $new_group_list[] = $group_srl;
640 640
 					}
641 641
 				}
642 642
 				// If there is no a new group, granted the default group
643
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
643
+				if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
644 644
 				// Remove linkage group
645
-				if($del_group_list && count($del_group_list))
645
+				if ($del_group_list && count($del_group_list))
646 646
 				{
647 647
 					$del_group_args = new stdClass;
648 648
 					$del_group_args->member_srl = $member_srl;
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 					$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
651 651
 				}
652 652
 				// Grant a new group
653
-				foreach($new_group_list as $group_srl)
653
+				foreach ($new_group_list as $group_srl)
654 654
 				{
655 655
 					$new_group_args = new stdClass;
656 656
 					$new_group_args->member_srl = $member_srl;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 		$trigger_obj->del_group_list = $del_group_list;
666 666
 		$trigger_obj->new_level = $level;
667 667
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj);
668
-		if(!$trigger_output->toBool())
668
+		if (!$trigger_output->toBool())
669 669
 		{
670 670
 			$oDB->rollback();
671 671
 			return $trigger_output;
@@ -681,17 +681,17 @@  discard block
 block discarded – undo
681 681
 		FileHandler::writeFile($cache_filename, $point);
682 682
 
683 683
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
684
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
684
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
685 685
 		{
686
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
686
+			$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0';
687 687
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
688 688
 			$oCacheHandler->delete($cache_key);
689 689
 		}
690 690
 
691 691
 		$oCacheHandler = CacheHandler::getInstance('object');
692
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
692
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
693 693
 		{
694
-			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
694
+			$object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl;
695 695
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
696 696
 			$oCacheHandler->delete($cache_key);
697 697
 		}
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
 		$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
706 706
 
707 707
 		$oModuleController = getController('module');
708
-		if(is_array($obj->moduleSrlList))
708
+		if (is_array($obj->moduleSrlList))
709 709
 		{
710
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
710
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
711 711
 			{
712 712
 				$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
713 713
 			}
Please login to merge, or discard this patch.
Braces   +175 added lines, -67 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
@@ -194,10 +228,14 @@  discard block
 block discarded – undo
194 228
 			$module_srl = $obj->module_srl;
195 229
 			$member_srl = $obj->member_srl;
196 230
 			// The process related to clearing the post object
197
-			if(!$module_srl || !$member_srl) return new Object();
231
+			if(!$module_srl || !$member_srl) {
232
+				return new Object();
233
+			}
198 234
 			// Run only when logged in
199 235
 			$logged_info = Context::get('logged_info');
200
-			if(!$logged_info->member_srl) return new Object();
236
+			if(!$logged_info->member_srl) {
237
+				return new Object();
238
+			}
201 239
 			// Get the points of the member
202 240
 			$oPointModel = getModel('point');
203 241
 			$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -207,14 +245,22 @@  discard block
 block discarded – undo
207 245
 			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
208 246
 
209 247
 			$point = $module_config['insert_document'];
210
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
248
+			if(strlen($point) == 0 && !is_int($point)) {
249
+				$point = $config->insert_document;
250
+			}
211 251
 			// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
212
-			if($point < 0) return new Object();
252
+			if($point < 0) {
253
+				return new Object();
254
+			}
213 255
 			$cur_point -= $point;
214 256
 			// Add points related to deleting an attachment
215 257
 			$point = $module_config['upload_file'];
216
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
217
-			if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
258
+			if(strlen($point) == 0 && !is_int($point)) {
259
+				$point = $config->upload_file;
260
+			}
261
+			if($obj->uploaded_count) {
262
+				$cur_point -= $point * $obj->uploaded_count;
263
+			}
218 264
 			// Increase the point
219 265
 			$this->setPoint($member_srl,$cur_point);
220 266
 		}
@@ -229,12 +275,16 @@  discard block
 block discarded – undo
229 275
 	{
230 276
 		$module_srl = $obj->module_srl;
231 277
 		$member_srl = $obj->member_srl;
232
-		if(!$module_srl || !$member_srl) return new Object();
278
+		if(!$module_srl || !$member_srl) {
279
+			return new Object();
280
+		}
233 281
 		// Do not increase the points if the member is the author of the post
234 282
 		$document_srl = $obj->document_srl;
235 283
 		$oDocumentModel = getModel('document');
236 284
 		$oDocument = $oDocumentModel->getDocument($document_srl);
237
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
285
+		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) {
286
+			return new Object();
287
+		}
238 288
 		// Get the point module information
239 289
 		$oModuleModel = getModel('module');
240 290
 		$config = $oModuleModel->getModuleConfig('point');
@@ -244,7 +294,9 @@  discard block
 block discarded – undo
244 294
 		$cur_point = $oPointModel->getPoint($member_srl, true);
245 295
 
246 296
 		$point = $module_config['insert_comment'];
247
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
297
+		if(strlen($point) == 0 && !is_int($point)) {
298
+			$point = $config->insert_comment;
299
+		}
248 300
 		// Increase the point
249 301
 		$cur_point += $point;
250 302
 		$this->setPoint($member_srl,$cur_point);
@@ -264,11 +316,17 @@  discard block
 block discarded – undo
264 316
 		$module_srl = $obj->module_srl;
265 317
 		$member_srl = abs($obj->member_srl);
266 318
 		$document_srl = $obj->document_srl;
267
-		if(!$module_srl || !$member_srl) return new Object();
319
+		if(!$module_srl || !$member_srl) {
320
+			return new Object();
321
+		}
268 322
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
269 323
 		$oDocument = $oDocumentModel->getDocument($document_srl);
270
-		if(!$oDocument->isExists()) return new Object();
271
-		if($oDocument->get('member_srl')==$member_srl) return new Object();
324
+		if(!$oDocument->isExists()) {
325
+			return new Object();
326
+		}
327
+		if($oDocument->get('member_srl')==$member_srl) {
328
+			return new Object();
329
+		}
272 330
 		// Get the point module information
273 331
 		$config = $oModuleModel->getModuleConfig('point');
274 332
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -276,9 +334,13 @@  discard block
 block discarded – undo
276 334
 		$cur_point = $oPointModel->getPoint($member_srl, true);
277 335
 
278 336
 		$point = $module_config['insert_comment'];
279
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
337
+		if(strlen($point) == 0 && !is_int($point)) {
338
+			$point = $config->insert_comment;
339
+		}
280 340
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
281
-		if($point < 0) return new Object();
341
+		if($point < 0) {
342
+			return new Object();
343
+		}
282 344
 		// Increase the point
283 345
 		$cur_point -= $point;
284 346
 		$this->setPoint($member_srl,$cur_point);
@@ -301,11 +363,15 @@  discard block
 block discarded – undo
301 363
 	 */
302 364
 	function triggerDeleteFile(&$obj)
303 365
 	{
304
-		if($obj->isvalid != 'Y') return new Object();
366
+		if($obj->isvalid != 'Y') {
367
+			return new Object();
368
+		}
305 369
 
306 370
 		$module_srl = $obj->module_srl;
307 371
 		$member_srl = $obj->member_srl;
308
-		if(!$module_srl || !$member_srl) return new Object();
372
+		if(!$module_srl || !$member_srl) {
373
+			return new Object();
374
+		}
309 375
 		// Get the point module information
310 376
 		$oModuleModel = getModel('module');
311 377
 		$config = $oModuleModel->getModuleConfig('point');
@@ -315,7 +381,9 @@  discard block
 block discarded – undo
315 381
 		$cur_point = $oPointModel->getPoint($member_srl, true);
316 382
 
317 383
 		$point = $module_config['upload_file'];
318
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
384
+		if(strlen($point) == 0 && !is_int($point)) {
385
+			$point = $config->upload_file;
386
+		}
319 387
 		// Increase the point
320 388
 		$cur_point -= $point;
321 389
 		$this->setPoint($member_srl,$cur_point);
@@ -331,18 +399,21 @@  discard block
 block discarded – undo
331 399
 		$logged_info = Context::get('logged_info');
332 400
 		$member_srl = $logged_info->member_srl;
333 401
 		$module_srl = $obj->module_srl;
334
-		if(!$module_srl) return new Object();
402
+		if(!$module_srl) {
403
+			return new Object();
404
+		}
335 405
 
336 406
 		// Pass if it is your file
337
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
407
+		if($member_srl && abs($obj->member_srl) == $member_srl) {
408
+			return new Object();
409
+		}
338 410
 		$oModuleModel = getModel('module');
339 411
 		$config = $oModuleModel->getModuleConfig('point');
340 412
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
341 413
 		if (isset($module_config['download_file']))
342 414
 		{
343 415
 			$point = intval($module_config['download_file']);
344
-		}
345
-		else
416
+		} else
346 417
 		{
347 418
 			$point = intval($config->download_file);
348 419
 		}
@@ -353,8 +424,7 @@  discard block
 block discarded – undo
353 424
 			if($config->disable_download == 'Y' && $point)
354 425
 			{
355 426
 				return new Object(-1,'msg_not_permitted_download');
356
-			}
357
-			else
427
+			} else
358 428
 			{
359 429
 				return new Object();
360 430
 			}
@@ -381,13 +451,19 @@  discard block
 block discarded – undo
381 451
 	{
382 452
 		// Run only when logged in
383 453
 		$logged_info = Context::get('logged_info');
384
-		if(!$logged_info->member_srl) return new Object();
454
+		if(!$logged_info->member_srl) {
455
+			return new Object();
456
+		}
385 457
 		$module_srl = $obj->module_srl;
386 458
 		$member_srl = $logged_info->member_srl;
387
-		if(!$module_srl) return new Object();
459
+		if(!$module_srl) {
460
+			return new Object();
461
+		}
388 462
 
389 463
 		// Pass if it is your file
390
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new Object();
464
+		if($member_srl && abs($obj->member_srl) == $member_srl) {
465
+			return new Object();
466
+		}
391 467
 
392 468
 		// Get the point module information
393 469
 		$oModuleModel = getModel('module');
@@ -396,8 +472,7 @@  discard block
 block discarded – undo
396 472
 		if (isset($module_config['download_file']))
397 473
 		{
398 474
 			$point = intval($module_config['download_file']);
399
-		}
400
-		else
475
+		} else
401 476
 		{
402 477
 			$point = intval($config->download_file);
403 478
 		}
@@ -428,25 +503,32 @@  discard block
 block discarded – undo
428 503
 		// Get the original author number
429 504
 		$target_member_srl = abs($obj->get('member_srl'));
430 505
 		// Pass without increasing the hits if the viewer is the same as the author
431
-		if($target_member_srl == $member_srl) return new Object();
506
+		if($target_member_srl == $member_srl) {
507
+			return new Object();
508
+		}
432 509
 		// Get the point information for each module
433 510
 		$config = $oModuleModel->getModuleConfig('point');
434 511
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
435 512
 		// Get hits points
436 513
 		$point = $module_config['read_document'];
437
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
514
+		if(strlen($point) == 0 && !is_int($point)) {
515
+			$point = $config->read_document;
516
+		}
438 517
 		// Pass if there are no requested points
439
-		if(!$point) return new Object();
518
+		if(!$point) {
519
+			return new Object();
520
+		}
440 521
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
441 522
 		if($member_srl)
442 523
 		{
443 524
 			$args->member_srl = $member_srl;
444 525
 			$args->document_srl = $obj->document_srl;
445 526
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
446
-			if($output->data->count) return new Object();
527
+			if($output->data->count) {
528
+				return new Object();
529
+			}
447 530
 			$cur_point = $oPointModel->getPoint($member_srl, true);
448
-		}
449
-		else
531
+		} else
450 532
 		{
451 533
 			$cur_point = 0;
452 534
 		}
@@ -462,9 +544,13 @@  discard block
 block discarded – undo
462 544
 			return new Object(-1, $message);
463 545
 		}
464 546
 		// If not logged in, pass
465
-		if(!$logged_info->member_srl) return new Object();
547
+		if(!$logged_info->member_srl) {
548
+			return new Object();
549
+		}
466 550
 		// Pass, if there are no requested points
467
-		if(!$point) return new Object();
551
+		if(!$point) {
552
+			return new Object();
553
+		}
468 554
 		// If the read record is missing, leave it
469 555
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
470 556
 		// Increase the point
@@ -481,7 +567,9 @@  discard block
 block discarded – undo
481 567
 	{
482 568
 		$module_srl = $obj->module_srl;
483 569
 		$member_srl = $obj->member_srl;
484
-		if(!$module_srl || !$member_srl) return new Object();
570
+		if(!$module_srl || !$member_srl) {
571
+			return new Object();
572
+		}
485 573
 
486 574
 		$oModuleModel = getModel('module');
487 575
 		$config = $oModuleModel->getModuleConfig('point');
@@ -493,15 +581,20 @@  discard block
 block discarded – undo
493 581
 		if( $obj->point > 0 )
494 582
 		{
495 583
 			$point = $module_config['voted'];
496
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
497
-		}
498
-		else
584
+			if(strlen($point) == 0 && !is_int($point)) {
585
+				$point = $config->voted;
586
+			}
587
+		} else
499 588
 		{
500 589
 			$point = $module_config['blamed'];
501
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
590
+			if(strlen($point) == 0 && !is_int($point)) {
591
+				$point = $config->blamed;
592
+			}
502 593
 		}
503 594
 
504
-		if(!$point) return new Object();
595
+		if(!$point) {
596
+			return new Object();
597
+		}
505 598
 		// Increase the point
506 599
 		$cur_point += $point;
507 600
 		$this->setPoint($member_srl,$cur_point);
@@ -516,7 +609,9 @@  discard block
 block discarded – undo
516 609
 	{
517 610
 		$member_srl = abs($member_srl);
518 611
 		$mode_arr = array('add', 'minus', 'update', 'signup');
519
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
612
+		if(!$mode || !in_array($mode,$mode_arr)) {
613
+			$mode = 'update';
614
+		}
520 615
 
521 616
 		// Get configuration information
522 617
 		$oMemberModel = getModel('member');
@@ -546,7 +641,9 @@  discard block
 block discarded – undo
546 641
 				$args->point = $point;
547 642
 				break;
548 643
 		}
549
-		if($args->point < 0) $args->point = 0;
644
+		if($args->point < 0) {
645
+			$args->point = 0;
646
+		}
550 647
 		$point = $args->point;
551 648
 
552 649
 		// Call a trigger (before)
@@ -568,8 +665,11 @@  discard block
 block discarded – undo
568 665
 
569 666
 		// If there are points, update, if no, insert
570 667
 		$oPointModel = getModel('point');
571
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
572
-		else executeQuery("point.insertPoint", $args);
668
+		if($oPointModel->isExistsPoint($member_srl)) {
669
+			executeQuery("point.updatePoint", $args);
670
+		} else {
671
+			executeQuery("point.insertPoint", $args);
672
+		}
573 673
 
574 674
 		// Get a new level
575 675
 		$level = $oPointModel->getLevel($point, $config->level_step);
@@ -599,7 +699,9 @@  discard block
 block discarded – undo
599 699
 						foreach($point_group as $group_srl => $target_level)
600 700
 						{
601 701
 							$del_group_list[] = $group_srl;
602
-							if($target_level == $level) $new_group_list[] = $group_srl;
702
+							if($target_level == $level) {
703
+								$new_group_list[] = $group_srl;
704
+							}
603 705
 						}
604 706
 					}
605 707
 					// Otherwise, in case the level is reduced, add the recent group
@@ -625,7 +727,9 @@  discard block
 block discarded – undo
625 727
 					// Delete the group of a level which is higher than the current level
626 728
 					foreach($point_group as $group_srl => $target_level)
627 729
 					{
628
-						if($target_level > $level) $del_group_list[] = $group_srl;
730
+						if($target_level > $level) {
731
+							$del_group_list[] = $group_srl;
732
+						}
629 733
 					}
630 734
 					$del_group_list[] = $default_group->group_srl;
631 735
 				}
@@ -636,11 +740,15 @@  discard block
 block discarded – undo
636 740
 					foreach($point_group as $group_srl => $target_level)
637 741
 					{
638 742
 						$del_group_list[] = $group_srl;
639
-						if($target_level <= $level) $new_group_list[] = $group_srl;
743
+						if($target_level <= $level) {
744
+							$new_group_list[] = $group_srl;
745
+						}
640 746
 					}
641 747
 				}
642 748
 				// If there is no a new group, granted the default group
643
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
749
+				if(!$new_group_list[0]) {
750
+					$new_group_list[0] = $default_group->group_srl;
751
+				}
644 752
 				// Remove linkage group
645 753
 				if($del_group_list && count($del_group_list))
646 754
 				{
Please login to merge, or discard this patch.
modules/poll/poll.admin.controller.php 3 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.
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.