GitHub Access Token became invalid

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