@@ -56,7 +56,7 @@ discard block |
||
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 |
||
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 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 |
||
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 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 |
||
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 |
||
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 | 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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -464,27 +464,27 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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('&','"','<','>'),$node->url); |
|
1908 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
1909 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
|
1907 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
1908 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $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 |
||
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('&','"','<','>'),$normal_btn); |
|
1919 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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('&','"','<','>'),$hover_btn); |
|
1922 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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('&','"','<','>'),$active_btn); |
|
1925 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
1933 | - if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
1932 | + if ($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
1933 | + if ($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
1934 | 1934 | $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); |
1935 | 1935 | } |
1936 | 1936 | else |
@@ -1939,8 +1939,8 @@ discard block |
||
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 |
||
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 |
||
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('&','"','<','>'),$node->href); |
|
2027 | - $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); |
|
2028 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
2029 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
|
2026 | + $href = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->href); |
|
2027 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
2028 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $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('&','"','<','>'),$node->normal_btn); |
|
2037 | - $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn); |
|
2038 | - $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn); |
|
2036 | + $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->normal_btn); |
|
2037 | + $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->hover_btn); |
|
2038 | + $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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('&','"','<','>'),$normal_btn); |
|
2050 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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('&','"','<','>'),$hover_btn); |
|
2054 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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('&','"','<','>'),$active_btn); |
|
2058 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -69,7 +69,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
1933 | - if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
2048 | + if($hover_btn) { |
|
2049 | + $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); |
|
2050 | + } else { |
|
2051 | + $hover_str = ''; |
|
2052 | + } |
|
2053 | + if($active_btn) { |
|
2054 | + $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); |
|
2055 | + } else { |
|
2056 | + $active_str = ''; |
|
2057 | + } |
|
1934 | 2058 | $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); |
1935 | - } |
|
1936 | - else |
|
2059 | + } else |
|
1937 | 2060 | { |
1938 | 2061 | $link = '<?php print $_names[$lang_type]; ?>'; |
1939 | 2062 | } |
@@ -1941,8 +2064,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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('&','"','<','>'),$node->href); |
@@ -2029,8 +2163,9 @@ discard block |
||
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('&','"','<','>'),$node->normal_btn); |
@@ -2047,29 +2182,48 @@ discard block |
||
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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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('&','"','<','>'),$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 |
||
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 |
||
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 |
||
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(); |
@@ -58,18 +58,24 @@ discard block |
||
58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
59 | 59 | |
60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
61 | - if(count($_document_list) <= 0) return; |
|
61 | + if(count($_document_list) <= 0) { |
|
62 | + return; |
|
63 | + } |
|
62 | 64 | |
63 | 65 | // Find all called the document object variable has been set extension |
64 | 66 | $document_srls = array(); |
65 | 67 | foreach($_document_list as $key => $val) |
66 | 68 | { |
67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
69 | + if(!$val->document_srl || $checked_documents[$val->document_srl]) { |
|
70 | + continue; |
|
71 | + } |
|
68 | 72 | $checked_documents[$val->document_srl] = true; |
69 | 73 | $document_srls[] = $val->document_srl; |
70 | 74 | } |
71 | 75 | // If the document number, return detected |
72 | - if(!count($document_srls)) return; |
|
76 | + if(!count($document_srls)) { |
|
77 | + return; |
|
78 | + } |
|
73 | 79 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
74 | 80 | //$obj->document_srl = implode(',',$document_srls); |
75 | 81 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
@@ -77,8 +83,12 @@ discard block |
||
77 | 83 | { |
78 | 84 | foreach($output->data as $key => $val) |
79 | 85 | { |
80 | - if(!isset($val->value)) continue; |
|
81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
86 | + if(!isset($val->value)) { |
|
87 | + continue; |
|
88 | + } |
|
89 | + if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) { |
|
90 | + $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
91 | + } |
|
82 | 92 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
83 | 93 | } |
84 | 94 | } |
@@ -89,7 +99,9 @@ discard block |
||
89 | 99 | $document_srl = $document_srls[$i]; |
90 | 100 | unset($vars); |
91 | 101 | |
92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
102 | + if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) { |
|
103 | + continue; |
|
104 | + } |
|
93 | 105 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
94 | 106 | $extra_keys = $this->getExtraKeys($module_srl); |
95 | 107 | $vars = $extra_vars[$document_srl]; |
@@ -101,10 +113,15 @@ discard block |
||
101 | 113 | { |
102 | 114 | $extra_keys[$idx] = clone($key); |
103 | 115 | $val = $vars[$idx]; |
104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | - else if(isset($val[0])) $v = $val[0]; |
|
107 | - else $v = null; |
|
116 | + if(isset($val[$user_lang_code])) { |
|
117 | + $v = $val[$user_lang_code]; |
|
118 | + } else if(isset($val[$document_lang_code])) { |
|
119 | + $v = $val[$document_lang_code]; |
|
120 | + } else if(isset($val[0])) { |
|
121 | + $v = $val[0]; |
|
122 | + } else { |
|
123 | + $v = null; |
|
124 | + } |
|
108 | 125 | $extra_keys[$idx]->value = $v; |
109 | 126 | } |
110 | 127 | } |
@@ -113,9 +130,13 @@ discard block |
||
113 | 130 | $evars = new ExtraVar($module_srl); |
114 | 131 | $evars->setExtraVarKeys($extra_keys); |
115 | 132 | // Title Processing |
116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
133 | + if($vars[-1][$user_lang_code]) { |
|
134 | + $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
135 | + } |
|
117 | 136 | // Information processing |
118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
137 | + if($vars[-2][$user_lang_code]) { |
|
138 | + $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
139 | + } |
|
119 | 140 | |
120 | 141 | if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
121 | 142 | { |
@@ -136,7 +157,9 @@ discard block |
||
136 | 157 | */ |
137 | 158 | function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
138 | 159 | { |
139 | - if(!$document_srl) return new documentItem(); |
|
160 | + if(!$document_srl) { |
|
161 | + return new documentItem(); |
|
162 | + } |
|
140 | 163 | |
141 | 164 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
142 | 165 | { |
@@ -146,9 +169,13 @@ discard block |
||
146 | 169 | return $oDocument; |
147 | 170 | } |
148 | 171 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
149 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
172 | + if($load_extra_vars) { |
|
173 | + $this->setToAllDocumentExtraVars(); |
|
174 | + } |
|
175 | + } |
|
176 | + if($is_admin) { |
|
177 | + $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
150 | 178 | } |
151 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
152 | 179 | |
153 | 180 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
154 | 181 | } |
@@ -167,8 +194,7 @@ discard block |
||
167 | 194 | { |
168 | 195 | $list_count = count($document_srls); |
169 | 196 | $document_srls = implode(',',$document_srls); |
170 | - } |
|
171 | - else |
|
197 | + } else |
|
172 | 198 | { |
173 | 199 | $list_count = 1; |
174 | 200 | } |
@@ -179,28 +205,38 @@ discard block |
||
179 | 205 | |
180 | 206 | $output = executeQuery('document.getDocuments', $args, $columnList); |
181 | 207 | $document_list = $output->data; |
182 | - if(!$document_list) return; |
|
183 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
208 | + if(!$document_list) { |
|
209 | + return; |
|
210 | + } |
|
211 | + if(!is_array($document_list)) { |
|
212 | + $document_list = array($document_list); |
|
213 | + } |
|
184 | 214 | |
185 | 215 | $document_count = count($document_list); |
186 | 216 | foreach($document_list as $key => $attribute) |
187 | 217 | { |
188 | 218 | $document_srl = $attribute->document_srl; |
189 | - if(!$document_srl) continue; |
|
219 | + if(!$document_srl) { |
|
220 | + continue; |
|
221 | + } |
|
190 | 222 | |
191 | 223 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
192 | 224 | { |
193 | 225 | $oDocument = null; |
194 | 226 | $oDocument = new documentItem(); |
195 | 227 | $oDocument->setAttribute($attribute, false); |
196 | - if($is_admin) $oDocument->setGrant(); |
|
228 | + if($is_admin) { |
|
229 | + $oDocument->setGrant(); |
|
230 | + } |
|
197 | 231 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
198 | 232 | } |
199 | 233 | |
200 | 234 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
201 | 235 | } |
202 | 236 | |
203 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
237 | + if($load_extra_vars) { |
|
238 | + $this->setToAllDocumentExtraVars(); |
|
239 | + } |
|
204 | 240 | |
205 | 241 | $output = null; |
206 | 242 | if(count($result)) |
@@ -248,18 +284,15 @@ discard block |
||
248 | 284 | { |
249 | 285 | $output = $obj->use_alternate_output; |
250 | 286 | unset($obj->use_alternate_output); |
251 | - } |
|
252 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
287 | + } elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
253 | 288 | { |
254 | 289 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
255 | 290 | $args->sort_index = str_replace('documents.','',$args->sort_index); |
256 | 291 | $output = executeQueryArray($query_id, $args); |
257 | - } |
|
258 | - elseif ($sort_check->isExtraVars) |
|
292 | + } elseif ($sort_check->isExtraVars) |
|
259 | 293 | { |
260 | 294 | $output = executeQueryArray($query_id, $args); |
261 | - } |
|
262 | - else |
|
295 | + } else |
|
263 | 296 | { |
264 | 297 | // document.getDocumentList query execution |
265 | 298 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
@@ -269,11 +302,15 @@ discard block |
||
269 | 302 | $group_args = clone($args); |
270 | 303 | $group_args->sort_index = 'documents.'.$args->sort_index; |
271 | 304 | $output = executeQueryArray($query_id, $group_args); |
272 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
305 | + if(!$output->toBool()||!count($output->data)) { |
|
306 | + return $output; |
|
307 | + } |
|
273 | 308 | |
274 | 309 | foreach($output->data as $key => $val) |
275 | 310 | { |
276 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
311 | + if($val->document_srl) { |
|
312 | + $target_srls[] = $val->document_srl; |
|
313 | + } |
|
277 | 314 | } |
278 | 315 | |
279 | 316 | $page_navigation = $output->page_navigation; |
@@ -291,14 +328,15 @@ discard block |
||
291 | 328 | $output->total_count = $page_navigation->total_count; |
292 | 329 | $output->total_page = $page_navigation->total_page; |
293 | 330 | $output->page = $page_navigation->cur_page; |
294 | - } |
|
295 | - else |
|
331 | + } else |
|
296 | 332 | { |
297 | 333 | $output = executeQueryArray($query_id, $args, $columnList); |
298 | 334 | } |
299 | 335 | } |
300 | 336 | // Return if no result or an error occurs |
301 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
337 | + if(!$output->toBool()||!count($output->data)) { |
|
338 | + return $output; |
|
339 | + } |
|
302 | 340 | $idx = 0; |
303 | 341 | $data = $output->data; |
304 | 342 | unset($output->data); |
@@ -313,20 +351,26 @@ discard block |
||
313 | 351 | { |
314 | 352 | foreach($data as $key => $attribute) |
315 | 353 | { |
316 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
354 | + if($attribute->is_notice == 'Y') { |
|
355 | + $virtual_number --; |
|
356 | + } |
|
317 | 357 | } |
318 | 358 | } |
319 | 359 | |
320 | 360 | foreach($data as $key => $attribute) |
321 | 361 | { |
322 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
362 | + if($except_notice && $attribute->is_notice == 'Y') { |
|
363 | + continue; |
|
364 | + } |
|
323 | 365 | $document_srl = $attribute->document_srl; |
324 | 366 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
325 | 367 | { |
326 | 368 | $oDocument = null; |
327 | 369 | $oDocument = new documentItem(); |
328 | 370 | $oDocument->setAttribute($attribute, false); |
329 | - if($is_admin) $oDocument->setGrant(); |
|
371 | + if($is_admin) { |
|
372 | + $oDocument->setGrant(); |
|
373 | + } |
|
330 | 374 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
331 | 375 | } |
332 | 376 | |
@@ -334,7 +378,9 @@ discard block |
||
334 | 378 | $virtual_number--; |
335 | 379 | } |
336 | 380 | |
337 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
381 | + if($load_extra_vars) { |
|
382 | + $this->setToAllDocumentExtraVars(); |
|
383 | + } |
|
338 | 384 | |
339 | 385 | if(count($output->data)) |
340 | 386 | { |
@@ -362,12 +408,16 @@ discard block |
||
362 | 408 | $args->module_srl = $obj->module_srl; |
363 | 409 | $args->category_srl= $obj->category_srl; |
364 | 410 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
365 | - if(!$output->toBool()||!$output->data) return; |
|
411 | + if(!$output->toBool()||!$output->data) { |
|
412 | + return; |
|
413 | + } |
|
366 | 414 | |
367 | 415 | foreach($output->data as $key => $val) |
368 | 416 | { |
369 | 417 | $document_srl = $val->document_srl; |
370 | - if(!$document_srl) continue; |
|
418 | + if(!$document_srl) { |
|
419 | + continue; |
|
420 | + } |
|
371 | 421 | |
372 | 422 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
373 | 423 | { |
@@ -463,7 +513,9 @@ discard block |
||
463 | 513 | |
464 | 514 | $oExtraVar->setExtraVarKeys($output->data); |
465 | 515 | $keys = $oExtraVar->getExtraVars(); |
466 | - if(!$keys) $keys = array(); |
|
516 | + if(!$keys) { |
|
517 | + $keys = array(); |
|
518 | + } |
|
467 | 519 | |
468 | 520 | if($oCacheHandler->isSupport()) |
469 | 521 | { |
@@ -493,7 +545,9 @@ discard block |
||
493 | 545 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
494 | 546 | $this->setToAllDocumentExtraVars(); |
495 | 547 | } |
496 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
548 | + if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { |
|
549 | + ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
550 | + } |
|
497 | 551 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
498 | 552 | } |
499 | 553 | |
@@ -523,7 +577,9 @@ discard block |
||
523 | 577 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
524 | 578 | $module_srl = $oDocument->get('module_srl'); |
525 | 579 | $member_srl = $oDocument->get('member_srl'); |
526 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
580 | + if(!$module_srl) { |
|
581 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
582 | + } |
|
527 | 583 | |
528 | 584 | $oModuleModel = getModel('module'); |
529 | 585 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
@@ -596,7 +652,9 @@ discard block |
||
596 | 652 | */ |
597 | 653 | function getDocumentCount($module_srl, $search_obj = NULL) |
598 | 654 | { |
599 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
655 | + if(is_null($search_obj)) { |
|
656 | + $search_obj = new stdClass(); |
|
657 | + } |
|
600 | 658 | $search_obj->module_srl = $module_srl; |
601 | 659 | |
602 | 660 | $output = executeQuery('document.getDocumentCount', $search_obj); |
@@ -613,7 +671,9 @@ discard block |
||
613 | 671 | function getDocumentCountByGroupStatus($search_obj = NULL) |
614 | 672 | { |
615 | 673 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
616 | - if(!$output->toBool()) return array(); |
|
674 | + if(!$output->toBool()) { |
|
675 | + return array(); |
|
676 | + } |
|
617 | 677 | |
618 | 678 | return $output->data; |
619 | 679 | } |
@@ -652,34 +712,29 @@ discard block |
||
652 | 712 | if($sort_check->isExtraVars) |
653 | 713 | { |
654 | 714 | return 1; |
655 | - } |
|
656 | - else |
|
715 | + } else |
|
657 | 716 | { |
658 | 717 | if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
659 | 718 | { |
660 | 719 | if($args->order_type === 'desc') |
661 | 720 | { |
662 | 721 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
663 | - } |
|
664 | - else |
|
722 | + } else |
|
665 | 723 | { |
666 | 724 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
667 | 725 | } |
668 | - } |
|
669 | - elseif($sort_check->sort_index === 'regdate') |
|
726 | + } elseif($sort_check->sort_index === 'regdate') |
|
670 | 727 | { |
671 | 728 | |
672 | 729 | if($args->order_type === 'asc') |
673 | 730 | { |
674 | 731 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
675 | - } |
|
676 | - else |
|
732 | + } else |
|
677 | 733 | { |
678 | 734 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
679 | 735 | } |
680 | 736 | |
681 | - } |
|
682 | - else |
|
737 | + } else |
|
683 | 738 | { |
684 | 739 | return 1; |
685 | 740 | } |
@@ -705,15 +760,16 @@ discard block |
||
705 | 760 | $output = executeQuery('document.getCategory', $args, $columnList); |
706 | 761 | |
707 | 762 | $node = $output->data; |
708 | - if(!$node) return; |
|
763 | + if(!$node) { |
|
764 | + return; |
|
765 | + } |
|
709 | 766 | |
710 | 767 | if($node->group_srls) |
711 | 768 | { |
712 | 769 | $group_srls = explode(',',$node->group_srls); |
713 | 770 | unset($node->group_srls); |
714 | 771 | $node->group_srls = $group_srls; |
715 | - } |
|
716 | - else |
|
772 | + } else |
|
717 | 773 | { |
718 | 774 | unset($node->group_srls); |
719 | 775 | $node->group_srls = array(); |
@@ -731,7 +787,9 @@ discard block |
||
731 | 787 | $args = new stdClass(); |
732 | 788 | $args->category_srl = $category_srl; |
733 | 789 | $output = executeQuery('document.getChildCategoryCount',$args); |
734 | - if($output->data->count > 0) return true; |
|
790 | + if($output->data->count > 0) { |
|
791 | + return true; |
|
792 | + } |
|
735 | 793 | return false; |
736 | 794 | } |
737 | 795 | |
@@ -750,7 +808,9 @@ discard block |
||
750 | 808 | if(!file_exists($filename)) |
751 | 809 | { |
752 | 810 | $oDocumentController = getController('document'); |
753 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
811 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
812 | + return array(); |
|
813 | + } |
|
754 | 814 | } |
755 | 815 | |
756 | 816 | include($filename); |
@@ -770,7 +830,9 @@ discard block |
||
770 | 830 | */ |
771 | 831 | function _arrangeCategory(&$document_category, $list, $depth) |
772 | 832 | { |
773 | - if(!count($list)) return; |
|
833 | + if(!count($list)) { |
|
834 | + return; |
|
835 | + } |
|
774 | 836 | $idx = 0; |
775 | 837 | $list_order = array(); |
776 | 838 | foreach($list as $key => $val) |
@@ -790,8 +852,11 @@ discard block |
||
790 | 852 | $obj->childs = array(); |
791 | 853 | $obj->grant = $val['grant']; |
792 | 854 | |
793 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
794 | - else $selected = false; |
|
855 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
856 | + $selected = true; |
|
857 | + } else { |
|
858 | + $selected = false; |
|
859 | + } |
|
795 | 860 | |
796 | 861 | $obj->selected = $selected; |
797 | 862 | |
@@ -802,14 +867,18 @@ discard block |
||
802 | 867 | $parent_srl = $obj->parent_srl; |
803 | 868 | $document_count = $obj->document_count; |
804 | 869 | $expand = $obj->expand; |
805 | - if($selected) $expand = true; |
|
870 | + if($selected) { |
|
871 | + $expand = true; |
|
872 | + } |
|
806 | 873 | |
807 | 874 | while($parent_srl) |
808 | 875 | { |
809 | 876 | $document_category[$parent_srl]->document_count += $document_count; |
810 | 877 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
811 | 878 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
812 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
879 | + if($expand) { |
|
880 | + $document_category[$parent_srl]->expand = $expand; |
|
881 | + } |
|
813 | 882 | |
814 | 883 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
815 | 884 | } |
@@ -817,7 +886,9 @@ discard block |
||
817 | 886 | |
818 | 887 | $document_category[$key] = $obj; |
819 | 888 | |
820 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
889 | + if(count($val['list'])) { |
|
890 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
891 | + } |
|
821 | 892 | } |
822 | 893 | $document_category[$list_order[0]]->first = true; |
823 | 894 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -885,13 +956,20 @@ discard block |
||
885 | 956 | } |
886 | 957 | // Module_srl passed the array may be a check whether the array |
887 | 958 | $args = new stdClass; |
888 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
889 | - else $args->module_srl = $obj->module_srl; |
|
959 | + if(is_array($obj->module_srl)) { |
|
960 | + $args->module_srl = implode(',', $obj->module_srl); |
|
961 | + } else { |
|
962 | + $args->module_srl = $obj->module_srl; |
|
963 | + } |
|
890 | 964 | |
891 | 965 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
892 | - if(!$output->toBool()||!$output->data) return $output; |
|
966 | + if(!$output->toBool()||!$output->data) { |
|
967 | + return $output; |
|
968 | + } |
|
893 | 969 | |
894 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
970 | + if(!is_array($output->data)) { |
|
971 | + $output->data = array($output->data); |
|
972 | + } |
|
895 | 973 | |
896 | 974 | return $output; |
897 | 975 | } |
@@ -911,14 +989,21 @@ discard block |
||
911 | 989 | } |
912 | 990 | // Module_srl passed the array may be a check whether the array |
913 | 991 | $args = new stdClass; |
914 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
915 | - else $args->module_srl = $obj->module_srl; |
|
992 | + if(is_array($obj->module_srl)) { |
|
993 | + $args->module_srl = implode(',', $obj->module_srl); |
|
994 | + } else { |
|
995 | + $args->module_srl = $obj->module_srl; |
|
996 | + } |
|
916 | 997 | $args->regdate = $obj->regdate; |
917 | 998 | |
918 | 999 | $output = executeQuery('document.getDailyArchivedList', $args); |
919 | - if(!$output->toBool()) return $output; |
|
1000 | + if(!$output->toBool()) { |
|
1001 | + return $output; |
|
1002 | + } |
|
920 | 1003 | |
921 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
1004 | + if(!is_array($output->data)) { |
|
1005 | + $output->data = array($output->data); |
|
1006 | + } |
|
922 | 1007 | |
923 | 1008 | return $output; |
924 | 1009 | } |
@@ -929,7 +1014,9 @@ discard block |
||
929 | 1014 | */ |
930 | 1015 | function getDocumentCategories() |
931 | 1016 | { |
932 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
1017 | + if(!Context::get('is_logged')) { |
|
1018 | + return new BaseObject(-1,'msg_not_permitted'); |
|
1019 | + } |
|
933 | 1020 | $module_srl = Context::get('module_srl'); |
934 | 1021 | $categories= $this->getCategoryList($module_srl); |
935 | 1022 | $lang = Context::get('lang'); |
@@ -1024,7 +1111,9 @@ discard block |
||
1024 | 1111 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1025 | 1112 | // Check permissions |
1026 | 1113 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1027 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
1114 | + if(!$grant->manager) { |
|
1115 | + return new BaseObject(-1,'msg_not_permitted'); |
|
1116 | + } |
|
1028 | 1117 | |
1029 | 1118 | $category_srl = Context::get('category_srl'); |
1030 | 1119 | $category_info = $this->getCategory($category_srl); |
@@ -1044,15 +1133,20 @@ discard block |
||
1044 | 1133 | */ |
1045 | 1134 | function getDocumentSrlByAlias($mid, $alias) |
1046 | 1135 | { |
1047 | - if(!$mid || !$alias) return null; |
|
1136 | + if(!$mid || !$alias) { |
|
1137 | + return null; |
|
1138 | + } |
|
1048 | 1139 | $site_module_info = Context::get('site_module_info'); |
1049 | 1140 | $args = new stdClass; |
1050 | 1141 | $args->mid = $mid; |
1051 | 1142 | $args->alias_title = $alias; |
1052 | 1143 | $args->site_srl = $site_module_info->site_srl; |
1053 | 1144 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1054 | - if(!$output->data) return null; |
|
1055 | - else return $output->data->document_srl; |
|
1145 | + if(!$output->data) { |
|
1146 | + return null; |
|
1147 | + } else { |
|
1148 | + return $output->data->document_srl; |
|
1149 | + } |
|
1056 | 1150 | } |
1057 | 1151 | |
1058 | 1152 | /** |
@@ -1063,15 +1157,20 @@ discard block |
||
1063 | 1157 | */ |
1064 | 1158 | function getDocumentSrlByTitle($module_srl, $title) |
1065 | 1159 | { |
1066 | - if(!$module_srl || !$title) return null; |
|
1160 | + if(!$module_srl || !$title) { |
|
1161 | + return null; |
|
1162 | + } |
|
1067 | 1163 | $args = new stdClass; |
1068 | 1164 | $args->module_srl = $module_srl; |
1069 | 1165 | $args->title = $title; |
1070 | 1166 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1071 | - if(!$output->data) return null; |
|
1072 | - else |
|
1167 | + if(!$output->data) { |
|
1168 | + return null; |
|
1169 | + } else |
|
1073 | 1170 | { |
1074 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1171 | + if(is_array($output->data)) { |
|
1172 | + return $output->data[0]->document_srl; |
|
1173 | + } |
|
1075 | 1174 | return $output->data->document_srl; |
1076 | 1175 | } |
1077 | 1176 | } |
@@ -1083,13 +1182,18 @@ discard block |
||
1083 | 1182 | */ |
1084 | 1183 | function getAlias($document_srl) |
1085 | 1184 | { |
1086 | - if(!$document_srl) return null; |
|
1185 | + if(!$document_srl) { |
|
1186 | + return null; |
|
1187 | + } |
|
1087 | 1188 | $args = new stdClass; |
1088 | 1189 | $args->document_srl = $document_srl; |
1089 | 1190 | $output = executeQueryArray('document.getAliases', $args); |
1090 | 1191 | |
1091 | - if(!$output->data) return null; |
|
1092 | - else return $output->data[0]->alias_title; |
|
1192 | + if(!$output->data) { |
|
1193 | + return null; |
|
1194 | + } else { |
|
1195 | + return $output->data[0]->alias_title; |
|
1196 | + } |
|
1093 | 1197 | } |
1094 | 1198 | |
1095 | 1199 | /** |
@@ -1146,17 +1250,23 @@ discard block |
||
1146 | 1250 | { |
1147 | 1251 | case 'title' : |
1148 | 1252 | case 'content' : |
1149 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1253 | + if($search_keyword) { |
|
1254 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1255 | + } |
|
1150 | 1256 | $args->{"s_".$search_target} = $search_keyword; |
1151 | 1257 | $use_division = true; |
1152 | 1258 | break; |
1153 | 1259 | case 'title_content' : |
1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1260 | + if($search_keyword) { |
|
1261 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1262 | + } |
|
1155 | 1263 | $args->s_title = $search_keyword; |
1156 | 1264 | $args->s_content = $search_keyword; |
1157 | 1265 | break; |
1158 | 1266 | case 'user_id' : |
1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1267 | + if($search_keyword) { |
|
1268 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1269 | + } |
|
1160 | 1270 | $args->s_user_id = $search_keyword; |
1161 | 1271 | $args->sort_index = 'documents.'.$args->sort_index; |
1162 | 1272 | break; |
@@ -1164,13 +1274,18 @@ discard block |
||
1164 | 1274 | case 'nick_name' : |
1165 | 1275 | case 'email_address' : |
1166 | 1276 | case 'homepage' : |
1167 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1277 | + if($search_keyword) { |
|
1278 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1279 | + } |
|
1168 | 1280 | $args->{"s_".$search_target} = $search_keyword; |
1169 | 1281 | break; |
1170 | 1282 | case 'is_notice' : |
1171 | 1283 | case 'is_secret' : |
1172 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1173 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1284 | + if($search_keyword=='N') { |
|
1285 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1286 | + } elseif($search_keyword=='Y') { |
|
1287 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1288 | + } |
|
1174 | 1289 | break; |
1175 | 1290 | case 'member_srl' : |
1176 | 1291 | case 'readed_count' : |
@@ -1212,34 +1327,45 @@ discard block |
||
1212 | 1327 | { |
1213 | 1328 | $args = new stdClass; |
1214 | 1329 | $document_srl = Context::get('document_srl'); |
1215 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
1330 | + if(!$document_srl) { |
|
1331 | + return new BaseObject(-1,'msg_invalid_request'); |
|
1332 | + } |
|
1216 | 1333 | |
1217 | 1334 | $point = Context::get('point'); |
1218 | - if($point != -1) $point = 1; |
|
1335 | + if($point != -1) { |
|
1336 | + $point = 1; |
|
1337 | + } |
|
1219 | 1338 | |
1220 | 1339 | $oDocumentModel = getModel('document'); |
1221 | 1340 | $columnList = array('document_srl', 'module_srl'); |
1222 | 1341 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1223 | 1342 | $module_srl = $oDocument->get('module_srl'); |
1224 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1343 | + if(!$module_srl) { |
|
1344 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1345 | + } |
|
1225 | 1346 | |
1226 | 1347 | $oModuleModel = getModel('module'); |
1227 | 1348 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
1228 | 1349 | if($point == -1) |
1229 | 1350 | { |
1230 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1351 | + if($document_config->use_vote_down!='S') { |
|
1352 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1353 | + } |
|
1231 | 1354 | $args->below_point = 0; |
1232 | - } |
|
1233 | - else |
|
1355 | + } else |
|
1234 | 1356 | { |
1235 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1357 | + if($document_config->use_vote_up!='S') { |
|
1358 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1359 | + } |
|
1236 | 1360 | $args->more_point = 0; |
1237 | 1361 | } |
1238 | 1362 | |
1239 | 1363 | $args->document_srl = $document_srl; |
1240 | 1364 | |
1241 | 1365 | $output = executeQueryArray('document.getVotedMemberList',$args); |
1242 | - if(!$output->toBool()) return $output; |
|
1366 | + if(!$output->toBool()) { |
|
1367 | + return $output; |
|
1368 | + } |
|
1243 | 1369 | |
1244 | 1370 | $oMemberModel = getModel('member'); |
1245 | 1371 | if($output->data) |
@@ -1261,9 +1387,11 @@ discard block |
||
1261 | 1387 | function getStatusNameList() |
1262 | 1388 | { |
1263 | 1389 | global $lang; |
1264 | - if(!isset($lang->status_name_list)) |
|
1265 | - return array_flip($this->getStatusList()); |
|
1266 | - else return $lang->status_name_list; |
|
1390 | + if(!isset($lang->status_name_list)) { |
|
1391 | + return array_flip($this->getStatusList()); |
|
1392 | + } else { |
|
1393 | + return $lang->status_name_list; |
|
1394 | + } |
|
1267 | 1395 | } |
1268 | 1396 | |
1269 | 1397 | /** |
@@ -1287,20 +1415,22 @@ discard block |
||
1287 | 1415 | if (!$extra_output->data || !$extra_output->toBool()) |
1288 | 1416 | { |
1289 | 1417 | $sortIndex = 'list_order'; |
1290 | - } |
|
1291 | - else |
|
1418 | + } else |
|
1292 | 1419 | { |
1293 | 1420 | $check_array = array(); |
1294 | 1421 | foreach($extra_output->data as $val) |
1295 | 1422 | { |
1296 | 1423 | $check_array[] = $val->eid; |
1297 | 1424 | } |
1298 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1299 | - else $isExtraVars = true; |
|
1425 | + if(!in_array($sortIndex, $check_array)) { |
|
1426 | + $sortIndex = 'list_order'; |
|
1427 | + } else { |
|
1428 | + $isExtraVars = true; |
|
1429 | + } |
|
1300 | 1430 | } |
1431 | + } else { |
|
1432 | + $sortIndex = 'list_order'; |
|
1301 | 1433 | } |
1302 | - else |
|
1303 | - $sortIndex = 'list_order'; |
|
1304 | 1434 | } |
1305 | 1435 | $returnObj = new stdClass(); |
1306 | 1436 | $returnObj->sort_index = $sortIndex; |
@@ -1338,7 +1468,9 @@ discard block |
||
1338 | 1468 | |
1339 | 1469 | // Check the target and sequence alignment |
1340 | 1470 | $orderType = array('desc' => 1, 'asc' => 1); |
1341 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1471 | + if(!isset($orderType[$args->order_type])) { |
|
1472 | + $args->order_type = 'asc'; |
|
1473 | + } |
|
1342 | 1474 | |
1343 | 1475 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1344 | 1476 | if($searchOpt->mid) |
@@ -1349,21 +1481,29 @@ discard block |
||
1349 | 1481 | } |
1350 | 1482 | |
1351 | 1483 | // Module_srl passed the array may be a check whether the array |
1352 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1353 | - else $args->module_srl = $searchOpt->module_srl; |
|
1484 | + if(is_array($searchOpt->module_srl)) { |
|
1485 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1486 | + } else { |
|
1487 | + $args->module_srl = $searchOpt->module_srl; |
|
1488 | + } |
|
1354 | 1489 | |
1355 | 1490 | // Except for the test module_srl |
1356 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1357 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1491 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
1492 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1493 | + } else { |
|
1494 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1495 | + } |
|
1358 | 1496 | |
1359 | 1497 | // only admin document list, temp document showing |
1360 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1361 | - else |
|
1498 | + if($searchOpt->statusList) { |
|
1499 | + $args->statusList = $searchOpt->statusList; |
|
1500 | + } else |
|
1362 | 1501 | { |
1363 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1364 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1365 | - else |
|
1366 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1502 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
1503 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1504 | + } else { |
|
1505 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1506 | + } |
|
1367 | 1507 | } |
1368 | 1508 | |
1369 | 1509 | // Category is selected, further sub-categories until all conditions |
@@ -1391,18 +1531,24 @@ discard block |
||
1391 | 1531 | { |
1392 | 1532 | case 'title' : |
1393 | 1533 | case 'content' : |
1394 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1534 | + if($search_keyword) { |
|
1535 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1536 | + } |
|
1395 | 1537 | $args->{"s_".$search_target} = $search_keyword; |
1396 | 1538 | $use_division = true; |
1397 | 1539 | break; |
1398 | 1540 | case 'title_content' : |
1399 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1541 | + if($search_keyword) { |
|
1542 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1543 | + } |
|
1400 | 1544 | $args->s_title = $search_keyword; |
1401 | 1545 | $args->s_content = $search_keyword; |
1402 | 1546 | $use_division = true; |
1403 | 1547 | break; |
1404 | 1548 | case 'user_id' : |
1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1549 | + if($search_keyword) { |
|
1550 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1551 | + } |
|
1406 | 1552 | $args->s_user_id = $search_keyword; |
1407 | 1553 | $args->sort_index = 'documents.'.$args->sort_index; |
1408 | 1554 | break; |
@@ -1410,18 +1556,28 @@ discard block |
||
1410 | 1556 | case 'nick_name' : |
1411 | 1557 | case 'email_address' : |
1412 | 1558 | case 'homepage' : |
1413 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1559 | + if($search_keyword) { |
|
1560 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1561 | + } |
|
1414 | 1562 | $args->{"s_".$search_target} = $search_keyword; |
1415 | 1563 | break; |
1416 | 1564 | case 'is_notice' : |
1417 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1418 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1419 | - else $args->{"s_".$search_target} = ''; |
|
1565 | + if($search_keyword=='N') { |
|
1566 | + $args->{"s_".$search_target} = 'N'; |
|
1567 | + } elseif($search_keyword=='Y') { |
|
1568 | + $args->{"s_".$search_target} = 'Y'; |
|
1569 | + } else { |
|
1570 | + $args->{"s_".$search_target} = ''; |
|
1571 | + } |
|
1420 | 1572 | break; |
1421 | 1573 | case 'is_secret' : |
1422 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1423 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1424 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1574 | + if($search_keyword=='N') { |
|
1575 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1576 | + } elseif($search_keyword=='Y') { |
|
1577 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1578 | + } elseif($search_keyword=='temp') { |
|
1579 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
1580 | + } |
|
1425 | 1581 | break; |
1426 | 1582 | case 'member_srl' : |
1427 | 1583 | case 'readed_count' : |
@@ -1466,13 +1622,14 @@ discard block |
||
1466 | 1622 | if ($searchOpt->isExtraVars) |
1467 | 1623 | { |
1468 | 1624 | $query_id = 'document.getDocumentListExtraSort'; |
1469 | - } |
|
1470 | - else |
|
1625 | + } else |
|
1471 | 1626 | { |
1472 | 1627 | /** |
1473 | 1628 | * list_order asc sort of division that can be used only when |
1474 | 1629 | */ |
1475 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1630 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
1631 | + $use_division = false; |
|
1632 | + } |
|
1476 | 1633 | |
1477 | 1634 | /** |
1478 | 1635 | * If it is true, use_division changed to use the document division |
@@ -1487,8 +1644,7 @@ discard block |
||
1487 | 1644 | { |
1488 | 1645 | $listSqlID = 'document.getDocumentListUseIndex'; |
1489 | 1646 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
1490 | - } |
|
1491 | - else |
|
1647 | + } else |
|
1492 | 1648 | { |
1493 | 1649 | $listSqlID = 'document.getDocumentList'; |
1494 | 1650 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1545,7 +1701,9 @@ discard block |
||
1545 | 1701 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1546 | 1702 | $last_division_args->list_order = $last_division; |
1547 | 1703 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1548 | - if($output->data->count<1) $last_division = null; |
|
1704 | + if($output->data->count<1) { |
|
1705 | + $last_division = null; |
|
1706 | + } |
|
1549 | 1707 | } |
1550 | 1708 | |
1551 | 1709 | $args->division = $division; |
@@ -1586,8 +1744,12 @@ discard block |
||
1586 | 1744 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1587 | 1745 | $document_list = $output->data; |
1588 | 1746 | |
1589 | - if(!$document_list) return array(); |
|
1590 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1747 | + if(!$document_list) { |
|
1748 | + return array(); |
|
1749 | + } |
|
1750 | + if(!is_array($document_list)) { |
|
1751 | + $document_list = array($document_list); |
|
1752 | + } |
|
1591 | 1753 | |
1592 | 1754 | return $document_list; |
1593 | 1755 | } |
@@ -1602,8 +1764,7 @@ discard block |
||
1602 | 1764 | if(Mobile::isFromMobilePhone()) |
1603 | 1765 | { |
1604 | 1766 | $iconSkin = $documentConfig->micons; |
1605 | - } |
|
1606 | - else |
|
1767 | + } else |
|
1607 | 1768 | { |
1608 | 1769 | $iconSkin = $documentConfig->icons; |
1609 | 1770 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function getDocumentExtraVarsFromDB($documentSrls) |
39 | 39 | { |
40 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
40 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
41 | 41 | { |
42 | 42 | return new BaseObject(-1, 'msg_invalid_request'); |
43 | 43 | } |
@@ -58,52 +58,52 @@ discard block |
||
58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
59 | 59 | |
60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
61 | - if(count($_document_list) <= 0) return; |
|
61 | + if (count($_document_list) <= 0) return; |
|
62 | 62 | |
63 | 63 | // Find all called the document object variable has been set extension |
64 | 64 | $document_srls = array(); |
65 | - foreach($_document_list as $key => $val) |
|
65 | + foreach ($_document_list as $key => $val) |
|
66 | 66 | { |
67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
67 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
68 | 68 | $checked_documents[$val->document_srl] = true; |
69 | 69 | $document_srls[] = $val->document_srl; |
70 | 70 | } |
71 | 71 | // If the document number, return detected |
72 | - if(!count($document_srls)) return; |
|
72 | + if (!count($document_srls)) return; |
|
73 | 73 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
74 | 74 | //$obj->document_srl = implode(',',$document_srls); |
75 | 75 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
76 | - if($output->toBool() && $output->data) |
|
76 | + if ($output->toBool() && $output->data) |
|
77 | 77 | { |
78 | - foreach($output->data as $key => $val) |
|
78 | + foreach ($output->data as $key => $val) |
|
79 | 79 | { |
80 | - if(!isset($val->value)) continue; |
|
81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
80 | + if (!isset($val->value)) continue; |
|
81 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
82 | 82 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | $user_lang_code = Context::getLangType(); |
87 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
87 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
88 | 88 | { |
89 | 89 | $document_srl = $document_srls[$i]; |
90 | 90 | unset($vars); |
91 | 91 | |
92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
92 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
93 | 93 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
94 | 94 | $extra_keys = $this->getExtraKeys($module_srl); |
95 | 95 | $vars = $extra_vars[$document_srl]; |
96 | 96 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
97 | 97 | // Expand the variable processing |
98 | - if(count($extra_keys)) |
|
98 | + if (count($extra_keys)) |
|
99 | 99 | { |
100 | - foreach($extra_keys as $idx => $key) |
|
100 | + foreach ($extra_keys as $idx => $key) |
|
101 | 101 | { |
102 | 102 | $extra_keys[$idx] = clone($key); |
103 | 103 | $val = $vars[$idx]; |
104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | - else if(isset($val[0])) $v = $val[0]; |
|
104 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | + else if (isset($val[0])) $v = $val[0]; |
|
107 | 107 | else $v = null; |
108 | 108 | $extra_keys[$idx]->value = $v; |
109 | 109 | } |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $evars = new ExtraVar($module_srl); |
114 | 114 | $evars->setExtraVarKeys($extra_keys); |
115 | 115 | // Title Processing |
116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
116 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
117 | 117 | // Information processing |
118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
118 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
119 | 119 | |
120 | - if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
120 | + if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
121 | 121 | { |
122 | 122 | unset($checked_documents[$document_srl]); |
123 | 123 | } |
@@ -134,21 +134,21 @@ discard block |
||
134 | 134 | * @param array $columnList |
135 | 135 | * @return documentItem |
136 | 136 | */ |
137 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
137 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
138 | 138 | { |
139 | - if(!$document_srl) return new documentItem(); |
|
139 | + if (!$document_srl) return new documentItem(); |
|
140 | 140 | |
141 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
141 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
142 | 142 | { |
143 | 143 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
144 | - if(!$oDocument->isExists()) |
|
144 | + if (!$oDocument->isExists()) |
|
145 | 145 | { |
146 | 146 | return $oDocument; |
147 | 147 | } |
148 | 148 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
149 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
149 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
150 | 150 | } |
151 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
151 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
152 | 152 | |
153 | 153 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
154 | 154 | } |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | * @param array $columnList |
162 | 162 | * @return array value type is documentItem |
163 | 163 | */ |
164 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
164 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
165 | 165 | { |
166 | - if(is_array($document_srls)) |
|
166 | + if (is_array($document_srls)) |
|
167 | 167 | { |
168 | 168 | $list_count = count($document_srls); |
169 | - $document_srls = implode(',',$document_srls); |
|
169 | + $document_srls = implode(',', $document_srls); |
|
170 | 170 | } |
171 | 171 | else |
172 | 172 | { |
@@ -179,33 +179,33 @@ discard block |
||
179 | 179 | |
180 | 180 | $output = executeQuery('document.getDocuments', $args, $columnList); |
181 | 181 | $document_list = $output->data; |
182 | - if(!$document_list) return; |
|
183 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
182 | + if (!$document_list) return; |
|
183 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
184 | 184 | |
185 | 185 | $document_count = count($document_list); |
186 | - foreach($document_list as $key => $attribute) |
|
186 | + foreach ($document_list as $key => $attribute) |
|
187 | 187 | { |
188 | 188 | $document_srl = $attribute->document_srl; |
189 | - if(!$document_srl) continue; |
|
189 | + if (!$document_srl) continue; |
|
190 | 190 | |
191 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
191 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
192 | 192 | { |
193 | 193 | $oDocument = null; |
194 | 194 | $oDocument = new documentItem(); |
195 | 195 | $oDocument->setAttribute($attribute, false); |
196 | - if($is_admin) $oDocument->setGrant(); |
|
196 | + if ($is_admin) $oDocument->setGrant(); |
|
197 | 197 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
201 | 201 | } |
202 | 202 | |
203 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
203 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
204 | 204 | |
205 | 205 | $output = null; |
206 | - if(count($result)) |
|
206 | + if (count($result)) |
|
207 | 207 | { |
208 | - foreach($result as $document_srl => $val) |
|
208 | + foreach ($result as $document_srl => $val) |
|
209 | 209 | { |
210 | 210 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
211 | 211 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param array $columnList |
223 | 223 | * @return BaseObject |
224 | 224 | */ |
225 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
225 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
226 | 226 | { |
227 | 227 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
228 | 228 | $obj->sort_index = $sort_check->sort_index; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | // Call trigger (before) |
233 | 233 | // This trigger can be used to set an alternative output using a different search method |
234 | 234 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
235 | - if($output instanceof BaseObject && !$output->toBool()) |
|
235 | + if ($output instanceof BaseObject && !$output->toBool()) |
|
236 | 236 | { |
237 | 237 | return $output; |
238 | 238 | } |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $output = $obj->use_alternate_output; |
250 | 250 | unset($obj->use_alternate_output); |
251 | 251 | } |
252 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
252 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
253 | 253 | { |
254 | 254 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
255 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
255 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
256 | 256 | $output = executeQueryArray($query_id, $args); |
257 | 257 | } |
258 | 258 | elseif ($sort_check->isExtraVars) |
@@ -264,16 +264,16 @@ discard block |
||
264 | 264 | // document.getDocumentList query execution |
265 | 265 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
266 | 266 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
267 | - if(isset($groupByQuery[$query_id])) |
|
267 | + if (isset($groupByQuery[$query_id])) |
|
268 | 268 | { |
269 | 269 | $group_args = clone($args); |
270 | 270 | $group_args->sort_index = 'documents.'.$args->sort_index; |
271 | 271 | $output = executeQueryArray($query_id, $group_args); |
272 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
272 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
273 | 273 | |
274 | - foreach($output->data as $key => $val) |
|
274 | + foreach ($output->data as $key => $val) |
|
275 | 275 | { |
276 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
276 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | $page_navigation = $output->page_navigation; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $virtual_number = $keys[0]; |
282 | 282 | |
283 | 283 | $target_args = new stdClass(); |
284 | - $target_args->document_srls = implode(',',$target_srls); |
|
284 | + $target_args->document_srls = implode(',', $target_srls); |
|
285 | 285 | $target_args->list_order = $args->sort_index; |
286 | 286 | $target_args->order_type = $args->order_type; |
287 | 287 | $target_args->list_count = $args->list_count; |
@@ -298,35 +298,35 @@ discard block |
||
298 | 298 | } |
299 | 299 | } |
300 | 300 | // Return if no result or an error occurs |
301 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
301 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
302 | 302 | $idx = 0; |
303 | 303 | $data = $output->data; |
304 | 304 | unset($output->data); |
305 | 305 | |
306 | - if(!isset($virtual_number)) |
|
306 | + if (!isset($virtual_number)) |
|
307 | 307 | { |
308 | 308 | $keys = array_keys($data); |
309 | 309 | $virtual_number = $keys[0]; |
310 | 310 | } |
311 | 311 | |
312 | - if($except_notice) |
|
312 | + if ($except_notice) |
|
313 | 313 | { |
314 | - foreach($data as $key => $attribute) |
|
314 | + foreach ($data as $key => $attribute) |
|
315 | 315 | { |
316 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
316 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | - foreach($data as $key => $attribute) |
|
320 | + foreach ($data as $key => $attribute) |
|
321 | 321 | { |
322 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
322 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
323 | 323 | $document_srl = $attribute->document_srl; |
324 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
324 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
325 | 325 | { |
326 | 326 | $oDocument = null; |
327 | 327 | $oDocument = new documentItem(); |
328 | 328 | $oDocument->setAttribute($attribute, false); |
329 | - if($is_admin) $oDocument->setGrant(); |
|
329 | + if ($is_admin) $oDocument->setGrant(); |
|
330 | 330 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
331 | 331 | } |
332 | 332 | |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | $virtual_number--; |
335 | 335 | } |
336 | 336 | |
337 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
337 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
338 | 338 | |
339 | - if(count($output->data)) |
|
339 | + if (count($output->data)) |
|
340 | 340 | { |
341 | - foreach($output->data as $number => $document) |
|
341 | + foreach ($output->data as $number => $document) |
|
342 | 342 | { |
343 | 343 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
360 | 360 | { |
361 | 361 | $args = new stdClass(); |
362 | 362 | $args->module_srl = $obj->module_srl; |
363 | - $args->category_srl= $obj->category_srl; |
|
363 | + $args->category_srl = $obj->category_srl; |
|
364 | 364 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
365 | - if(!$output->toBool()||!$output->data) return; |
|
365 | + if (!$output->toBool() || !$output->data) return; |
|
366 | 366 | |
367 | - foreach($output->data as $key => $val) |
|
367 | + foreach ($output->data as $key => $val) |
|
368 | 368 | { |
369 | 369 | $document_srl = $val->document_srl; |
370 | - if(!$document_srl) continue; |
|
370 | + if (!$document_srl) continue; |
|
371 | 371 | |
372 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
372 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
373 | 373 | { |
374 | 374 | $oDocument = null; |
375 | 375 | $oDocument = new documentItem(); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | $this->setToAllDocumentExtraVars(); |
382 | 382 | |
383 | - foreach($result->data as $document_srl => $val) |
|
383 | + foreach ($result->data as $document_srl => $val) |
|
384 | 384 | { |
385 | 385 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
386 | 386 | } |
@@ -396,20 +396,20 @@ discard block |
||
396 | 396 | */ |
397 | 397 | function getExtraKeys($module_srl) |
398 | 398 | { |
399 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
399 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
400 | 400 | { |
401 | 401 | $keys = false; |
402 | 402 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
403 | - if($oCacheHandler->isSupport()) |
|
403 | + if ($oCacheHandler->isSupport()) |
|
404 | 404 | { |
405 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
405 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
406 | 406 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
407 | 407 | $keys = $oCacheHandler->get($cache_key); |
408 | 408 | } |
409 | 409 | |
410 | 410 | $oExtraVar = ExtraVar::getInstance($module_srl); |
411 | 411 | |
412 | - if($keys === false) |
|
412 | + if ($keys === false) |
|
413 | 413 | { |
414 | 414 | $obj = new stdClass(); |
415 | 415 | $obj->module_srl = $module_srl; |
@@ -419,13 +419,13 @@ discard block |
||
419 | 419 | |
420 | 420 | // correcting index order |
421 | 421 | $isFixed = FALSE; |
422 | - if(is_array($output->data)) |
|
422 | + if (is_array($output->data)) |
|
423 | 423 | { |
424 | 424 | $prevIdx = 0; |
425 | - foreach($output->data as $no => $value) |
|
425 | + foreach ($output->data as $no => $value) |
|
426 | 426 | { |
427 | 427 | // case first |
428 | - if($prevIdx == 0 && $value->idx != 1) |
|
428 | + if ($prevIdx == 0 && $value->idx != 1) |
|
429 | 429 | { |
430 | 430 | $args = new stdClass(); |
431 | 431 | $args->module_srl = $module_srl; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | // case others |
442 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
442 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
443 | 443 | { |
444 | 444 | $args = new stdClass(); |
445 | 445 | $args->module_srl = $module_srl; |
@@ -456,16 +456,16 @@ discard block |
||
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
459 | - if($isFixed) |
|
459 | + if ($isFixed) |
|
460 | 460 | { |
461 | 461 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
462 | 462 | } |
463 | 463 | |
464 | 464 | $oExtraVar->setExtraVarKeys($output->data); |
465 | 465 | $keys = $oExtraVar->getExtraVars(); |
466 | - if(!$keys) $keys = array(); |
|
466 | + if (!$keys) $keys = array(); |
|
467 | 467 | |
468 | - if($oCacheHandler->isSupport()) |
|
468 | + if ($oCacheHandler->isSupport()) |
|
469 | 469 | { |
470 | 470 | $oCacheHandler->put($cache_key, $keys); |
471 | 471 | } |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | */ |
487 | 487 | function getExtraVars($module_srl, $document_srl) |
488 | 488 | { |
489 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
489 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
490 | 490 | { |
491 | 491 | // Extended to extract the values of variables set |
492 | 492 | $oDocument = $this->getDocument($document_srl, false); |
493 | 493 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
494 | 494 | $this->setToAllDocumentExtraVars(); |
495 | 495 | } |
496 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
496 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
497 | 497 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
498 | 498 | } |
499 | 499 | |
@@ -516,71 +516,71 @@ discard block |
||
516 | 516 | |
517 | 517 | $oDocumentController = getController('document'); |
518 | 518 | // Members must be a possible feature |
519 | - if($logged_info->member_srl) |
|
519 | + if ($logged_info->member_srl) |
|
520 | 520 | { |
521 | 521 | $oDocumentModel = getModel('document'); |
522 | 522 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
523 | 523 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
524 | 524 | $module_srl = $oDocument->get('module_srl'); |
525 | 525 | $member_srl = $oDocument->get('member_srl'); |
526 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
526 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
527 | 527 | |
528 | 528 | $oModuleModel = getModel('module'); |
529 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
530 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
529 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
530 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
531 | 531 | { |
532 | 532 | // Add a Referral Button |
533 | 533 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
534 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
534 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
535 | 535 | } |
536 | 536 | |
537 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
537 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
538 | 538 | { |
539 | 539 | // Add button to negative |
540 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
541 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
540 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
541 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | // Adding Report |
545 | 545 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
546 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
546 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
547 | 547 | |
548 | 548 | // Add Bookmark button |
549 | 549 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
550 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
550 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
551 | 551 | } |
552 | 552 | // Add print button |
553 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
554 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
553 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
554 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
555 | 555 | // Call a trigger (after) |
556 | 556 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
557 | - if($this->grant->manager) |
|
557 | + if ($this->grant->manager) |
|
558 | 558 | { |
559 | 559 | $str_confirm = Context::getLang('confirm_move'); |
560 | 560 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
561 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
561 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | // If you are managing to find posts by ip |
565 | - if($logged_info->is_admin == 'Y') |
|
565 | + if ($logged_info->is_admin == 'Y') |
|
566 | 566 | { |
567 | 567 | $oDocumentModel = getModel('document'); |
568 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
568 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
569 | 569 | |
570 | - if($oDocument->isExists()) |
|
570 | + if ($oDocument->isExists()) |
|
571 | 571 | { |
572 | 572 | // Find a post equivalent to ip address |
573 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
574 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
573 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
574 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
575 | 575 | |
576 | 576 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
577 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
577 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | // Changing the language of pop-up menu |
581 | 581 | $menus = Context::get('document_popup_menu_list'); |
582 | 582 | $menus_count = count($menus); |
583 | - for($i=0;$i<$menus_count;$i++) |
|
583 | + for ($i = 0; $i < $menus_count; $i++) |
|
584 | 584 | { |
585 | 585 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
586 | 586 | } |
@@ -596,13 +596,13 @@ discard block |
||
596 | 596 | */ |
597 | 597 | function getDocumentCount($module_srl, $search_obj = NULL) |
598 | 598 | { |
599 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
599 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
600 | 600 | $search_obj->module_srl = $module_srl; |
601 | 601 | |
602 | 602 | $output = executeQuery('document.getDocumentCount', $search_obj); |
603 | 603 | // Return total number of |
604 | 604 | $total_count = $output->data->count; |
605 | - return (int)$total_count; |
|
605 | + return (int) $total_count; |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | function getDocumentCountByGroupStatus($search_obj = NULL) |
614 | 614 | { |
615 | 615 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
616 | - if(!$output->toBool()) return array(); |
|
616 | + if (!$output->toBool()) return array(); |
|
617 | 617 | |
618 | 618 | return $output->data; |
619 | 619 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
633 | 633 | // Return total number of |
634 | 634 | $total_count = $output->data->count; |
635 | - return (int)$total_count; |
|
635 | + return (int) $total_count; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -649,29 +649,29 @@ discard block |
||
649 | 649 | |
650 | 650 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
651 | 651 | |
652 | - if($sort_check->isExtraVars) |
|
652 | + if ($sort_check->isExtraVars) |
|
653 | 653 | { |
654 | 654 | return 1; |
655 | 655 | } |
656 | 656 | else |
657 | 657 | { |
658 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
658 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
659 | 659 | { |
660 | - if($args->order_type === 'desc') |
|
660 | + if ($args->order_type === 'desc') |
|
661 | 661 | { |
662 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
662 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
663 | 663 | } |
664 | 664 | else |
665 | 665 | { |
666 | 666 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
667 | 667 | } |
668 | 668 | } |
669 | - elseif($sort_check->sort_index === 'regdate') |
|
669 | + elseif ($sort_check->sort_index === 'regdate') |
|
670 | 670 | { |
671 | 671 | |
672 | - if($args->order_type === 'asc') |
|
672 | + if ($args->order_type === 'asc') |
|
673 | 673 | { |
674 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
674 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
675 | 675 | } |
676 | 676 | else |
677 | 677 | { |
@@ -686,9 +686,9 @@ discard block |
||
686 | 686 | } |
687 | 687 | |
688 | 688 | // Guhanhu total number of the article search page |
689 | - $output = executeQuery($query_id . 'Page', $args); |
|
689 | + $output = executeQuery($query_id.'Page', $args); |
|
690 | 690 | $count = $output->data->count; |
691 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
691 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
692 | 692 | return $page; |
693 | 693 | } |
694 | 694 | |
@@ -700,16 +700,16 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function getCategory($category_srl, $columnList = array()) |
702 | 702 | { |
703 | - $args =new stdClass(); |
|
703 | + $args = new stdClass(); |
|
704 | 704 | $args->category_srl = $category_srl; |
705 | 705 | $output = executeQuery('document.getCategory', $args, $columnList); |
706 | 706 | |
707 | 707 | $node = $output->data; |
708 | - if(!$node) return; |
|
708 | + if (!$node) return; |
|
709 | 709 | |
710 | - if($node->group_srls) |
|
710 | + if ($node->group_srls) |
|
711 | 711 | { |
712 | - $group_srls = explode(',',$node->group_srls); |
|
712 | + $group_srls = explode(',', $node->group_srls); |
|
713 | 713 | unset($node->group_srls); |
714 | 714 | $node->group_srls = $group_srls; |
715 | 715 | } |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | { |
731 | 731 | $args = new stdClass(); |
732 | 732 | $args->category_srl = $category_srl; |
733 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
734 | - if($output->data->count > 0) return true; |
|
733 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
734 | + if ($output->data->count > 0) return true; |
|
735 | 735 | return false; |
736 | 736 | } |
737 | 737 | |
@@ -747,10 +747,10 @@ discard block |
||
747 | 747 | // Category of the target module file swollen |
748 | 748 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
749 | 749 | // If the target file to the cache file regeneration category |
750 | - if(!file_exists($filename)) |
|
750 | + if (!file_exists($filename)) |
|
751 | 751 | { |
752 | 752 | $oDocumentController = getController('document'); |
753 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
753 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | include($filename); |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | */ |
771 | 771 | function _arrangeCategory(&$document_category, $list, $depth) |
772 | 772 | { |
773 | - if(!count($list)) return; |
|
773 | + if (!count($list)) return; |
|
774 | 774 | $idx = 0; |
775 | 775 | $list_order = array(); |
776 | - foreach($list as $key => $val) |
|
776 | + foreach ($list as $key => $val) |
|
777 | 777 | { |
778 | 778 | $obj = new stdClass; |
779 | 779 | $obj->mid = $val['mid']; |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | $obj->parent_srl = $val['parent_srl']; |
783 | 783 | $obj->title = $obj->text = $val['text']; |
784 | 784 | $obj->description = $val['description']; |
785 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
785 | + $obj->expand = $val['expand'] == 'Y' ?true:false; |
|
786 | 786 | $obj->color = $val['color']; |
787 | 787 | $obj->document_count = $val['document_count']; |
788 | 788 | $obj->depth = $depth; |
@@ -790,26 +790,26 @@ discard block |
||
790 | 790 | $obj->childs = array(); |
791 | 791 | $obj->grant = $val['grant']; |
792 | 792 | |
793 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
793 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
794 | 794 | else $selected = false; |
795 | 795 | |
796 | 796 | $obj->selected = $selected; |
797 | 797 | |
798 | 798 | $list_order[$idx++] = $obj->category_srl; |
799 | 799 | // If you have a parent category of child nodes apply data |
800 | - if($obj->parent_srl) |
|
800 | + if ($obj->parent_srl) |
|
801 | 801 | { |
802 | 802 | $parent_srl = $obj->parent_srl; |
803 | 803 | $document_count = $obj->document_count; |
804 | 804 | $expand = $obj->expand; |
805 | - if($selected) $expand = true; |
|
805 | + if ($selected) $expand = true; |
|
806 | 806 | |
807 | - while($parent_srl) |
|
807 | + while ($parent_srl) |
|
808 | 808 | { |
809 | 809 | $document_category[$parent_srl]->document_count += $document_count; |
810 | 810 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
811 | 811 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
812 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
812 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
813 | 813 | |
814 | 814 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
815 | 815 | } |
@@ -817,10 +817,10 @@ discard block |
||
817 | 817 | |
818 | 818 | $document_category[$key] = $obj; |
819 | 819 | |
820 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
820 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
821 | 821 | } |
822 | 822 | $document_category[$list_order[0]]->first = true; |
823 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
823 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | $args->module_srl = $module_srl; |
836 | 836 | $args->category_srl = $category_srl; |
837 | 837 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
838 | - return (int)$output->data->count; |
|
838 | + return (int) $output->data->count; |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | /** |
@@ -845,8 +845,8 @@ discard block |
||
845 | 845 | */ |
846 | 846 | function getCategoryXmlFile($module_srl) |
847 | 847 | { |
848 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
849 | - if(!file_exists($xml_file)) |
|
848 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
849 | + if (!file_exists($xml_file)) |
|
850 | 850 | { |
851 | 851 | $oDocumentController = getController('document'); |
852 | 852 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | */ |
862 | 862 | function getCategoryPhpFile($module_srl) |
863 | 863 | { |
864 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
865 | - if(!file_exists($php_file)) |
|
864 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
865 | + if (!file_exists($php_file)) |
|
866 | 866 | { |
867 | 867 | $oDocumentController = getController('document'); |
868 | 868 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | */ |
878 | 878 | function getMonthlyArchivedList($obj) |
879 | 879 | { |
880 | - if($obj->mid) |
|
880 | + if ($obj->mid) |
|
881 | 881 | { |
882 | 882 | $oModuleModel = getModel('module'); |
883 | 883 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | } |
886 | 886 | // Module_srl passed the array may be a check whether the array |
887 | 887 | $args = new stdClass; |
888 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
888 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
889 | 889 | else $args->module_srl = $obj->module_srl; |
890 | 890 | |
891 | 891 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
892 | - if(!$output->toBool()||!$output->data) return $output; |
|
892 | + if (!$output->toBool() || !$output->data) return $output; |
|
893 | 893 | |
894 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
894 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
895 | 895 | |
896 | 896 | return $output; |
897 | 897 | } |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | */ |
904 | 904 | function getDailyArchivedList($obj) |
905 | 905 | { |
906 | - if($obj->mid) |
|
906 | + if ($obj->mid) |
|
907 | 907 | { |
908 | 908 | $oModuleModel = getModel('module'); |
909 | 909 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -911,14 +911,14 @@ discard block |
||
911 | 911 | } |
912 | 912 | // Module_srl passed the array may be a check whether the array |
913 | 913 | $args = new stdClass; |
914 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
914 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
915 | 915 | else $args->module_srl = $obj->module_srl; |
916 | 916 | $args->regdate = $obj->regdate; |
917 | 917 | |
918 | 918 | $output = executeQuery('document.getDailyArchivedList', $args); |
919 | - if(!$output->toBool()) return $output; |
|
919 | + if (!$output->toBool()) return $output; |
|
920 | 920 | |
921 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
921 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
922 | 922 | |
923 | 923 | return $output; |
924 | 924 | } |
@@ -929,17 +929,17 @@ discard block |
||
929 | 929 | */ |
930 | 930 | function getDocumentCategories() |
931 | 931 | { |
932 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
932 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
933 | 933 | $module_srl = Context::get('module_srl'); |
934 | - $categories= $this->getCategoryList($module_srl); |
|
934 | + $categories = $this->getCategoryList($module_srl); |
|
935 | 935 | $lang = Context::get('lang'); |
936 | 936 | // No additional category |
937 | 937 | $output = "0,0,{$lang->none_category}\n"; |
938 | - if($categories) |
|
938 | + if ($categories) |
|
939 | 939 | { |
940 | - foreach($categories as $category_srl => $category) |
|
940 | + foreach ($categories as $category_srl => $category) |
|
941 | 941 | { |
942 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
942 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
943 | 943 | } |
944 | 944 | } |
945 | 945 | $this->add('categories', $output); |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | */ |
952 | 952 | function getDocumentConfig() |
953 | 953 | { |
954 | - if($this->documentConfig === NULL) |
|
954 | + if ($this->documentConfig === NULL) |
|
955 | 955 | { |
956 | 956 | $oModuleModel = getModel('module'); |
957 | 957 | $config = $oModuleModel->getModuleConfig('document'); |
@@ -1024,11 +1024,11 @@ discard block |
||
1024 | 1024 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1025 | 1025 | // Check permissions |
1026 | 1026 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1027 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
1027 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
1028 | 1028 | |
1029 | 1029 | $category_srl = Context::get('category_srl'); |
1030 | 1030 | $category_info = $this->getCategory($category_srl); |
1031 | - if(!$category_info) |
|
1031 | + if (!$category_info) |
|
1032 | 1032 | { |
1033 | 1033 | return new BaseObject(-1, 'msg_invalid_request'); |
1034 | 1034 | } |
@@ -1044,14 +1044,14 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | function getDocumentSrlByAlias($mid, $alias) |
1046 | 1046 | { |
1047 | - if(!$mid || !$alias) return null; |
|
1047 | + if (!$mid || !$alias) return null; |
|
1048 | 1048 | $site_module_info = Context::get('site_module_info'); |
1049 | 1049 | $args = new stdClass; |
1050 | 1050 | $args->mid = $mid; |
1051 | 1051 | $args->alias_title = $alias; |
1052 | 1052 | $args->site_srl = $site_module_info->site_srl; |
1053 | 1053 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1054 | - if(!$output->data) return null; |
|
1054 | + if (!$output->data) return null; |
|
1055 | 1055 | else return $output->data->document_srl; |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1063,15 +1063,15 @@ discard block |
||
1063 | 1063 | */ |
1064 | 1064 | function getDocumentSrlByTitle($module_srl, $title) |
1065 | 1065 | { |
1066 | - if(!$module_srl || !$title) return null; |
|
1066 | + if (!$module_srl || !$title) return null; |
|
1067 | 1067 | $args = new stdClass; |
1068 | 1068 | $args->module_srl = $module_srl; |
1069 | 1069 | $args->title = $title; |
1070 | 1070 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1071 | - if(!$output->data) return null; |
|
1071 | + if (!$output->data) return null; |
|
1072 | 1072 | else |
1073 | 1073 | { |
1074 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1074 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
1075 | 1075 | return $output->data->document_srl; |
1076 | 1076 | } |
1077 | 1077 | } |
@@ -1083,12 +1083,12 @@ discard block |
||
1083 | 1083 | */ |
1084 | 1084 | function getAlias($document_srl) |
1085 | 1085 | { |
1086 | - if(!$document_srl) return null; |
|
1086 | + if (!$document_srl) return null; |
|
1087 | 1087 | $args = new stdClass; |
1088 | 1088 | $args->document_srl = $document_srl; |
1089 | 1089 | $output = executeQueryArray('document.getAliases', $args); |
1090 | 1090 | |
1091 | - if(!$output->data) return null; |
|
1091 | + if (!$output->data) return null; |
|
1092 | 1092 | else return $output->data[0]->alias_title; |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1131,32 +1131,32 @@ discard block |
||
1131 | 1131 | { |
1132 | 1132 | // Variable check |
1133 | 1133 | $args = new stdClass; |
1134 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
1134 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
1135 | 1135 | $args->sort_index = $obj->sort_index; |
1136 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
1137 | - $args->page = $obj->page?$obj->page:1; |
|
1138 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
1139 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
1136 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
1137 | + $args->page = $obj->page ? $obj->page : 1; |
|
1138 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
1139 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
1140 | 1140 | // Search options |
1141 | 1141 | $search_target = $obj->search_target; |
1142 | 1142 | $search_keyword = $obj->search_keyword; |
1143 | - if($search_target && $search_keyword) |
|
1143 | + if ($search_target && $search_keyword) |
|
1144 | 1144 | { |
1145 | - switch($search_target) |
|
1145 | + switch ($search_target) |
|
1146 | 1146 | { |
1147 | 1147 | case 'title' : |
1148 | 1148 | case 'content' : |
1149 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1149 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1150 | 1150 | $args->{"s_".$search_target} = $search_keyword; |
1151 | 1151 | $use_division = true; |
1152 | 1152 | break; |
1153 | 1153 | case 'title_content' : |
1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1154 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1155 | 1155 | $args->s_title = $search_keyword; |
1156 | 1156 | $args->s_content = $search_keyword; |
1157 | 1157 | break; |
1158 | 1158 | case 'user_id' : |
1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1160 | 1160 | $args->s_user_id = $search_keyword; |
1161 | 1161 | $args->sort_index = 'documents.'.$args->sort_index; |
1162 | 1162 | break; |
@@ -1164,13 +1164,13 @@ discard block |
||
1164 | 1164 | case 'nick_name' : |
1165 | 1165 | case 'email_address' : |
1166 | 1166 | case 'homepage' : |
1167 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1167 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1168 | 1168 | $args->{"s_".$search_target} = $search_keyword; |
1169 | 1169 | break; |
1170 | 1170 | case 'is_notice' : |
1171 | 1171 | case 'is_secret' : |
1172 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1173 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1172 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1173 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1174 | 1174 | break; |
1175 | 1175 | case 'member_srl' : |
1176 | 1176 | case 'readed_count' : |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | case 'comment_count' : |
1180 | 1180 | case 'trackback_count' : |
1181 | 1181 | case 'uploaded_count' : |
1182 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1182 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1183 | 1183 | break; |
1184 | 1184 | case 'regdate' : |
1185 | 1185 | case 'last_update' : |
@@ -1191,9 +1191,9 @@ discard block |
||
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | $output = executeQueryArray('document.getTrashList', $args); |
1194 | - if($output->data) |
|
1194 | + if ($output->data) |
|
1195 | 1195 | { |
1196 | - foreach($output->data as $key => $attribute) |
|
1196 | + foreach ($output->data as $key => $attribute) |
|
1197 | 1197 | { |
1198 | 1198 | $oDocument = null; |
1199 | 1199 | $oDocument = new documentItem(); |
@@ -1212,46 +1212,46 @@ discard block |
||
1212 | 1212 | { |
1213 | 1213 | $args = new stdClass; |
1214 | 1214 | $document_srl = Context::get('document_srl'); |
1215 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
1215 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1216 | 1216 | |
1217 | 1217 | $point = Context::get('point'); |
1218 | - if($point != -1) $point = 1; |
|
1218 | + if ($point != -1) $point = 1; |
|
1219 | 1219 | |
1220 | 1220 | $oDocumentModel = getModel('document'); |
1221 | 1221 | $columnList = array('document_srl', 'module_srl'); |
1222 | 1222 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1223 | 1223 | $module_srl = $oDocument->get('module_srl'); |
1224 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1224 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1225 | 1225 | |
1226 | 1226 | $oModuleModel = getModel('module'); |
1227 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
1228 | - if($point == -1) |
|
1227 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
1228 | + if ($point == -1) |
|
1229 | 1229 | { |
1230 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1230 | + if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1231 | 1231 | $args->below_point = 0; |
1232 | 1232 | } |
1233 | 1233 | else |
1234 | 1234 | { |
1235 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1235 | + if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1236 | 1236 | $args->more_point = 0; |
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | $args->document_srl = $document_srl; |
1240 | 1240 | |
1241 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
1242 | - if(!$output->toBool()) return $output; |
|
1241 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
1242 | + if (!$output->toBool()) return $output; |
|
1243 | 1243 | |
1244 | 1244 | $oMemberModel = getModel('member'); |
1245 | - if($output->data) |
|
1245 | + if ($output->data) |
|
1246 | 1246 | { |
1247 | - foreach($output->data as $k => $d) |
|
1247 | + foreach ($output->data as $k => $d) |
|
1248 | 1248 | { |
1249 | 1249 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
1250 | 1250 | $output->data[$k]->src = $profile_image->src; |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - $this->add('voted_member_list',$output->data); |
|
1254 | + $this->add('voted_member_list', $output->data); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | function getStatusNameList() |
1262 | 1262 | { |
1263 | 1263 | global $lang; |
1264 | - if(!isset($lang->status_name_list)) |
|
1264 | + if (!isset($lang->status_name_list)) |
|
1265 | 1265 | return array_flip($this->getStatusList()); |
1266 | 1266 | else return $lang->status_name_list; |
1267 | 1267 | } |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | { |
1277 | 1277 | $sortIndex = $obj->sort_index; |
1278 | 1278 | $isExtraVars = false; |
1279 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
1279 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
1280 | 1280 | { |
1281 | 1281 | // get module_srl extra_vars list |
1282 | 1282 | if ($load_extra_vars) |
@@ -1291,11 +1291,11 @@ discard block |
||
1291 | 1291 | else |
1292 | 1292 | { |
1293 | 1293 | $check_array = array(); |
1294 | - foreach($extra_output->data as $val) |
|
1294 | + foreach ($extra_output->data as $val) |
|
1295 | 1295 | { |
1296 | 1296 | $check_array[] = $val->eid; |
1297 | 1297 | } |
1298 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1298 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1299 | 1299 | else $isExtraVars = true; |
1300 | 1300 | } |
1301 | 1301 | } |
@@ -1323,13 +1323,13 @@ discard block |
||
1323 | 1323 | { |
1324 | 1324 | // Variable check |
1325 | 1325 | $args = new stdClass(); |
1326 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
1326 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
1327 | 1327 | $args->order_type = $searchOpt->order_type; |
1328 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
1329 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
1330 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
1331 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
1332 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
1328 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
1329 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
1330 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
1331 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
1332 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
1333 | 1333 | $args->member_srl = $searchOpt->member_srl; |
1334 | 1334 | $args->member_srls = $searchOpt->member_srls; |
1335 | 1335 | |
@@ -1339,10 +1339,10 @@ discard block |
||
1339 | 1339 | |
1340 | 1340 | // Check the target and sequence alignment |
1341 | 1341 | $orderType = array('desc' => 1, 'asc' => 1); |
1342 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1342 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1343 | 1343 | |
1344 | 1344 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1345 | - if($searchOpt->mid) |
|
1345 | + if ($searchOpt->mid) |
|
1346 | 1346 | { |
1347 | 1347 | $oModuleModel = getModel('module'); |
1348 | 1348 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1350,30 +1350,30 @@ discard block |
||
1350 | 1350 | } |
1351 | 1351 | |
1352 | 1352 | // Module_srl passed the array may be a check whether the array |
1353 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1353 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1354 | 1354 | else $args->module_srl = $searchOpt->module_srl; |
1355 | 1355 | |
1356 | 1356 | // Except for the test module_srl |
1357 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1357 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1358 | 1358 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
1359 | 1359 | |
1360 | 1360 | // only admin document list, temp document showing |
1361 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1361 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1362 | 1362 | else |
1363 | 1363 | { |
1364 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1364 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1365 | 1365 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
1366 | 1366 | else |
1367 | 1367 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | // Category is selected, further sub-categories until all conditions |
1371 | - if($args->category_srl) |
|
1371 | + if ($args->category_srl) |
|
1372 | 1372 | { |
1373 | 1373 | $category_list = $this->getCategoryList($args->module_srl); |
1374 | 1374 | $category_info = $category_list[$args->category_srl]; |
1375 | 1375 | $category_info->childs[] = $args->category_srl; |
1376 | - $args->category_srl = implode(',',$category_info->childs); |
|
1376 | + $args->category_srl = implode(',', $category_info->childs); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1386,24 +1386,24 @@ discard block |
||
1386 | 1386 | $search_target = $searchOpt->search_target; |
1387 | 1387 | $search_keyword = $searchOpt->search_keyword; |
1388 | 1388 | |
1389 | - if($search_target && $search_keyword) |
|
1389 | + if ($search_target && $search_keyword) |
|
1390 | 1390 | { |
1391 | - switch($search_target) |
|
1391 | + switch ($search_target) |
|
1392 | 1392 | { |
1393 | 1393 | case 'title' : |
1394 | 1394 | case 'content' : |
1395 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1395 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1396 | 1396 | $args->{"s_".$search_target} = $search_keyword; |
1397 | 1397 | $use_division = true; |
1398 | 1398 | break; |
1399 | 1399 | case 'title_content' : |
1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1400 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1401 | 1401 | $args->s_title = $search_keyword; |
1402 | 1402 | $args->s_content = $search_keyword; |
1403 | 1403 | $use_division = true; |
1404 | 1404 | break; |
1405 | 1405 | case 'user_id' : |
1406 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1406 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1407 | 1407 | $args->s_user_id = $search_keyword; |
1408 | 1408 | $args->sort_index = 'documents.'.$args->sort_index; |
1409 | 1409 | break; |
@@ -1411,18 +1411,18 @@ discard block |
||
1411 | 1411 | case 'nick_name' : |
1412 | 1412 | case 'email_address' : |
1413 | 1413 | case 'homepage' : |
1414 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1414 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1415 | 1415 | $args->{"s_".$search_target} = $search_keyword; |
1416 | 1416 | break; |
1417 | 1417 | case 'is_notice' : |
1418 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1419 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1418 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
1419 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
1420 | 1420 | else $args->{"s_".$search_target} = ''; |
1421 | 1421 | break; |
1422 | 1422 | case 'is_secret' : |
1423 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1424 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1425 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1423 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1424 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1425 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1426 | 1426 | break; |
1427 | 1427 | case 'member_srl' : |
1428 | 1428 | case 'readed_count' : |
@@ -1430,17 +1430,17 @@ discard block |
||
1430 | 1430 | case 'comment_count' : |
1431 | 1431 | case 'trackback_count' : |
1432 | 1432 | case 'uploaded_count' : |
1433 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1433 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1434 | 1434 | break; |
1435 | 1435 | case 'member_srls' : |
1436 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1436 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1437 | 1437 | |
1438 | - if($logged_info->member_srl) |
|
1438 | + if ($logged_info->member_srl) |
|
1439 | 1439 | { |
1440 | 1440 | $srls = explode(',', $search_keyword); |
1441 | - foreach($srls as $srl) |
|
1441 | + foreach ($srls as $srl) |
|
1442 | 1442 | { |
1443 | - if(abs($srl) != $logged_info->member_srl) |
|
1443 | + if (abs($srl) != $logged_info->member_srl) |
|
1444 | 1444 | { |
1445 | 1445 | break; // foreach |
1446 | 1446 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | } |
1452 | 1452 | break; |
1453 | 1453 | case 'blamed_count' : |
1454 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
1454 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
1455 | 1455 | break; |
1456 | 1456 | case 'regdate' : |
1457 | 1457 | case 'last_update' : |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $use_division = true; |
1465 | 1465 | break; |
1466 | 1466 | case 'tag' : |
1467 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
1467 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
1468 | 1468 | $query_id = 'document.getDocumentListWithinTag'; |
1469 | 1469 | break; |
1470 | 1470 | case 'extra_vars': |
@@ -1472,9 +1472,9 @@ discard block |
||
1472 | 1472 | $query_id = 'document.getDocumentListWithinExtraVars'; |
1473 | 1473 | break; |
1474 | 1474 | default : |
1475 | - if(strpos($search_target,'extra_vars')!==false) { |
|
1475 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
1476 | 1476 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
1477 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
1477 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
1478 | 1478 | $args->sort_index = 'documents.'.$args->sort_index; |
1479 | 1479 | $query_id = 'document.getDocumentListWithExtraVars'; |
1480 | 1480 | } |
@@ -1491,18 +1491,18 @@ discard block |
||
1491 | 1491 | /** |
1492 | 1492 | * list_order asc sort of division that can be used only when |
1493 | 1493 | */ |
1494 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1494 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1495 | 1495 | |
1496 | 1496 | /** |
1497 | 1497 | * If it is true, use_division changed to use the document division |
1498 | 1498 | */ |
1499 | - if($use_division) |
|
1499 | + if ($use_division) |
|
1500 | 1500 | { |
1501 | 1501 | // Division begins |
1502 | - $division = (int)Context::get('division'); |
|
1502 | + $division = (int) Context::get('division'); |
|
1503 | 1503 | |
1504 | 1504 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
1505 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1505 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1506 | 1506 | { |
1507 | 1507 | $listSqlID = 'document.getDocumentListUseIndex'; |
1508 | 1508 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | // If you do not value the best division top |
1517 | - if(!$division) |
|
1517 | + if (!$division) |
|
1518 | 1518 | { |
1519 | 1519 | $division_args = new stdClass(); |
1520 | 1520 | $division_args->module_srl = $args->module_srl; |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | $division_args->statusList = $args->statusList; |
1526 | 1526 | |
1527 | 1527 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
1528 | - if($output->data) |
|
1528 | + if ($output->data) |
|
1529 | 1529 | { |
1530 | 1530 | $item = array_pop($output->data); |
1531 | 1531 | $division = $item->list_order; |
@@ -1534,10 +1534,10 @@ discard block |
||
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | // The last division |
1537 | - $last_division = (int)Context::get('last_division'); |
|
1537 | + $last_division = (int) Context::get('last_division'); |
|
1538 | 1538 | |
1539 | 1539 | // Division after division from the 5000 value of the specified Wanted |
1540 | - if(!$last_division) |
|
1540 | + if (!$last_division) |
|
1541 | 1541 | { |
1542 | 1542 | $last_division_args = new stdClass(); |
1543 | 1543 | $last_division_args->module_srl = $args->module_srl; |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | $last_division_args->page = 5001; |
1550 | 1550 | |
1551 | 1551 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
1552 | - if($output->data) |
|
1552 | + if ($output->data) |
|
1553 | 1553 | { |
1554 | 1554 | $item = array_pop($output->data); |
1555 | 1555 | $last_division = $item->list_order; |
@@ -1557,14 +1557,14 @@ discard block |
||
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | // Make sure that after last_division article |
1560 | - if($last_division) |
|
1560 | + if ($last_division) |
|
1561 | 1561 | { |
1562 | 1562 | $last_division_args = new stdClass(); |
1563 | 1563 | $last_division_args->module_srl = $args->module_srl; |
1564 | 1564 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1565 | 1565 | $last_division_args->list_order = $last_division; |
1566 | 1566 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1567 | - if($output->data->count<1) $last_division = null; |
|
1567 | + if ($output->data->count < 1) $last_division = null; |
|
1568 | 1568 | } |
1569 | 1569 | |
1570 | 1570 | $args->division = $division; |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | * @param int $count |
1598 | 1598 | * @return object |
1599 | 1599 | */ |
1600 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
1600 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
1601 | 1601 | { |
1602 | 1602 | $args = new stdClass(); |
1603 | 1603 | $args->member_srl = $member_srl; |
@@ -1605,8 +1605,8 @@ discard block |
||
1605 | 1605 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1606 | 1606 | $document_list = $output->data; |
1607 | 1607 | |
1608 | - if(!$document_list) return array(); |
|
1609 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1608 | + if (!$document_list) return array(); |
|
1609 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
1610 | 1610 | |
1611 | 1611 | return $document_list; |
1612 | 1612 | } |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | function getDocumentExtraImagePath() |
1619 | 1619 | { |
1620 | 1620 | $documentConfig = getModel('document')->getDocumentConfig(); |
1621 | - if(Mobile::isFromMobilePhone()) |
|
1621 | + if (Mobile::isFromMobilePhone()) |
|
1622 | 1622 | { |
1623 | 1623 | $iconSkin = $documentConfig->micons; |
1624 | 1624 | } |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | { |
1627 | 1627 | $iconSkin = $documentConfig->icons; |
1628 | 1628 | } |
1629 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1629 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1630 | 1630 | |
1631 | 1631 | return $path; |
1632 | 1632 | } |
@@ -8,6 +8,9 @@ |
||
8 | 8 | |
9 | 9 | if(!function_exists('lcfirst')) |
10 | 10 | { |
11 | + /** |
|
12 | + * @param string $text |
|
13 | + */ |
|
11 | 14 | function lcfirst($text) |
12 | 15 | { |
13 | 16 | return strtolower(substr($text, 0, 1)) . substr($text, 1); |
@@ -6,11 +6,11 @@ |
||
6 | 6 | * @brief Krzip module high class. |
7 | 7 | */ |
8 | 8 | |
9 | -if(!function_exists('lcfirst')) |
|
9 | +if (!function_exists('lcfirst')) |
|
10 | 10 | { |
11 | 11 | function lcfirst($text) |
12 | 12 | { |
13 | - return strtolower(substr($text, 0, 1)) . substr($text, 1); |
|
13 | + return strtolower(substr($text, 0, 1)).substr($text, 1); |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 |
@@ -54,6 +54,9 @@ discard block |
||
54 | 54 | return $config; |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $property |
|
59 | + */ |
|
57 | 60 | public function addMeta($property, $content, $attr_name = 'property') |
58 | 61 | { |
59 | 62 | if (!$content) return; |
@@ -68,6 +71,10 @@ discard block |
||
68 | 71 | $this->SEO['meta'][] = array('property' => $property, 'content' => $content, 'attr_name' => $attr_name); |
69 | 72 | } |
70 | 73 | |
74 | + /** |
|
75 | + * @param string $rel |
|
76 | + * @param string $href |
|
77 | + */ |
|
71 | 78 | public function addLink($rel, $href) |
72 | 79 | { |
73 | 80 | if (!$href) return; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $oModuleModel = getModel('module'); |
21 | 21 | $config = $oModuleModel->getModuleConfig('seo'); |
22 | 22 | |
23 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
23 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
24 | 24 | $IDN = new idna_convert(array('idn_version' => 2008)); |
25 | 25 | $request_uri = $IDN->encode(Context::get('request_uri')); |
26 | 26 | |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | if (!$config->ga_track_subdomain) $config->ga_track_subdomain = 'N'; |
32 | 32 | if ($config->site_image) |
33 | 33 | { |
34 | - $config->site_image_url = $request_uri . 'files/attach/site_image/' . $config->site_image; |
|
34 | + $config->site_image_url = $request_uri.'files/attach/site_image/'.$config->site_image; |
|
35 | 35 | |
36 | 36 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
37 | - if($oCacheHandler->isSupport()) { |
|
37 | + if ($oCacheHandler->isSupport()) { |
|
38 | 38 | $site_image = false; |
39 | 39 | $cache_key = 'seo:site_image'; |
40 | 40 | $site_image = $oCacheHandler->get($cache_key); |
41 | - if(!$site_image) { |
|
42 | - $path = _XE_PATH_ . 'files/attach/site_image/'; |
|
43 | - list($width, $height) = @getimagesize($path . $config->site_image); |
|
41 | + if (!$site_image) { |
|
42 | + $path = _XE_PATH_.'files/attach/site_image/'; |
|
43 | + list($width, $height) = @getimagesize($path.$config->site_image); |
|
44 | 44 | $site_image_dimension = array( |
45 | 45 | 'width' => $width, |
46 | 46 | 'height' => $height |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | foreach ($list as $val) { |
87 | 87 | if ($type == 'meta') { |
88 | 88 | $attr_name = $val['attr_name']; |
89 | - Context::addHtmlHeader('<meta ' . $attr_name . '="' . $val['property'] . '" content="' . $val['content'] . '" />'); |
|
89 | + Context::addHtmlHeader('<meta '.$attr_name.'="'.$val['property'].'" content="'.$val['content'].'" />'); |
|
90 | 90 | } elseif ($type == 'link') { |
91 | - Context::addHtmlHeader('<link rel="' . $val['rel'] . '" href="' . $val['href'] . '" />'); |
|
91 | + Context::addHtmlHeader('<link rel="'.$val['rel'].'" href="'.$val['href'].'" />'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | </script> |
115 | 115 | GASCRIPT; |
116 | 116 | |
117 | - Context::addHtmlHeader($ga_script . PHP_EOL); |
|
117 | + Context::addHtmlHeader($ga_script.PHP_EOL); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Naver Analytics |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <script src="//wcs.naver.net/wcslog.js"></script> |
125 | 125 | <script>if(!wcs_add){var wcs_add={wa:'{$config->na_id}'};}if(typeof wcs_do!="undefined"){wcs_do();}</script> |
126 | 126 | NASCRIPT; |
127 | - Context::addHtmlFooter($na_script . PHP_EOL); |
|
127 | + Context::addHtmlFooter($na_script.PHP_EOL); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $seo_config = $this->getConfig(); |
141 | 141 | |
142 | - if($seo_config->enable === 'Y') { |
|
142 | + if ($seo_config->enable === 'Y') { |
|
143 | 143 | foreach ($this->triggers as $trigger) { |
144 | 144 | if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return TRUE; |
145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $seo_config = $this->getConfig(); |
157 | 157 | |
158 | - if($seo_config->enable === 'Y') { |
|
158 | + if ($seo_config->enable === 'Y') { |
|
159 | 159 | foreach ($this->triggers as $trigger) { |
160 | 160 | if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) { |
161 | 161 | $oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); |
@@ -24,11 +24,21 @@ discard block |
||
24 | 24 | $IDN = new idna_convert(array('idn_version' => 2008)); |
25 | 25 | $request_uri = $IDN->encode(Context::get('request_uri')); |
26 | 26 | |
27 | - if (!$config) $config = new stdClass; |
|
28 | - if (!$config->enable) $config->enable = 'Y'; |
|
29 | - if (!$config->use_optimize_title) $config->use_optimize_title = 'N'; |
|
30 | - if (!$config->ga_except_admin) $config->ga_except_admin = 'N'; |
|
31 | - if (!$config->ga_track_subdomain) $config->ga_track_subdomain = 'N'; |
|
27 | + if (!$config) { |
|
28 | + $config = new stdClass; |
|
29 | + } |
|
30 | + if (!$config->enable) { |
|
31 | + $config->enable = 'Y'; |
|
32 | + } |
|
33 | + if (!$config->use_optimize_title) { |
|
34 | + $config->use_optimize_title = 'N'; |
|
35 | + } |
|
36 | + if (!$config->ga_except_admin) { |
|
37 | + $config->ga_except_admin = 'N'; |
|
38 | + } |
|
39 | + if (!$config->ga_track_subdomain) { |
|
40 | + $config->ga_track_subdomain = 'N'; |
|
41 | + } |
|
32 | 42 | if ($config->site_image) |
33 | 43 | { |
34 | 44 | $config->site_image_url = $request_uri . 'files/attach/site_image/' . $config->site_image; |
@@ -56,7 +66,9 @@ discard block |
||
56 | 66 | |
57 | 67 | public function addMeta($property, $content, $attr_name = 'property') |
58 | 68 | { |
59 | - if (!$content) return; |
|
69 | + if (!$content) { |
|
70 | + return; |
|
71 | + } |
|
60 | 72 | |
61 | 73 | $oModuleController = getController('module'); |
62 | 74 | $oModuleController->replaceDefinedLangCode($content); |
@@ -70,7 +82,9 @@ discard block |
||
70 | 82 | |
71 | 83 | public function addLink($rel, $href) |
72 | 84 | { |
73 | - if (!$href) return; |
|
85 | + if (!$href) { |
|
86 | + return; |
|
87 | + } |
|
74 | 88 | |
75 | 89 | $this->SEO['link'][] = array('rel' => $rel, 'href' => $href); |
76 | 90 | } |
@@ -81,7 +95,9 @@ discard block |
||
81 | 95 | $logged_info = Context::get('logged_info'); |
82 | 96 | |
83 | 97 | foreach ($this->SEO as $type => $list) { |
84 | - if (!$list || !count($list)) continue; |
|
98 | + if (!$list || !count($list)) { |
|
99 | + continue; |
|
100 | + } |
|
85 | 101 | |
86 | 102 | foreach ($list as $val) { |
87 | 103 | if ($type == 'meta') { |
@@ -141,7 +157,9 @@ discard block |
||
141 | 157 | |
142 | 158 | if($seo_config->enable === 'Y') { |
143 | 159 | foreach ($this->triggers as $trigger) { |
144 | - if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return TRUE; |
|
160 | + if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) { |
|
161 | + return TRUE; |
|
162 | + } |
|
145 | 163 | } |
146 | 164 | } |
147 | 165 |
@@ -174,6 +174,9 @@ |
||
174 | 174 | $output = executeQuery('syndication.deleteLog', $args); |
175 | 175 | } |
176 | 176 | |
177 | + /** |
|
178 | + * @param string $type |
|
179 | + */ |
|
177 | 180 | function ping($id, $type, $page=1) { |
178 | 181 | $this->ping_message = ''; |
179 | 182 | debugPrint($id); |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
15 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
16 | 16 | |
17 | 17 | $oSyndicationModel = getModel('syndication'); |
18 | 18 | $oModuleModel = getModel('module'); |
19 | 19 | |
20 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
20 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
21 | 21 | |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | 23 | |
24 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
24 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
25 | 25 | |
26 | 26 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
27 | 27 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | function triggerUpdateDocument(&$obj) { |
34 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
34 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
35 | 35 | |
36 | 36 | $oSyndicationModel = getModel('syndication'); |
37 | 37 | $oModuleModel = getModel('module'); |
38 | 38 | |
39 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
39 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
40 | 40 | |
41 | 41 | $config = $oModuleModel->getModuleConfig('syndication'); |
42 | 42 | |
43 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
43 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
44 | 44 | |
45 | 45 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
46 | 46 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | function triggerDeleteDocument(&$obj) { |
53 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
53 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
54 | 54 | |
55 | 55 | $oSyndicationModel = getModel('syndication'); |
56 | 56 | $oModuleModel = getModel('module'); |
57 | 57 | |
58 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
58 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
59 | 59 | |
60 | 60 | $config = $oModuleModel->getModuleConfig('syndication'); |
61 | 61 | |
62 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
62 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
63 | 63 | |
64 | 64 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
65 | 65 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | $oSyndicationModel = getModel('syndication'); |
76 | 76 | $oModuleModel = getModel('module'); |
77 | 77 | |
78 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
78 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
79 | 79 | |
80 | 80 | $config = $oModuleModel->getModuleConfig('syndication'); |
81 | 81 | |
82 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
82 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
83 | 83 | |
84 | 84 | $output = executeQuery('syndication.getExceptModule', $obj); |
85 | - if($output->data->count) return $this->makeObject(); |
|
85 | + if ($output->data->count) return $this->makeObject(); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $id = $oSyndicationModel->getID('site', $obj->module_srl); |
@@ -93,21 +93,21 @@ discard block |
||
93 | 93 | |
94 | 94 | function triggerMoveDocumentModule(&$obj) |
95 | 95 | { |
96 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
96 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
97 | 97 | |
98 | 98 | $oSyndicationModel = getModel('syndication'); |
99 | 99 | $oModuleModel = getModel('module'); |
100 | 100 | |
101 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
101 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
102 | 102 | |
103 | 103 | $config = $oModuleModel->getModuleConfig('syndication'); |
104 | 104 | |
105 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
105 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
106 | 106 | |
107 | 107 | $arr_document_srl = explode(',', $obj->document_srls); |
108 | - if(!$arr_document_srl) return $this->makeObject(); |
|
108 | + if (!$arr_document_srl) return $this->makeObject(); |
|
109 | 109 | |
110 | - foreach($arr_document_srl as $document_srl) |
|
110 | + foreach ($arr_document_srl as $document_srl) |
|
111 | 111 | { |
112 | 112 | $target_id = sprintf('%s-%s', $obj->module_srl, $document_srl); |
113 | 113 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | $oSyndicationModel = getModel('syndication'); |
122 | 122 | $oModuleModel = getModel('module'); |
123 | 123 | |
124 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
124 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
125 | 125 | |
126 | 126 | $config = $oModuleModel->getModuleConfig('syndication'); |
127 | 127 | |
128 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
128 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
129 | 129 | |
130 | 130 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
131 | 131 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | $oSyndicationModel = getModel('syndication'); |
141 | 141 | $oModuleModel = getModel('module'); |
142 | 142 | |
143 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
143 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
144 | 144 | |
145 | 145 | $config = $oModuleModel->getModuleConfig('syndication'); |
146 | 146 | |
147 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
147 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
148 | 148 | |
149 | 149 | // 신디케이션 삭제 로그 제거 |
150 | 150 | $this->deleteLog($obj->module_srl, $obj->document_srl); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $output = executeQuery('syndication.deleteLog', $args); |
175 | 175 | } |
176 | 176 | |
177 | - function ping($id, $type, $page=1) { |
|
177 | + function ping($id, $type, $page = 1) { |
|
178 | 178 | $this->ping_message = ''; |
179 | 179 | debugPrint($id); |
180 | 180 | $oSyndicationModel = getModel('syndication'); |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $oModuleModel = getModel('module'); |
183 | 183 | $config = $oModuleModel->getModuleConfig('syndication'); |
184 | 184 | |
185 | - if(!$config->syndication_token) |
|
185 | + if (!$config->syndication_token) |
|
186 | 186 | { |
187 | 187 | $this->ping_message = 'Syndication Token empty'; |
188 | 188 | $oSyndicationModel->setResentPingLog($this->ping_message); |
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - if(!$this->checkOpenSSLSupport()) |
|
192 | + if (!$this->checkOpenSSLSupport()) |
|
193 | 193 | { |
194 | 194 | $lang = Context::get('lang'); |
195 | 195 | $this->ping_message = $lang->msg_need_openssl_support; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - if(substr($config->site_url,-1)!='/') |
|
200 | + if (substr($config->site_url, -1) != '/') |
|
201 | 201 | { |
202 | 202 | $config->site_url .= '/'; |
203 | 203 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $buff = FileHandler::getRemoteResource($ping_url, null, 10, 'POST', 'application/x-www-form-urlencoded', $ping_header, array(), array('ping_url'=>$ping_body), $request_config); |
218 | 218 | |
219 | 219 | $xml = new XmlParser(); |
220 | - $xmlDoc= $xml->parse($buff); |
|
220 | + $xmlDoc = $xml->parse($buff); |
|
221 | 221 | |
222 | - if($xmlDoc->result->error_code->body != '000') |
|
222 | + if ($xmlDoc->result->error_code->body != '000') |
|
223 | 223 | { |
224 | - if(!$buff) |
|
224 | + if (!$buff) |
|
225 | 225 | { |
226 | 226 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
227 | 227 | } |
@@ -12,16 +12,22 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
15 | + if($obj->module_srl < 1) { |
|
16 | + return $this->makeObject(); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $oSyndicationModel = getModel('syndication'); |
18 | 20 | $oModuleModel = getModel('module'); |
19 | 21 | |
20 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
22 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
23 | + return $this->makeObject(); |
|
24 | + } |
|
21 | 25 | |
22 | 26 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | 27 | |
24 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
28 | + if($config->syndication_use!='Y') { |
|
29 | + return $this->makeObject(); |
|
30 | + } |
|
25 | 31 | |
26 | 32 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
27 | 33 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -31,16 +37,22 @@ discard block |
||
31 | 37 | } |
32 | 38 | |
33 | 39 | function triggerUpdateDocument(&$obj) { |
34 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
40 | + if($obj->module_srl < 1) { |
|
41 | + return $this->makeObject(); |
|
42 | + } |
|
35 | 43 | |
36 | 44 | $oSyndicationModel = getModel('syndication'); |
37 | 45 | $oModuleModel = getModel('module'); |
38 | 46 | |
39 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
47 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
48 | + return $this->makeObject(); |
|
49 | + } |
|
40 | 50 | |
41 | 51 | $config = $oModuleModel->getModuleConfig('syndication'); |
42 | 52 | |
43 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
53 | + if($config->syndication_use!='Y') { |
|
54 | + return $this->makeObject(); |
|
55 | + } |
|
44 | 56 | |
45 | 57 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
46 | 58 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,16 +62,22 @@ discard block |
||
50 | 62 | } |
51 | 63 | |
52 | 64 | function triggerDeleteDocument(&$obj) { |
53 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
65 | + if($obj->module_srl < 1) { |
|
66 | + return $this->makeObject(); |
|
67 | + } |
|
54 | 68 | |
55 | 69 | $oSyndicationModel = getModel('syndication'); |
56 | 70 | $oModuleModel = getModel('module'); |
57 | 71 | |
58 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
72 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
73 | + return $this->makeObject(); |
|
74 | + } |
|
59 | 75 | |
60 | 76 | $config = $oModuleModel->getModuleConfig('syndication'); |
61 | 77 | |
62 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
78 | + if($config->syndication_use!='Y') { |
|
79 | + return $this->makeObject(); |
|
80 | + } |
|
63 | 81 | |
64 | 82 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
65 | 83 | |
@@ -75,14 +93,20 @@ discard block |
||
75 | 93 | $oSyndicationModel = getModel('syndication'); |
76 | 94 | $oModuleModel = getModel('module'); |
77 | 95 | |
78 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
96 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
97 | + return $this->makeObject(); |
|
98 | + } |
|
79 | 99 | |
80 | 100 | $config = $oModuleModel->getModuleConfig('syndication'); |
81 | 101 | |
82 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
102 | + if($config->syndication_use!='Y') { |
|
103 | + return $this->makeObject(); |
|
104 | + } |
|
83 | 105 | |
84 | 106 | $output = executeQuery('syndication.getExceptModule', $obj); |
85 | - if($output->data->count) return $this->makeObject(); |
|
107 | + if($output->data->count) { |
|
108 | + return $this->makeObject(); |
|
109 | + } |
|
86 | 110 | |
87 | 111 | |
88 | 112 | $id = $oSyndicationModel->getID('site', $obj->module_srl); |
@@ -93,19 +117,27 @@ discard block |
||
93 | 117 | |
94 | 118 | function triggerMoveDocumentModule(&$obj) |
95 | 119 | { |
96 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
120 | + if($obj->module_srl < 1) { |
|
121 | + return $this->makeObject(); |
|
122 | + } |
|
97 | 123 | |
98 | 124 | $oSyndicationModel = getModel('syndication'); |
99 | 125 | $oModuleModel = getModel('module'); |
100 | 126 | |
101 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
127 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
128 | + return $this->makeObject(); |
|
129 | + } |
|
102 | 130 | |
103 | 131 | $config = $oModuleModel->getModuleConfig('syndication'); |
104 | 132 | |
105 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
133 | + if($config->syndication_use!='Y') { |
|
134 | + return $this->makeObject(); |
|
135 | + } |
|
106 | 136 | |
107 | 137 | $arr_document_srl = explode(',', $obj->document_srls); |
108 | - if(!$arr_document_srl) return $this->makeObject(); |
|
138 | + if(!$arr_document_srl) { |
|
139 | + return $this->makeObject(); |
|
140 | + } |
|
109 | 141 | |
110 | 142 | foreach($arr_document_srl as $document_srl) |
111 | 143 | { |
@@ -121,11 +153,15 @@ discard block |
||
121 | 153 | $oSyndicationModel = getModel('syndication'); |
122 | 154 | $oModuleModel = getModel('module'); |
123 | 155 | |
124 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
156 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
157 | + return $this->makeObject(); |
|
158 | + } |
|
125 | 159 | |
126 | 160 | $config = $oModuleModel->getModuleConfig('syndication'); |
127 | 161 | |
128 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
162 | + if($config->syndication_use!='Y') { |
|
163 | + return $this->makeObject(); |
|
164 | + } |
|
129 | 165 | |
130 | 166 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
131 | 167 | |
@@ -140,11 +176,15 @@ discard block |
||
140 | 176 | $oSyndicationModel = getModel('syndication'); |
141 | 177 | $oModuleModel = getModel('module'); |
142 | 178 | |
143 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
179 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
180 | + return $this->makeObject(); |
|
181 | + } |
|
144 | 182 | |
145 | 183 | $config = $oModuleModel->getModuleConfig('syndication'); |
146 | 184 | |
147 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
185 | + if($config->syndication_use!='Y') { |
|
186 | + return $this->makeObject(); |
|
187 | + } |
|
148 | 188 | |
149 | 189 | // 신디케이션 삭제 로그 제거 |
150 | 190 | $this->deleteLog($obj->module_srl, $obj->document_srl); |
@@ -224,8 +264,7 @@ discard block |
||
224 | 264 | if(!$buff) |
225 | 265 | { |
226 | 266 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
227 | - } |
|
228 | - else |
|
267 | + } else |
|
229 | 268 | { |
230 | 269 | $this->ping_message = $xmlDoc->result->message->body; |
231 | 270 | } |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return $module_srls; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $key |
|
68 | + */ |
|
66 | 69 | function getLang($key, $site_srl) |
67 | 70 | { |
68 | 71 | if(!$this->langs[$site_srl]) |
@@ -438,6 +441,12 @@ discard block |
||
438 | 441 | return $article; |
439 | 442 | } |
440 | 443 | |
444 | + /** |
|
445 | + * @param string $startTime |
|
446 | + * @param string $endTime |
|
447 | + * @param string $type |
|
448 | + * @param string $id |
|
449 | + */ |
|
441 | 450 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
442 | 451 | if($this->site_url==null) $this->init(); |
443 | 452 | |
@@ -481,6 +490,12 @@ discard block |
||
481 | 490 | return $result; |
482 | 491 | } |
483 | 492 | |
493 | + /** |
|
494 | + * @param string $startTime |
|
495 | + * @param string $endTime |
|
496 | + * @param string $type |
|
497 | + * @param string $id |
|
498 | + */ |
|
484 | 499 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | 500 | if($this->site_url==null) $this->init(); |
486 | 501 | |
@@ -538,6 +553,9 @@ discard block |
||
538 | 553 | return $output->data; |
539 | 554 | } |
540 | 555 | |
556 | + /** |
|
557 | + * @param string $type |
|
558 | + */ |
|
541 | 559 | function getID($type, $target_id = null) { |
542 | 560 | if($this->site_url==null) $this->init(); |
543 | 561 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | private $site_url = null; |
13 | 13 | private $uri_scheme = 'http://'; |
14 | - private $syndication_password= null; |
|
14 | + private $syndication_password = null; |
|
15 | 15 | private $year = null; |
16 | 16 | private $langs = array(); |
17 | 17 | private $granted_modules = array(); |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if (Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
24 | 24 | |
25 | 25 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 26 | $this->syndication_password = $config->syndication_password; |
27 | 27 | $this->year = $config->year; |
28 | 28 | |
29 | 29 | $output = executeQueryArray('syndication.getGrantedModules'); |
30 | - if($output->data) { |
|
31 | - foreach($output->data as $key => $val) { |
|
30 | + if ($output->data) { |
|
31 | + foreach ($output->data as $key => $val) { |
|
32 | 32 | $this->granted_modules[] = $val->module_srl; |
33 | 33 | } |
34 | 34 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $args->module_srl = $module_srl; |
42 | 42 | |
43 | 43 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
44 | + if ($output->data->count) return TRUE; |
|
45 | 45 | |
46 | 46 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
47 | + if ($output->data->count) return TRUE; |
|
48 | 48 | |
49 | 49 | return FALSE; |
50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $module_srls = array(); |
56 | 56 | if (is_array($output->data)) |
57 | 57 | { |
58 | - foreach($output->data as $val) |
|
58 | + foreach ($output->data as $val) |
|
59 | 59 | { |
60 | 60 | $module_srls[] = $val->module_srl; |
61 | 61 | } |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | |
66 | 66 | function getLang($key, $site_srl) |
67 | 67 | { |
68 | - if(!$this->langs[$site_srl]) |
|
68 | + if (!$this->langs[$site_srl]) |
|
69 | 69 | { |
70 | 70 | $this->langs[$site_srl] = array(); |
71 | 71 | $args = new stdClass; |
72 | 72 | $args->site_srl = $site_srl; |
73 | 73 | $args->lang_code = Context::getLangType(); |
74 | 74 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
75 | + if (!$output->toBool() || !$output->data) return $key; |
|
76 | 76 | |
77 | - foreach($output->data as $value) |
|
77 | + foreach ($output->data as $value) |
|
78 | 78 | { |
79 | 79 | $this->langs[$site_srl][$value->name] = $value->value; |
80 | 80 | } |
81 | 81 | } |
82 | - if($this->langs[$site_srl][$key]) |
|
82 | + if ($this->langs[$site_srl][$key]) |
|
83 | 83 | { |
84 | 84 | return $this->langs[$site_srl][$key]; |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | function handleLang($title, $site_srl) |
90 | 90 | { |
91 | 91 | $matches = NULL; |
92 | - if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
92 | + if (!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
93 | 93 | { |
94 | 94 | return $title; |
95 | 95 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | function getSyndicationList() { |
103 | 103 | $oModuleModel = getModel('module'); |
104 | 104 | $config = $oModuleModel->getModuleConfig('syndication'); |
105 | - if(!$config->year || !$config->site_url || !$config->syndication_token) |
|
105 | + if (!$config->year || !$config->site_url || !$config->syndication_token) |
|
106 | 106 | { |
107 | - return $this->makeObject(-1,'msg_check_syndication_config'); |
|
107 | + return $this->makeObject(-1, 'msg_check_syndication_config'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $id = Context::get('id'); |
@@ -114,49 +114,49 @@ discard block |
||
114 | 114 | $endTime = Context::get('end-time'); |
115 | 115 | |
116 | 116 | $page = Context::get('page'); |
117 | - if(!$page) |
|
117 | + if (!$page) |
|
118 | 118 | { |
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | $vars = Context::getRequestVars(); |
122 | - if(!$id || !$type) |
|
122 | + if (!$id || !$type) |
|
123 | 123 | { |
124 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
124 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
125 | 125 | } |
126 | 126 | |
127 | - if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$id,$matches)) |
|
127 | + if (!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i', $id, $matches)) |
|
128 | 128 | { |
129 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
129 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
130 | 130 | } |
131 | 131 | |
132 | - if($config->syndication_password != Context::get('syndication_password')) |
|
132 | + if ($config->syndication_password != Context::get('syndication_password')) |
|
133 | 133 | { |
134 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
134 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $url = $matches[1]; |
138 | 138 | $year = $matches[2]; |
139 | 139 | $target = $matches[3]; |
140 | 140 | $id = $matches[4]; |
141 | - if($id && $id{0}==':') |
|
141 | + if ($id && $id{0} == ':') |
|
142 | 142 | { |
143 | 143 | $id = substr($id, 1); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $module_srl = null; |
147 | 147 | $document_srl = null; |
148 | - if($id && strpos($id,'-')!==false) |
|
148 | + if ($id && strpos($id, '-') !== false) |
|
149 | 149 | { |
150 | 150 | list($module_srl, $document_srl) = explode('-', $id); |
151 | 151 | } |
152 | - elseif($id) |
|
152 | + elseif ($id) |
|
153 | 153 | { |
154 | 154 | $module_srl = $id; |
155 | 155 | } |
156 | 156 | |
157 | - if(!$url || !$year || !$target) |
|
157 | + if (!$url || !$year || !$target) |
|
158 | 158 | { |
159 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
159 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | |
165 | 165 | $site_module_info = Context::get('site_module_info'); |
166 | 166 | |
167 | - if($target == 'channel' && !$module_srl) |
|
167 | + if ($target == 'channel' && !$module_srl) |
|
168 | 168 | { |
169 | 169 | $target = 'site'; |
170 | 170 | } |
171 | 171 | |
172 | - if($module_srl) |
|
172 | + if ($module_srl) |
|
173 | 173 | { |
174 | 174 | $args = new stdClass; |
175 | 175 | $args->module_srls = $module_srl; |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | self::$modules[$module_srl] = $output->data; |
179 | 179 | } |
180 | 180 | |
181 | - if($target == 'channel' && $module_srl) |
|
181 | + if ($target == 'channel' && $module_srl) |
|
182 | 182 | { |
183 | - if($module_info) |
|
183 | + if ($module_info) |
|
184 | 184 | { |
185 | 185 | $args->module_srl = $module_srl; |
186 | 186 | $output = executeQuery('syndication.getExceptModules', $args); |
187 | - if($output->data->count) |
|
187 | + if ($output->data->count) |
|
188 | 188 | { |
189 | 189 | $error = 'target is not founded'; |
190 | 190 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | unset($args); |
198 | 198 | } |
199 | 199 | |
200 | - if(!$error) |
|
200 | + if (!$error) |
|
201 | 201 | { |
202 | 202 | Context::set('target', $target); |
203 | 203 | Context::set('type', $type); |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | $oModuleModel = getModel('module'); |
209 | 209 | $site_config = $oModuleModel->getModuleConfig('module'); |
210 | 210 | |
211 | - switch($target) |
|
211 | + switch ($target) |
|
212 | 212 | { |
213 | 213 | case 'site' : |
214 | 214 | $site_info = new stdClass; |
215 | 215 | $site_info->id = $this->getID('site'); |
216 | - $site_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
216 | + $site_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
217 | 217 | $site_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl); |
218 | 218 | $site_info->title = $site_info->site_title; |
219 | 219 | |
220 | - if($module_srl) |
|
220 | + if ($module_srl) |
|
221 | 221 | { |
222 | 222 | $args->module_srl = $module_srl; |
223 | 223 | $site_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
224 | - if(!$site_info->title) |
|
224 | + if (!$site_info->title) |
|
225 | 225 | { |
226 | 226 | $site_info->title = $site_info->site_title; |
227 | 227 | } |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | else |
230 | 230 | { |
231 | 231 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | - if(is_array($except_module_output->data)) |
|
232 | + if (is_array($except_module_output->data)) |
|
233 | 233 | { |
234 | 234 | $except_module_srls = array(); |
235 | - foreach($except_module_output->data as $val) |
|
235 | + foreach ($except_module_output->data as $val) |
|
236 | 236 | { |
237 | 237 | $except_module_srls[] = $val->module_srl; |
238 | 238 | } |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | |
243 | 243 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
244 | 244 | |
245 | - if($output->data) |
|
245 | + if ($output->data) |
|
246 | 246 | { |
247 | 247 | $site_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
248 | 248 | } |
249 | 249 | |
250 | - $site_info->self_href = $this->getSelfHref($site_info->id,$type); |
|
250 | + $site_info->self_href = $this->getSelfHref($site_info->id, $type); |
|
251 | 251 | Context::set('site_info', $site_info); |
252 | 252 | |
253 | 253 | $this->setTemplateFile('site'); |
254 | - switch($type) { |
|
254 | + switch ($type) { |
|
255 | 255 | case 'article' : |
256 | 256 | // 문서 전체를 신디케이션에 추가 |
257 | - Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article',$site_info->id)); |
|
257 | + Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $site_info->id)); |
|
258 | 258 | $next_url = Context::get('articles')->next_url; |
259 | 259 | |
260 | 260 | break; |
261 | 261 | case 'deleted' : |
262 | 262 | // 문서 전체를 신디케이션에서 삭제 |
263 | - Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted',$site_info->id)); |
|
263 | + Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted', $site_info->id)); |
|
264 | 264 | $next_url = Context::get('deleted')->next_url; |
265 | 265 | break; |
266 | 266 | default : |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | // 다음 페이지가 있다면 다시 신디케이션 호출 |
272 | - if($next_url) |
|
272 | + if ($next_url) |
|
273 | 273 | { |
274 | 274 | $oSyndicationController = getController('syndication'); |
275 | 275 | $oSyndicationController->ping(Context::get('id'), Context::get('type'), ++$page); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
283 | 283 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
284 | 284 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
285 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
285 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
286 | 286 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
287 | 287 | $channel_info->summary = $module_info->description; |
288 | - if($module_info->module == "textyle") |
|
288 | + if ($module_info->module == "textyle") |
|
289 | 289 | { |
290 | 290 | $channel_info->type = "blog"; |
291 | 291 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | $channel_info->type = "web"; |
296 | 296 | } |
297 | 297 | $except_module_srls = $this->getExceptModuleSrls(); |
298 | - if($except_module_srls) |
|
298 | + if ($except_module_srls) |
|
299 | 299 | { |
300 | - $args->except_modules = implode(',',$except_module_srls); |
|
300 | + $args->except_modules = implode(',', $except_module_srls); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
304 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
305 | 305 | Context::set('channel_info', $channel_info); |
306 | 306 | |
307 | 307 | $this->setTemplateFile('channel'); |
308 | - switch($type) { |
|
308 | + switch ($type) { |
|
309 | 309 | case 'article' : |
310 | 310 | Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $channel_info->id)); |
311 | 311 | break; |
@@ -323,29 +323,29 @@ discard block |
||
323 | 323 | $channel_info->id = $this->getID('channel', $module_info->module_srl); |
324 | 324 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
325 | 325 | $channel_info->site_title = $site_config->siteTitle; |
326 | - if(!$channel_info->site_title) { |
|
326 | + if (!$channel_info->site_title) { |
|
327 | 327 | $channel_info->site_title = $channel_info->title; |
328 | 328 | } |
329 | 329 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
330 | 330 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
331 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
331 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
332 | 332 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
333 | 333 | $channel_info->webmaster_name = $member_config->webmaster_name; |
334 | 334 | $channel_info->webmaster_email = $member_config->webmaster_email; |
335 | 335 | |
336 | 336 | $except_module_srls = $this->getExceptModuleSrls(); |
337 | - if($except_module_srls) |
|
337 | + if ($except_module_srls) |
|
338 | 338 | { |
339 | - $args->except_modules = implode(',',$except_module_srls); |
|
339 | + $args->except_modules = implode(',', $except_module_srls); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
343 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
344 | 344 | Context::set('channel_info', $channel_info); |
345 | 345 | Context::set('member_config', $member_config); |
346 | 346 | |
347 | 347 | $this->setTemplateFile('channel'); |
348 | - switch($type) { |
|
348 | + switch ($type) { |
|
349 | 349 | case "article" : |
350 | 350 | $articles = new stdClass; |
351 | 351 | $articles->list = array($this->getArticle($document_srl)); |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | |
372 | 372 | // @DEPRECATED |
373 | 373 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
374 | + if ($module_srls) $args->module_srls = $module_srls; |
|
375 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
376 | 376 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 377 | |
378 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
378 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
379 | 379 | Context::set('time_zone', $time_zone); |
380 | 380 | |
381 | - if($output->data) { |
|
382 | - foreach($output->data as $module_info) { |
|
381 | + if ($output->data) { |
|
382 | + foreach ($output->data as $module_info) { |
|
383 | 383 | unset($obj); |
384 | 384 | $obj = new stdClass; |
385 | 385 | $obj->id = $this->getID('channel', $module_info->module_srl); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $obj->self_href = $this->getSelfHref($obj->id, 'channel'); |
389 | 389 | $obj->alternative_href = $this->getChannelAlternativeHref($module_info); |
390 | 390 | $obj->summary = $module_info->description; |
391 | - if($module_info->module == "textyle") |
|
391 | + if ($module_info->module == "textyle") |
|
392 | 392 | { |
393 | 393 | $obj->type = "blog"; |
394 | 394 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
408 | + if ($this->site_url == null) $this->init(); |
|
409 | 409 | |
410 | 410 | $oDocumentModel = getModel('document'); |
411 | - $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
|
412 | - if(!$oDocument->isExists()) return; |
|
411 | + $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
412 | + if (!$oDocument->isExists()) return; |
|
413 | 413 | |
414 | 414 | $val = $oDocument->getObjectVars(); |
415 | 415 | |
416 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
416 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
417 | 417 | Context::set('time_zone', $time_zone); |
418 | 418 | |
419 | 419 | $mdoule_info = self::$modules[$oDocument->get('module_srl')]; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $article->nick_name = (!$oDocument->get('nick_name')) ? $oDocument->get('user_name') : $oDocument->get('nick_name'); |
428 | 428 | $article->title = $oDocument->getTitle(); |
429 | 429 | $article->content = $oDocument->get('content'); |
430 | - if($val->category_srl) { |
|
430 | + if ($val->category_srl) { |
|
431 | 431 | $category = $oDocumentModel->getCategory($val->category_srl); |
432 | 432 | $category_title = $category->title; |
433 | 433 | $article->category = new stdClass(); |
@@ -438,14 +438,14 @@ discard block |
||
438 | 438 | return $article; |
439 | 439 | } |
440 | 440 | |
441 | - function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | - if($this->site_url==null) $this->init(); |
|
441 | + function getArticles($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | + if ($this->site_url == null) $this->init(); |
|
443 | 443 | |
444 | 444 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
445 | + if ($module_srl) $args->module_srl = $module_srl; |
|
446 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
449 | 449 | $args->page = $page; |
450 | 450 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 451 | $cur_page = $output->page_navigation->cur_page; |
@@ -455,23 +455,23 @@ discard block |
||
455 | 455 | $result->next_url = null; |
456 | 456 | $result->list = array(); |
457 | 457 | |
458 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
458 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
459 | 459 | Context::set('time_zone', $time_zone); |
460 | 460 | |
461 | - if($cur_page<$total_page) { |
|
461 | + if ($cur_page < $total_page) { |
|
462 | 462 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | - $result->next_url = $next_url.'&page='.($cur_page+1); |
|
463 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
466 | 466 | } |
467 | 467 | |
468 | - if($output->data) { |
|
469 | - foreach($output->data as $key => $val) { |
|
468 | + if ($output->data) { |
|
469 | + foreach ($output->data as $key => $val) { |
|
470 | 470 | $article = new stdClass(); |
471 | 471 | $article->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
472 | 472 | $article->updated = date("Y-m-d\\TH:i:s", ztime($val->last_update)).$time_zone; |
473 | 473 | $article->published = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
474 | - $article->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
474 | + $article->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
475 | 475 | $article->channel_alternative_href = $this->getChannelAlternativeHref($val->module_srl); |
476 | 476 | $article->nick_name = (!$val->nick_name) ? $val->user_name : $val->nick_name; |
477 | 477 | $article->content = $val->content; |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
485 | + if ($this->site_url == null) $this->init(); |
|
486 | 486 | |
487 | 487 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
488 | + if ($module_srl) $args->module_srl = $module_srl; |
|
489 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
491 | 491 | $args->page = $page; |
492 | 492 | |
493 | 493 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -499,21 +499,21 @@ discard block |
||
499 | 499 | $result->next_url = null; |
500 | 500 | $result->list = array(); |
501 | 501 | |
502 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
502 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
503 | 503 | Context::set('time_zone', $time_zone); |
504 | 504 | |
505 | - if($cur_page<$total_page) { |
|
505 | + if ($cur_page < $total_page) { |
|
506 | 506 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | - $result->next_url = $next_url . '&page='.($cur_page+1); |
|
507 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
510 | 510 | } |
511 | 511 | |
512 | - if($output->data) { |
|
513 | - foreach($output->data as $key => $val) { |
|
512 | + if ($output->data) { |
|
513 | + foreach ($output->data as $key => $val) { |
|
514 | 514 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
515 | 515 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
516 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
516 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
517 | 517 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
518 | 518 | $output->data[$key] = $val; |
519 | 519 | } |
@@ -527,10 +527,10 @@ discard block |
||
527 | 527 | $args = new stdClass; |
528 | 528 | $args->document_srl = $document_srl; |
529 | 529 | $output = executeQueryArray('syndication.getDeletedList', $args); |
530 | - foreach($output->data as $key => $val) { |
|
530 | + foreach ($output->data as $key => $val) { |
|
531 | 531 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
532 | 532 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
533 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
533 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
534 | 534 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
535 | 535 | $output->data[$key] = $val; |
536 | 536 | } |
@@ -539,42 +539,42 @@ discard block |
||
539 | 539 | } |
540 | 540 | |
541 | 541 | function getID($type, $target_id = null) { |
542 | - if($this->site_url==null) $this->init(); |
|
542 | + if ($this->site_url == null) $this->init(); |
|
543 | 543 | |
544 | - return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
|
544 | + return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type).($target_id ? ':'.$target_id : ''); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | function getChannelAlternativeHref($module_srl) { |
548 | 548 | static $module_info = array(); |
549 | - if(!isset($module_info[$module_srl])) { |
|
549 | + if (!isset($module_info[$module_srl])) { |
|
550 | 550 | $args = new stdClass; |
551 | 551 | $args->module_srl = $module_srl; |
552 | 552 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
553 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
553 | + if ($output->data) $module_info[$module_srl] = $output->data; |
|
554 | 554 | else $module_info[$module_srl] = null; |
555 | 555 | } |
556 | 556 | |
557 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
557 | + if (is_null($module_info[$module_srl])) return $this->site_url; |
|
558 | 558 | |
559 | 559 | $domain = $module_info[$module_srl]->domain; |
560 | 560 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
561 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
561 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
562 | 562 | return $url; |
563 | 563 | } |
564 | 564 | |
565 | 565 | function getSelfHref($id, $type = null) { |
566 | - if($this->site_url==null) $this->init(); |
|
566 | + if ($this->site_url == null) $this->init(); |
|
567 | 567 | |
568 | - return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
|
568 | + return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme.$this->site_url, $id, $type, $this->syndication_password); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
572 | 572 | * 문서의 고유 URL 반환 |
573 | 573 | */ |
574 | 574 | function getAlternativeHref($document_srl, $module_srl) { |
575 | - if($this->site_url==null) $this->init(); |
|
575 | + if ($this->site_url == null) $this->init(); |
|
576 | 576 | |
577 | - if(!self::$modules[$module_srl]) { |
|
577 | + if (!self::$modules[$module_srl]) { |
|
578 | 578 | $args = new stdClass; |
579 | 579 | $args->module_srls = $module_srl; |
580 | 580 | $output = executeQuery('syndication.getModules', $args); |
@@ -586,20 +586,20 @@ discard block |
||
586 | 586 | |
587 | 587 | $domain = $module_info->domain; |
588 | 588 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
589 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
589 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
590 | 590 | return $url; |
591 | 591 | } |
592 | 592 | |
593 | 593 | function getDate($date) { |
594 | 594 | $time = strtotime($date); |
595 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
595 | + if ($time == -1) $time = ztime(str_replace(array('-', 'T', ':'), '', $date)); |
|
596 | 596 | return date('YmdHis', $time); |
597 | 597 | } |
598 | 598 | |
599 | 599 | function getResentPingLogPath() |
600 | 600 | { |
601 | 601 | $target_filename = _XE_PATH_.'files/cache/tmp/syndication_ping_log'; |
602 | - if(!file_exists($target_filename)) |
|
602 | + if (!file_exists($target_filename)) |
|
603 | 603 | { |
604 | 604 | FileHandler::writeFile($target_filename, ''); |
605 | 605 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $args->message = urlencode($msg); |
616 | 616 | |
617 | 617 | $list = $this->getResentPingLog(); |
618 | - if(count($list)>=10) |
|
618 | + if (count($list) >= 10) |
|
619 | 619 | { |
620 | 620 | array_pop($list); |
621 | 621 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $file_path = $this->getResentPingLogPath(); |
631 | 631 | $str = FileHandler::readFile($file_path); |
632 | 632 | $list = array(); |
633 | - if($str) |
|
633 | + if ($str) |
|
634 | 634 | { |
635 | 635 | $list = unserialize($str); |
636 | 636 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if(Context::getSslStatus() == 'always') { |
|
24 | + $this->uri_scheme = 'https://'; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 28 | $this->syndication_password = $config->syndication_password; |
@@ -41,10 +43,14 @@ discard block |
||
41 | 43 | $args->module_srl = $module_srl; |
42 | 44 | |
43 | 45 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
46 | + if($output->data->count) { |
|
47 | + return TRUE; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
51 | + if($output->data->count) { |
|
52 | + return TRUE; |
|
53 | + } |
|
48 | 54 | |
49 | 55 | return FALSE; |
50 | 56 | } |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | $args->site_srl = $site_srl; |
73 | 79 | $args->lang_code = Context::getLangType(); |
74 | 80 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
81 | + if(!$output->toBool() || !$output->data) { |
|
82 | + return $key; |
|
83 | + } |
|
76 | 84 | |
77 | 85 | foreach($output->data as $value) |
78 | 86 | { |
@@ -82,8 +90,9 @@ discard block |
||
82 | 90 | if($this->langs[$site_srl][$key]) |
83 | 91 | { |
84 | 92 | return $this->langs[$site_srl][$key]; |
93 | + } else { |
|
94 | + return $key; |
|
85 | 95 | } |
86 | - else return $key; |
|
87 | 96 | } |
88 | 97 | |
89 | 98 | function handleLang($title, $site_srl) |
@@ -92,8 +101,7 @@ discard block |
||
92 | 101 | if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
93 | 102 | { |
94 | 103 | return $title; |
95 | - } |
|
96 | - else |
|
104 | + } else |
|
97 | 105 | { |
98 | 106 | return $this->getLang($matches[1], $site_srl); |
99 | 107 | } |
@@ -148,8 +156,7 @@ discard block |
||
148 | 156 | if($id && strpos($id,'-')!==false) |
149 | 157 | { |
150 | 158 | list($module_srl, $document_srl) = explode('-', $id); |
151 | - } |
|
152 | - elseif($id) |
|
159 | + } elseif($id) |
|
153 | 160 | { |
154 | 161 | $module_srl = $id; |
155 | 162 | } |
@@ -188,8 +195,7 @@ discard block |
||
188 | 195 | { |
189 | 196 | $error = 'target is not founded'; |
190 | 197 | } |
191 | - } |
|
192 | - else |
|
198 | + } else |
|
193 | 199 | { |
194 | 200 | $error = 'target is not founded'; |
195 | 201 | } |
@@ -225,8 +231,7 @@ discard block |
||
225 | 231 | { |
226 | 232 | $site_info->title = $site_info->site_title; |
227 | 233 | } |
228 | - } |
|
229 | - else |
|
234 | + } else |
|
230 | 235 | { |
231 | 236 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | 237 | if(is_array($except_module_output->data)) |
@@ -289,8 +294,7 @@ discard block |
||
289 | 294 | { |
290 | 295 | $channel_info->type = "blog"; |
291 | 296 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
292 | - } |
|
293 | - else |
|
297 | + } else |
|
294 | 298 | { |
295 | 299 | $channel_info->type = "web"; |
296 | 300 | } |
@@ -301,7 +305,9 @@ discard block |
||
301 | 305 | } |
302 | 306 | |
303 | 307 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
308 | + if($output->data) { |
|
309 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
310 | + } |
|
305 | 311 | Context::set('channel_info', $channel_info); |
306 | 312 | |
307 | 313 | $this->setTemplateFile('channel'); |
@@ -340,7 +346,9 @@ discard block |
||
340 | 346 | } |
341 | 347 | |
342 | 348 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
349 | + if($output->data) { |
|
350 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
351 | + } |
|
344 | 352 | Context::set('channel_info', $channel_info); |
345 | 353 | Context::set('member_config', $member_config); |
346 | 354 | |
@@ -371,8 +379,12 @@ discard block |
||
371 | 379 | |
372 | 380 | // @DEPRECATED |
373 | 381 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
382 | + if($module_srls) { |
|
383 | + $args->module_srls = $module_srls; |
|
384 | + } |
|
385 | + if(count($this->granted_modules)) { |
|
386 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
387 | + } |
|
376 | 388 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 389 | |
378 | 390 | $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
@@ -392,8 +404,7 @@ discard block |
||
392 | 404 | { |
393 | 405 | $obj->type = "blog"; |
394 | 406 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
395 | - } |
|
396 | - else |
|
407 | + } else |
|
397 | 408 | { |
398 | 409 | $obj->type = "web"; |
399 | 410 | } |
@@ -405,11 +416,15 @@ discard block |
||
405 | 416 | } |
406 | 417 | |
407 | 418 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
419 | + if($this->site_url==null) { |
|
420 | + $this->init(); |
|
421 | + } |
|
409 | 422 | |
410 | 423 | $oDocumentModel = getModel('document'); |
411 | 424 | $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
412 | - if(!$oDocument->isExists()) return; |
|
425 | + if(!$oDocument->isExists()) { |
|
426 | + return; |
|
427 | + } |
|
413 | 428 | |
414 | 429 | $val = $oDocument->getObjectVars(); |
415 | 430 | |
@@ -439,13 +454,23 @@ discard block |
||
439 | 454 | } |
440 | 455 | |
441 | 456 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
442 | - if($this->site_url==null) $this->init(); |
|
457 | + if($this->site_url==null) { |
|
458 | + $this->init(); |
|
459 | + } |
|
443 | 460 | |
444 | 461 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
462 | + if($module_srl) { |
|
463 | + $args->module_srl = $module_srl; |
|
464 | + } |
|
465 | + if($startTime) { |
|
466 | + $args->start_date = $this->getDate($startTime); |
|
467 | + } |
|
468 | + if($endTime) { |
|
469 | + $args->end_date = $this->getDate($endTime); |
|
470 | + } |
|
471 | + if(count($this->granted_modules)) { |
|
472 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
473 | + } |
|
449 | 474 | $args->page = $page; |
450 | 475 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 476 | $cur_page = $output->page_navigation->cur_page; |
@@ -460,8 +485,12 @@ discard block |
||
460 | 485 | |
461 | 486 | if($cur_page<$total_page) { |
462 | 487 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
488 | + if($startTime) { |
|
489 | + $next_url .= '&startTime='.$startTime; |
|
490 | + } |
|
491 | + if($endTime) { |
|
492 | + $next_url .= '&endTime='.$endTime; |
|
493 | + } |
|
465 | 494 | $result->next_url = $next_url.'&page='.($cur_page+1); |
466 | 495 | } |
467 | 496 | |
@@ -482,12 +511,20 @@ discard block |
||
482 | 511 | } |
483 | 512 | |
484 | 513 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
514 | + if($this->site_url==null) { |
|
515 | + $this->init(); |
|
516 | + } |
|
486 | 517 | |
487 | 518 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
519 | + if($module_srl) { |
|
520 | + $args->module_srl= $module_srl; |
|
521 | + } |
|
522 | + if($startTime) { |
|
523 | + $args->start_date = $this->getDate($startTime); |
|
524 | + } |
|
525 | + if($endTime) { |
|
526 | + $args->end_date = $this->getDate($endTime); |
|
527 | + } |
|
491 | 528 | $args->page = $page; |
492 | 529 | |
493 | 530 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -504,8 +541,12 @@ discard block |
||
504 | 541 | |
505 | 542 | if($cur_page<$total_page) { |
506 | 543 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
544 | + if($startTime) { |
|
545 | + $next_url .= '&startTime='.$startTime; |
|
546 | + } |
|
547 | + if($endTime) { |
|
548 | + $next_url .= '&endTime='.$endTime; |
|
549 | + } |
|
509 | 550 | $result->next_url = $next_url . '&page='.($cur_page+1); |
510 | 551 | } |
511 | 552 | |
@@ -539,7 +580,9 @@ discard block |
||
539 | 580 | } |
540 | 581 | |
541 | 582 | function getID($type, $target_id = null) { |
542 | - if($this->site_url==null) $this->init(); |
|
583 | + if($this->site_url==null) { |
|
584 | + $this->init(); |
|
585 | + } |
|
543 | 586 | |
544 | 587 | return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
545 | 588 | } |
@@ -550,20 +593,29 @@ discard block |
||
550 | 593 | $args = new stdClass; |
551 | 594 | $args->module_srl = $module_srl; |
552 | 595 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
553 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
554 | - else $module_info[$module_srl] = null; |
|
596 | + if($output->data) { |
|
597 | + $module_info[$module_srl] = $output->data; |
|
598 | + } else { |
|
599 | + $module_info[$module_srl] = null; |
|
600 | + } |
|
555 | 601 | } |
556 | 602 | |
557 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
603 | + if(is_null($module_info[$module_srl])) { |
|
604 | + return $this->site_url; |
|
605 | + } |
|
558 | 606 | |
559 | 607 | $domain = $module_info[$module_srl]->domain; |
560 | 608 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
561 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
609 | + if(substr($url,0,1)=='/') { |
|
610 | + $domain = $this->uri_scheme . $this->site_url . $url; |
|
611 | + } |
|
562 | 612 | return $url; |
563 | 613 | } |
564 | 614 | |
565 | 615 | function getSelfHref($id, $type = null) { |
566 | - if($this->site_url==null) $this->init(); |
|
616 | + if($this->site_url==null) { |
|
617 | + $this->init(); |
|
618 | + } |
|
567 | 619 | |
568 | 620 | return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
569 | 621 | } |
@@ -572,7 +624,9 @@ discard block |
||
572 | 624 | * 문서의 고유 URL 반환 |
573 | 625 | */ |
574 | 626 | function getAlternativeHref($document_srl, $module_srl) { |
575 | - if($this->site_url==null) $this->init(); |
|
627 | + if($this->site_url==null) { |
|
628 | + $this->init(); |
|
629 | + } |
|
576 | 630 | |
577 | 631 | if(!self::$modules[$module_srl]) { |
578 | 632 | $args = new stdClass; |
@@ -586,13 +640,17 @@ discard block |
||
586 | 640 | |
587 | 641 | $domain = $module_info->domain; |
588 | 642 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
589 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
643 | + if(substr($url,0,1)=='/') { |
|
644 | + $domain = $this->uri_scheme . $this->site_url.$url; |
|
645 | + } |
|
590 | 646 | return $url; |
591 | 647 | } |
592 | 648 | |
593 | 649 | function getDate($date) { |
594 | 650 | $time = strtotime($date); |
595 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
651 | + if($time == -1) { |
|
652 | + $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
653 | + } |
|
596 | 654 | return date('YmdHis', $time); |
597 | 655 | } |
598 | 656 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
39 | 39 | |
40 | 40 | $oAddonAdminModel = getAdminModel('addon'); |
41 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
41 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
42 | 42 | $oAddonAdminController = &addonAdminController::getInstance(); |
43 | 43 | $oAddonAdminController->doActivate('catpcha'); |
44 | 44 | $oAddonAdminController->makeCacheFile(); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
50 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | + if (!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
53 | 53 | |
54 | 54 | return false; |
55 | 55 | } |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | $oModuleModel = getModel('module'); |
59 | 59 | $oModuleController = getController('module'); |
60 | 60 | |
61 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){ |
|
61 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
62 | 62 | $oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after'); |
63 | 63 | } |
64 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){ |
|
64 | + if (!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) { |
|
65 | 65 | $oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after'); |
66 | 66 | } |
67 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')){ |
|
67 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
68 | 68 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
69 | 69 | } |
70 | 70 | |
71 | 71 | $oAddonAdminModel = getAdminModel('addon'); |
72 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
72 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
73 | 73 | $oAddonAdminController = &addonAdminController::getInstance(); |
74 | 74 | $oAddonAdminController->doActivate('catpcha'); |
75 | 75 | $oAddonAdminController->makeCacheFile(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | function checkOpenSSLSupport() |
83 | 83 | { |
84 | - if(!in_array('ssl', stream_get_transports())) { |
|
84 | + if (!in_array('ssl', stream_get_transports())) { |
|
85 | 85 | return FALSE; |
86 | 86 | } |
87 | 87 | return TRUE; |
@@ -47,9 +47,15 @@ |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
50 | + if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
51 | + return true; |
|
52 | + } |
|
53 | + if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) { |
|
54 | + return true; |
|
55 | + } |
|
56 | + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
57 | + return true; |
|
58 | + } |
|
53 | 59 | |
54 | 60 | return false; |
55 | 61 | } |
@@ -21,28 +21,28 @@ discard block |
||
21 | 21 | $oSyndicationModel = getModel('syndication'); |
22 | 22 | Context::set('ping_log', $oSyndicationModel->getResentPingLog()); |
23 | 23 | |
24 | - if(!$module_config->syndication_use) |
|
24 | + if (!$module_config->syndication_use) |
|
25 | 25 | { |
26 | 26 | $module_config->syndication_use = 'Y'; |
27 | 27 | } |
28 | 28 | |
29 | - if(!$module_config->site_url) |
|
29 | + if (!$module_config->site_url) |
|
30 | 30 | { |
31 | - $module_config->site_url = Context::getDefaultUrl()?Context::getDefaultUrl():getFullUrl(); |
|
31 | + $module_config->site_url = Context::getDefaultUrl() ?Context::getDefaultUrl() : getFullUrl(); |
|
32 | 32 | } |
33 | 33 | |
34 | - if(!$module_config->year) |
|
34 | + if (!$module_config->year) |
|
35 | 35 | { |
36 | 36 | $module_config->year = date("Y"); |
37 | 37 | } |
38 | 38 | |
39 | - if(!isset($module_config->syndication_password)) |
|
39 | + if (!isset($module_config->syndication_password)) |
|
40 | 40 | { |
41 | 41 | $module_config->syndication_password = uniqid(); |
42 | 42 | } |
43 | 43 | |
44 | 44 | Context::set('syndication_use', $module_config->syndication_use); |
45 | - Context::set('site_url', preg_replace('/^(http|https):\/\//i','',$module_config->site_url)); |
|
45 | + Context::set('site_url', preg_replace('/^(http|https):\/\//i', '', $module_config->site_url)); |
|
46 | 46 | Context::set('year', $module_config->year); |
47 | 47 | Context::set('syndication_token', $module_config->syndication_token); |
48 | 48 | Context::set('syndication_password', $module_config->syndication_password); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $output = executeQueryArray('syndication.getExceptModules'); |
52 | 52 | $except_module_list = array(); |
53 | - if($output->data && count($output->data) > 0) |
|
53 | + if ($output->data && count($output->data) > 0) |
|
54 | 54 | { |
55 | - foreach($output->data as $item) |
|
55 | + foreach ($output->data as $item) |
|
56 | 56 | { |
57 | 57 | $except_module_list[] = $item; |
58 | 58 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | |
63 | 63 | //Security |
64 | 64 | $security = new Security(); |
65 | - $security->encodeHTML('services..service','except_module..ping'); |
|
66 | - $security->encodeHTML('except_module..mid','except_module..browser_title'); |
|
65 | + $security->encodeHTML('services..service', 'except_module..ping'); |
|
66 | + $security->encodeHTML('except_module..mid', 'except_module..browser_title'); |
|
67 | 67 | |
68 | 68 | $this->setTemplatePath($this->module_path.'tpl'); |
69 | 69 | $this->setTemplateFile('config'); |
@@ -21,36 +21,36 @@ discard block |
||
21 | 21 | |
22 | 22 | $config = new stdClass; |
23 | 23 | $config->syndication_use = Context::get('syndication_use'); |
24 | - $config->site_url = preg_replace('/\/+$/is','',Context::get('site_url')); |
|
24 | + $config->site_url = preg_replace('/\/+$/is', '', Context::get('site_url')); |
|
25 | 25 | $config->year = Context::get('year'); |
26 | 26 | $config->syndication_token = Context::get('syndication_token'); |
27 | 27 | $config->syndication_password = urlencode(Context::get('syndication_password')); |
28 | 28 | |
29 | - if(!$config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
30 | - if(!$config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
29 | + if (!$config->site_url) return $this->makeObject(-1, 'msg_site_url_is_null'); |
|
30 | + if (!$config->syndication_token) return $this->makeObject(-1, 'msg_syndication_token_is_null'); |
|
31 | 31 | |
32 | - $oModuleController->updateModuleConfig('syndication',$config); |
|
32 | + $oModuleController->updateModuleConfig('syndication', $config); |
|
33 | 33 | |
34 | 34 | $except_module = Context::get('except_module'); |
35 | 35 | $output = executeQuery('syndication.deleteExceptModules'); |
36 | - if(!$output->toBool()) return $output; |
|
36 | + if (!$output->toBool()) return $output; |
|
37 | 37 | |
38 | - if ($except_module){ |
|
39 | - $modules = explode(',',$except_module); |
|
40 | - for($i=0,$c=count($modules);$i<$c;$i++) { |
|
38 | + if ($except_module) { |
|
39 | + $modules = explode(',', $except_module); |
|
40 | + for ($i = 0, $c = count($modules); $i < $c; $i++) { |
|
41 | 41 | $args->module_srl = $modules[$i]; |
42 | - $output = executeQuery('syndication.insertExceptModule',$args); |
|
43 | - if(!$output->toBool()) return $output; |
|
42 | + $output = executeQuery('syndication.insertExceptModule', $args); |
|
43 | + if (!$output->toBool()) return $output; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if(!$this->checkOpenSSLSupport()) |
|
47 | + if (!$this->checkOpenSSLSupport()) |
|
48 | 48 | { |
49 | 49 | return $this->makeObject(-1, 'msg_need_openssl_support'); |
50 | 50 | } |
51 | 51 | |
52 | 52 | $this->setMessage('success_applied'); |
53 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { |
|
53 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { |
|
54 | 54 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSyndicationAdminConfig'); |
55 | 55 | $this->setRedirectUrl($returnUrl); |
56 | 56 | return; |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | $oModuleModel = getModel('module'); |
63 | 63 | |
64 | 64 | $oSyndicationController = getController('syndication'); |
65 | - $oSyndicationModel= getModel('syndication'); |
|
65 | + $oSyndicationModel = getModel('syndication'); |
|
66 | 66 | |
67 | 67 | $module_config = $oModuleModel->getModuleConfig('syndication'); |
68 | 68 | |
69 | 69 | $site_url = trim(Context::get('site_url')); |
70 | - if(!$module_config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
71 | - if(!$module_config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
70 | + if (!$module_config->site_url) return $this->makeObject(-1, 'msg_site_url_is_null'); |
|
71 | + if (!$module_config->syndication_token) return $this->makeObject(-1, 'msg_syndication_token_is_null'); |
|
72 | 72 | |
73 | 73 | $id = $oSyndicationModel->getID('site'); |
74 | 74 | |
75 | 75 | // site_url 정보와 token 정보를 이용해서 ping 전송 테스트 |
76 | - if($oSyndicationController->ping($id, 'site')===FALSE) |
|
76 | + if ($oSyndicationController->ping($id, 'site') === FALSE) |
|
77 | 77 | { |
78 | 78 | $this->setError(-1); |
79 | 79 | $this->setMessage($oSyndicationController->ping_message); |
@@ -26,21 +26,29 @@ discard block |
||
26 | 26 | $config->syndication_token = Context::get('syndication_token'); |
27 | 27 | $config->syndication_password = urlencode(Context::get('syndication_password')); |
28 | 28 | |
29 | - if(!$config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
30 | - if(!$config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
29 | + if(!$config->site_url) { |
|
30 | + return $this->makeObject(-1,'msg_site_url_is_null'); |
|
31 | + } |
|
32 | + if(!$config->syndication_token) { |
|
33 | + return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
34 | + } |
|
31 | 35 | |
32 | 36 | $oModuleController->updateModuleConfig('syndication',$config); |
33 | 37 | |
34 | 38 | $except_module = Context::get('except_module'); |
35 | 39 | $output = executeQuery('syndication.deleteExceptModules'); |
36 | - if(!$output->toBool()) return $output; |
|
40 | + if(!$output->toBool()) { |
|
41 | + return $output; |
|
42 | + } |
|
37 | 43 | |
38 | 44 | if ($except_module){ |
39 | 45 | $modules = explode(',',$except_module); |
40 | 46 | for($i=0,$c=count($modules);$i<$c;$i++) { |
41 | 47 | $args->module_srl = $modules[$i]; |
42 | 48 | $output = executeQuery('syndication.insertExceptModule',$args); |
43 | - if(!$output->toBool()) return $output; |
|
49 | + if(!$output->toBool()) { |
|
50 | + return $output; |
|
51 | + } |
|
44 | 52 | } |
45 | 53 | } |
46 | 54 | |
@@ -67,8 +75,12 @@ discard block |
||
67 | 75 | $module_config = $oModuleModel->getModuleConfig('syndication'); |
68 | 76 | |
69 | 77 | $site_url = trim(Context::get('site_url')); |
70 | - if(!$module_config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
71 | - if(!$module_config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
78 | + if(!$module_config->site_url) { |
|
79 | + return $this->makeObject(-1,'msg_site_url_is_null'); |
|
80 | + } |
|
81 | + if(!$module_config->syndication_token) { |
|
82 | + return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
83 | + } |
|
72 | 84 | |
73 | 85 | $id = $oSyndicationModel->getID('site'); |
74 | 86 | |
@@ -77,8 +89,7 @@ discard block |
||
77 | 89 | { |
78 | 90 | $this->setError(-1); |
79 | 91 | $this->setMessage($oSyndicationController->ping_message); |
80 | - } |
|
81 | - else |
|
92 | + } else |
|
82 | 93 | { |
83 | 94 | $this->setMessage('msg_success_ping_test'); |
84 | 95 | } |