GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 20c33e...dafa19 )
by gyeong-won
15:14 queued 06:07
created
modules/menu/menu.admin.controller.php 2 patches
Spacing   +298 added lines, -298 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();
@@ -465,27 +465,27 @@  discard block
 block discarded – undo
465 465
 			$args->is_shortcut = $request->is_shortcut;
466 466
 			$args->url = $request->shortcut_target;
467 467
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
468
+			if (!$args->open_window) $args->open_window = 'N';
469
+			if (!$args->expand) $args->expand = 'N';
470
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
471 471
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
473 473
 			else $args->name = $request->menu_name;
474 474
 		}
475 475
 		// type is module short cut
476
-		else if(is_numeric($request->shortcut_target))
476
+		else if (is_numeric($request->shortcut_target))
477 477
 		{
478 478
 			// Get original information
479 479
 			$oMenuAdminModel = getAdminModel('menu');
480 480
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
481
-			if(!$itemInfo->menu_item_srl)
481
+			if (!$itemInfo->menu_item_srl)
482 482
 			{
483 483
 				return new Object(-1, 'msg_invalid_request');
484 484
 			}
485 485
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
486 486
 
487 487
 			$args = $itemInfo;
488
-			if(count($args->group_srls) == 0)
488
+			if (count($args->group_srls) == 0)
489 489
 			{
490 490
 				unset($args->group_srls);
491 491
 			}
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 			$args->url = '#';
506 506
 		}
507 507
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
509 509
 		else $args->desc = '';
510 510
 
511 511
 		$args->menu_item_srl = getNextSequence();
512
-		$args->listorder = -1*$args->menu_item_srl;
512
+		$args->listorder = -1 * $args->menu_item_srl;
513 513
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
514
+		if (!$output->toBool()) return $output;
515 515
 
516 516
 		$oDB->commit();
517 517
 
@@ -533,46 +533,46 @@  discard block
 block discarded – undo
533 533
 		$args->expand = $request->menu_expand;
534 534
 		$args->is_shortcut = $request->is_shortcut;
535 535
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
536
+		if (!$args->open_window) $args->open_window = 'N';
537
+		if (!$args->expand) $args->expand = 'N';
538
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
539 539
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
541 541
 		else $args->name = $request->menu_name;
542 542
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
544 544
 		else $args->desc = '';
545 545
 
546
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 547
 		{
548 548
 			return new Object(-1, 'msg_invalid_request');
549 549
 		}
550 550
 
551 551
 		// when menu copy, module already copied
552
-		if($isProc)
552
+		if ($isProc)
553 553
 		{
554 554
 			$result = $this->_insertModule($request, $args);
555
-			if(!$result->toBool())
555
+			if (!$result->toBool())
556 556
 			{
557 557
 				return new Object(-1, $result->message);
558 558
 			}
559 559
 		}
560 560
 
561 561
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
562
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
565 565
 
566
-		if(!$request->module_id)
566
+		if (!$request->module_id)
567 567
 		{
568 568
 			return new Object(-1, 'msg_invalid_request');
569 569
 		}
570 570
 
571 571
 		$args->url = $request->module_id;
572 572
 		$args->menu_item_srl = getNextSequence();
573
-		$args->listorder = -1*$args->menu_item_srl;
573
+		$args->listorder = -1 * $args->menu_item_srl;
574 574
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
575
+		if (!$output->toBool()) return $output;
576 576
 
577 577
 		$oDB->commit();
578 578
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		//module create
606 606
 		$site_module_info = Context::get('site_module_info');
607
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
607
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
608 608
 		$cmArgs->browser_title = $args->name;
609 609
 		$cmArgs->menu_srl = $request->menu_srl;
610 610
 		$cmArgs->layout_srl = -1;
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
 		$cmArgs->is_skin_fix = 'N';
613 613
 		$cmArgs->is_mskin_fix = 'N';
614 614
 
615
-		if(Mobile::isMobileEnabled() === true)
615
+		if (Mobile::isMobileEnabled() === true)
616 616
 		{
617 617
 			$cmArgs->use_mobile = 'Y';
618 618
 		}
619 619
 
620 620
 		// if mid is empty, auto create mid
