@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function init() |
54 | 54 | { |
55 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
55 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function __construct() { |
@@ -68,8 +68,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
168 | 168 | */ |
169 | 169 | function updateLinkModule($moduleInfos, $menuSrl) |
170 | 170 | { |
171 | - if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0) |
|
171 | + if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0) |
|
172 | 172 | { |
173 | 173 | return new Object(-1, 'msg_invalid_request'); |
174 | 174 | } |
175 | 175 | |
176 | - foreach($moduleInfos as $moduleInfo) |
|
176 | + foreach ($moduleInfos as $moduleInfo) |
|
177 | 177 | { |
178 | 178 | // search menu. |
179 | 179 | $args = new stdClass; |
@@ -183,7 +183,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
255 | 255 | $menuInfo = $oMenuAdminModel->getMenu($menu_srl); |
256 | 256 | |
257 | 257 | $oAdmin = getClass('admin'); |
258 | - if($menuInfo->title == $oAdmin->getAdminMenuName()) |
|
258 | + if ($menuInfo->title == $oAdmin->getAdminMenuName()) |
|
259 | 259 | return new Object(-1, 'msg_adminmenu_cannot_delete'); |
260 | 260 | |
261 | 261 | // get menu properies with child menu |
262 | 262 | $phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl); |
263 | 263 | $originMenu = NULL; |
264 | 264 | |
265 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
265 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
266 | 266 | { |
267 | 267 | include(FileHandler::getRealPath($phpFile)); |
268 | 268 | } |
@@ -273,25 +273,25 @@ discard block |
||
273 | 273 | |
274 | 274 | $isStartmenuInclude = false; |
275 | 275 | |
276 | - if(is_array($menu->list)) |
|
276 | + if (is_array($menu->list)) |
|
277 | 277 | { |
278 | - foreach($menu->list AS $key=>$value) |
|
278 | + foreach ($menu->list AS $key=>$value) |
|
279 | 279 | { |
280 | 280 | $originMenu = $value; |
281 | 281 | $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); |
282 | 282 | |
283 | - if($isStartmenuInclude) |
|
283 | + if ($isStartmenuInclude) |
|
284 | 284 | break; |
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | - if($isStartmenuInclude) |
|
288 | + if ($isStartmenuInclude) |
|
289 | 289 | { |
290 | 290 | return new Object(-1, 'msg_cannot_delete_homemenu'); |
291 | 291 | } |
292 | 292 | |
293 | 293 | $output = $this->deleteMenu($menu_srl); |
294 | - if(!$output->toBool()) |
|
294 | + if (!$output->toBool()) |
|
295 | 295 | { |
296 | 296 | return new Object(-1, $output->message); |
297 | 297 | } |
@@ -319,7 +319,7 @@ discard block |
||
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 |
||
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 |
||
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 | - $pos = strpos($cache_file, $menu_srl.'.'); |
|
369 | - if($pos>0)FileHandler::removeFile($cache_file); |
|
368 | + $pos = strpos($cache_file, $menu_srl . '.'); |
|
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 |
||
375 | 375 | |
376 | 376 | $oDB->commit(); |
377 | 377 | |
378 | - return new Object(0,'success_deleted'); |
|
378 | + return new Object(0, 'success_deleted'); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -385,24 +385,24 @@ discard block |
||
385 | 385 | public function procMenuAdminInsertItem($request = NULL) |
386 | 386 | { |
387 | 387 | $isProc = false; |
388 | - if(!$request) |
|
388 | + if (!$request) |
|
389 | 389 | { |
390 | 390 | $isProc = true; |
391 | 391 | $request = Context::getRequestVars(); |
392 | 392 | } |
393 | 393 | |
394 | - if(!$request->parent_srl || !$request->menu_name) |
|
394 | + if (!$request->parent_srl || !$request->menu_name) |
|
395 | 395 | { |
396 | 396 | return new Object(-1, 'msg_invalid_request'); |
397 | 397 | } |
398 | 398 | |
399 | 399 | $this->_setMenuSrl($request->parent_srl, $request->menu_srl); |
400 | - if(!$request->menu_srl) |
|
400 | + if (!$request->menu_srl) |
|
401 | 401 | { |
402 | 402 | return new Object(-1, 'msg_invalid_request'); |
403 | 403 | } |
404 | 404 | |
405 | - if($request->is_shortcut == 'Y') |
|
405 | + if ($request->is_shortcut == 'Y') |
|
406 | 406 | { |
407 | 407 | $result = $this->_insertShortcut($request); |
408 | 408 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $result = $this->_insertMenu($request, $isProc); |
412 | 412 | } |
413 | 413 | |
414 | - if($result->error < 0) |
|
414 | + if ($result->error < 0) |
|
415 | 415 | { |
416 | 416 | return new Object($result->error, $result->message); |
417 | 417 | } |
@@ -419,7 +419,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
453 | 453 | $oDB->begin(); |
454 | 454 | |
455 | 455 | // type is url |
456 | - if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
456 | + if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
457 | 457 | { |
458 | 458 | // set menu variable |
459 | 459 | $args = new stdClass(); |
@@ -465,27 +465,27 @@ discard block |
||
465 | 465 | $args->is_shortcut = $request->is_shortcut; |
466 | 466 | $args->url = $request->shortcut_target; |
467 | 467 | |
468 | - if(!$args->open_window) $args->open_window = 'N'; |
|
469 | - if(!$args->expand) $args->expand = 'N'; |
|
470 | - if(!$args->is_shortcut) $args->is_shortcut = 'Y'; |
|
468 | + if (!$args->open_window) $args->open_window = 'N'; |
|
469 | + if (!$args->expand) $args->expand = 'N'; |
|
470 | + if (!$args->is_shortcut) $args->is_shortcut = 'Y'; |
|
471 | 471 | |
472 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
472 | + if ($request->menu_name_key) $args->name = $request->menu_name_key; |
|
473 | 473 | else $args->name = $request->menu_name; |
474 | 474 | } |
475 | 475 | // type is module short cut |
476 | - else if(is_numeric($request->shortcut_target)) |
|
476 | + else if (is_numeric($request->shortcut_target)) |
|
477 | 477 | { |
478 | 478 | // Get original information |
479 | 479 | $oMenuAdminModel = getAdminModel('menu'); |
480 | 480 | $itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target); |
481 | - if(!$itemInfo->menu_item_srl) |
|
481 | + if (!$itemInfo->menu_item_srl) |
|
482 | 482 | { |
483 | 483 | return new Object(-1, 'msg_invalid_request'); |
484 | 484 | } |
485 | 485 | unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn); |
486 | 486 | |
487 | 487 | $args = $itemInfo; |
488 | - if(count($args->group_srls) == 0) |
|
488 | + if (count($args->group_srls) == 0) |
|
489 | 489 | { |
490 | 490 | unset($args->group_srls); |
491 | 491 | } |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | $args->url = '#'; |
506 | 506 | } |
507 | 507 | |
508 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
508 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
509 | 509 | else $args->desc = ''; |
510 | 510 | |
511 | 511 | $args->menu_item_srl = getNextSequence(); |
512 | - $args->listorder = -1*$args->menu_item_srl; |
|
512 | + $args->listorder = -1 * $args->menu_item_srl; |
|
513 | 513 | $output = executeQuery('menu.insertMenuItem', $args); |
514 | - if(!$output->toBool()) return $output; |
|
514 | + if (!$output->toBool()) return $output; |
|
515 | 515 | |
516 | 516 | $oDB->commit(); |
517 | 517 | |
@@ -533,46 +533,46 @@ discard block |
||
533 | 533 | $args->expand = $request->menu_expand; |
534 | 534 | $args->is_shortcut = $request->is_shortcut; |
535 | 535 | |
536 | - if(!$args->open_window) $args->open_window = 'N'; |
|
537 | - if(!$args->expand) $args->expand = 'N'; |
|
538 | - if(!$args->is_shortcut) $args->is_shortcut = 'N'; |
|
536 | + if (!$args->open_window) $args->open_window = 'N'; |
|
537 | + if (!$args->expand) $args->expand = 'N'; |
|
538 | + if (!$args->is_shortcut) $args->is_shortcut = 'N'; |
|
539 | 539 | |
540 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
540 | + if ($request->menu_name_key) $args->name = $request->menu_name_key; |
|
541 | 541 | else $args->name = $request->menu_name; |
542 | 542 | |
543 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
543 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
544 | 544 | else $args->desc = ''; |
545 | 545 | |
546 | - if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0) |
|
546 | + if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0) |
|
547 | 547 | { |
548 | 548 | return new Object(-1, 'msg_invalid_request'); |
549 | 549 | } |
550 | 550 | |
551 | 551 | // when menu copy, module already copied |
552 | - if($isProc) |
|
552 | + if ($isProc) |
|
553 | 553 | { |
554 | 554 | $result = $this->_insertModule($request, $args); |
555 | - if(!$result->toBool()) |
|
555 | + if (!$result->toBool()) |
|
556 | 556 | { |
557 | 557 | return new Object(-1, $result->message); |
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | 561 | // if setting button variables, set argument button variables for db insert. but not upload in this method |
562 | - if($request->normal_btn) $args->normal_btn = $request->normal_btn; |
|
563 | - if($request->hover_btn) $args->hover_btn = $request->hover_btn; |
|
564 | - if($request->active_btn) $args->active_btn = $request->active_btn; |
|
562 | + if ($request->normal_btn) $args->normal_btn = $request->normal_btn; |
|
563 | + if ($request->hover_btn) $args->hover_btn = $request->hover_btn; |
|
564 | + if ($request->active_btn) $args->active_btn = $request->active_btn; |
|
565 | 565 | |
566 | - if(!$request->module_id) |
|
566 | + if (!$request->module_id) |
|
567 | 567 | { |
568 | 568 | return new Object(-1, 'msg_invalid_request'); |
569 | 569 | } |
570 | 570 | |
571 | 571 | $args->url = $request->module_id; |
572 | 572 | $args->menu_item_srl = getNextSequence(); |
573 | - $args->listorder = -1*$args->menu_item_srl; |
|
573 | + $args->listorder = -1 * $args->menu_item_srl; |
|
574 | 574 | $output = executeQuery('menu.insertMenuItem', $args); |
575 | - if(!$output->toBool()) return $output; |
|
575 | + if (!$output->toBool()) return $output; |
|
576 | 576 | |
577 | 577 | $oDB->commit(); |
578 | 578 | |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | //module create |
606 | 606 | $site_module_info = Context::get('site_module_info'); |
607 | - $cmArgs->site_srl = (int)$site_module_info->site_srl; |
|
607 | + $cmArgs->site_srl = (int) $site_module_info->site_srl; |
|
608 | 608 | $cmArgs->browser_title = $args->name; |
609 | 609 | $cmArgs->menu_srl = $request->menu_srl; |
610 | 610 | $cmArgs->layout_srl = -1; |
@@ -612,23 +612,23 @@ discard block |
||
612 | 612 | $cmArgs->is_skin_fix = 'N'; |
613 | 613 | $cmArgs->is_mskin_fix = 'N'; |
614 | 614 | |
615 | - if(Mobile::isMobileEnabled() === true) |
|
615 | + if (Mobile::isMobileEnabled() === true) |
|
616 | 616 | { |
617 | 617 | $cmArgs->use_mobile = 'Y'; |
618 | 618 | } |
619 | 619 | |
620 | 620 | // if mid is empty, auto create mid |
621 | - if(!$request->module_id) |
|
621 | + if (!$request->module_id) |
|
622 | 622 | { |
623 | 623 | $randomMid = $this->_makeRandomMid(); |
624 | - $request->module_id = $cmArgs->module.'_'.$randomMid; |
|
624 | + $request->module_id = $cmArgs->module . '_' . $randomMid; |
|
625 | 625 | } |
626 | 626 | $cmArgs->mid = $request->module_id; |
627 | 627 | |
628 | 628 | // check already created module instance |
629 | 629 | $oModuleModel = getModel('module'); |
630 | 630 | $output = $oModuleModel->getModuleInfoByMid($request->module_id); |
631 | - if($output->module_srl) |
|
631 | + if ($output->module_srl) |
|
632 | 632 | { |
633 | 633 | return new Object(-1, 'msg_module_name_exists'); |
634 | 634 | } |
@@ -647,14 +647,14 @@ discard block |
||
647 | 647 | { |
648 | 648 | $request = Context::getRequestVars(); |
649 | 649 | |
650 | - if(!$request->menu_item_srl || !$request->menu_name) |
|
650 | + if (!$request->menu_item_srl || !$request->menu_name) |
|
651 | 651 | { |
652 | 652 | return new Object(-1, 'msg_invalid_request'); |
653 | 653 | } |
654 | 654 | |
655 | 655 | // variables set |
656 | - if($request->menu_open_window != "Y") $request->menu_open_window = "N"; |
|
657 | - if($request->menu_expand != "Y") $request->menu_expand = "N"; |
|
656 | + if ($request->menu_open_window != "Y") $request->menu_open_window = "N"; |
|
657 | + if ($request->menu_expand != "Y") $request->menu_expand = "N"; |
|
658 | 658 | |
659 | 659 | // Get original information |
660 | 660 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -662,19 +662,19 @@ discard block |
||
662 | 662 | $args = $itemInfo; |
663 | 663 | |
664 | 664 | // if menu type is module, check exists module and update |
665 | - if($itemInfo->is_shortcut == 'Y') |
|
665 | + if ($itemInfo->is_shortcut == 'Y') |
|
666 | 666 | { |
667 | 667 | // type is url |
668 | - if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
668 | + if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
669 | 669 | { |
670 | 670 | $args->url = $request->shortcut_target; |
671 | 671 | } |
672 | 672 | // type is module short cut |
673 | - else if(is_numeric($request->shortcut_target)) |
|
673 | + else if (is_numeric($request->shortcut_target)) |
|
674 | 674 | { |
675 | 675 | // Get new original information |
676 | 676 | $newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target); |
677 | - if(!$newItemInfo->menu_item_srl) |
|
677 | + if (!$newItemInfo->menu_item_srl) |
|
678 | 678 | { |
679 | 679 | return new Object(-1, 'msg_invalid_request'); |
680 | 680 | } |
@@ -691,10 +691,10 @@ discard block |
||
691 | 691 | { |
692 | 692 | // check already created module instance |
693 | 693 | $oModuleModel = getModel('module'); |
694 | - if($request->module_id != $itemInfo->url) |
|
694 | + if ($request->module_id != $itemInfo->url) |
|
695 | 695 | { |
696 | 696 | $output = $oModuleModel->getModuleInfoByMid($request->module_id); |
697 | - if($output->module_srl) |
|
697 | + if ($output->module_srl) |
|
698 | 698 | { |
699 | 699 | return new Object(-1, 'msg_module_name_exists'); |
700 | 700 | } |
@@ -702,13 +702,13 @@ discard block |
||
702 | 702 | |
703 | 703 | // if not exist module, return error |
704 | 704 | $moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url); |
705 | - if(!$moduleInfo) |
|
705 | + if (!$moduleInfo) |
|
706 | 706 | { |
707 | 707 | return new Object(-1, 'msg_invalid_request'); |
708 | 708 | } |
709 | 709 | |
710 | 710 | $moduleInfo->mid = $request->module_id; |
711 | - if($request->browser_title) |
|
711 | + if ($request->browser_title) |
|
712 | 712 | { |
713 | 713 | $moduleInfo->browser_title = $request->browser_title; |
714 | 714 | } |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $args->url = $request->module_id; |
718 | 718 | } |
719 | 719 | |
720 | - if($request->menu_name_key) |
|
720 | + if ($request->menu_name_key) |
|
721 | 721 | { |
722 | 722 | $args->name = $request->menu_name_key; |
723 | 723 | } |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $args->name = $request->menu_name; |
727 | 727 | } |
728 | 728 | |
729 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
729 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
730 | 730 | else $args->desc = ''; |
731 | 731 | |
732 | 732 | unset($args->group_srls); |
@@ -754,38 +754,38 @@ discard block |
||
754 | 754 | |
755 | 755 | $btnOutput = $this->_uploadButton($args); |
756 | 756 | |
757 | - if($btnOutput['normal_btn']) |
|
757 | + if ($btnOutput['normal_btn']) |
|
758 | 758 | { |
759 | 759 | $this->add('normal_btn', $btnOutput['normal_btn']); |
760 | 760 | $item_info->normal_btn = $btnOutput['normal_btn']; |
761 | 761 | } |
762 | - if($btnOutput['hover_btn']) |
|
762 | + if ($btnOutput['hover_btn']) |
|
763 | 763 | { |
764 | 764 | $this->add('hover_btn', $btnOutput['hover_btn']); |
765 | 765 | $item_info->hover_btn = $btnOutput['hover_btn']; |
766 | 766 | } |
767 | - if($btnOutput['active_btn']) |
|
767 | + if ($btnOutput['active_btn']) |
|
768 | 768 | { |
769 | 769 | $this->add('active_btn', $btnOutput['active_btn']); |
770 | 770 | $item_info->active_btn = $btnOutput['active_btn']; |
771 | 771 | } |
772 | 772 | |
773 | 773 | // group_srls check |
774 | - if(count($item_info->group_srls) == 0) |
|
774 | + if (count($item_info->group_srls) == 0) |
|
775 | 775 | { |
776 | 776 | unset($item_info->group_srls); |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Button delete check |
780 | - if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y') |
|
780 | + if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y') |
|
781 | 781 | { |
782 | 782 | $item_info->normal_btn = ''; |
783 | 783 | } |
784 | - if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y') |
|
784 | + if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y') |
|
785 | 785 | { |
786 | 786 | $item_info->hover_btn = ''; |
787 | 787 | } |
788 | - if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y') |
|
788 | + if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y') |
|
789 | 789 | { |
790 | 790 | $item_info->active_btn = ''; |
791 | 791 | } |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $args->is_force = Context::get('is_force'); |
826 | 826 | |
827 | 827 | $returnObj = $this->deleteItem($args); |
828 | - if(is_object($returnObj)) |
|
828 | + if (is_object($returnObj)) |
|
829 | 829 | { |
830 | 830 | $this->setError($returnObj->error); |
831 | 831 | $this->setMessage($returnObj->message); |
@@ -854,11 +854,11 @@ discard block |
||
854 | 854 | $args->menu_srl = $itemInfo->menu_srl; |
855 | 855 | |
856 | 856 | // Display an error that the category cannot be deleted if it has a child node 603 |
857 | - if($args->is_force != 'Y') |
|
857 | + if ($args->is_force != 'Y') |
|
858 | 858 | { |
859 | 859 | $output = executeQuery('menu.getChildMenuCount', $args); |
860 | - if(!$output->toBool()) return $output; |
|
861 | - if($output->data->count > 0) |
|
860 | + if (!$output->toBool()) return $output; |
|
861 | + if ($output->data->count > 0) |
|
862 | 862 | { |
863 | 863 | return new Object(-1001, 'msg_cannot_delete_for_child'); |
864 | 864 | } |
@@ -870,22 +870,22 @@ discard block |
||
870 | 870 | |
871 | 871 | // check admin menu delete |
872 | 872 | $oAdmin = getClass('admin'); |
873 | - if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0) |
|
873 | + if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0) |
|
874 | 874 | { |
875 | 875 | return $this->stop('msg_cannot_delete_for_admin_topmenu'); |
876 | 876 | } |
877 | 877 | |
878 | - if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; |
|
878 | + if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; |
|
879 | 879 | |
880 | 880 | // get menu properies with child menu |
881 | 881 | $phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl); |
882 | 882 | $originMenu = NULL; |
883 | 883 | |
884 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
884 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
885 | 885 | { |
886 | 886 | include(FileHandler::getRealPath($phpFile)); |
887 | 887 | |
888 | - if(is_array($menu->list)) |
|
888 | + if (is_array($menu->list)) |
|
889 | 889 | { |
890 | 890 | $this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu); |
891 | 891 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | $siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl); |
896 | 896 | $isStartmenuInclude = false; |
897 | 897 | $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); |
898 | - if($isStartmenuInclude) |
|
898 | + if ($isStartmenuInclude) |
|
899 | 899 | { |
900 | 900 | return new Object(-1, 'msg_cannot_delete_homemenu'); |
901 | 901 | } |
@@ -919,14 +919,14 @@ discard block |
||
919 | 919 | |
920 | 920 | private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude) |
921 | 921 | { |
922 | - if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid) |
|
922 | + if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid) |
|
923 | 923 | { |
924 | 924 | $isStartmenuInclude = true; |
925 | 925 | } |
926 | 926 | |
927 | - if(!$isStartmenuInclude && is_array($originMenu['list'])) |
|
927 | + if (!$isStartmenuInclude && is_array($originMenu['list'])) |
|
928 | 928 | { |
929 | - foreach($originMenu['list'] AS $key=>$value) |
|
929 | + foreach ($originMenu['list'] AS $key=>$value) |
|
930 | 930 | { |
931 | 931 | $this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude); |
932 | 932 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | $args->menu_srl = $menuSrl; |
941 | 941 | $args->menu_item_srl = $node['node_srl']; |
942 | 942 | $output = executeQuery("menu.deleteMenuItem", $args); |
943 | - if(!$output->toBool()) |
|
943 | + if (!$output->toBool()) |
|
944 | 944 | { |
945 | 945 | $oDB->rollback(); |
946 | 946 | return $output; |
@@ -949,12 +949,12 @@ discard block |
||
949 | 949 | // Update the xml file and get its location |
950 | 950 | $xml_file = $this->makeXmlFile($args->menu_srl); |
951 | 951 | // Delete all of image buttons |
952 | - if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']); |
|
953 | - if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']); |
|
954 | - if($node['active_btn']) FileHandler::removeFile($node['active_btn']); |
|
952 | + if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']); |
|
953 | + if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']); |
|
954 | + if ($node['active_btn']) FileHandler::removeFile($node['active_btn']); |
|
955 | 955 | |
956 | 956 | // Delete module |
957 | - if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0) |
|
957 | + if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0) |
|
958 | 958 | { |
959 | 959 | $oModuleController = getController('module'); |
960 | 960 | $oModuleModel = getModel('module'); |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | $args->site_srl = $menuInfo->site_srl; |
965 | 965 | $args->is_shortcut = 'Y'; |
966 | 966 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
967 | - if($output->data->menu_item_srl) |
|
967 | + if ($output->data->menu_item_srl) |
|
968 | 968 | { |
969 | 969 | $output->data->url = ''; |
970 | 970 | $referenceItem = $output->data; |
971 | 971 | $output = $this->_updateMenuItem($referenceItem); |
972 | - if(!$output->toBool()) |
|
972 | + if (!$output->toBool()) |
|
973 | 973 | { |
974 | 974 | $oDB->rollback(); |
975 | 975 | return $output; |
@@ -977,10 +977,10 @@ discard block |
||
977 | 977 | } |
978 | 978 | |
979 | 979 | $moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl); |
980 | - if($moduleInfo->module_srl) |
|
980 | + if ($moduleInfo->module_srl) |
|
981 | 981 | { |
982 | 982 | $output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl); |
983 | - if(!$output->toBool()) |
|
983 | + if (!$output->toBool()) |
|
984 | 984 | { |
985 | 985 | $oDB->rollback(); |
986 | 986 | return $output; |
@@ -993,14 +993,14 @@ discard block |
||
993 | 993 | private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node) |
994 | 994 | { |
995 | 995 | $output = $this->_deleteMenuItem($oDB, $menuInfo, $node); |
996 | - if(!$output->toBool()) |
|
996 | + if (!$output->toBool()) |
|
997 | 997 | { |
998 | 998 | return new Object(-1, $output->message); |
999 | 999 | } |
1000 | 1000 | |
1001 | - if(is_array($node['list'])) |
|
1001 | + if (is_array($node['list'])) |
|
1002 | 1002 | { |
1003 | - foreach($node['list'] AS $key=>$value) |
|
1003 | + foreach ($node['list'] AS $key=>$value) |
|
1004 | 1004 | { |
1005 | 1005 | $this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value); |
1006 | 1006 | } |
@@ -1013,18 +1013,18 @@ discard block |
||
1013 | 1013 | */ |
1014 | 1014 | function procMenuAdminMoveItem() |
1015 | 1015 | { |
1016 | - $mode = Context::get('mode'); //move |
|
1017 | - $parent_srl = Context::get('parent_srl'); // Parent menu item serial number |
|
1018 | - $source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number |
|
1019 | - $target_srl = Context::get('target_srl'); // Self menu item serial number |
|
1016 | + $mode = Context::get('mode'); //move |
|
1017 | + $parent_srl = Context::get('parent_srl'); // Parent menu item serial number |
|
1018 | + $source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number |
|
1019 | + $target_srl = Context::get('target_srl'); // Self menu item serial number |
|
1020 | 1020 | |
1021 | - if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request'); |
|
1021 | + if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request'); |
|
1022 | 1022 | |
1023 | 1023 | $oMenuAdminModel = getAdminModel('menu'); |
1024 | 1024 | |
1025 | 1025 | // get original menu item info for cache file recreate |
1026 | 1026 | $originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl); |
1027 | - if(!$originalItemInfo->menu_item_srl) |
|
1027 | + if (!$originalItemInfo->menu_item_srl) |
|
1028 | 1028 | { |
1029 | 1029 | return new Object(-1, 'msg_empty_menu_item'); |
1030 | 1030 | } |
@@ -1033,11 +1033,11 @@ discard block |
||
1033 | 1033 | $phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl); |
1034 | 1034 | $originMenu = NULL; |
1035 | 1035 | |
1036 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
1036 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
1037 | 1037 | { |
1038 | 1038 | include(FileHandler::getRealPath($phpFile)); |
1039 | 1039 | |
1040 | - if(is_array($menu->list)) |
|
1040 | + if (is_array($menu->list)) |
|
1041 | 1041 | { |
1042 | 1042 | $this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu); |
1043 | 1043 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | // get target menu info for move |
1047 | 1047 | $targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl); |
1048 | 1048 | // if move in same sitemap |
1049 | - if($targetMenuItemInfo->menu_item_srl) |
|
1049 | + if ($targetMenuItemInfo->menu_item_srl) |
|
1050 | 1050 | { |
1051 | 1051 | $menu_srl = $targetMenuItemInfo->menu_srl; |
1052 | 1052 | } |
@@ -1058,20 +1058,20 @@ discard block |
||
1058 | 1058 | $parent_srl = 0; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - if(!$this->homeModuleMid) |
|
1061 | + if (!$this->homeModuleMid) |
|
1062 | 1062 | { |
1063 | 1063 | $oModuleModel = getModel('module'); |
1064 | 1064 | $oMenuAdminController = getAdminController('menu'); |
1065 | 1065 | $columnList = array('modules.mid',); |
1066 | 1066 | $output = $oModuleModel->getSiteInfo(0, $columnList); |
1067 | - if($output->mid) |
|
1067 | + if ($output->mid) |
|
1068 | 1068 | { |
1069 | 1069 | $this->homeModuleMid = $output->mid; |
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | $this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']); |
1074 | - if(count($originMenu['list']) > 0) |
|
1074 | + if (count($originMenu['list']) > 0) |
|
1075 | 1075 | { |
1076 | 1076 | $this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl); |
1077 | 1077 | } |
@@ -1085,9 +1085,9 @@ discard block |
||
1085 | 1085 | |
1086 | 1086 | private function _recursiveUpdateMenuItem($node, $menu_srl) |
1087 | 1087 | { |
1088 | - if(is_array($node)) |
|
1088 | + if (is_array($node)) |
|
1089 | 1089 | { |
1090 | - foreach($node AS $key=>$node) |
|
1090 | + foreach ($node AS $key=>$node) |
|
1091 | 1091 | { |
1092 | 1092 | $args = new stdClass(); |
1093 | 1093 | $args->menu_srl = $menu_srl; |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | $output = $this->_updateMenuItem($args); |
1096 | 1096 | |
1097 | 1097 | //module's menu_srl move also |
1098 | - if($node['is_shortcut'] == 'N' && !empty($node['url'])) |
|
1098 | + if ($node['is_shortcut'] == 'N' && !empty($node['url'])) |
|
1099 | 1099 | { |
1100 | 1100 | $oModuleModel = getModel('module'); |
1101 | 1101 | $moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']); |
1102 | - if($menu_srl != $moduleInfo->menu_srl) |
|
1102 | + if ($menu_srl != $moduleInfo->menu_srl) |
|
1103 | 1103 | { |
1104 | 1104 | $moduleInfo->menu_srl = $menu_srl; |
1105 | 1105 | $oModuleController = getController('module'); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | |
1110 | - if(count($node['list']) > 0) |
|
1110 | + if (count($node['list']) > 0) |
|
1111 | 1111 | { |
1112 | 1112 | $this->_recursiveUpdateMenuItem($node['list'], $menu_srl); |
1113 | 1113 | } |
@@ -1132,18 +1132,18 @@ discard block |
||
1132 | 1132 | $phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl); |
1133 | 1133 | $originMenu = NULL; |
1134 | 1134 | |
1135 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
1135 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
1136 | 1136 | { |
1137 | 1137 | include(FileHandler::getRealPath($phpFile)); |
1138 | 1138 | |
1139 | - if(is_array($menu->list)) |
|
1139 | + if (is_array($menu->list)) |
|
1140 | 1140 | { |
1141 | 1141 | $this->_searchMenu($menu->list, $menuItemSrl, $originMenu); |
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | // copy the menu item with recursively |
1146 | - if(is_array($originMenu)) |
|
1146 | + if (is_array($originMenu)) |
|
1147 | 1147 | { |
1148 | 1148 | $this->_copyMenu($menuSrl, $parentSrl, $originMenu); |
1149 | 1149 | } |
@@ -1159,15 +1159,15 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu) |
1161 | 1161 | { |
1162 | - if(array_key_exists($menuItemSrl, $menuList)) |
|
1162 | + if (array_key_exists($menuItemSrl, $menuList)) |
|
1163 | 1163 | { |
1164 | 1164 | $originMenu = $menuList[$menuItemSrl]; |
1165 | 1165 | return; |
1166 | 1166 | } |
1167 | 1167 | |
1168 | - foreach($menuList AS $key=>$value) |
|
1168 | + foreach ($menuList AS $key=>$value) |
|
1169 | 1169 | { |
1170 | - if(count($value['list']) > 0) |
|
1170 | + if (count($value['list']) > 0) |
|
1171 | 1171 | { |
1172 | 1172 | $this->_searchMenu($value['list'], $menuItemSrl, $originMenu); |
1173 | 1173 | } |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | // default argument setting |
1183 | 1183 | $args = new stdClass(); |
1184 | 1184 | $args->menu_srl = $menuSrl; |
1185 | - if($parentSrl == 0) $args->parent_srl = $menuSrl; |
|
1185 | + if ($parentSrl == 0) $args->parent_srl = $menuSrl; |
|
1186 | 1186 | else $args->parent_srl = $parentSrl; |
1187 | 1187 | $args->menu_name_key = $originMenu['text']; |
1188 | 1188 | $args->menu_name = $originMenu['text']; |
@@ -1195,14 +1195,14 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | $isModuleCopySuccess = false; |
1197 | 1197 | // if menu have a reference of module instance |
1198 | - if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 ) |
|
1198 | + if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0) |
|
1199 | 1199 | { |
1200 | 1200 | $oModuleModel = getModel('module'); |
1201 | 1201 | $moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']); |
1202 | 1202 | |
1203 | 1203 | $args->module_type = $moduleInfo->module; |
1204 | 1204 | $randomMid = $this->_makeRandomMid(); |
1205 | - $args->module_id = $moduleInfo->module.'_'.$randomMid; |
|
1205 | + $args->module_id = $moduleInfo->module . '_' . $randomMid; |
|
1206 | 1206 | $args->layout_srl = $moduleInfo->layout_srl; |
1207 | 1207 | |
1208 | 1208 | $oModuleAdminController = getAdminController('module'); |
@@ -1215,22 +1215,22 @@ discard block |
||
1215 | 1215 | |
1216 | 1216 | $args->module_srl = $copiedModuleSrl; |
1217 | 1217 | |
1218 | - if($copiedModuleSrl) |
|
1218 | + if ($copiedModuleSrl) |
|
1219 | 1219 | { |
1220 | 1220 | $isModuleCopySuccess = true; |
1221 | 1221 | } |
1222 | 1222 | } |
1223 | 1223 | // if menu type is shortcut |
1224 | - else if($menuItemInfo->is_shortcut == 'Y') |
|
1224 | + else if ($menuItemInfo->is_shortcut == 'Y') |
|
1225 | 1225 | { |
1226 | 1226 | $args->shortcut_target = $originMenu['url']; |
1227 | 1227 | $isModuleCopySuccess = true; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if($isModuleCopySuccess) |
|
1230 | + if ($isModuleCopySuccess) |
|
1231 | 1231 | { |
1232 | 1232 | // if have a group permission |
1233 | - if($menuItemInfo->group_srls) |
|
1233 | + if ($menuItemInfo->group_srls) |
|
1234 | 1234 | { |
1235 | 1235 | $args->group_srls = $menuItemInfo->group_srls; |
1236 | 1236 | } |
@@ -1244,12 +1244,12 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | // if have a button, copy a button image also |
1246 | 1246 | $insertedMenuItemSrl = $this->get('menu_item_srl'); |
1247 | - if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn) |
|
1247 | + if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn) |
|
1248 | 1248 | { |
1249 | 1249 | // copy & upate |
1250 | 1250 | $update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl); |
1251 | - $copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo); |
|
1252 | - if(count($update_item_info->group_srls) == 0) |
|
1251 | + $copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo); |
|
1252 | + if (count($update_item_info->group_srls) == 0) |
|
1253 | 1253 | { |
1254 | 1254 | unset($update_item_info->group_srls); |
1255 | 1255 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | // if have a child menu, copy child menu also |
1265 | 1265 | $childMenu = array_shift($originMenu['list']); |
1266 | - if(count($childMenu) > 0) |
|
1266 | + if (count($childMenu) > 0) |
|
1267 | 1267 | { |
1268 | 1268 | $this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu); |
1269 | 1269 | } |
@@ -1273,16 +1273,16 @@ discard block |
||
1273 | 1273 | { |
1274 | 1274 | $time = $_SERVER['REQUEST_TIME']; |
1275 | 1275 | $randomString = ""; |
1276 | - for($i=0;$i<4;$i++) |
|
1276 | + for ($i = 0; $i < 4; $i++) |
|
1277 | 1277 | { |
1278 | 1278 | $case = rand(0, 1); |
1279 | - if($case) $doc = rand(65, 90); |
|
1279 | + if ($case) $doc = rand(65, 90); |
|
1280 | 1280 | else $doc = rand(97, 122); |
1281 | 1281 | |
1282 | 1282 | $randomString .= chr($doc); |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - return $randomString.substr($time, -2); |
|
1285 | + return $randomString . substr($time, -2); |
|
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | /** |
@@ -1300,32 +1300,32 @@ discard block |
||
1300 | 1300 | // menu name update |
1301 | 1301 | $args->menu_srl = $this->menuSrl; |
1302 | 1302 | $output = executeQuery('menu.updateMenu', $args); |
1303 | - if(!$output->toBool()) return $output; |
|
1303 | + if (!$output->toBool()) return $output; |
|
1304 | 1304 | |
1305 | 1305 | $this->map = array(); |
1306 | - if(is_array($parentKeyList)) |
|
1306 | + if (is_array($parentKeyList)) |
|
1307 | 1307 | { |
1308 | - foreach($parentKeyList as $no=>$srl) |
|
1308 | + foreach ($parentKeyList as $no=>$srl) |
|
1309 | 1309 | { |
1310 | - if($srl === 0) continue; |
|
1311 | - if(!is_array($this->map[$srl]))$this->map[$srl] = array(); |
|
1310 | + if ($srl === 0) continue; |
|
1311 | + if (!is_array($this->map[$srl]))$this->map[$srl] = array(); |
|
1312 | 1312 | $this->map[$srl][] = $no; |
1313 | 1313 | } |
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | $result = array(); |
1317 | - if(is_array($this->itemKeyList)) |
|
1317 | + if (is_array($this->itemKeyList)) |
|
1318 | 1318 | { |
1319 | - foreach($this->itemKeyList as $srl) |
|
1319 | + foreach ($this->itemKeyList as $srl) |
|
1320 | 1320 | { |
1321 | - if(!$this->checked[$srl]) |
|
1321 | + if (!$this->checked[$srl]) |
|
1322 | 1322 | { |
1323 | 1323 | $target = new stdClass(); |
1324 | 1324 | $this->checked[$srl] = 1; |
1325 | 1325 | $target->node = $srl; |
1326 | - $target->child= array(); |
|
1326 | + $target->child = array(); |
|
1327 | 1327 | |
1328 | - while(count($this->map[$srl])) |
|
1328 | + while (count($this->map[$srl])) |
|
1329 | 1329 | { |
1330 | 1330 | $this->_setParent($srl, array_shift($this->map[$srl]), $target); |
1331 | 1331 | } |
@@ -1334,13 +1334,13 @@ discard block |
||
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - if(is_array($result)) |
|
1337 | + if (is_array($result)) |
|
1338 | 1338 | { |
1339 | 1339 | $i = 0; |
1340 | - foreach($result AS $key=>$node) |
|
1340 | + foreach ($result AS $key=>$node) |
|
1341 | 1341 | { |
1342 | - $this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node |
|
1343 | - $this->_recursiveMoveMenuItem($node); //move child node |
|
1342 | + $this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node |
|
1343 | + $this->_recursiveMoveMenuItem($node); //move child node |
|
1344 | 1344 | $i = $node->node; |
1345 | 1345 | } |
1346 | 1346 | } |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | $child_node->child = array(); |
1370 | 1370 | $target->child[] = $child_node; |
1371 | 1371 | |
1372 | - while(count($this->map[$child_srl])) |
|
1372 | + while (count($this->map[$child_srl])) |
|
1373 | 1373 | { |
1374 | 1374 | $this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node); |
1375 | 1375 | } |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | function _recursiveMoveMenuItem($result) |
1385 | 1385 | { |
1386 | 1386 | $i = 0; |
1387 | - while(count($result->child)) |
|
1387 | + while (count($result->child)) |
|
1388 | 1388 | { |
1389 | 1389 | unset($node); |
1390 | 1390 | $node = array_shift($result->child); |
@@ -1404,48 +1404,48 @@ discard block |
||
1404 | 1404 | * @param string $mode 'move' or 'insert' |
1405 | 1405 | * @return void |
1406 | 1406 | */ |
1407 | - function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL) |
|
1407 | + function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL) |
|
1408 | 1408 | { |
1409 | 1409 | // Get the original menus |
1410 | 1410 | $oMenuAdminModel = getAdminModel('menu'); |
1411 | 1411 | |
1412 | 1412 | $target_item = $oMenuAdminModel->getMenuItemInfo($target_srl); |
1413 | - if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request'); |
|
1413 | + if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request'); |
|
1414 | 1414 | // Move the menu location(change the order menu appears) |
1415 | - if($mode == 'move') |
|
1415 | + if ($mode == 'move') |
|
1416 | 1416 | { |
1417 | 1417 | $args = new stdClass(); |
1418 | 1418 | $args->parent_srl = $parent_srl; |
1419 | 1419 | $args->menu_srl = $menu_srl; |
1420 | 1420 | |
1421 | - if($source_srl) |
|
1421 | + if ($source_srl) |
|
1422 | 1422 | { |
1423 | 1423 | $source_item = $oMenuAdminModel->getMenuItemInfo($source_srl); |
1424 | - if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request'); |
|
1425 | - $args->listorder = $source_item->listorder-1; |
|
1424 | + if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request'); |
|
1425 | + $args->listorder = $source_item->listorder - 1; |
|
1426 | 1426 | } |
1427 | 1427 | else |
1428 | 1428 | { |
1429 | 1429 | $output = executeQuery('menu.getMaxListorder', $args); |
1430 | - if(!$output->toBool()) return $output; |
|
1431 | - $args->listorder = (int)$output->data->listorder; |
|
1432 | - if(!$args->listorder) $args->listorder= 0; |
|
1430 | + if (!$output->toBool()) return $output; |
|
1431 | + $args->listorder = (int) $output->data->listorder; |
|
1432 | + if (!$args->listorder) $args->listorder = 0; |
|
1433 | 1433 | } |
1434 | 1434 | $args->parent_srl = $parent_srl; |
1435 | 1435 | $output = executeQuery('menu.updateMenuItemListorder', $args); |
1436 | - if(!$output->toBool()) return $output; |
|
1436 | + if (!$output->toBool()) return $output; |
|
1437 | 1437 | |
1438 | 1438 | $args->parent_srl = $parent_srl; |
1439 | 1439 | $args->menu_item_srl = $target_srl; |
1440 | 1440 | $output = executeQuery('menu.updateMenuItemNode', $args); |
1441 | - if(!$output->toBool()) return $output; |
|
1441 | + if (!$output->toBool()) return $output; |
|
1442 | 1442 | |
1443 | 1443 | //module's menu_srl move also |
1444 | - if($isShortcut == 'N' && !empty($url)) |
|
1444 | + if ($isShortcut == 'N' && !empty($url)) |
|
1445 | 1445 | { |
1446 | 1446 | $oModuleModel = getModel('module'); |
1447 | 1447 | $moduleInfo = $oModuleModel->getModuleInfoByMid($url); |
1448 | - if($menu_srl != $moduleInfo->menu_srl) |
|
1448 | + if ($menu_srl != $moduleInfo->menu_srl) |
|
1449 | 1449 | { |
1450 | 1450 | $moduleInfo->menu_srl = $menu_srl; |
1451 | 1451 | $oModuleController = getController('module'); |
@@ -1453,13 +1453,13 @@ discard block |
||
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | // change home menu cache file |
1456 | - if($url == $this->homeModuleMid) |
|
1456 | + if ($url == $this->homeModuleMid) |
|
1457 | 1457 | { |
1458 | - if(file_exists($this->homeMenuCacheFile)) |
|
1458 | + if (file_exists($this->homeMenuCacheFile)) |
|
1459 | 1459 | { |
1460 | 1460 | include($this->homeMenuCacheFile); |
1461 | 1461 | } |
1462 | - if(!$homeMenuSrl || $homeMenuSrl != $menu_srl) |
|
1462 | + if (!$homeMenuSrl || $homeMenuSrl != $menu_srl) |
|
1463 | 1463 | { |
1464 | 1464 | $this->makeHomemenuCacheFile($menu_srl); |
1465 | 1465 | } |
@@ -1467,13 +1467,13 @@ discard block |
||
1467 | 1467 | } |
1468 | 1468 | // Add a child |
1469 | 1469 | } |
1470 | - elseif($mode == 'insert') |
|
1470 | + elseif ($mode == 'insert') |
|
1471 | 1471 | { |
1472 | 1472 | $args->menu_item_srl = $target_srl; |
1473 | 1473 | $args->parent_srl = $parent_srl; |
1474 | - $args->listorder = -1*getNextSequence(); |
|
1474 | + $args->listorder = -1 * getNextSequence(); |
|
1475 | 1475 | $output = executeQuery('menu.updateMenuItemNode', $args); |
1476 | - if(!$output->toBool()) return $output; |
|
1476 | + if (!$output->toBool()) return $output; |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | $xml_file = $this->makeXmlFile($menu_srl); |
@@ -1498,8 +1498,8 @@ discard block |
||
1498 | 1498 | // Re-generate the xml file |
1499 | 1499 | $xml_file = $this->makeXmlFile($menu_srl); |
1500 | 1500 | // Set return value |
1501 | - $this->add('menu_title',$menu_title); |
|
1502 | - $this->add('xml_file',$xml_file); |
|
1501 | + $this->add('menu_title', $menu_title); |
|
1502 | + $this->add('xml_file', $xml_file); |
|
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | /** |
@@ -1513,12 +1513,12 @@ discard block |
||
1513 | 1513 | $target = Context::get('target'); |
1514 | 1514 | $target_file = Context::get($target); |
1515 | 1515 | // Error occurs when the target is neither a uploaded file nor a valid file |
1516 | - if(!$menu_srl || !$menu_item_srl) |
|
1516 | + if (!$menu_srl || !$menu_item_srl) |
|
1517 | 1517 | { |
1518 | 1518 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
1519 | 1519 | |
1520 | 1520 | } |
1521 | - else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
1521 | + else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
1522 | 1522 | { |
1523 | 1523 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
1524 | 1524 | } |
@@ -1526,19 +1526,19 @@ discard block |
||
1526 | 1526 | // Move the file to a specific director if the uploaded file meets requirement |
1527 | 1527 | else |
1528 | 1528 | { |
1529 | - $tmp_arr = explode('.',$target_file['name']); |
|
1530 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
1529 | + $tmp_arr = explode('.', $target_file['name']); |
|
1530 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
1531 | 1531 | |
1532 | 1532 | $path = sprintf('./files/attach/menu_button/%d/', $menu_srl); |
1533 | 1533 | $filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext); |
1534 | 1534 | |
1535 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
1535 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
1536 | 1536 | |
1537 | 1537 | move_uploaded_file($target_file['tmp_name'], $filename); |
1538 | 1538 | Context::set('filename', $filename); |
1539 | 1539 | } |
1540 | 1540 | |
1541 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
1541 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
1542 | 1542 | $this->setTemplateFile('menu_file_uploaded'); |
1543 | 1543 | } |
1544 | 1544 | |
@@ -1565,14 +1565,14 @@ discard block |
||
1565 | 1565 | { |
1566 | 1566 | $oModuleModel = getModel('module'); |
1567 | 1567 | $installed_module_list = $oModuleModel->getModulesXmlInfo(); |
1568 | - if(is_array($installed_module_list)) |
|
1568 | + if (is_array($installed_module_list)) |
|
1569 | 1569 | { |
1570 | 1570 | $currentLang = Context::getLangType(); |
1571 | 1571 | $menuList = array(); |
1572 | - foreach($installed_module_list AS $key=>$value) |
|
1572 | + foreach ($installed_module_list AS $key=>$value) |
|
1573 | 1573 | { |
1574 | 1574 | $info = $oModuleModel->getModuleActionXml($value->module); |
1575 | - if($info->menu) $menuList[$value->module] = $info->menu; |
|
1575 | + if ($info->menu) $menuList[$value->module] = $info->menu; |
|
1576 | 1576 | unset($info->menu); |
1577 | 1577 | } |
1578 | 1578 | } |
@@ -1604,8 +1604,8 @@ discard block |
||
1604 | 1604 | $info = $oModuleModel->getModuleActionXml($moduleName); |
1605 | 1605 | |
1606 | 1606 | $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index); |
1607 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
1608 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
1607 | + if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
1608 | + if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
1609 | 1609 | $dbInfo = Context::getDBInfo(); |
1610 | 1610 | |
1611 | 1611 | $args = new stdClass(); |
@@ -1614,13 +1614,13 @@ discard block |
||
1614 | 1614 | $args->menu_srl = $requestArgs->menu_srl; |
1615 | 1615 | $args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName); |
1616 | 1616 | //if now page is https... |
1617 | - if(strpos($url, 'https') !== false) |
|
1617 | + if (strpos($url, 'https') !== false) |
|
1618 | 1618 | { |
1619 | 1619 | $parsedRequestUrl = parse_url($url); |
1620 | 1620 | $parsedRequestUrl['scheme']; |
1621 | 1621 | |
1622 | 1622 | $parsedDefaultUrl = parse_url($dbInfo->default_url); |
1623 | - $args->url = str_replace('https://'.$parsedDefaultUrl['host'].':'.$parsedRequestUrl['port'].$parsedDefaultUrl['path'], '', $url); |
|
1623 | + $args->url = str_replace('https://' . $parsedDefaultUrl['host'] . ':' . $parsedRequestUrl['port'] . $parsedDefaultUrl['path'], '', $url); |
|
1624 | 1624 | } |
1625 | 1625 | else |
1626 | 1626 | { |
@@ -1632,23 +1632,23 @@ discard block |
||
1632 | 1632 | $args->hover_btn = ''; |
1633 | 1633 | $args->active_btn = ''; |
1634 | 1634 | $args->group_srls = implode(',', array_keys($groupSrlList)); |
1635 | - $args->listorder = -1*$args->menu_item_srl; |
|
1635 | + $args->listorder = -1 * $args->menu_item_srl; |
|
1636 | 1636 | |
1637 | 1637 | // Check if already exists |
1638 | 1638 | $oMenuModel = getAdminModel('menu'); |
1639 | 1639 | $item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl); |
1640 | 1640 | // Update if exists |
1641 | - if($item_info->menu_item_srl == $args->menu_item_srl) |
|
1641 | + if ($item_info->menu_item_srl == $args->menu_item_srl) |
|
1642 | 1642 | { |
1643 | 1643 | $output = $this->_updateMenuItem($args); |
1644 | - if(!$output->toBool()) return $output; |
|
1644 | + if (!$output->toBool()) return $output; |
|
1645 | 1645 | } |
1646 | 1646 | // Insert if not exist |
1647 | 1647 | else |
1648 | 1648 | { |
1649 | - $args->listorder = -1*$args->menu_item_srl; |
|
1649 | + $args->listorder = -1 * $args->menu_item_srl; |
|
1650 | 1650 | $output = executeQuery('menu.insertMenuItem', $args); |
1651 | - if(!$output->toBool()) return $output; |
|
1651 | + if (!$output->toBool()) return $output; |
|
1652 | 1652 | } |
1653 | 1653 | // Get information of the menu |
1654 | 1654 | $menu_info = $oMenuModel->getMenu($args->menu_srl); |
@@ -1676,23 +1676,23 @@ discard block |
||
1676 | 1676 | |
1677 | 1677 | // Menu Exposure update |
1678 | 1678 | // if exposure target is only login user... |
1679 | - if(!$exposure) |
|
1679 | + if (!$exposure) |
|
1680 | 1680 | { |
1681 | 1681 | $args->group_srls = ''; |
1682 | 1682 | } |
1683 | 1683 | else |
1684 | 1684 | { |
1685 | 1685 | $exposure = explode(',', $exposure); |
1686 | - if(in_array($exposure, array('-1','-3'))) |
|
1686 | + if (in_array($exposure, array('-1', '-3'))) |
|
1687 | 1687 | { |
1688 | 1688 | $args->group_srls = $exposure; |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - if($exposure) $args->group_srls = implode(',', $exposure); |
|
1691 | + if ($exposure) $args->group_srls = implode(',', $exposure); |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | $output = $this->_updateMenuItem($args); |
1695 | - if(!$output->toBool()) |
|
1695 | + if (!$output->toBool()) |
|
1696 | 1696 | { |
1697 | 1697 | return $output; |
1698 | 1698 | } |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | $xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module); |
1709 | 1709 | |
1710 | 1710 | $grantList = $xml_info->grant; |
1711 | - if(!$grantList) $grantList = new stdClass; |
|
1711 | + if (!$grantList) $grantList = new stdClass; |
|
1712 | 1712 | |
1713 | 1713 | $grantList->access = new stdClass(); |
1714 | 1714 | $grantList->access->default = 'guest'; |
@@ -1716,9 +1716,9 @@ discard block |
||
1716 | 1716 | $grantList->manager->default = 'manager'; |
1717 | 1717 | |
1718 | 1718 | $grant = new stdClass; |
1719 | - foreach($grantList AS $grantName=>$grantInfo) |
|
1719 | + foreach ($grantList AS $grantName=>$grantInfo) |
|
1720 | 1720 | { |
1721 | - if(!$htPerm[$grantName]) |
|
1721 | + if (!$htPerm[$grantName]) |
|
1722 | 1722 | { |
1723 | 1723 | continue; |
1724 | 1724 | } |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | $htPerm[$grantName] = explode(',', $htPerm[$grantName]); |
1727 | 1727 | |
1728 | 1728 | // users in a particular group |
1729 | - if(is_array($htPerm[$grantName])) |
|
1729 | + if (is_array($htPerm[$grantName])) |
|
1730 | 1730 | { |
1731 | 1731 | $grant->{$grantName} = $htPerm[$grantName]; |
1732 | 1732 | continue; |
@@ -1740,7 +1740,7 @@ discard block |
||
1740 | 1740 | $grant->{$group_srls} = array(); |
1741 | 1741 | } |
1742 | 1742 | |
1743 | - if(count($grant)) |
|
1743 | + if (count($grant)) |
|
1744 | 1744 | { |
1745 | 1745 | $oModuleController = getController('module'); |
1746 | 1746 | $oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant); |
@@ -1758,15 +1758,15 @@ discard block |
||
1758 | 1758 | function makeXmlFile($menu_srl) |
1759 | 1759 | { |
1760 | 1760 | // Return if there is no information when creating the xml file |
1761 | - if(!$menu_srl) return; |
|
1761 | + if (!$menu_srl) return; |
|
1762 | 1762 | // Get menu informaton |
1763 | 1763 | $args = new stdClass(); |
1764 | 1764 | $args->menu_srl = $menu_srl; |
1765 | 1765 | $output = executeQuery('menu.getMenu', $args); |
1766 | - if(!$output->toBool() || !$output->data) return $output; |
|
1767 | - $site_srl = (int)$output->data->site_srl; |
|
1766 | + if (!$output->toBool() || !$output->data) return $output; |
|
1767 | + $site_srl = (int) $output->data->site_srl; |
|
1768 | 1768 | |
1769 | - if($site_srl) |
|
1769 | + if ($site_srl) |
|
1770 | 1770 | { |
1771 | 1771 | $oModuleModel = getModel('module'); |
1772 | 1772 | $columnList = array('sites.domain'); |
@@ -1777,13 +1777,13 @@ discard block |
||
1777 | 1777 | $args->menu_srl = $menu_srl; |
1778 | 1778 | $args->sort_index = 'listorder'; |
1779 | 1779 | $output = executeQuery('menu.getMenuItems', $args); |
1780 | - if(!$output->toBool()) return; |
|
1780 | + if (!$output->toBool()) return; |
|
1781 | 1781 | // Specify the name of the cache file |
1782 | 1782 | $xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl); |
1783 | 1783 | $php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl); |
1784 | 1784 | // If no data found, generate an XML file without node data |
1785 | 1785 | $list = $output->data; |
1786 | - if(!$list) |
|
1786 | + if (!$list) |
|
1787 | 1787 | { |
1788 | 1788 | $xml_buff = "<root />"; |
1789 | 1789 | FileHandler::writeFile($xml_file, $xml_buff); |
@@ -1791,10 +1791,10 @@ discard block |
||
1791 | 1791 | return $xml_file; |
1792 | 1792 | } |
1793 | 1793 | // Change to an array if only a single data is obtained |
1794 | - if(!is_array($list)) $list = array($list); |
|
1794 | + if (!is_array($list)) $list = array($list); |
|
1795 | 1795 | // Create a tree for loop |
1796 | 1796 | $list_count = count($list); |
1797 | - for($i=0;$i<$list_count;$i++) |
|
1797 | + for ($i = 0; $i < $list_count; $i++) |
|
1798 | 1798 | { |
1799 | 1799 | $node = $list[$i]; |
1800 | 1800 | $menu_item_srl = $node->menu_item_srl; |
@@ -1804,43 +1804,43 @@ discard block |
||
1804 | 1804 | } |
1805 | 1805 | // A common header to set permissions of the cache file and groups |
1806 | 1806 | $header_script = |
1807 | - '$lang_type = Context::getLangType(); '. |
|
1808 | - '$is_logged = Context::get(\'is_logged\'); '. |
|
1809 | - '$logged_info = Context::get(\'logged_info\'); '. |
|
1810 | - '$site_srl = '.$site_srl.';'. |
|
1811 | - '$site_admin = false;'. |
|
1812 | - 'if($site_srl) { '. |
|
1813 | - '$oModuleModel = getModel(\'module\');'. |
|
1814 | - '$site_module_info = $oModuleModel->getSiteInfo($site_srl); '. |
|
1815 | - 'if($site_module_info) Context::set(\'site_module_info\',$site_module_info);'. |
|
1816 | - 'else $site_module_info = Context::get(\'site_module_info\');'. |
|
1817 | - '$grant = $oModuleModel->getGrant($site_module_info, $logged_info); '. |
|
1818 | - 'if($grant->manager ==1) $site_admin = true;'. |
|
1819 | - '}'. |
|
1820 | - 'if($is_logged) {'. |
|
1821 | - 'if($logged_info->is_admin=="Y") $is_admin = true; '. |
|
1822 | - 'else $is_admin = false; '. |
|
1823 | - '$group_srls = array_keys($logged_info->group_list); '. |
|
1824 | - '} else { '. |
|
1825 | - '$is_admin = false; '. |
|
1826 | - '$group_srls = array(); '. |
|
1807 | + '$lang_type = Context::getLangType(); ' . |
|
1808 | + '$is_logged = Context::get(\'is_logged\'); ' . |
|
1809 | + '$logged_info = Context::get(\'logged_info\'); ' . |
|
1810 | + '$site_srl = ' . $site_srl . ';' . |
|
1811 | + '$site_admin = false;' . |
|
1812 | + 'if($site_srl) { ' . |
|
1813 | + '$oModuleModel = getModel(\'module\');' . |
|
1814 | + '$site_module_info = $oModuleModel->getSiteInfo($site_srl); ' . |
|
1815 | + 'if($site_module_info) Context::set(\'site_module_info\',$site_module_info);' . |
|
1816 | + 'else $site_module_info = Context::get(\'site_module_info\');' . |
|
1817 | + '$grant = $oModuleModel->getGrant($site_module_info, $logged_info); ' . |
|
1818 | + 'if($grant->manager ==1) $site_admin = true;' . |
|
1819 | + '}' . |
|
1820 | + 'if($is_logged) {' . |
|
1821 | + 'if($logged_info->is_admin=="Y") $is_admin = true; ' . |
|
1822 | + 'else $is_admin = false; ' . |
|
1823 | + '$group_srls = array_keys($logged_info->group_list); ' . |
|
1824 | + '} else { ' . |
|
1825 | + '$is_admin = false; ' . |
|
1826 | + '$group_srls = array(); ' . |
|
1827 | 1827 | '}'; |
1828 | 1828 | // Create the xml cache file (a separate session is needed for xml cache) |
1829 | 1829 | $xml_buff = sprintf( |
1830 | - '<?php '. |
|
1831 | - 'define(\'__XE__\', true); '. |
|
1832 | - 'require_once(\''.FileHandler::getRealPath('./config/config.inc.php').'\'); '. |
|
1833 | - '$oContext = Context::getInstance(); '. |
|
1834 | - '$oContext->init(); '. |
|
1835 | - 'header("Content-Type: text/xml; charset=UTF-8"); '. |
|
1836 | - 'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); '. |
|
1837 | - 'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); '. |
|
1838 | - 'header("Cache-Control: no-store, no-cache, must-revalidate"); '. |
|
1839 | - 'header("Cache-Control: post-check=0, pre-check=0", false); '. |
|
1840 | - 'header("Pragma: no-cache"); '. |
|
1841 | - '%s '. |
|
1842 | - '$oContext->close(); '. |
|
1843 | - '?>'. |
|
1830 | + '<?php ' . |
|
1831 | + 'define(\'__XE__\', true); ' . |
|
1832 | + 'require_once(\'' . FileHandler::getRealPath('./config/config.inc.php') . '\'); ' . |
|
1833 | + '$oContext = Context::getInstance(); ' . |
|
1834 | + '$oContext->init(); ' . |
|
1835 | + 'header("Content-Type: text/xml; charset=UTF-8"); ' . |
|
1836 | + 'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); ' . |
|
1837 | + 'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ' . |
|
1838 | + 'header("Cache-Control: no-store, no-cache, must-revalidate"); ' . |
|
1839 | + 'header("Cache-Control: post-check=0, pre-check=0", false); ' . |
|
1840 | + 'header("Pragma: no-cache"); ' . |
|
1841 | + '%s ' . |
|
1842 | + '$oContext->close(); ' . |
|
1843 | + '?>' . |
|
1844 | 1844 | '<root>%s</root>', |
1845 | 1845 | $header_script, |
1846 | 1846 | $this->getXmlTree($tree[0], $tree, $site_srl, $domain) |
@@ -1848,14 +1848,14 @@ discard block |
||
1848 | 1848 | // Create php cache file |
1849 | 1849 | $php_output = $this->getPhpCacheCode($tree[0], $tree, $site_srl, $domain); |
1850 | 1850 | $php_buff = sprintf( |
1851 | - '<?php '. |
|
1852 | - 'if(!defined("__XE__")) exit(); '. |
|
1851 | + '<?php ' . |
|
1852 | + 'if(!defined("__XE__")) exit(); ' . |
|
1853 | 1853 | '$menu = new stdClass();' . |
1854 | - '%s; '. |
|
1855 | - '%s; '. |
|
1856 | - '$menu->list = array(%s); '. |
|
1857 | - 'if(!$is_admin) { recurciveExposureCheck($menu->list); }'. |
|
1858 | - 'Context::set("included_menu", $menu); '. |
|
1854 | + '%s; ' . |
|
1855 | + '%s; ' . |
|
1856 | + '$menu->list = array(%s); ' . |
|
1857 | + 'if(!$is_admin) { recurciveExposureCheck($menu->list); }' . |
|
1858 | + 'Context::set("included_menu", $menu); ' . |
|
1859 | 1859 | '?>', |
1860 | 1860 | $header_script, |
1861 | 1861 | $php_output['name'], |
@@ -1879,26 +1879,26 @@ discard block |
||
1879 | 1879 | */ |
1880 | 1880 | function getXmlTree($source_node, $tree, $site_srl, $domain) |
1881 | 1881 | { |
1882 | - if(!$source_node) return; |
|
1882 | + if (!$source_node) return; |
|
1883 | 1883 | |
1884 | 1884 | $oMenuAdminModel = getAdminModel('menu'); |
1885 | 1885 | |
1886 | - foreach($source_node as $menu_item_srl => $node) |
|
1886 | + foreach ($source_node as $menu_item_srl => $node) |
|
1887 | 1887 | { |
1888 | 1888 | $child_buff = ""; |
1889 | 1889 | // Get data of the child nodes |
1890 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
1890 | + if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
1891 | 1891 | // List variables |
1892 | 1892 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
1893 | - foreach($names as $key => $val) |
|
1893 | + foreach ($names as $key => $val) |
|
1894 | 1894 | { |
1895 | - $name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val)); |
|
1895 | + $name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val)); |
|
1896 | 1896 | } |
1897 | 1897 | $name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str); |
1898 | 1898 | |
1899 | - $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); |
|
1900 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
1901 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
|
1899 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
1900 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $node->desc); |
|
1901 | + if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
|
1902 | 1902 | { |
1903 | 1903 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
1904 | 1904 | } |
@@ -1908,21 +1908,21 @@ discard block |
||
1908 | 1908 | $expand = $node->expand; |
1909 | 1909 | |
1910 | 1910 | $normal_btn = $node->normal_btn; |
1911 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
1911 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $normal_btn); |
|
1912 | 1912 | else $normal_btn = ''; |
1913 | 1913 | $hover_btn = $node->hover_btn; |
1914 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
1914 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $hover_btn); |
|
1915 | 1915 | else $hover_btn = ''; |
1916 | 1916 | $active_btn = $node->active_btn; |
1917 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
1917 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $active_btn); |
|
1918 | 1918 | else $active_btn = ''; |
1919 | 1919 | |
1920 | 1920 | $group_srls = $node->group_srls; |
1921 | 1921 | |
1922 | - if($normal_btn) |
|
1922 | + if ($normal_btn) |
|
1923 | 1923 | { |
1924 | - if($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
1925 | - if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
1924 | + if ($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
1925 | + if ($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
1926 | 1926 | $link = sprintf('<img src="%s" onmouseout="this.src=\'%s\'" alt="<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" %s %s />', $normal_btn, $normal_btn, $hover_str, $active_str); |
1927 | 1927 | } |
1928 | 1928 | else |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | $link = '<?php print $_names[$lang_type]; ?>'; |
1931 | 1931 | } |
1932 | 1932 | // If the value of node->group_srls exists |
1933 | - if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0); |
|
1933 | + if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0); |
|
1934 | 1934 | else $group_check_code = "true"; |
1935 | 1935 | $attribute = sprintf( |
1936 | 1936 | 'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"', |
@@ -1954,8 +1954,8 @@ discard block |
||
1954 | 1954 | $link |
1955 | 1955 | ); |
1956 | 1956 | |
1957 | - if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
1958 | - else $buff .= sprintf('<node %s />', $attribute); |
|
1957 | + if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
1958 | + else $buff .= sprintf('<node %s />', $attribute); |
|
1959 | 1959 | } |
1960 | 1960 | return $buff; |
1961 | 1961 | } |
@@ -1974,74 +1974,74 @@ discard block |
||
1974 | 1974 | function getPhpCacheCode($source_node, $tree, $site_srl, $domain) |
1975 | 1975 | { |
1976 | 1976 | $output = array("buff"=>"", "url_list"=>array()); |
1977 | - if(!$source_node) return $output; |
|
1977 | + if (!$source_node) return $output; |
|
1978 | 1978 | |
1979 | 1979 | $oMenuAdminModel = getAdminModel('menu'); |
1980 | 1980 | |
1981 | - foreach($source_node as $menu_item_srl => $node) |
|
1981 | + foreach ($source_node as $menu_item_srl => $node) |
|
1982 | 1982 | { |
1983 | 1983 | // Get data from child nodes if exist. |
1984 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
1984 | + if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
1985 | 1985 | else $child_output = array("buff"=>"", "url_list"=>array()); |
1986 | 1986 | // List variables |
1987 | 1987 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
1988 | 1988 | unset($name_arr_str); |
1989 | - foreach($names as $key => $val) |
|
1989 | + foreach ($names as $key => $val) |
|
1990 | 1990 | { |
1991 | - $name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace(array('\\','"'),array('\\\\','"'),$val)); |
|
1991 | + $name_arr_str .= sprintf('"%s"=>"%s",', $key, str_replace(array('\\', '"'), array('\\\\', '"'), $val)); |
|
1992 | 1992 | } |
1993 | 1993 | $name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']); |
1994 | 1994 | // If url value is not empty in the current node, put the value into an array url_list |
1995 | - if($node->url) $child_output['url_list'][] = $node->url; |
|
1995 | + if ($node->url) $child_output['url_list'][] = $node->url; |
|
1996 | 1996 | $output['url_list'] = array_merge($output['url_list'], $child_output['url_list']); |
1997 | 1997 | // If node->group_srls value exists |
1998 | - 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); |
|
1998 | + 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); |
|
1999 | 1999 | else $group_check_code = "true"; |
2000 | 2000 | // List variables |
2001 | - $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href); |
|
2002 | - $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); |
|
2003 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
2004 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
|
2001 | + $href = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->href); |
|
2002 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
2003 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $node->desc); |
|
2004 | + if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
|
2005 | 2005 | { |
2006 | 2006 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
2007 | 2007 | } |
2008 | 2008 | else $href = sprintf('"%s"', $url); |
2009 | 2009 | $is_shortcut = $node->is_shortcut; |
2010 | 2010 | $open_window = $node->open_window; |
2011 | - $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn); |
|
2012 | - $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn); |
|
2013 | - $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn); |
|
2011 | + $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->normal_btn); |
|
2012 | + $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->hover_btn); |
|
2013 | + $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->active_btn); |
|
2014 | 2014 | |
2015 | - foreach($child_output['url_list'] as $key =>$val) |
|
2015 | + foreach ($child_output['url_list'] as $key =>$val) |
|
2016 | 2016 | { |
2017 | 2017 | $child_output['url_list'][$key] = addslashes($val); |
2018 | 2018 | } |
2019 | 2019 | |
2020 | - $selected = '"'.implode('","',$child_output['url_list']).'"'; |
|
2020 | + $selected = '"' . implode('","', $child_output['url_list']) . '"'; |
|
2021 | 2021 | $child_buff = $child_output['buff']; |
2022 | 2022 | $expand = $node->expand; |
2023 | 2023 | |
2024 | 2024 | $normal_btn = $node->normal_btn; |
2025 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
2025 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $normal_btn); |
|
2026 | 2026 | else $normal_btn = ''; |
2027 | 2027 | |
2028 | 2028 | $hover_btn = $node->hover_btn; |
2029 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
2029 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $hover_btn); |
|
2030 | 2030 | else $hover_btn = ''; |
2031 | 2031 | |
2032 | 2032 | $active_btn = $node->active_btn; |
2033 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
2033 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $active_btn); |
|
2034 | 2034 | else $active_btn = ''; |
2035 | 2035 | |
2036 | 2036 | |
2037 | 2037 | $group_srls = $node->group_srls; |
2038 | 2038 | |
2039 | - if($normal_btn) |
|
2039 | + if ($normal_btn) |
|
2040 | 2040 | { |
2041 | - if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = ''; |
|
2042 | - if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = ''; |
|
2041 | + if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = ''; |
|
2042 | + if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = ''; |
|
2043 | 2043 | $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); |
2044 | - 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); |
|
2044 | + 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); |
|
2045 | 2045 | else $link_active = $link; |
2046 | 2046 | } |
2047 | 2047 | else |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | ); |
2080 | 2080 | |
2081 | 2081 | // Generate buff data |
2082 | - $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute); |
|
2082 | + $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute); |
|
2083 | 2083 | $output['name'] .= $name_str; |
2084 | 2084 | } |
2085 | 2085 | return $output; |
@@ -2093,19 +2093,19 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | function updateMenuLayout($layout_srl, $menu_srl_list) |
2095 | 2095 | { |
2096 | - if(!count($menu_srl_list)) return; |
|
2096 | + if (!count($menu_srl_list)) return; |
|
2097 | 2097 | // Delete the value of menu_srls |
2098 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
2098 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
2099 | 2099 | $output = executeQuery('menu.deleteMenuLayout', $args); |
2100 | - if(!$output->toBool()) return $output; |
|
2100 | + if (!$output->toBool()) return $output; |
|
2101 | 2101 | |
2102 | 2102 | $args->layout_srl = $layout_srl; |
2103 | 2103 | // Mapping menu_srls, layout_srl |
2104 | - for($i=0;$i<count($menu_srl_list);$i++) |
|
2104 | + for ($i = 0; $i < count($menu_srl_list); $i++) |
|
2105 | 2105 | { |
2106 | 2106 | $args->menu_srl = $menu_srl_list[$i]; |
2107 | 2107 | $output = executeQuery('menu.insertMenuLayout', $args); |
2108 | - if(!$output->toBool()) return $output; |
|
2108 | + if (!$output->toBool()) return $output; |
|
2109 | 2109 | } |
2110 | 2110 | } |
2111 | 2111 | |
@@ -2118,47 +2118,47 @@ discard block |
||
2118 | 2118 | { |
2119 | 2119 | // path setting |
2120 | 2120 | $path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl); |
2121 | - if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path)) |
|
2121 | + if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path)) |
|
2122 | 2122 | { |
2123 | 2123 | FileHandler::makeDir($path); |
2124 | 2124 | } |
2125 | 2125 | |
2126 | - if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y') |
|
2126 | + if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y') |
|
2127 | 2127 | { |
2128 | 2128 | $oMenuModel = getAdminModel('menu'); |
2129 | 2129 | $itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl); |
2130 | 2130 | |
2131 | - if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn); |
|
2132 | - if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn); |
|
2133 | - if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn); |
|
2131 | + if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn); |
|
2132 | + if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn); |
|
2133 | + if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn); |
|
2134 | 2134 | } |
2135 | 2135 | |
2136 | 2136 | $returnArray = array(); |
2137 | 2137 | $date = date('YmdHis'); |
2138 | 2138 | // normal button |
2139 | - if($args->menu_normal_btn) |
|
2139 | + if ($args->menu_normal_btn) |
|
2140 | 2140 | { |
2141 | - $tmp_arr = explode('.',$args->menu_normal_btn['name']); |
|
2142 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
2141 | + $tmp_arr = explode('.', $args->menu_normal_btn['name']); |
|
2142 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
2143 | 2143 | |
2144 | 2144 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext); |
2145 | 2145 | |
2146 | - if(checkUploadedFile($args->menu_normal_btn['tmp_name'])) |
|
2146 | + if (checkUploadedFile($args->menu_normal_btn['tmp_name'])) |
|
2147 | 2147 | { |
2148 | - move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename ); |
|
2148 | + move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename); |
|
2149 | 2149 | $returnArray ['normal_btn'] = $filename; |
2150 | 2150 | } |
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | // hover button |
2154 | - if($args->menu_hover_btn) |
|
2154 | + if ($args->menu_hover_btn) |
|
2155 | 2155 | { |
2156 | - $tmp_arr = explode('.',$args->menu_hover_btn['name']); |
|
2157 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
2156 | + $tmp_arr = explode('.', $args->menu_hover_btn['name']); |
|
2157 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
2158 | 2158 | |
2159 | 2159 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext); |
2160 | 2160 | |
2161 | - if(checkUploadedFile($args->menu_hover_btn['tmp_name'])) |
|
2161 | + if (checkUploadedFile($args->menu_hover_btn['tmp_name'])) |
|
2162 | 2162 | { |
2163 | 2163 | move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename); |
2164 | 2164 | $returnArray['hover_btn'] = $filename; |
@@ -2166,14 +2166,14 @@ discard block |
||
2166 | 2166 | } |
2167 | 2167 | |
2168 | 2168 | // active button |
2169 | - if($args->menu_active_btn) |
|
2169 | + if ($args->menu_active_btn) |
|
2170 | 2170 | { |
2171 | - $tmp_arr = explode('.',$args->menu_active_btn['name']); |
|
2172 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
2171 | + $tmp_arr = explode('.', $args->menu_active_btn['name']); |
|
2172 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
2173 | 2173 | |
2174 | 2174 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext); |
2175 | 2175 | |
2176 | - if(checkUploadedFile($args->menu_active_btn['tmp_name'])) |
|
2176 | + if (checkUploadedFile($args->menu_active_btn['tmp_name'])) |
|
2177 | 2177 | { |
2178 | 2178 | move_uploaded_file($args->menu_active_btn['tmp_name'], $filename); |
2179 | 2179 | $returnArray['active_btn'] = $filename; |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | "active_btn"=>"", |
2196 | 2196 | ); |
2197 | 2197 | //normal_btn |
2198 | - if($menuItemInfo->normal_btn) |
|
2198 | + if ($menuItemInfo->normal_btn) |
|
2199 | 2199 | { |
2200 | 2200 | $originFile = FileHandler::getRealPath($menuItemInfo->normal_btn); |
2201 | 2201 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal'); |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | } |
2206 | 2206 | |
2207 | 2207 | //hover_btn |
2208 | - if($menuItemInfo->hover_btn) |
|
2208 | + if ($menuItemInfo->hover_btn) |
|
2209 | 2209 | { |
2210 | 2210 | $originFile = FileHandler::getRealPath($menuItemInfo->hover_btn); |
2211 | 2211 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover'); |
@@ -2215,7 +2215,7 @@ discard block |
||
2215 | 2215 | } |
2216 | 2216 | |
2217 | 2217 | //active_btn |
2218 | - if($menuItemInfo->active_btn) |
|
2218 | + if ($menuItemInfo->active_btn) |
|
2219 | 2219 | { |
2220 | 2220 | $originFile = FileHandler::getRealPath($menuItemInfo->active_btn); |
2221 | 2221 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active'); |
@@ -2230,9 +2230,9 @@ discard block |
||
2230 | 2230 | { |
2231 | 2231 | $path = sprintf('./files/attach/menu_button/%d/', $menuSrl); |
2232 | 2232 | $tmp_arr = explode('.', $buttonPath); |
2233 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
2233 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
2234 | 2234 | $date = date("YmdHis"); |
2235 | - return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext); |
|
2235 | + return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_' . $mode . '_btn', $ext); |
|
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | public function makeHomemenuCacheFile($menuSrl) |