621
-		if(!$request->module_id)
621
+		if (!$request->module_id)
622 622
 		{
623 623
 			$randomMid = $this->_makeRandomMid();
624 624
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 		// check already created module instance
629 629
 		$oModuleModel = getModel('module');
630 630
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
631
-		if($output->module_srl)
631
+		if ($output->module_srl)
632 632
 		{
633 633
 			return new Object(-1, 'msg_module_name_exists');
634 634
 		}
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 	{
648 648
 		$request = Context::getRequestVars();
649 649
 
650
-		if(!$request->menu_item_srl || !$request->menu_name)
650
+		if (!$request->menu_item_srl || !$request->menu_name)
651 651
 		{
652 652
 			return new Object(-1, 'msg_invalid_request');
653 653
 		}
654 654
 
655 655
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
656
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
658 658
 
659 659
 		// Get original information
660 660
 		$oMenuAdminModel = getAdminModel('menu');
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		$args = $itemInfo;
663 663
 
664 664
 		// if menu type is module, check exists module and update
665
-		if($itemInfo->is_shortcut == 'Y')
665
+		if ($itemInfo->is_shortcut == 'Y')
666 666
 		{
667 667
 			// type is url
668
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
669 669
 			{
670 670
 				$args->url = $request->shortcut_target;
671 671
 			}
672 672
 			// type is module short cut
673
-			else if(is_numeric($request->shortcut_target))
673
+			else if (is_numeric($request->shortcut_target))
674 674
 			{
675 675
 				// Get new original information
676 676
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
677
-				if(!$newItemInfo->menu_item_srl)
677
+				if (!$newItemInfo->menu_item_srl)
678 678
 				{
679 679
 					return new Object(-1, 'msg_invalid_request');
680 680
 				}
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
 		{
692 692
 			// check already created module instance
693 693
 			$oModuleModel = getModel('module');
694
-			if($request->module_id != $itemInfo->url)
694
+			if ($request->module_id != $itemInfo->url)
695 695
 			{
696 696
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
697
-				if($output->module_srl)
697
+				if ($output->module_srl)
698 698
 				{
699 699
 					return new Object(-1, 'msg_module_name_exists');
700 700
 				}
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
 
703 703
 			// if not exist module, return error
704 704
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
705
-			if(!$moduleInfo)
705
+			if (!$moduleInfo)
706 706
 			{
707 707
 				return new Object(-1, 'msg_invalid_request');
708 708
 			}
709 709
 
710 710
 			$moduleInfo->mid = $request->module_id;
711
-			if($request->browser_title)
711
+			if ($request->browser_title)
712 712
 			{
713 713
 				$moduleInfo->browser_title = $request->browser_title;
714 714
 			}
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			$args->url = $request->module_id;
718 718
 		}
719 719
 
720
-		if($request->menu_name_key)
720
+		if ($request->menu_name_key)
721 721
 		{
722 722
 			$args->name = $request->menu_name_key;
723 723
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			$args->name = $request->menu_name;
727 727
 		}
728 728
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
730 730
 		else $args->desc = '';
731 731
 
732 732
 		unset($args->group_srls);
@@ -754,38 +754,38 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$btnOutput = $this->_uploadButton($args);
756 756
 
757
-		if($btnOutput['normal_btn'])
757
+		if ($btnOutput['normal_btn'])
758 758
 		{
759 759
 			$this->add('normal_btn', $btnOutput['normal_btn']);
760 760
 			$item_info->normal_btn = $btnOutput['normal_btn'];
761 761
 		}
762
-		if($btnOutput['hover_btn'])
762
+		if ($btnOutput['hover_btn'])
763 763
 		{
764 764
 			$this->add('hover_btn', $btnOutput['hover_btn']);
765 765
 			$item_info->hover_btn = $btnOutput['hover_btn'];
766 766
 		}
767
-		if($btnOutput['active_btn'])
767
+		if ($btnOutput['active_btn'])
768 768
 		{
769 769
 			$this->add('active_btn', $btnOutput['active_btn']);
770 770
 			$item_info->active_btn = $btnOutput['active_btn'];
771 771
 		}
772 772
 
773 773
 		// group_srls check
774
-		if(count($item_info->group_srls) == 0)
774
+		if (count($item_info->group_srls) == 0)
775 775
 		{
776 776
 			unset($item_info->group_srls);
777 777
 		}
778 778
 
779 779
 		// Button delete check
780
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
781 781
 		{
782 782
 			$item_info->normal_btn = '';
783 783
 		}
784
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
785 785
 		{
786 786
 			$item_info->hover_btn = '';
787 787
 		}
788
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
789 789
 		{
790 790
 			$item_info->active_btn = '';
791 791
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$args->is_force = Context::get('is_force');
826 826
 
827 827
 		$returnObj = $this->deleteItem($args);
828
-		if(is_object($returnObj))
828
+		if (is_object($returnObj))
829 829
 		{
830 830
 			$this->setError($returnObj->error);
831 831
 			$this->setMessage($returnObj->message);
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
 		$args->menu_srl = $itemInfo->menu_srl;
855 855
 
856 856
 		// Display an error that the category cannot be deleted if it has a child node	603
857
-		if($args->is_force != 'Y')
857
+		if ($args->is_force != 'Y')
858 858
 		{
859 859
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
861
-			if($output->data->count > 0)
860
+			if (!$output->toBool()) return $output;
861
+			if ($output->data->count > 0)
862 862
 			{
863 863
 				return new Object(-1001, 'msg_cannot_delete_for_child');
864 864
 			}
@@ -870,22 +870,22 @@  discard block
 block discarded – undo
870 870
 
871 871
 		// check admin menu delete
872 872
 		$oAdmin = getClass('admin');
873
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
874 874
 		{
875 875
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 876
 		}
877 877
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
879 879
 
880 880
 		// get menu properies with child menu
881 881
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
882 882
 		$originMenu = NULL;
883 883
 
884
-		if(is_readable(FileHandler::getRealPath($phpFile)))
884
+		if (is_readable(FileHandler::getRealPath($phpFile)))
885 885
 		{
886 886
 			include(FileHandler::getRealPath($phpFile));
887 887
 
888
-			if(is_array($menu->list))
888
+			if (is_array($menu->list))
889 889
 			{
890 890
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
891 891
 			}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
896 896
 		$isStartmenuInclude = false;
897 897
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
898
-		if($isStartmenuInclude)
898
+		if ($isStartmenuInclude)
899 899
 		{
900 900
 			return new Object(-1, 'msg_cannot_delete_homemenu');
901 901
 		}
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 
920 920
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
921 921
 	{
922
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
923 923
 		{
924 924
 			$isStartmenuInclude = true;
925 925
 		}
926 926
 
927
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
927
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
928 928
 		{
929
-			foreach($originMenu['list'] AS $key=>$value)
929
+			foreach ($originMenu['list'] AS $key=>$value)
930 930
 			{
931 931
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
932 932
 			}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		$args->menu_srl = $menuSrl;
941 941
 		$args->menu_item_srl = $node['node_srl'];
942 942
 		$output = executeQuery("menu.deleteMenuItem", $args);
943
-		if(!$output->toBool())
943
+		if (!$output->toBool())
944 944
 		{
945 945
 			$oDB->rollback();
946 946
 			return $output;
@@ -949,12 +949,12 @@  discard block
 block discarded – undo
949 949
 		// Update the xml file and get its location
950 950
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 951
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
952
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
955 955
 
956 956
 		// Delete module
957
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
958 958
 		{
959 959
 			$oModuleController = getController('module');
960 960
 			$oModuleModel = getModel('module');
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 			$args->site_srl = $menuInfo->site_srl;
965 965
 			$args->is_shortcut = 'Y';
966 966
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
967
-			if($output->data->menu_item_srl)
967
+			if ($output->data->menu_item_srl)
968 968
 			{
969 969
 				$output->data->url = '';
970 970
 				$referenceItem = $output->data;
971 971
 				$output = $this->_updateMenuItem($referenceItem);
972
-				if(!$output->toBool())
972
+				if (!$output->toBool())
973 973
 				{
974 974
 					$oDB->rollback();
975 975
 					return $output;
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 			}
978 978
 
979 979
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
980
-			if($moduleInfo->module_srl)
980
+			if ($moduleInfo->module_srl)
981 981
 			{
982 982
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
983
-				if(!$output->toBool())
983
+				if (!$output->toBool())
984 984
 				{
985 985
 					$oDB->rollback();
986 986
 					return $output;
@@ -993,14 +993,14 @@  discard block
 block discarded – undo
993 993
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 994
 	{
995 995
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
996
-		if(!$output->toBool())
996
+		if (!$output->toBool())
997 997
 		{
998 998
 			return new Object(-1, $output->message);
999 999
 		}
1000 1000
 
1001
-		if(is_array($node['list']))
1001
+		if (is_array($node['list']))
1002 1002
 		{
1003
-			foreach($node['list'] AS $key=>$value)
1003
+			foreach ($node['list'] AS $key=>$value)
1004 1004
 			{
1005 1005
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1006 1006
 			}
@@ -1013,31 +1013,31 @@  discard block
 block discarded – undo
1013 1013
 	 */
1014 1014
 	function procMenuAdminMoveItem()
1015 1015
 	{
1016
-		$mode = Context::get('mode');	//move
1017
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1018
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1016
+		$mode = Context::get('mode'); //move
1017
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1018
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1019
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1020 1020
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1021
+		if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request');
1022 1022
 
1023 1023
 		$oMenuAdminModel = getAdminModel('menu');
1024 1024
 
1025 1025
 		// get original menu item info for cache file recreate
1026 1026
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1027
-		if(!$originalItemInfo->menu_item_srl)
1027
+		if (!$originalItemInfo->menu_item_srl)
1028 1028
 		{
1029 1029
 			return new Object(-1, 'msg_empty_menu_item');
1030 1030
 		}
1031 1031
 
1032 1032
 		// get menu properies with child menu
1033
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1034 1034
 		$originMenu = NULL;
1035 1035
 
1036
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1036
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1037 1037
 		{
1038 1038
 			include(FileHandler::getRealPath($phpFile));
1039 1039
 
1040
-			if(is_array($menu->list))
1040
+			if (is_array($menu->list))
1041 1041
 			{
1042 1042
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1043 1043
 			}
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 		// get target menu info for move
1047 1047
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1048 1048
 		// if move in same sitemap
1049
-		if($targetMenuItemInfo->menu_item_srl)
1049
+		if ($targetMenuItemInfo->menu_item_srl)
1050 1050
 		{
1051 1051
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1052 1052
 		}
@@ -1058,20 +1058,20 @@  discard block
 block discarded – undo
1058 1058
 			$parent_srl = 0;
1059 1059
 		}
1060 1060
 
1061
-		if(!$this->homeModuleMid)
1061
+		if (!$this->homeModuleMid)
1062 1062
 		{
1063 1063
 			$oModuleModel = getModel('module');
1064 1064
 			$oMenuAdminController = getAdminController('menu');
1065 1065
 			$columnList = array('modules.mid',);
1066 1066
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1067
-			if($output->mid)
1067
+			if ($output->mid)
1068 1068
 			{
1069 1069
 				$this->homeModuleMid = $output->mid;
1070 1070
 			}
1071 1071
 		}
1072 1072
 
1073 1073
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1074
-		if(count($originMenu['list']) > 0)
1074
+		if (count($originMenu['list']) > 0)
1075 1075
 		{
1076 1076
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1077 1077
 		}
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1087 1087
 	{
1088
-		if(is_array($node))
1088
+		if (is_array($node))
1089 1089
 		{
1090
-			foreach($node AS $key=>$node)
1090
+			foreach ($node AS $key=>$node)
1091 1091
 			{
1092 1092
 				$args = new stdClass();
1093 1093
 				$args->menu_srl = $menu_srl;
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 				$output = $this->_updateMenuItem($args);
1096 1096
 
1097 1097
 				//module's menu_srl move also
1098
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1098
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1099 1099
 				{
1100 1100
 					$oModuleModel = getModel('module');
1101 1101
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1102
-					if($menu_srl != $moduleInfo->menu_srl)
1102
+					if ($menu_srl != $moduleInfo->menu_srl)
1103 1103
 					{
1104 1104
 						$moduleInfo->menu_srl = $menu_srl;
1105 1105
 						$oModuleController = getController('module');
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 					}
1108 1108
 				}
1109 1109
 
1110
-				if(count($node['list']) > 0)
1110
+				if (count($node['list']) > 0)
1111 1111
 				{
1112 1112
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1113 1113
 				}
@@ -1129,21 +1129,21 @@  discard block
 block discarded – undo
1129 1129
 		$menuSrl = $itemInfo->menu_srl;
1130 1130
 
1131 1131
 		// get menu properies with child menu
1132
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1132
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1133 1133
 		$originMenu = NULL;
1134 1134
 
1135
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1135
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1136 1136
 		{
1137 1137
 			include(FileHandler::getRealPath($phpFile));
1138 1138
 
1139
-			if(is_array($menu->list))
1139
+			if (is_array($menu->list))
1140 1140
 			{
1141 1141
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		// copy the menu item with recursively
1146
-		if(is_array($originMenu))
1146
+		if (is_array($originMenu))
1147 1147
 		{
1148 1148
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1149 1149
 		}
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1161 1161
 	{
1162
-		if(array_key_exists($menuItemSrl, $menuList))
1162
+		if (array_key_exists($menuItemSrl, $menuList))
1163 1163
 		{
1164 1164
 			$originMenu = $menuList[$menuItemSrl];
1165 1165
 			return;
1166 1166
 		}
1167 1167
 
1168
-		foreach($menuList AS $key=>$value)
1168
+		foreach ($menuList AS $key=>$value)
1169 1169
 		{
1170
-			if(count($value['list']) > 0)
1170
+			if (count($value['list']) > 0)
1171 1171
 			{
1172 1172
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1173 1173
 			}
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		// default argument setting
1183 1183
 		$args = new stdClass();
1184 1184
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1186 1186
 		else $args->parent_srl = $parentSrl;
1187 1187
 		$args->menu_name_key = $originMenu['text'];
1188 1188
 		$args->menu_name = $originMenu['text'];
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$isModuleCopySuccess = false;
1197 1197
 		// if menu have a reference of module instance
1198
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1198
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1199 1199
 		{
1200 1200
 			$oModuleModel = getModel('module');
1201 1201
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1215,22 +1215,22 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 			$args->module_srl = $copiedModuleSrl;
1217 1217
 
1218
-			if($copiedModuleSrl)
1218
+			if ($copiedModuleSrl)
1219 1219
 			{
1220 1220
 				$isModuleCopySuccess = true;
1221 1221
 			}
1222 1222
 		}
1223 1223
 		// if menu type is shortcut
1224
-		else if($menuItemInfo->is_shortcut == 'Y')
1224
+		else if ($menuItemInfo->is_shortcut == 'Y')
1225 1225
 		{
1226 1226
 			$args->shortcut_target = $originMenu['url'];
1227 1227
 			$isModuleCopySuccess = true;
1228 1228
 		}
1229 1229
 
1230
-		if($isModuleCopySuccess)
1230
+		if ($isModuleCopySuccess)
1231 1231
 		{
1232 1232
 			// if have a group permission
1233
-			if($menuItemInfo->group_srls)
1233
+			if ($menuItemInfo->group_srls)
1234 1234
 			{
1235 1235
 				$args->group_srls = $menuItemInfo->group_srls;
1236 1236
 			}
@@ -1244,12 +1244,12 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 			// if have a button, copy a button image also
1246 1246
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1247
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1248 1248
 			{
1249 1249
 				// copy & upate
1250 1250
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1251
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1252
-				if(count($update_item_info->group_srls) == 0)
1251
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1252
+				if (count($update_item_info->group_srls) == 0)
1253 1253
 				{
1254 1254
 					unset($update_item_info->group_srls);
1255 1255
 				}
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 		// if have a child menu, copy child menu also
1265 1265
 		$childMenu = array_shift($originMenu['list']);
1266
-		if(count($childMenu) > 0)
1266
+		if (count($childMenu) > 0)
1267 1267
 		{
1268 1268
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1269 1269
 		}
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 	{
1274 1274
 		$time = $_SERVER['REQUEST_TIME'];
1275 1275
 		$randomString = "";
1276
-		for($i=0;$i<4;$i++)
1276
+		for ($i = 0; $i < 4; $i++)
1277 1277
 		{
1278 1278
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1279
+			if ($case) $doc = rand(65, 90);
1280 1280
 			else $doc = rand(97, 122);
1281 1281
 
1282 1282
 			$randomString .= chr($doc);
@@ -1300,32 +1300,32 @@  discard block
 block discarded – undo
1300 1300
 		// menu name update
1301 1301
 		$args->menu_srl = $this->menuSrl;
1302 1302
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1303
+		if (!$output->toBool()) return $output;
1304 1304
 
1305 1305
 		$this->map = array();
1306
-		if(is_array($parentKeyList))
1306
+		if (is_array($parentKeyList))
1307 1307
 		{
1308
-			foreach($parentKeyList as $no=>$srl)
1308
+			foreach ($parentKeyList as $no=>$srl)
1309 1309
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1310
+				if ($srl === 0) continue;
1311
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1312 1312
 				$this->map[$srl][] = $no;
1313 1313
 			}
1314 1314
 		}
1315 1315
 
1316 1316
 		$result = array();
1317
-		if(is_array($this->itemKeyList))
1317
+		if (is_array($this->itemKeyList))
1318 1318
 		{
1319
-			foreach($this->itemKeyList as $srl)
1319
+			foreach ($this->itemKeyList as $srl)
1320 1320
 			{
1321
-				if(!$this->checked[$srl])
1321
+				if (!$this->checked[$srl])
1322 1322
 				{
1323 1323
 					$target = new stdClass();
1324 1324
 					$this->checked[$srl] = 1;
1325 1325
 					$target->node = $srl;
1326
-					$target->child= array();
1326
+					$target->child = array();
1327 1327
 
1328
-					while(count($this->map[$srl]))
1328
+					while (count($this->map[$srl]))
1329 1329
 					{
1330 1330
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1331 1331
 					}
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
 			}
1335 1335
 		}
1336 1336
 
1337
-		if(is_array($result))
1337
+		if (is_array($result))
1338 1338
 		{
1339 1339
 			$i = 0;
1340
-			foreach($result AS $key=>$node)
1340
+			foreach ($result AS $key=>$node)
1341 1341
 			{
1342
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1343
-				$this->_recursiveMoveMenuItem($node);	//move child node
1342
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1343
+				$this->_recursiveMoveMenuItem($node); //move child node
1344 1344
 				$i = $node->node;
1345 1345
 			}
1346 1346
 		}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 		$child_node->child = array();
1370 1370
 		$target->child[] = $child_node;
1371 1371
 
1372
-		while(count($this->map[$child_srl]))
1372
+		while (count($this->map[$child_srl]))
1373 1373
 		{
1374 1374
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1375 1375
 		}
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 	function _recursiveMoveMenuItem($result)
1385 1385
 	{
1386 1386
 		$i = 0;
1387
-		while(count($result->child))
1387
+		while (count($result->child))
1388 1388
 		{
1389 1389
 			unset($node);
1390 1390
 			$node = array_shift($result->child);
@@ -1404,48 +1404,48 @@  discard block
 block discarded – undo
1404 1404
 	 * @param string $mode 'move' or 'insert'
1405 1405
 	 * @return void
1406 1406
 	 */
1407
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1407
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1408 1408
 	{
1409 1409
 		// Get the original menus
1410 1410
 		$oMenuAdminModel = getAdminModel('menu');
1411 1411
 
1412 1412
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1413
+		if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request');
1414 1414
 		// Move the menu location(change the order menu appears)
1415
-		if($mode == 'move')
1415
+		if ($mode == 'move')
1416 1416
 		{
1417 1417
 			$args = new stdClass();
1418 1418
 			$args->parent_srl = $parent_srl;
1419 1419
 			$args->menu_srl = $menu_srl;
1420 1420
 
1421
-			if($source_srl)
1421
+			if ($source_srl)
1422 1422
 			{
1423 1423
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1425
-				$args->listorder = $source_item->listorder-1;
1424
+				if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request');
1425
+				$args->listorder = $source_item->listorder - 1;
1426 1426
 			}
1427 1427
 			else
1428 1428
 			{
1429 1429
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1431
-				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1430
+				if (!$output->toBool()) return $output;
1431
+				$args->listorder = (int) $output->data->listorder;
1432
+				if (!$args->listorder) $args->listorder = 0;
1433 1433
 			}
1434 1434
 			$args->parent_srl = $parent_srl;
1435 1435
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1436
+			if (!$output->toBool()) return $output;
1437 1437
 
1438 1438
 			$args->parent_srl = $parent_srl;
1439 1439
 			$args->menu_item_srl = $target_srl;
1440 1440
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1441
+			if (!$output->toBool()) return $output;
1442 1442
 
1443 1443
 			//module's menu_srl move also
1444
-			if($isShortcut == 'N' && !empty($url))
1444
+			if ($isShortcut == 'N' && !empty($url))
1445 1445
 			{
1446 1446
 				$oModuleModel = getModel('module');
1447 1447
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1448
-				if($menu_srl != $moduleInfo->menu_srl)
1448
+				if ($menu_srl != $moduleInfo->menu_srl)
1449 1449
 				{
1450 1450
 					$moduleInfo->menu_srl = $menu_srl;
1451 1451
 					$oModuleController = getController('module');
@@ -1453,13 +1453,13 @@  discard block
 block discarded – undo
1453 1453
 				}
1454 1454
 
1455 1455
 				// change home menu cache file
1456
-				if($url == $this->homeModuleMid)
1456
+				if ($url == $this->homeModuleMid)
1457 1457
 				{
1458
-					if(file_exists($this->homeMenuCacheFile))
1458
+					if (file_exists($this->homeMenuCacheFile))
1459 1459
 					{
1460 1460
 						include($this->homeMenuCacheFile);
1461 1461
 					}
1462
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1463 1463
 					{
1464 1464
 						$this->makeHomemenuCacheFile($menu_srl);
1465 1465
 					}
@@ -1467,13 +1467,13 @@  discard block
 block discarded – undo
1467 1467
 			}
1468 1468
 			// Add a child
1469 1469
 		}
1470
-		elseif($mode == 'insert')
1470
+		elseif ($mode == 'insert')
1471 1471
 		{
1472 1472
 			$args->menu_item_srl = $target_srl;
1473 1473
 			$args->parent_srl = $parent_srl;
1474
-			$args->listorder = -1*getNextSequence();
1474
+			$args->listorder = -1 * getNextSequence();
1475 1475
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1476
+			if (!$output->toBool()) return $output;
1477 1477
 		}
1478 1478
 
1479 1479
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
 		// Re-generate the xml file
1499 1499
 		$xml_file = $this->makeXmlFile($menu_srl);
1500 1500
 		// Set return value
1501
-		$this->add('menu_title',$menu_title);
1502
-		$this->add('xml_file',$xml_file);
1501
+		$this->add('menu_title', $menu_title);
1502
+		$this->add('xml_file', $xml_file);
1503 1503
 	}
1504 1504
 
1505 1505
 	/**
@@ -1513,12 +1513,12 @@  discard block
 block discarded – undo
1513 1513
 		$target = Context::get('target');
1514 1514
 		$target_file = Context::get($target);
1515 1515
 		// Error occurs when the target is neither a uploaded file nor a valid file
1516
-		if(!$menu_srl || !$menu_item_srl)
1516
+		if (!$menu_srl || !$menu_item_srl)
1517 1517
 		{
1518 1518
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1519
 
1520 1520
 		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1522 1522
 		{
1523 1523
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1524
 		}
@@ -1526,13 +1526,13 @@  discard block
 block discarded – undo
1526 1526
 		// Move the file to a specific director if the uploaded file meets requirement
1527 1527
 		else
1528 1528
 		{
1529
-			$tmp_arr = explode('.',$target_file['name']);
1530
-			$ext = $tmp_arr[count($tmp_arr)-1];
1529
+			$tmp_arr = explode('.', $target_file['name']);
1530
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1531 1531
 
1532 1532
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1533
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1534
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1535
+			if (!is_dir($path)) FileHandler::makeDir($path);
1536 1536
 
1537 1537
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1538
 			Context::set('filename', $filename);
@@ -1565,14 +1565,14 @@  discard block
 block discarded – undo
1565 1565
 	{
1566 1566
 		$oModuleModel = getModel('module');
1567 1567
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1568
-		if(is_array($installed_module_list))
1568
+		if (is_array($installed_module_list))
1569 1569
 		{
1570 1570
 			$currentLang = Context::getLangType();
1571 1571
 			$menuList = array();
1572
-			foreach($installed_module_list AS $key=>$value)
1572
+			foreach ($installed_module_list AS $key=>$value)
1573 1573
 			{
1574 1574
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1575
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1576 1576
 				unset($info->menu);
1577 1577
 			}
1578 1578
 		}
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1605
 
1606 1606
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1609 1609
 		$dbInfo = Context::getDBInfo();
1610 1610
 
1611 1611
 		$args = new stdClass();
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		$args->menu_srl = $requestArgs->menu_srl;
1615 1615
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1616 1616
 		//if now page is https...
1617
-		if(strpos($url, 'https') !== false)
1617
+		if (strpos($url, 'https') !== false)
1618 1618
 		{
1619 1619
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620 1620
 		}
@@ -1628,23 +1628,23 @@  discard block
 block discarded – undo
1628 1628
 		$args->hover_btn = '';
1629 1629
 		$args->active_btn = '';
1630 1630
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1631
-		$args->listorder = -1*$args->menu_item_srl;
1631
+		$args->listorder = -1 * $args->menu_item_srl;
1632 1632
 
1633 1633
 		// Check if already exists
1634 1634
 		$oMenuModel = getAdminModel('menu');
1635 1635
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1636 1636
 		// Update if exists
1637
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1637
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1638 1638
 		{
1639 1639
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1640
+			if (!$output->toBool()) return $output;
1641 1641
 		}
1642 1642
 		// Insert if not exist
1643 1643
 		else
1644 1644
 		{
1645
-			$args->listorder = -1*$args->menu_item_srl;
1645
+			$args->listorder = -1 * $args->menu_item_srl;
1646 1646
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1647
+			if (!$output->toBool()) return $output;
1648 1648
 		}
1649 1649
 		// Get information of the menu
1650 1650
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1672,23 +1672,23 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 		// Menu Exposure update
1674 1674
 		// if exposure target is only login user...
1675
-		if(!$exposure)
1675
+		if (!$exposure)
1676 1676
 		{
1677 1677
 			$args->group_srls = '';
1678 1678
 		}
1679 1679
 		else
1680 1680
 		{
1681 1681
 			$exposure = explode(',', $exposure);
1682
-			if(in_array($exposure, array('-1','-3')))
1682
+			if (in_array($exposure, array('-1', '-3')))
1683 1683
 			{
1684 1684
 				$args->group_srls = $exposure;
1685 1685
 			}
1686 1686
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1687
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1688 1688
 		}
1689 1689
 
1690 1690
 		$output = $this->_updateMenuItem($args);
1691
-		if(!$output->toBool())
1691
+		if (!$output->toBool())
1692 1692
 		{
1693 1693
 			return $output;
1694 1694
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1705
 
1706 1706
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1707
+		if (!$grantList) $grantList = new stdClass;
1708 1708
 
1709 1709
 		$grantList->access = new stdClass();
1710 1710
 		$grantList->access->default = 'guest';
@@ -1712,9 +1712,9 @@  discard block
 block discarded – undo
1712 1712
 		$grantList->manager->default = 'manager';
1713 1713
 
1714 1714
 		$grant = new stdClass;
1715
-		foreach($grantList AS $grantName=>$grantInfo)
1715
+		foreach ($grantList AS $grantName=>$grantInfo)
1716 1716
 		{
1717
-			if(!$htPerm[$grantName])
1717
+			if (!$htPerm[$grantName])
1718 1718
 			{
1719 1719
 				continue;
1720 1720
 			}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 			$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1723 1723
 
1724 1724
 			// users in a particular group
1725
-			if(is_array($htPerm[$grantName]))
1725
+			if (is_array($htPerm[$grantName]))
1726 1726
 			{
1727 1727
 				$grant->{$grantName} = $htPerm[$grantName];
1728 1728
 				continue;
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 			$grant->{$group_srls} = array();
1737 1737
 		}
1738 1738
 
1739
-		if(count($grant))
1739
+		if (count($grant))
1740 1740
 		{
1741 1741
 			$oModuleController = getController('module');
1742 1742
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
 	function makeXmlFile($menu_srl)
1755 1755
 	{
1756 1756
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1757
+		if (!$menu_srl) return;
1758 1758
 		// Get menu informaton
1759 1759
 		$args = new stdClass();
1760 1760
 		$args->menu_srl = $menu_srl;
1761 1761
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1763
-		$site_srl = (int)$output->data->site_srl;
1762
+		if (!$output->toBool() || !$output->data) return $output;
1763
+		$site_srl = (int) $output->data->site_srl;
1764 1764
 
1765
-		if($site_srl)
1765
+		if ($site_srl)
1766 1766
 		{
1767 1767
 			$oModuleModel = getModel('module');
1768 1768
 			$columnList = array('sites.domain');
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 		$args->menu_srl = $menu_srl;
1774 1774
 		$args->sort_index = 'listorder';
1775 1775
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1776
+		if (!$output->toBool()) return;
1777 1777
 		// Specify the name of the cache file
1778
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1778
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1779
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1780 1780
 		// If no data found, generate an XML file without node data
1781 1781
 		$list = $output->data;
1782
-		if(!$list)
1782
+		if (!$list)
1783 1783
 		{
1784 1784
 			$xml_buff = "<root />";
1785 1785
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1787,10 +1787,10 @@  discard block
 block discarded – undo
1787 1787
 			return $xml_file;
1788 1788
 		}
1789 1789
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1790
+		if (!is_array($list)) $list = array($list);
1791 1791
 		// Create a tree for loop
1792 1792
 		$list_count = count($list);
1793
-		for($i=0;$i<$list_count;$i++)
1793
+		for ($i = 0; $i < $list_count; $i++)
1794 1794
 		{
1795 1795
 			$node = $list[$i];
1796 1796
 			$menu_item_srl = $node->menu_item_srl;
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 		$php_buff = sprintf(
1847 1847
 			'<?php '.
1848 1848
 			'if(!defined("__XE__")) exit(); '.
1849
-			'$menu = new stdClass();' .
1849
+			'$menu = new stdClass();'.
1850 1850
 			'%s; '.
1851 1851
 			'%s; '.
1852 1852
 			'$menu->list = array(%s); '.
@@ -1875,26 +1875,26 @@  discard block
 block discarded – undo
1875 1875
 	 */
1876 1876
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1877
 	{
1878
-		if(!$source_node) return;
1878
+		if (!$source_node) return;
1879 1879
 
1880 1880
 		$oMenuAdminModel = getAdminModel('menu');
1881 1881
 
1882
-		foreach($source_node as $menu_item_srl => $node)
1882
+		foreach ($source_node as $menu_item_srl => $node)
1883 1883
 		{
1884 1884
 			$child_buff = "";
1885 1885
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1886
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1887 1887
 			// List variables
1888 1888
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889
-			foreach($names as $key => $val)
1889
+			foreach ($names as $key => $val)
1890 1890
 			{
1891
-				$name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1891
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1892 1892
 			}
1893 1893
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1894 1894
 
1895
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1896
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1897
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1895
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1896
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1897
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 1898
 			{
1899 1899
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1900 1900
 			}
@@ -1904,21 +1904,21 @@  discard block
 block discarded – undo
1904 1904
 			$expand = $node->expand;
1905 1905
 
1906 1906
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1907
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1908 1908
 			else $normal_btn = '';
1909 1909
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1910
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1911 1911
 			else $hover_btn = '';
1912 1912
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1913
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1914 1914
 			else $active_btn = '';
1915 1915
 
1916 1916
 			$group_srls = $node->group_srls;
1917 1917
 
1918
-			if($normal_btn)
1918
+			if ($normal_btn)
1919 1919
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1920
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1922 1922
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923 1923
 			}
1924 1924
 			else
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 1927
 			}
1928 1928
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1929
+			if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1930 1930
 			else $group_check_code = "true";
1931 1931
 			$attribute = sprintf(
1932 1932
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 				$link
1951 1951
 			);
1952 1952
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
1953
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
+			else $buff .= sprintf('<node %s />', $attribute);
1955 1955
 		}
1956 1956
 		return $buff;
1957 1957
 	}
@@ -1970,84 +1970,84 @@  discard block
 block discarded – undo
1970 1970
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 1971
 	{
1972 1972
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
1973
+		if (!$source_node) return $output;
1974 1974
 
1975 1975
 		$oMenuAdminModel = getAdminModel('menu');
1976 1976
 
1977
-		foreach($source_node as $menu_item_srl => $node)
1977
+		foreach ($source_node as $menu_item_srl => $node)
1978 1978
 		{
1979 1979
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1980
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981 1981
 			else $child_output = array("buff"=>"", "url_list"=>array());
1982 1982
 
1983 1983
 			// List variables
1984 1984
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1985 1985
 			unset($name_arr_str);
1986
-			foreach($names as $key => $val)
1986
+			foreach ($names as $key => $val)
1987 1987
 			{
1988
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1988
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1989 1989
 				{
1990 1990
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
1991 1991
 				}
1992 1992
 				else
1993 1993
 				{
1994
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), strip_tags($val)));
1994
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), strip_tags($val)));
1995 1995
 				}
1996 1996
 			}
1997 1997
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1998 1998
 
1999 1999
 			// If url value is not empty in the current node, put the value into an array url_list
2000
-			if($node->url) $child_output['url_list'][] = $node->url;
2000
+			if ($node->url) $child_output['url_list'][] = $node->url;
2001 2001
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2002 2002
 			// If node->group_srls value exists
2003
-			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);
2003
+			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);
2004 2004
 			else $group_check_code = "true";
2005 2005
 
2006 2006
 			// List variables
2007
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2008
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2009
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2010
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2007
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2008
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2009
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2010
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2011 2011
 			{
2012 2012
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2013 2013
 			}
2014 2014
 			else $href = sprintf('"%s"', $url);
2015 2015
 			$is_shortcut = $node->is_shortcut;
2016 2016
 			$open_window = $node->open_window;
2017
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2018
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2019
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2017
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2018
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2019
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2020 2020
 
2021
-			foreach($child_output['url_list'] as $key =>$val)
2021
+			foreach ($child_output['url_list'] as $key =>$val)
2022 2022
 			{
2023 2023
 				$child_output['url_list'][$key] = addslashes($val);
2024 2024
 			}
2025 2025
 
2026
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2026
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2027 2027
 			$child_buff = $child_output['buff'];
2028 2028
 			$expand = $node->expand;
2029 2029
 
2030 2030
 			$normal_btn = $node->normal_btn;
2031
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2031
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2032 2032
 			else $normal_btn = '';
2033 2033
 
2034 2034
 			$hover_btn = $node->hover_btn;
2035
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2035
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2036 2036
 			else $hover_btn = '';
2037 2037
 
2038 2038
 			$active_btn = $node->active_btn;
2039
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2039
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2040 2040
 			else $active_btn = '';
2041 2041
 
2042 2042
 
2043 2043
 			$group_srls = $node->group_srls;
2044 2044
 
2045
-			if($normal_btn)
2045
+			if ($normal_btn)
2046 2046
 			{
2047
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2047
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2049 2049
 				$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);
2050
-				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);
2050
+				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);
2051 2051
 				else $link_active = $link;
2052 2052
 			}
2053 2053
 			else
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
 			);
2086 2086
 
2087 2087
 			// Generate buff data
2088
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2088
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2089 2089
 			$output['name'] .= $name_str;
2090 2090
 		}
2091 2091
 		return $output;
@@ -2099,19 +2099,19 @@  discard block
 block discarded – undo
2099 2099
 	 */
2100 2100
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2101 2101
 	{
2102
-		if(!count($menu_srl_list)) return;
2102
+		if (!count($menu_srl_list)) return;
2103 2103
 		// Delete the value of menu_srls
2104
-		$args->menu_srls = implode(',',$menu_srl_list);
2104
+		$args->menu_srls = implode(',', $menu_srl_list);
2105 2105
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2106
-		if(!$output->toBool()) return $output;
2106
+		if (!$output->toBool()) return $output;
2107 2107
 
2108 2108
 		$args->layout_srl = $layout_srl;
2109 2109
 		// Mapping menu_srls, layout_srl
2110
-		for($i=0;$i<count($menu_srl_list);$i++)
2110
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2111 2111
 		{
2112 2112
 			$args->menu_srl = $menu_srl_list[$i];
2113 2113
 			$output = executeQuery('menu.insertMenuLayout', $args);
2114
-			if(!$output->toBool()) return $output;
2114
+			if (!$output->toBool()) return $output;
2115 2115
 		}
2116 2116
 	}
2117 2117
 
@@ -2124,47 +2124,47 @@  discard block
 block discarded – undo
2124 2124
 	{
2125 2125
 		// path setting
2126 2126
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2127
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2127
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2128 2128
 		{
2129 2129
 			FileHandler::makeDir($path);
2130 2130
 		}
2131 2131
 
2132
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2132
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2133 2133
 		{
2134 2134
 			$oMenuModel = getAdminModel('menu');
2135 2135
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2136 2136
 
2137
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2137
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2140 2140
 		}
2141 2141
 
2142 2142
 		$returnArray = array();
2143 2143
 		$date = date('YmdHis');
2144 2144
 		// normal button
2145
-		if($args->menu_normal_btn)
2145
+		if ($args->menu_normal_btn)
2146 2146
 		{
2147
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2148
-			$ext = $tmp_arr[count($tmp_arr)-1];
2147
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2148
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2149 2149
 
2150 2150
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2151 2151
 
2152
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2152
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2153 2153
 			{
2154
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2154
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2155 2155
 				$returnArray ['normal_btn'] = $filename;
2156 2156
 			}
2157 2157
 		}
2158 2158
 
2159 2159
 		// hover button
2160
-		if($args->menu_hover_btn)
2160
+		if ($args->menu_hover_btn)
2161 2161
 		{
2162
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2163
-			$ext = $tmp_arr[count($tmp_arr)-1];
2162
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2163
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2164 2164
 
2165 2165
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2166 2166
 
2167
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2167
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2168 2168
 			{
2169 2169
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2170 2170
 				$returnArray['hover_btn'] = $filename;
@@ -2172,14 +2172,14 @@  discard block
 block discarded – undo
2172 2172
 		}
2173 2173
 
2174 2174
 		// active button
2175
-		if($args->menu_active_btn)
2175
+		if ($args->menu_active_btn)
2176 2176
 		{
2177
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2178
-			$ext = $tmp_arr[count($tmp_arr)-1];
2177
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2178
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2179 2179
 
2180 2180
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2181 2181
 
2182
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2182
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2183 2183
 			{
2184 2184
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2185 2185
 				$returnArray['active_btn'] = $filename;
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 			"active_btn"=>"",
2202 2202
 		);
2203 2203
 		//normal_btn
2204
-		if($menuItemInfo->normal_btn)
2204
+		if ($menuItemInfo->normal_btn)
2205 2205
 		{
2206 2206
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2207 2207
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 		}
2212 2212
 
2213 2213
 		//hover_btn
2214
-		if($menuItemInfo->hover_btn)
2214
+		if ($menuItemInfo->hover_btn)
2215 2215
 		{
2216 2216
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2217 2217
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 		}
2222 2222
 
2223 2223
 		//active_btn
2224
-		if($menuItemInfo->active_btn)
2224
+		if ($menuItemInfo->active_btn)
2225 2225
 		{
2226 2226
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2227 2227
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2236,9 +2236,9 @@  discard block
 block discarded – undo
2236 2236
 	{
2237 2237
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2238 2238
 		$tmp_arr = explode('.', $buttonPath);
2239
-		$ext = $tmp_arr[count($tmp_arr)-1];
2239
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2240 2240
 		$date = date("YmdHis");
2241
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2241
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2242 2242
 	}
2243 2243
 
2244 2244
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +297 added lines, -130 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new Object(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new Object(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -465,12 +470,21 @@  discard block
 block discarded – undo
465 470
 			$args->is_shortcut = $request->is_shortcut;
466 471
 			$args->url = $request->shortcut_target;
467 472
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
473
+			if(!$args->open_window) {
474
+				$args->open_window = 'N';
475
+			}
476
+			if(!$args->expand) {
477
+				$args->expand = 'N';
478
+			}
479
+			if(!$args->is_shortcut) {
480
+				$args->is_shortcut = 'Y';
481
+			}
471 482
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
473
-			else $args->name = $request->menu_name;
483
+			if($request->menu_name_key) {
484
+				$args->name = $request->menu_name_key;
485
+			} else {
486
+				$args->name = $request->menu_name;
487
+			}
474 488
 		}
475 489
 		// type is module short cut
476 490
 		else if(is_numeric($request->shortcut_target))
@@ -505,13 +519,18 @@  discard block
 block discarded – undo
505 519
 			$args->url = '#';
506 520
 		}
507 521
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
509
-		else $args->desc = '';
522
+		if($request->menu_desc) {
523
+			$args->desc = $request->menu_desc;
524
+		} else {
525
+			$args->desc = '';
526
+		}
510 527
 
511 528
 		$args->menu_item_srl = getNextSequence();
512 529
 		$args->listorder = -1*$args->menu_item_srl;
513 530
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
531
+		if(!$output->toBool()) {
532
+			return $output;
533
+		}
515 534
 
516 535
 		$oDB->commit();
517 536
 
@@ -533,15 +552,27 @@  discard block
 block discarded – undo
533 552
 		$args->expand = $request->menu_expand;
534 553
 		$args->is_shortcut = $request->is_shortcut;
535 554
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
555
+		if(!$args->open_window) {
556
+			$args->open_window = 'N';
557
+		}
558
+		if(!$args->expand) {
559
+			$args->expand = 'N';
560
+		}
561
+		if(!$args->is_shortcut) {
562
+			$args->is_shortcut = 'N';
563
+		}
539 564
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
541
-		else $args->name = $request->menu_name;
565
+		if($request->menu_name_key) {
566
+			$args->name = $request->menu_name_key;
567
+		} else {
568
+			$args->name = $request->menu_name;
569
+		}
542 570
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
544
-		else $args->desc = '';
571
+		if($request->menu_desc) {
572
+			$args->desc = $request->menu_desc;
573
+		} else {
574
+			$args->desc = '';
575
+		}
545 576
 
546 577
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 578
 		{
@@ -559,9 +590,15 @@  discard block
 block discarded – undo
559 590
 		}
560 591
 
561 592
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
593
+		if($request->normal_btn) {
594
+			$args->normal_btn = $request->normal_btn;
595
+		}
596
+		if($request->hover_btn) {
597
+			$args->hover_btn = $request->hover_btn;
598
+		}
599
+		if($request->active_btn) {
600
+			$args->active_btn = $request->active_btn;
601
+		}
565 602
 
566 603
 		if(!$request->module_id)
567 604
 		{
@@ -572,7 +609,9 @@  discard block
 block discarded – undo
572 609
 		$args->menu_item_srl = getNextSequence();
573 610
 		$args->listorder = -1*$args->menu_item_srl;
574 611
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
612
+		if(!$output->toBool()) {
613
+			return $output;
614
+		}
576 615
 
577 616
 		$oDB->commit();
578 617
 
@@ -653,8 +692,12 @@  discard block
 block discarded – undo
653 692
 		}
654 693
 
655 694
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
695
+		if($request->menu_open_window != "Y") {
696
+			$request->menu_open_window = "N";
697
+		}
698
+		if($request->menu_expand != "Y") {
699
+			$request->menu_expand = "N";
700
+		}
658 701
 
659 702
 		// Get original information
660 703
 		$oMenuAdminModel = getAdminModel('menu');
@@ -681,13 +724,11 @@  discard block
 block discarded – undo
681 724
 
682 725
 				$args->url = $newItemInfo->url;
683 726
 				$args->is_shortcut = 'Y';
684
-			}
685
-			else
727
+			} else
686 728
 			{
687 729
 				$args->url = '#';
688 730
 			}
689
-		}
690
-		else
731
+		} else
691 732
 		{
692 733
 			// check already created module instance
693 734
 			$oModuleModel = getModel('module');
@@ -720,14 +761,16 @@  discard block
 block discarded – undo
720 761
 		if($request->menu_name_key)
721 762
 		{
722 763
 			$args->name = $request->menu_name_key;
723
-		}
724
-		else
764
+		} else
725 765
 		{
726 766
 			$args->name = $request->menu_name;
727 767
 		}
728 768
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
730
-		else $args->desc = '';
769
+		if($request->menu_desc) {
770
+			$args->desc = $request->menu_desc;
771
+		} else {
772
+			$args->desc = '';
773
+		}
731 774
 
732 775
 		unset($args->group_srls);
733 776
 		$args->open_window = $request->menu_open_window;
@@ -829,8 +872,7 @@  discard block
 block discarded – undo
829 872
 		{
830 873
 			$this->setError($returnObj->error);
831 874
 			$this->setMessage($returnObj->message);
832
-		}
833
-		else
875
+		} else
834 876
 		{
835 877
 			$this->setMessage('success_deleted');
836 878
 		}
@@ -857,7 +899,9 @@  discard block
 block discarded – undo
857 899
 		if($args->is_force != 'Y')
858 900
 		{
859 901
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
902
+			if(!$output->toBool()) {
903
+				return $output;
904
+			}
861 905
 			if($output->data->count > 0)
862 906
 			{
863 907
 				return new Object(-1001, 'msg_cannot_delete_for_child');
@@ -875,7 +919,9 @@  discard block
 block discarded – undo
875 919
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 920
 		}
877 921
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
922
+		if($itemInfo->parent_srl) {
923
+			$parent_srl = $itemInfo->parent_srl;
924
+		}
879 925
 
880 926
 		// get menu properies with child menu
881 927
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -949,9 +995,15 @@  discard block
 block discarded – undo
949 995
 		// Update the xml file and get its location
950 996
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 997
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
998
+		if($node['normal_btn']) {
999
+			FileHandler::removeFile($node['normal_btn']);
1000
+		}
1001
+		if($node['hover_btn']) {
1002
+			FileHandler::removeFile($node['hover_btn']);
1003
+		}
1004
+		if($node['active_btn']) {
1005
+			FileHandler::removeFile($node['active_btn']);
1006
+		}
955 1007
 
956 1008
 		// Delete module
957 1009
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1018,7 +1070,9 @@  discard block
 block discarded – undo
1018 1070
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019 1071
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1020 1072
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1073
+		if(!$mode || !$parent_srl || !$target_srl) {
1074
+			return new Object(-1,'msg_invalid_request');
1075
+		}
1022 1076
 
1023 1077
 		$oMenuAdminModel = getAdminModel('menu');
1024 1078
 
@@ -1182,8 +1236,11 @@  discard block
 block discarded – undo
1182 1236
 		// default argument setting
1183 1237
 		$args = new stdClass();
1184 1238
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1186
-		else $args->parent_srl = $parentSrl;
1239
+		if($parentSrl == 0) {
1240
+			$args->parent_srl = $menuSrl;
1241
+		} else {
1242
+			$args->parent_srl = $parentSrl;
1243
+		}
1187 1244
 		$args->menu_name_key = $originMenu['text'];
1188 1245
 		$args->menu_name = $originMenu['text'];
1189 1246
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1276,8 +1333,11 @@  discard block
 block discarded – undo
1276 1333
 		for($i=0;$i<4;$i++)
1277 1334
 		{
1278 1335
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1280
-			else $doc = rand(97, 122);
1336
+			if($case) {
1337
+				$doc = rand(65, 90);
1338
+			} else {
1339
+				$doc = rand(97, 122);
1340
+			}
1281 1341
 
1282 1342
 			$randomString .= chr($doc);
1283 1343
 		}
@@ -1300,15 +1360,21 @@  discard block
 block discarded – undo
1300 1360
 		// menu name update
1301 1361
 		$args->menu_srl = $this->menuSrl;
1302 1362
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1363
+		if(!$output->toBool()) {
1364
+			return $output;
1365
+		}
1304 1366
 
1305 1367
 		$this->map = array();
1306 1368
 		if(is_array($parentKeyList))
1307 1369
 		{
1308 1370
 			foreach($parentKeyList as $no=>$srl)
1309 1371
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1372
+				if($srl === 0) {
1373
+					continue;
1374
+				}
1375
+				if(!is_array($this->map[$srl])) {
1376
+					$this->map[$srl] = array();
1377
+				}
1312 1378
 				$this->map[$srl][] = $no;
1313 1379
 			}
1314 1380
 		}
@@ -1410,7 +1476,9 @@  discard block
 block discarded – undo
1410 1476
 		$oMenuAdminModel = getAdminModel('menu');
1411 1477
 
1412 1478
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1479
+		if($target_item->menu_item_srl != $target_srl) {
1480
+			return new Object(-1,'msg_invalid_request');
1481
+		}
1414 1482
 		// Move the menu location(change the order menu appears)
1415 1483
 		if($mode == 'move')
1416 1484
 		{
@@ -1421,24 +1489,33 @@  discard block
 block discarded – undo
1421 1489
 			if($source_srl)
1422 1490
 			{
1423 1491
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1492
+				if($source_item->menu_item_srl != $source_srl) {
1493
+					return new Object(-1,'msg_invalid_request');
1494
+				}
1425 1495
 				$args->listorder = $source_item->listorder-1;
1426
-			}
1427
-			else
1496
+			} else
1428 1497
 			{
1429 1498
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1499
+				if(!$output->toBool()) {
1500
+					return $output;
1501
+				}
1431 1502
 				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1503
+				if(!$args->listorder) {
1504
+					$args->listorder= 0;
1505
+				}
1433 1506
 			}
1434 1507
 			$args->parent_srl = $parent_srl;
1435 1508
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1509
+			if(!$output->toBool()) {
1510
+				return $output;
1511
+			}
1437 1512
 
1438 1513
 			$args->parent_srl = $parent_srl;
1439 1514
 			$args->menu_item_srl = $target_srl;
1440 1515
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1516
+			if(!$output->toBool()) {
1517
+				return $output;
1518
+			}
1442 1519
 
1443 1520
 			//module's menu_srl move also
1444 1521
 			if($isShortcut == 'N' && !empty($url))
@@ -1466,14 +1543,15 @@  discard block
 block discarded – undo
1466 1543
 				}
1467 1544
 			}
1468 1545
 			// Add a child
1469
-		}
1470
-		elseif($mode == 'insert')
1546
+		} elseif($mode == 'insert')
1471 1547
 		{
1472 1548
 			$args->menu_item_srl = $target_srl;
1473 1549
 			$args->parent_srl = $parent_srl;
1474 1550
 			$args->listorder = -1*getNextSequence();
1475 1551
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1552
+			if(!$output->toBool()) {
1553
+				return $output;
1554
+			}
1477 1555
 		}
1478 1556
 
1479 1557
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1517,8 +1595,7 @@  discard block
 block discarded – undo
1517 1595
 		{
1518 1596
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1597
 
1520
-		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1598
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1522 1599
 		{
1523 1600
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1601
 		}
@@ -1532,7 +1609,9 @@  discard block
 block discarded – undo
1532 1609
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1610
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1611
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1612
+			if(!is_dir($path)) {
1613
+				FileHandler::makeDir($path);
1614
+			}
1536 1615
 
1537 1616
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1617
 			Context::set('filename', $filename);
@@ -1572,7 +1651,9 @@  discard block
 block discarded – undo
1572 1651
 			foreach($installed_module_list AS $key=>$value)
1573 1652
 			{
1574 1653
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1654
+				if($info->menu) {
1655
+					$menuList[$value->module] = $info->menu;
1656
+				}
1576 1657
 				unset($info->menu);
1577 1658
 			}
1578 1659
 		}
@@ -1604,8 +1685,12 @@  discard block
 block discarded – undo
1604 1685
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1686
 
1606 1687
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1688
+		if(empty($url)) {
1689
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1690
+		}
1691
+		if(empty($url)) {
1692
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1693
+		}
1609 1694
 		$dbInfo = Context::getDBInfo();
1610 1695
 
1611 1696
 		$args = new stdClass();
@@ -1617,8 +1702,7 @@  discard block
 block discarded – undo
1617 1702
 		if(strpos($url, 'https') !== false)
1618 1703
 		{
1619 1704
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620
-		}
1621
-		else
1705
+		} else
1622 1706
 		{
1623 1707
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1624 1708
 		}
@@ -1637,14 +1721,18 @@  discard block
 block discarded – undo
1637 1721
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1638 1722
 		{
1639 1723
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1724
+			if(!$output->toBool()) {
1725
+				return $output;
1726
+			}
1641 1727
 		}
1642 1728
 		// Insert if not exist
1643 1729
 		else
1644 1730
 		{
1645 1731
 			$args->listorder = -1*$args->menu_item_srl;
1646 1732
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1733
+			if(!$output->toBool()) {
1734
+				return $output;
1735
+			}
1648 1736
 		}
1649 1737
 		// Get information of the menu
1650 1738
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1675,8 +1763,7 @@  discard block
 block discarded – undo
1675 1763
 		if(!$exposure)
1676 1764
 		{
1677 1765
 			$args->group_srls = '';
1678
-		}
1679
-		else
1766
+		} else
1680 1767
 		{
1681 1768
 			$exposure = explode(',', $exposure);
1682 1769
 			if(in_array($exposure, array('-1','-3')))
@@ -1684,7 +1771,9 @@  discard block
 block discarded – undo
1684 1771
 				$args->group_srls = $exposure;
1685 1772
 			}
1686 1773
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1774
+			if($exposure) {
1775
+				$args->group_srls = implode(',', $exposure);
1776
+			}
1688 1777
 		}
1689 1778
 
1690 1779
 		$output = $this->_updateMenuItem($args);
@@ -1704,7 +1793,9 @@  discard block
 block discarded – undo
1704 1793
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1794
 
1706 1795
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1796
+		if(!$grantList) {
1797
+			$grantList = new stdClass;
1798
+		}
1708 1799
 
1709 1800
 		$grantList->access = new stdClass();
1710 1801
 		$grantList->access->default = 'guest';
@@ -1754,12 +1845,16 @@  discard block
 block discarded – undo
1754 1845
 	function makeXmlFile($menu_srl)
1755 1846
 	{
1756 1847
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1848
+		if(!$menu_srl) {
1849
+			return;
1850
+		}
1758 1851
 		// Get menu informaton
1759 1852
 		$args = new stdClass();
1760 1853
 		$args->menu_srl = $menu_srl;
1761 1854
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1855
+		if(!$output->toBool() || !$output->data) {
1856
+			return $output;
1857
+		}
1763 1858
 		$site_srl = (int)$output->data->site_srl;
1764 1859
 
1765 1860
 		if($site_srl)
@@ -1773,7 +1868,9 @@  discard block
 block discarded – undo
1773 1868
 		$args->menu_srl = $menu_srl;
1774 1869
 		$args->sort_index = 'listorder';
1775 1870
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1871
+		if(!$output->toBool()) {
1872
+			return;
1873
+		}
1777 1874
 		// Specify the name of the cache file
1778 1875
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779 1876
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1787,7 +1884,9 @@  discard block
 block discarded – undo
1787 1884
 			return $xml_file;
1788 1885
 		}
1789 1886
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1887
+		if(!is_array($list)) {
1888
+			$list = array($list);
1889
+		}
1791 1890
 		// Create a tree for loop
1792 1891
 		$list_count = count($list);
1793 1892
 		for($i=0;$i<$list_count;$i++)
@@ -1875,7 +1974,9 @@  discard block
 block discarded – undo
1875 1974
 	 */
1876 1975
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1976
 	{
1878
-		if(!$source_node) return;
1977
+		if(!$source_node) {
1978
+			return;
1979
+		}
1879 1980
 
1880 1981
 		$oMenuAdminModel = getAdminModel('menu');
1881 1982
 
@@ -1883,7 +1984,9 @@  discard block
 block discarded – undo
1883 1984
 		{
1884 1985
 			$child_buff = "";
1885 1986
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1987
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
1988
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1989
+			}
1887 1990
 			// List variables
1888 1991
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889 1992
 			foreach($names as $key => $val)
@@ -1897,37 +2000,57 @@  discard block
 block discarded – undo
1897 2000
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 2001
 			{
1899 2002
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2003
+			} else {
2004
+				$href = sprintf('"%s"', $url);
1900 2005
 			}
1901
-			else $href = sprintf('"%s"', $url);
1902 2006
 			$is_shortcut = $node->is_shortcut;
1903 2007
 			$open_window = $node->open_window;
1904 2008
 			$expand = $node->expand;
1905 2009
 
1906 2010
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1908
-			else $normal_btn = '';
2011
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2012
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2013
+			} else {
2014
+				$normal_btn = '';
2015
+			}
1909 2016
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1911
-			else $hover_btn = '';
2017
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2018
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2019
+			} else {
2020
+				$hover_btn = '';
2021
+			}
1912 2022
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1914
-			else $active_btn = '';
2023
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2024
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2025
+			} else {
2026
+				$active_btn = '';
2027
+			}
1915 2028
 
1916 2029
 			$group_srls = $node->group_srls;
1917 2030
 
1918 2031
 			if($normal_btn)
1919 2032
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2033
+				if($hover_btn) {
2034
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2035
+				} else {
2036
+					$hover_str = '';
2037
+				}
2038
+				if($active_btn) {
2039
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2040
+				} else {
2041
+					$active_str = '';
2042
+				}
1922 2043
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923
-			}
1924
-			else
2044
+			} else
1925 2045
 			{
1926 2046
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 2047
 			}
1928 2048
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1930
-			else $group_check_code = "true";
2049
+			if($group_srls) {
2050
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
2051
+			} else {
2052
+				$group_check_code = "true";
2053
+			}
1931 2054
 			$attribute = sprintf(
1932 2055
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
1933 2056
 				$menu_item_srl,
@@ -1950,8 +2073,11 @@  discard block
 block discarded – undo
1950 2073
 				$link
1951 2074
 			);
1952 2075
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
2076
+			if($child_buff) {
2077
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2078
+			} else {
2079
+				$buff .=  sprintf('<node %s />', $attribute);
2080
+			}
1955 2081
 		}
1956 2082
 		return $buff;
1957 2083
 	}
@@ -1970,15 +2096,20 @@  discard block
 block discarded – undo
1970 2096
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 2097
 	{
1972 2098
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
2099
+		if(!$source_node) {
2100
+			return $output;
2101
+		}
1974 2102
 
1975 2103
 		$oMenuAdminModel = getAdminModel('menu');
1976 2104
 
1977 2105
 		foreach($source_node as $menu_item_srl => $node)
1978 2106
 		{
1979 2107
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981
-			else $child_output = array("buff"=>"", "url_list"=>array());
2108
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2109
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2110
+			} else {
2111
+				$child_output = array("buff"=>"", "url_list"=>array());
2112
+			}
1982 2113
 
1983 2114
 			// List variables
1984 2115
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -1988,8 +2119,7 @@  discard block
 block discarded – undo
1988 2119
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1989 2120
 				{
1990 2121
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
1991
-				}
1992
-				else
2122
+				} else
1993 2123
 				{
1994 2124
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), strip_tags($val)));
1995 2125
 				}
@@ -1997,11 +2127,16 @@  discard block
 block discarded – undo
1997 2127
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1998 2128
 
1999 2129
 			// If url value is not empty in the current node, put the value into an array url_list
2000
-			if($node->url) $child_output['url_list'][] = $node->url;
2130
+			if($node->url) {
2131
+				$child_output['url_list'][] = $node->url;
2132
+			}
2001 2133
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2002 2134
 			// If node->group_srls value exists
2003
-			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);
2004
-			else $group_check_code = "true";
2135
+			if($node->group_srls) {
2136
+				$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);
2137
+			} else {
2138
+				$group_check_code = "true";
2139
+			}
2005 2140
 
2006 2141
 			// List variables
2007 2142
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2010,8 +2145,9 @@  discard block
 block discarded – undo
2010 2145
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2011 2146
 			{
2012 2147
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2148
+			} else {
2149
+				$href = sprintf('"%s"', $url);
2013 2150
 			}
2014
-			else $href = sprintf('"%s"', $url);
2015 2151
 			$is_shortcut = $node->is_shortcut;
2016 2152
 			$open_window = $node->open_window;
2017 2153
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2028,29 +2164,48 @@  discard block
 block discarded – undo
2028 2164
 			$expand = $node->expand;
2029 2165
 
2030 2166
 			$normal_btn = $node->normal_btn;
2031
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2032
-			else $normal_btn = '';
2167
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2168
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2169
+			} else {
2170
+				$normal_btn = '';
2171
+			}
2033 2172
 
2034 2173
 			$hover_btn = $node->hover_btn;
2035
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2036
-			else $hover_btn = '';
2174
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2175
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2176
+			} else {
2177
+				$hover_btn = '';
2178
+			}
2037 2179
 
2038 2180
 			$active_btn = $node->active_btn;
2039
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2040
-			else $active_btn = '';
2181
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2182
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2183
+			} else {
2184
+				$active_btn = '';
2185
+			}
2041 2186
 
2042 2187
 
2043 2188
 			$group_srls = $node->group_srls;
2044 2189
 
2045 2190
 			if($normal_btn)
2046 2191
 			{
2047
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2192
+				if($hover_btn) {
2193
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2194
+				} else {
2195
+					$hover_str = '';
2196
+				}
2197
+				if($active_btn) {
2198
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2199
+				} else {
2200
+					$active_str = '';
2201
+				}
2049 2202
 				$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);
2050
-				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);
2051
-				else $link_active = $link;
2052
-			}
2053
-			else
2203
+				if($active_btn) {
2204
+					$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);
2205
+				} else {
2206
+					$link_active = $link;
2207
+				}
2208
+			} else
2054 2209
 			{
2055 2210
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2056 2211
 			}
@@ -2099,11 +2254,15 @@  discard block
 block discarded – undo
2099 2254
 	 */
2100 2255
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2101 2256
 	{
2102
-		if(!count($menu_srl_list)) return;
2257
+		if(!count($menu_srl_list)) {
2258
+			return;
2259
+		}
2103 2260
 		// Delete the value of menu_srls
2104 2261
 		$args->menu_srls = implode(',',$menu_srl_list);
2105 2262
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2106
-		if(!$output->toBool()) return $output;
2263
+		if(!$output->toBool()) {
2264
+			return $output;
2265
+		}
2107 2266
 
2108 2267
 		$args->layout_srl = $layout_srl;
2109 2268
 		// Mapping menu_srls, layout_srl
@@ -2111,7 +2270,9 @@  discard block
 block discarded – undo
2111 2270
 		{
2112 2271
 			$args->menu_srl = $menu_srl_list[$i];
2113 2272
 			$output = executeQuery('menu.insertMenuLayout', $args);
2114
-			if(!$output->toBool()) return $output;
2273
+			if(!$output->toBool()) {
2274
+				return $output;
2275
+			}
2115 2276
 		}
2116 2277
 	}
2117 2278
 
@@ -2134,9 +2295,15 @@  discard block
 block discarded – undo
2134 2295
 			$oMenuModel = getAdminModel('menu');
2135 2296
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2136 2297
 
2137
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2298
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2299
+				FileHandler::removeFile($itemInfo->normal_btn);
2300
+			}
2301
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2302
+				FileHandler::removeFile($itemInfo->hover_btn);
2303
+			}
2304
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2305
+				FileHandler::removeFile($itemInfo->active_btn);
2306
+			}
2140 2307
 		}
2141 2308
 
2142 2309
 		$returnArray = array();
Please login to merge, or discard this patch.